{
  "version": 3,
  "sources": ["../../../../../node_modules/hsluv/dist/hsluv.cjs", "../../../../../node_modules/eventemitter3/index.js", "../../../../../node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js", "../../../../../node_modules/hoist-non-react-statics/node_modules/react-is/index.js", "../../../../../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js", "../../../../../node_modules/fontfaceobserver/fontfaceobserver.standalone.js", "../../../../library/src/router/lazy.tsx", "../../../../library/src/utils/utils.ts", "../../../../library/src/router/lazyModulesCache.ts", "../../../../library/src/router/lazyModulesCollector.ts", "../../../../library/src/router/useRouteElementId.ts", "../../../../library/src/router/useCurrentRoute.tsx", "../../../../library/src/utils/objectKeys.ts", "../../../../library/src/render/utils/isEqual.ts", "../../../../library/src/router/RouterContext.tsx", "../../../../library/src/router/useGetRouteCallback.ts", "../../../../library/src/router/useRoute.ts", "../../../../library/src/router/utils.ts", "../../../../library/src/router/useCurrentPathVariables.tsx", "../../../../library/src/router/useRouteHandler.ts", "../../../../library/src/router/useRoutePreloader.ts", "../../../../library/src/modules/LibraryFeaturesContext.ts", "../../../../library/src/modules/cms/CollectionUtilsCache.tsx", "../../../../library/src/router/types.ts", "../../../../library/src/utils/assert.ts", "../../../../library/src/modules/LazyValue.ts", "../../../../../node_modules/devalue/src/utils.js", "../../../../../node_modules/devalue/src/base64.js", "../../../../../node_modules/devalue/src/constants.js", "../../../../../node_modules/devalue/src/parse.js", "../../../../../node_modules/devalue/src/stringify.js", "../../../../library/src/utils/safeWindow.ts", "../../../../library/src/utils/sendTrackingEvent.ts", "../../../../library/src/modules/dataHandover/dataHandover.ts", "../../../../library/src/utils/yield.ts", "../../../../library/src/router/history.ts", "../../../../library/src/router/computeRelativePath.ts", "../../../../library/src/router/customNotFoundPagePaths.ts", "../../../../library/src/router/pathVariables.ts", "../../../../library/src/router/fillPathVariables.ts", "../../../../library/src/router/forwardQueryParams.ts", "../../../../library/src/router/getLocalizedNavigationPath.ts", "../../../../library/src/router/getSitePrefix.ts", "../../../../library/src/router/pageEffects/useViewTransition.ts", "../../../../library/src/router/pageEffects/PageEffectsContext.tsx", "../../../../library/src/router/pageEffects/getPageEffect.ts", "../../../../library/src/router/pageEffects/cssGeneration/linearEasing.ts", "../../../../library/src/router/pageEffects/cssGeneration/masks.ts", "../../../../library/src/router/pageEffects/cssGeneration/page.ts", "../../../../library/src/router/pageEffects/cssGeneration/index.ts", "../../../../library/src/router/pageEffects/viewTransition.ts", "../../../../library/src/router/routerDomUtils.ts", "../../../../library/src/router/useMonitorNextPaintAfterRender.ts", "../../../../library/src/utils/useAfterPaintEffect.ts", "../../../../library/src/modules/useTracking.ts", "../../../../library/src/utils/slugify.ts", "../../../../library/src/modules/NodeIdContext.tsx", "../../../../library/src/router/queryParameters.tsx", "../../../../library/src/modules/RenderTargetEnvironmentContext.tsx", "../../../../library/src/utils/useMemoOne.ts", "../../../../library/src/router/useLocale.ts", "../../../../library/src/router/getLocalesForCurrentRoute.ts", "../../../../library/src/router/useRouteAnchor.ts", "../../../../library/src/router/hydration/reactHydrationINPOptimizer.ts", "../../../../library/src/render/presentation/Forms/useReplayPreHydrationInput.ts", "../../../../library/src/router/hydration/hydrationTimings.ts", "../../../../library/src/router/hydration/onlyRunOnce.ts", "../../../../library/src/router/error-boundary/NotFoundErrorBoundary.tsx", "../../../../library/src/router/renderPage.tsx", "../../../../shared/src/emptyArray.ts", "../../../../library/src/router/inferInitialRouteFromPath.ts", "../../../../library/src/router/routeVariants.ts", "../../../../library/src/router/useMetadata.ts", "../../../../library/src/utils/warnOnce.ts", "../../../../library/src/utils/deprecation.ts", "../../../../library/src/animation/Animatable/Observers.ts", "../../../../library/src/animation/Animatable/Animatable.ts", "../../../../library/src/render/utils/roundedNumber.ts", "../../../../library/src/render/types/Point.ts", "../../../../library/src/animation/Animators/BezierAnimator.ts", "../../../../library/src/animation/Animators/Integrator.ts", "../../../../library/src/animation/Animators/FrictionAnimator.ts", "../../../../library/src/interpolation/Interpolation.ts", "../../../../library/src/interpolation/NumberInterpolation.ts", "../../../../library/src/animation/Animators/SpringCurveValueConverter.ts", "../../../../library/src/animation/Animators/SpringAnimator.ts", "../../../../library/src/animation/Animators/InertialScrollAnimator.ts", "../../../../library/src/render/types/Color/CSSNames.ts", "../../../../library/src/render/types/Color/Utils.ts", "../../../../library/src/render/types/Color/types.ts", "../../../../library/src/render/types/Color/converters.ts", "../../../../library/src/render/types/Color/p3.ts", "../../../../library/src/render/types/Color/Color.ts", "../../../../library/src/interpolation/ColorInterpolation.ts", "../../../../library/src/interpolation/NoInterpolation.ts", "../../../../library/src/interpolation/ObjectInterpolation.ts", "../../../../library/src/interpolation/ValueInterpolation.ts", "../../../../library/src/render/utils/isMotionValue.ts", "../../../../library/src/animation/Animators/PrecalculatedAnimator.ts", "../../../../library/src/core/EventEmitter.ts", "../../../../library/src/core/Time.ts", "../../../../library/src/core/Loop.ts", "../../../../library/src/render/types/RenderEnvironment.ts", "../../../../library/src/animation/Drivers/AnimationDriver.ts", "../../../../library/src/animation/Drivers/MainLoopDriver.ts", "../../../../library/src/animation/FramerAnimation.ts", "../../../../library/src/animation/Motion/autoValueHandlers.ts", "../../../../library/src/animation/Motion/MotionSetup.tsx", "../../../../library/src/animation/Motion/patchBorderRadiusScaleCorrector.ts", "../../../../library/src/animation/Motion/startAnimation.ts", "../../../../library/src/animation/animate.ts", "../../../../library/src/components/AnimateLayout/LayoutIdContext.tsx", "../../../../library/src/components/Device/Device.tsx", "../../../../library/src/components/utils/useConstant.ts", "../../../../library/src/components/Device/ErrorPlaceholder.tsx", "../../../../library/src/components/Device/DeviceCodeComponent.tsx", "../../../../library/src/render/types/NewConstraints.tsx", "../../../../library/src/render/utils/isFiniteNumber.ts", "../../../../library/src/utils/type-guards.ts", "../../../../library/src/render/utils/degreesToRadians.ts", "../../../../library/src/render/types/Line.ts", "../../../../library/src/render/types/Rect.ts", "../../../../library/src/render/types/Constraints.ts", "../../../../library/src/render/types/PropertyControls.ts", "../../../../shared/src/environment.ts", "../../../../library/src/modules/withCSS.tsx", "../../../../library/src/render/StyleSheetContext.ts", "../../../../library/src/render/utils/setDocumentStyles.ts", "../../../../library/src/modules/isFlexboxGapSupported.ts", "../../../../library/src/modules/workaroundFlexboxGapNotSupported.ts", "../../../../library/src/render/utils/injectDeprecatedRichTextRules.ts", "../../../../library/src/render/presentation/Forms/shared.ts", "../../../../library/src/render/utils/injectRichTextRules.ts", "../../../../library/src/render/utils/injectComponentCSSRules.ts", "../../../../library/src/utils/applyControlDefaultsToReactDefaultProps.ts", "../../../../library/src/utils/addPropertyControls.ts", "../../../../library/src/components/Device/presets.ts", "../../../../library/src/components/Device/DeviceCodeComponentProps.ts", "../../../../library/src/components/Device/usePrototypingMetaTags.ts", "../../../../library/src/components/EmptyState.tsx", "../../../../library/src/render/presentation/Frame/FrameWithMotion.tsx", "../../../../library/src/modules/useIsStaticRenderer.ts", "../../../../library/src/utils/asRecord.ts", "../../../../library/src/utils/isPropValid.ts", "../../../../library/src/utils/runtimeInjection.ts", "../../../../library/src/render/style/BackgroundImageComponent.tsx", "../../../../library/src/render/utils/corners.ts", "../../../assets/src/getVariantsDimensions.ts", "../../../../library/src/render/style/getSrcSet.ts", "../../../../library/src/render/style/BorderComponent.tsx", "../../../../library/src/render/types/BackgroundImage.ts", "../../../../library/src/render/style/backgroundImageFromProps.ts", "../../../../library/src/render/utils/getIntrinsicSizeForBackgroundImage.ts", "../../../../library/src/render/utils/htmlElementAsMotionComponent.ts", "../../../../library/src/render/utils/layoutHintDataPropsForCenter.ts", "../../../../library/src/render/utils/nodeIdFromString.ts", "../../../../library/src/render/utils/performanceDebugging.ts", "../../../../library/src/render/utils/processOverrideForwarding.ts", "../../../../library/src/render/utils/transformTemplate.ts", "../../../../library/src/render/utils/useLayoutId.ts", "../../../../library/src/render/utils/useMeasureLayout.ts", "../../../../library/src/useIsomorphicLayoutEffect.ts", "../../../../library/src/render/presentation/ComponentContainerContext.tsx", "../../../../library/src/components/hoc/withMeasuredSize.tsx", "../../../../library/src/modules/useForceUpdate.ts", "../../../../library/src/render/utils/getMeasurableCodeComponentChildren.ts", "../../../../library/src/render/presentation/Layer.tsx", "../../../../library/src/render/utils/setLayerBacked.ts", "../../../../library/src/render/utils/useWebkitFixes.ts", "../../../../library/src/utils/memoize.ts", "../../../../library/src/utils/string.ts", "../../../../library/src/render/types/Color/ConvertColor.ts", "../../../../library/src/render/utils/gradientColorStops.ts", "../../../../library/src/render/types/MultiStopGradient.ts", "../../../../library/src/render/types/SimpleGradient.ts", "../../../../library/src/render/types/LinearGradient.ts", "../../../../library/src/render/types/RadialGradient.ts", "../../../../library/src/render/traits/Background.ts", "../../../../library/src/render/utils/extractStyleFromProps.ts", "../../../../library/src/render/presentation/Frame/getStyleForFrameProps.ts", "../../../../library/src/components/Navigation.tsx", "../../../../library/src/components/AnimateLayout/SharedLayoutRoot.tsx", "../../../../library/src/components/MagicMotionCrossfadeRoot.tsx", "../../../../library/src/components/NavigationContainer.tsx", "../../../../library/src/modules/useAppearEffect.ts", "../../../../library/src/modules/useSharedIntersectionObserver.ts", "../../../../library/src/components/utils/refHelper.ts", "../../../../library/src/components/AnimateLayout/SharedLayoutTree.tsx", "../../../../library/src/components/NavigationContainerContext.tsx", "../../../../library/src/components/NavigationTargetContext.tsx", "../../../../library/src/components/utils/useMap.ts", "../../../../library/src/components/NavigationContext.ts", "../../../../library/src/components/NavigatorMock.tsx", "../../../../library/src/components/NavigationTransitions.ts", "../../../../library/src/components/reduceNavigationStateForAction.ts", "../../../../library/src/components/hoc/WithNavigator.tsx", "../../../../library/src/render/types/NavigationLink.ts", "../../../../library/src/components/AnimateLayout/AnimateSharedLayout.tsx", "../../../../library/src/render/presentation/Frame/index.tsx", "../../../../library/src/components/hoc/WithEvents.tsx", "../../../../library/src/utils/events.ts", "../../../../library/src/events/FramerEvent.ts", "../../../../library/src/components/hoc/WithDragging.tsx", "../../../../library/src/utils/math.ts", "../../../../library/src/render/presentation/Frame/DeprecatedFrame.tsx", "../../../../library/src/data/ObservableObject.ts", "../../../../library/src/render/traits/Blending.ts", "../../../../library/src/render/traits/Opacity.ts", "../../../../library/src/render/traits/Overflow.ts", "../../../../library/src/render/traits/Radius.ts", "../../../../library/src/render/traits/TextColor.ts", "../../../../library/src/render/types/Shadow.ts", "../../../../library/src/render/style/shadow.tsx", "../../../../library/src/render/utils/filtersForNode.ts", "../../../../library/src/render/style/collectVisualStyleFromProps.ts", "../../../../library/src/render/traits/Transform.ts", "../../../../library/src/render/presentation/Frame/isDeprecatedFrameProps.ts", "../../../../library/src/components/Draggable.ts", "../../../../library/src/components/Pagination/InfiniteScroll.tsx", "../../../../library/src/components/Page/EmulatedPage.tsx", "../../../../library/src/components/Scroll/useWheelScroll.ts", "../../../../library/src/render/utils/debounce.ts", "../../../../shared/src/parseNumberRounded.ts", "../../../../library/src/components/utils/paddingFromProps.ts", "../../../../library/src/components/Stack/Stack.tsx", "../../../../library/src/components/Page/PageContainer.tsx", "../../../../library/src/components/Page/Page.tsx", "../../../../library/src/components/Screen.tsx", "../../../../library/src/events/recognizer/GestureRecognizer.ts", "../../../../library/src/events/recognizer/MouseWheelGestureRecognizer.ts", "../../../../library/src/events/recognizer/PanGestureRecognizer.ts", "../../../../library/src/events/recognizer/TapGestureRecognizer.ts", "../../../../library/src/events/FramerEventSession.ts", "../../../../library/src/events/recognizer/MouseEventListener.ts", "../../../../library/src/events/recognizer/TouchEventListener.ts", "../../../../library/src/events/FramerEventListener.ts", "../../../../library/src/components/Scroll/Scroll.tsx", "../../../../library/src/components/Scroll/EmulatedScroll.tsx", "../../../../library/src/components/Scroll/NativeScroll.tsx", "../../../../library/src/modules/cx.ts", "../../../../library/src/components/utils/useEmulatedTouchScroll.ts", "../../../../library/src/components/utils/animatePointWithInertia.ts", "../../../../library/src/components/utils/useUpdateScrollOffset.ts", "../../../../library/src/components/useNavigation.ts", "../../../../library/src/data/Data.ts", "../../../../library/src/data/PropertyStore.ts", "../../../../library/src/data/useData/index.ts", "../../../../library/src/data/useData/store.ts", "../../../../library/src/deprecated/DataObserver.tsx", "../../../../library/src/deprecated/WithOverride.tsx", "../../../../library/src/deprecated/convertColorProps.ts", "../../../../library/src/modules/withFX.tsx", "../../../../library/src/modules/hocOptions.ts", "../../../../library/src/modules/optimizeAppear.tsx", "../../../../library/src/modules/GeneratedComponentContext.ts", "../../../../library/src/modules/PropertyOverrides.tsx", "../../../../library/src/components/utils/cloneChildrenWithProps.tsx", "../../../../library/src/components/utils/useCloneChildrenWithPropsAndRef.tsx", "../../../../library/src/modules/useFXValues.ts", "../../../../library/src/modules/useLoopEffect.ts", "../../../../library/src/modules/useParallax.ts", "../../../../library/src/modules/parallaxTransform.ts", "../../../../library/src/modules/usePresenceAnimation.ts", "../../../../library/src/modules/useStyleAppearEffect.ts", "../../../../library/src/modules/calculateOffsetTop.ts", "../../../../library/src/modules/createTransformInputRange.ts", "../../../../library/src/modules/useScrollDirectionChange.ts", "../../../../library/src/modules/useStyleTransformEffect.ts", "../../../../library/src/deprecated/deprecatedEffects.ts", "../../../../library/src/modules/ComponentPresetsContext.tsx", "../../../../library/src/modules/ComponentViewportContext.tsx", "../../../../library/src/modules/Container.tsx", "../../../../library/src/render/utils/withGeneratedLayoutId.tsx", "../../../../library/src/modules/code-boundary/CodeComponentBoundary.tsx", "../../../../library/src/router/SuspenseThatPreservesDom.tsx", "../../../../library/src/router/error-boundary/SynchronousSuspenseErrorBoundary.tsx", "../../../../library/src/modules/code-boundary/NullFallback.tsx", "../../../../library/src/modules/code-boundary/collectErrorToAnalytics.tsx", "../../../../library/src/modules/code-boundary/logger.ts", "../../../../library/src/modules/code-boundary/shouldEnableCodeBoundaries.ts", "../../../../library/src/modules/code-boundary/DeprecatedContainerErrorBoundary.tsx", "../../../../library/src/modules/code-boundary/ExternalComponentContext.tsx", "../../../../library/src/modules/code-boundary/errorMessages.ts", "../../../../library/src/modules/code-boundary/shouldWrapWithBoundary.ts", "../../../../library/src/modules/code-boundary/maybeWrapComponentWithCodeBoundary.tsx", "../../../../library/src/modules/CustomCursor.tsx", "../../../../library/src/modules/Floating.tsx", "../../../../library/src/modules/Link/useReplaceNestedLinks.tsx", "../../../../library/src/modules/LinkToWebPage.ts", "../../../../library/src/modules/NestedLinksCollector.ts", "../../../../library/src/modules/useIsOnFramerCanvas.ts", "../../../../library/src/modules/Link/urlChecks.tsx", "../../../../library/src/modules/Link/getRouteFromPageLink.tsx", "../../../../library/src/modules/framerPageLink.ts", "../../../../library/src/modules/Link/linkFromFramerPageLink.tsx", "../../../../library/src/modules/InjectSelectionStyle.tsx", "../../../../library/src/render/types/Polygon.ts", "../../../../library/src/modules/floatingPositionSafeAreaStyle.ts", "../../../../library/src/modules/Instance.tsx", "../../../../library/src/modules/AutoBreakpointVariant.tsx", "../../../../library/src/modules/GracefullyDegradingErrorBoundary.tsx", "../../../../library/src/modules/Link/index.tsx", "../../../../library/src/render/utils/findAnchorElement.ts", "../../../../library/src/modules/ChildrenCanSuspend.tsx", "../../../../library/src/modules/Link/findMatchingRouteAttributes.tsx", "../../../../library/src/modules/Link/linkMatchesRoute.tsx", "../../../../library/src/modules/Link/pathVariables.tsx", "../../../../library/src/modules/Link/observeRouteForPreloading.ts", "../../../../library/src/modules/Link/types.ts", "../../../../library/src/modules/Link/propsForLink.tsx", "../../../../library/src/modules/Link/resolveSlugs.ts", "../../../../library/src/modules/resolveSlug.ts", "../../../../library/src/modules/Link/useTrackLinkClick.ts", "../../../../library/src/modules/Link/resolveLink.ts", "../../../../library/src/modules/Link/resolvePageScope.tsx", "../../../../library/src/modules/PageRoot.tsx", "../../../../library/src/render/presentation/Forms/FormContainer.tsx", "../../../../library/src/render/presentation/Forms/antibot.ts", "../../../../library/src/render/presentation/Forms/formData.ts", "../../../../library/src/render/presentation/Forms/honeypot.tsx", "../../../../library/src/render/presentation/Forms/trackFormSubmit.ts", "../../../../library/src/render/presentation/Forms/useCaptcha.ts", "../../../../library/src/router/Router.tsx", "../../../../shared/src/constants.ts", "../../../../library/src/modules/EditorBarLauncher.tsx", "../../../../library/src/components/IgnoreErrors.tsx", "../../../../library/src/modules/TriggerStateContext.tsx", "../../../../library/src/utils/triggerActionsStorage.ts", "../../../../library/src/utils/triggerActions.ts", "../../../../shared/src/ssg/constants.ts", "../../../../library/src/modules/custom-code/useLoadSnippets.ts", "../../../../library/src/modules/custom-code/context.tsx", "../../../../shared/src/custom-code/markers.ts", "../../../../library/src/utils/insertHTML.ts", "../../../../library/src/modules/custom-code/markers.ts", "../../../../library/src/modules/custom-code/loadSnippets.ts", "../../../../library/src/router/isSamePage.ts", "../../../../library/src/router/pageAnalytics.ts", "../../../../library/src/router/useForceUpdate.ts", "../../../../library/src/modules/FetchClient.tsx", "../../../../library/src/render/utils/preloadImage.ts", "../../../../library/src/utils/getPropertyByPath.ts", "../../../../library/src/modules/ResolveLinks.tsx", "../../../../library/src/modules/Fetcher.tsx", "../../../../library/src/modules/callEach.ts", "../../../../library/src/utils/getLogger.ts", "../../../../library/src/modules/cms/optimizer/Evaluate.ts", "../../../../library/src/modules/cms/types.ts", "../../../../library/src/modules/cms/DatabaseValue.ts", "../../../../library/src/modules/cms/DatabaseValueDefinition.ts", "../../../../library/src/modules/cms/CompatibilityDatabaseCollection.ts", "../../../../library/src/modules/cms/getCollectionId.ts", "../../../../library/src/modules/cms/getCollectionForLocale.ts", "../../../../library/src/modules/cms/optimizer/Cost.ts", "../../../../library/src/modules/cms/optimizer/Group.ts", "../../../../library/src/modules/cms/optimizer/nodes/AbstractNode.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalNode.ts", "../../../../library/src/modules/cms/optimizer/Hashable.ts", "../../../../library/src/modules/cms/optimizer/Resolver.ts", "../../../../library/src/modules/cms/optimizer/Metadata.ts", "../../../../library/src/modules/cms/optimizer/Ordering.ts", "../../../../library/src/modules/cms/optimizer/PhysicalProps.ts", "../../../../library/src/modules/cms/optimizer/Scope.ts", "../../../../library/src/modules/cms/optimizer/Relation.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalProject.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarNode.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarCase.ts", "../../../../library/src/modules/cms/optimizer/Builder.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalFilter.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalIndexLookup.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalIntersection.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalScan.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalUnion.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarAnd.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarConstant.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarContains.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarEndsWith.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarEquals.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarGreaterThan.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarGreaterThanOrEqual.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarLessThan.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarLessThanOrEqual.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarNotEquals.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarOr.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarStartsWith.ts", "../../../../library/src/modules/cms/optimizer/Explorer.ts", "../../../../library/src/modules/cms/optimizer/LogicalProps.ts", "../../../../library/src/modules/cms/optimizer/Memo.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalLeftJoin.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalLimit.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalOffset.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarArray.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarCast.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarFlatArray.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarIn.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarIndexOf.ts", "../../../../shared/src/assert.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarIntersection.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarLength.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarNot.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarNotIn.ts", "../../../../library/src/modules/cms/optimizer/nodes/scalar/ScalarVariable.ts", "../../../../library/src/modules/cms/optimizer/Normalizer.ts", "../../../../library/src/modules/cms/optimizer/nodes/enforcer/EnforcerNode.ts", "../../../../library/src/modules/cms/optimizer/nodes/enforcer/EnforcerResolve.ts", "../../../../library/src/modules/cms/optimizer/nodes/enforcer/EnforcerSort.ts", "../../../../library/src/modules/cms/optimizer/nodes/relational/RelationalAssert.ts", "../../../../library/src/modules/cms/optimizer/Optimizer.ts", "../../../../library/src/modules/cms/stringifyQuery.ts", "../../../../library/src/modules/cms/QueryEngine.ts", "../../../../library/src/modules/cms/QueryCache.ts", "../../../../library/src/modules/cms/server-database/mock/executeServerDatabaseQuery.ts", "../../../../library/src/modules/cms/useFormSelectVariableBinding.tsx", "../../../../library/src/modules/useQueryData.ts", "../../../../library/src/utils/createTrigger.ts", "../../../../library/src/modules/TriggerSubscription.tsx", "../../../../library/src/utils/useStableCallback.ts", "../../../../library/src/modules/useActiveVariantCallback.ts", "../../../../library/src/modules/useAddVariantProps.ts", "../../../../library/src/modules/useBreakpointVariants.ts", "../../../../library/src/modules/useDataRecord.ts", "../../../../library/src/modules/useDynamicRefs.ts", "../../../../library/src/modules/useGamepad.ts", "../../../../library/src/modules/useHotkey.ts", "../../../../library/src/modules/useNavigate.tsx", "../../../../library/src/modules/useOnVariantChange.ts", "../../../../library/src/modules/useOverlayState.tsx", "../../../../library/src/modules/usePrototypeNavigate.tsx", "../../../../library/src/router/isRoute.ts", "../../../../library/src/components/utils/useLoadMorePaginatedQuery.tsx", "../../../../library/src/components/utils/useLoadMorePagination.tsx", "../../../../library/src/modules/useVariantState.ts", "../../../../library/src/modules/safeCSSValue.ts", "../../../../library/src/modules/code-boundary/withCodeBoundaryForOverrides.tsx", "../../../../library/src/modules/withStrokeFX.tsx", "../../../../library/src/render/presentation/Ticker.tsx", "../../../../library/src/render/utils/tickerUtils.ts", "../../../../library/src/render/presentation/BasicTicker.tsx", "../../../../library/src/render/presentation/motionplus/Ticker.tsx", "../../../../library/src/render/presentation/DraggableTicker.tsx", "../../../../library/src/render/presentation/TickerContext.tsx", "../../../../library/src/modules/withTickerFX.tsx", "../../../../library/src/modules/withFlowFX.tsx", "../../../../library/src/modules/withMappedReactProps.tsx", "../../../../library/src/render/presentation/Shader/WebGL2ShaderRenderer.ts", "../../../../library/src/render/presentation/Shader/uniformName.ts", "../../../../library/src/modules/defineShader.ts", "../../../../library/src/render/presentation/Shader/Shader.tsx", "../../../../library/src/render/presentation/Shader/ShaderFallbackImage.tsx", "../../../../library/src/render/presentation/Shader/ShaderSandboxFallbackImage.tsx", "../../../../library/src/render/utils/parseCSSVariable.ts", "../../../../library/src/render/presentation/Shader/shaderTextureCache.ts", "../../../../library/src/render/presentation/Shader/heightmap.ts", "../../../../library/src/render/presentation/Shader/helpers.ts", "../../../../library/src/render/presentation/Shader/ShaderWithFallbackOverlay.tsx", "../../../../library/src/render/presentation/Shader/ShaderCanvas.tsx", "../../../../library/src/render/presentation/Shader/defaultShaders.ts", "../../../../library/src/render/presentation/Shader/hooks.ts", "../../../../library/src/render/presentation/Shader/ShaderPoolContext.ts", "../../../../library/src/render/presentation/Shader/useShaderMouse.ts", "../../../../library/src/render/presentation/motionplus/usePointerPosition.ts", "../../../../library/src/render/presentation/Shader/useShaderPool.ts", "../../../../library/src/modules/withVariantAppearEffect.tsx", "../../../../library/src/modules/withVariantFX.tsx", "../../../../library/src/render/WindowContext.ts", "../../../../library/src/render/fonts/fonts.ts", "../../../../library/src/render/fonts/types.ts", "../../../../library/src/render/fonts/LocalFontSource.ts", "../../../../library/src/utils/MapWithHash.ts", "../../../../shared/src/ServiceMap.ts", "../../../assets/src/utils.ts", "../../../../library/src/render/fonts/css.ts", "../../../../library/src/render/fonts/fontUtils.ts", "../../../../library/src/render/fonts/BuiltInFontSource.ts", "../../../../library/src/render/fonts/getRelatedFontVariants.ts", "../../../../library/src/render/fonts/variableFont.ts", "../../../../library/src/render/fonts/CustomFontSource.ts", "../../../../library/src/render/fonts/loadOpenType.ts", "../../../../library/src/render/fonts/parseFontshareCategories.ts", "../../../../library/src/render/fonts/FontshareSource.ts", "../../../../library/src/render/fonts/FramerFontSource.ts", "../../../../library/src/render/fonts/GoogleFontSource.ts", "../../../../library/src/render/fonts/loadFont.ts", "../../../../library/src/render/fonts/static/variable-fonts/framer.json", "../../../../library/src/render/fonts/loadVariationAxes.ts", "../../../../library/src/render/fonts/fontStore.ts", "../../../../library/src/render/presentation/CustomProperties.tsx", "../../../../library/src/render/presentation/Forms/FormPlainTextInput.tsx", "../../../../library/src/render/presentation/Forms/useOptimisticValue.ts", "../../../../library/src/render/presentation/Forms/FormBooleanInput.tsx", "../../../../library/src/hooks/useBooleanLatch.ts", "../../../../library/src/render/presentation/Forms/FormSelect.tsx", "../../../../library/src/render/presentation/Image.tsx", "../../../../library/src/render/presentation/withLightbox.tsx", "../../../../library/src/render/presentation/useEscToClose.ts", "../../../../library/src/render/presentation/withColumnMasonryLayout.tsx", "../../../../library/src/render/presentation/RelativeDate.tsx", "../../../../library/src/render/presentation/formatRelativeDate.ts", "../../../../library/src/render/presentation/RichText.tsx", "../../../../library/src/render/presentation/DeprecatedRichText.tsx", "../../../../library/src/render/utils/dom.ts", "../../../../library/src/modules/replaceFramerPageLinks.ts", "../../../../library/src/render/utils/isShallowEqualArray.ts", "../../../../library/src/render/presentation/useTextEffect.tsx", "../../../../library/src/render/utils/patchAndWaitForChild.ts", "../../../../library/src/render/presentation/SVG.tsx", "../../../../library/src/render/utils/elementPropertiesForGradient.ts", "../../../../library/src/render/types/RelativeNumber.ts", "../../../../library/src/render/utils/imagePatternPropsForFill.tsx", "../../../../library/src/render/utils/imageUrlForAsset.ts", "../../../../library/src/render/presentation/ImagePatternElement.tsx", "../../../../library/src/render/presentation/SharedSVGManager.ts", "../../../../library/src/render/presentation/Text.tsx", "../../../../library/src/render/fonts/useFontLoadStatus.tsx", "../../../../library/src/render/presentation/TickerItem.tsx", "../../../../library/src/utils/internalId.ts", "../../../../library/src/render/types/randomID.ts", "../../../../library/src/render/types/PathSegment.ts", "../../../../library/src/render/traits/Path.ts", "../../../../library/src/render/types/svgElementAttributeDefaults.ts", "../../../../library/src/render/utils/createTransformValues.ts", "../../../../library/src/render/utils/transformString.ts", "../../../../library/src/render/presentation/GradientElement.tsx", "../../../../library/src/render/presentation/SVGRoot.tsx", "../../../../library/src/render/presentation/Vector.tsx", "../../../../library/src/render/presentation/VectorGroup.tsx", "../../../../library/src/render/traits/Shape.ts", "../../../../library/src/render/types/Size.ts", "../../../../library/src/render/utils/annotateTypeOnStringify.ts", "../../../../library/src/render/utils/getLoadingLazyAtYPosition.ts", "../../../../library/src/render/utils/gradientForShape.tsx", "../../../../library/src/render/utils/throttle.ts", "../../../../library/src/utils/addActionControls.ts", "../../../../library/src/utils/addFonts.ts", "../../../../library/src/utils/withPerformanceMarks.ts", "../../../../library/src/utils/environment.ts", "../../../../library/src/utils/network.ts", "../../../../library/src/utils/inspectObjectType.ts", "../../../../library/src/utils/inspect.ts", "../../../../library/src/utils/print.ts", "../../../../library/src/utils/useInitialRouteComponent.ts", "../../../../library/src/modules/loader/addLoader.ts", "../../../../library/src/modules/loader/forwardLoader.ts", "../../../../library/package.json", "../../../../library/src/version.ts", "../../../../library/src/animation/Motion/addChildHack.ts", "../../../../library/src/index.ts"],
  "sourcesContent": ["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Hsluv = void 0;\nclass Hsluv {\n    constructor() {\n        // RGB\n        this.hex = '#000000';\n        this.rgb_r = 0;\n        this.rgb_g = 0;\n        this.rgb_b = 0;\n        // CIE XYZ\n        this.xyz_x = 0;\n        this.xyz_y = 0;\n        this.xyz_z = 0;\n        // CIE LUV\n        this.luv_l = 0;\n        this.luv_u = 0;\n        this.luv_v = 0;\n        // CIE LUV LCh\n        this.lch_l = 0;\n        this.lch_c = 0;\n        this.lch_h = 0;\n        // HSLuv\n        this.hsluv_h = 0;\n        this.hsluv_s = 0;\n        this.hsluv_l = 0;\n        // HPLuv\n        this.hpluv_h = 0;\n        this.hpluv_p = 0;\n        this.hpluv_l = 0;\n        // 6 lines in slope-intercept format: R < 0, R > 1, G < 0, G > 1, B < 0, B > 1\n        this.r0s = 0;\n        this.r0i = 0;\n        this.r1s = 0;\n        this.r1i = 0;\n        this.g0s = 0;\n        this.g0i = 0;\n        this.g1s = 0;\n        this.g1i = 0;\n        this.b0s = 0;\n        this.b0i = 0;\n        this.b1s = 0;\n        this.b1i = 0;\n    }\n    static fromLinear(c) {\n        if (c <= 0.0031308) {\n            return 12.92 * c;\n        }\n        else {\n            return 1.055 * Math.pow(c, 1 / 2.4) - 0.055;\n        }\n    }\n    static toLinear(c) {\n        if (c > 0.04045) {\n            return Math.pow((c + 0.055) / 1.055, 2.4);\n        }\n        else {\n            return c / 12.92;\n        }\n    }\n    static yToL(Y) {\n        if (Y <= Hsluv.epsilon) {\n            return Y / Hsluv.refY * Hsluv.kappa;\n        }\n        else {\n            return 116 * Math.pow(Y / Hsluv.refY, 1 / 3) - 16;\n        }\n    }\n    static lToY(L) {\n        if (L <= 8) {\n            return Hsluv.refY * L / Hsluv.kappa;\n        }\n        else {\n            return Hsluv.refY * Math.pow((L + 16) / 116, 3);\n        }\n    }\n    static rgbChannelToHex(chan) {\n        const c = Math.round(chan * 255);\n        const digit2 = c % 16;\n        const digit1 = (c - digit2) / 16 | 0;\n        return Hsluv.hexChars.charAt(digit1) + Hsluv.hexChars.charAt(digit2);\n    }\n    static hexToRgbChannel(hex, offset) {\n        const digit1 = Hsluv.hexChars.indexOf(hex.charAt(offset));\n        const digit2 = Hsluv.hexChars.indexOf(hex.charAt(offset + 1));\n        const n = digit1 * 16 + digit2;\n        return n / 255.0;\n    }\n    static distanceFromOriginAngle(slope, intercept, angle) {\n        const d = intercept / (Math.sin(angle) - slope * Math.cos(angle));\n        if (d < 0) {\n            return Infinity;\n        }\n        else {\n            return d;\n        }\n    }\n    static distanceFromOrigin(slope, intercept) {\n        return Math.abs(intercept) / Math.sqrt(Math.pow(slope, 2) + 1);\n    }\n    static min6(f1, f2, f3, f4, f5, f6) {\n        return Math.min(f1, Math.min(f2, Math.min(f3, Math.min(f4, Math.min(f5, f6)))));\n    }\n    rgbToHex() {\n        this.hex = \"#\";\n        this.hex += Hsluv.rgbChannelToHex(this.rgb_r);\n        this.hex += Hsluv.rgbChannelToHex(this.rgb_g);\n        this.hex += Hsluv.rgbChannelToHex(this.rgb_b);\n    }\n    hexToRgb() {\n        this.hex = this.hex.toLowerCase();\n        this.rgb_r = Hsluv.hexToRgbChannel(this.hex, 1);\n        this.rgb_g = Hsluv.hexToRgbChannel(this.hex, 3);\n        this.rgb_b = Hsluv.hexToRgbChannel(this.hex, 5);\n    }\n    xyzToRgb() {\n        this.rgb_r = Hsluv.fromLinear(Hsluv.m_r0 * this.xyz_x + Hsluv.m_r1 * this.xyz_y + Hsluv.m_r2 * this.xyz_z);\n        this.rgb_g = Hsluv.fromLinear(Hsluv.m_g0 * this.xyz_x + Hsluv.m_g1 * this.xyz_y + Hsluv.m_g2 * this.xyz_z);\n        this.rgb_b = Hsluv.fromLinear(Hsluv.m_b0 * this.xyz_x + Hsluv.m_b1 * this.xyz_y + Hsluv.m_b2 * this.xyz_z);\n    }\n    rgbToXyz() {\n        const lr = Hsluv.toLinear(this.rgb_r);\n        const lg = Hsluv.toLinear(this.rgb_g);\n        const lb = Hsluv.toLinear(this.rgb_b);\n        this.xyz_x = 0.41239079926595 * lr + 0.35758433938387 * lg + 0.18048078840183 * lb;\n        this.xyz_y = 0.21263900587151 * lr + 0.71516867876775 * lg + 0.072192315360733 * lb;\n        this.xyz_z = 0.019330818715591 * lr + 0.11919477979462 * lg + 0.95053215224966 * lb;\n    }\n    xyzToLuv() {\n        const divider = this.xyz_x + 15 * this.xyz_y + 3 * this.xyz_z;\n        let varU = 4 * this.xyz_x;\n        let varV = 9 * this.xyz_y;\n        if (divider !== 0) {\n            varU /= divider;\n            varV /= divider;\n        }\n        else {\n            varU = NaN;\n            varV = NaN;\n        }\n        this.luv_l = Hsluv.yToL(this.xyz_y);\n        if (this.luv_l === 0) {\n            this.luv_u = 0;\n            this.luv_v = 0;\n        }\n        else {\n            this.luv_u = 13 * this.luv_l * (varU - Hsluv.refU);\n            this.luv_v = 13 * this.luv_l * (varV - Hsluv.refV);\n        }\n    }\n    luvToXyz() {\n        if (this.luv_l === 0) {\n            this.xyz_x = 0;\n            this.xyz_y = 0;\n            this.xyz_z = 0;\n            return;\n        }\n        const varU = this.luv_u / (13 * this.luv_l) + Hsluv.refU;\n        const varV = this.luv_v / (13 * this.luv_l) + Hsluv.refV;\n        this.xyz_y = Hsluv.lToY(this.luv_l);\n        this.xyz_x = 0 - 9 * this.xyz_y * varU / ((varU - 4) * varV - varU * varV);\n        this.xyz_z = (9 * this.xyz_y - 15 * varV * this.xyz_y - varV * this.xyz_x) / (3 * varV);\n    }\n    luvToLch() {\n        this.lch_l = this.luv_l;\n        this.lch_c = Math.sqrt(this.luv_u * this.luv_u + this.luv_v * this.luv_v);\n        if (this.lch_c < 0.00000001) {\n            this.lch_h = 0;\n        }\n        else {\n            const hrad = Math.atan2(this.luv_v, this.luv_u);\n            this.lch_h = hrad * 180.0 / Math.PI;\n            if (this.lch_h < 0) {\n                this.lch_h = 360 + this.lch_h;\n            }\n        }\n    }\n    lchToLuv() {\n        const hrad = this.lch_h / 180.0 * Math.PI;\n        this.luv_l = this.lch_l;\n        this.luv_u = Math.cos(hrad) * this.lch_c;\n        this.luv_v = Math.sin(hrad) * this.lch_c;\n    }\n    calculateBoundingLines(l) {\n        const sub1 = Math.pow(l + 16, 3) / 1560896;\n        const sub2 = sub1 > Hsluv.epsilon ? sub1 : l / Hsluv.kappa;\n        const s1r = sub2 * (284517 * Hsluv.m_r0 - 94839 * Hsluv.m_r2);\n        const s2r = sub2 * (838422 * Hsluv.m_r2 + 769860 * Hsluv.m_r1 + 731718 * Hsluv.m_r0);\n        const s3r = sub2 * (632260 * Hsluv.m_r2 - 126452 * Hsluv.m_r1);\n        const s1g = sub2 * (284517 * Hsluv.m_g0 - 94839 * Hsluv.m_g2);\n        const s2g = sub2 * (838422 * Hsluv.m_g2 + 769860 * Hsluv.m_g1 + 731718 * Hsluv.m_g0);\n        const s3g = sub2 * (632260 * Hsluv.m_g2 - 126452 * Hsluv.m_g1);\n        const s1b = sub2 * (284517 * Hsluv.m_b0 - 94839 * Hsluv.m_b2);\n        const s2b = sub2 * (838422 * Hsluv.m_b2 + 769860 * Hsluv.m_b1 + 731718 * Hsluv.m_b0);\n        const s3b = sub2 * (632260 * Hsluv.m_b2 - 126452 * Hsluv.m_b1);\n        this.r0s = s1r / s3r;\n        this.r0i = s2r * l / s3r;\n        this.r1s = s1r / (s3r + 126452);\n        this.r1i = (s2r - 769860) * l / (s3r + 126452);\n        this.g0s = s1g / s3g;\n        this.g0i = s2g * l / s3g;\n        this.g1s = s1g / (s3g + 126452);\n        this.g1i = (s2g - 769860) * l / (s3g + 126452);\n        this.b0s = s1b / s3b;\n        this.b0i = s2b * l / s3b;\n        this.b1s = s1b / (s3b + 126452);\n        this.b1i = (s2b - 769860) * l / (s3b + 126452);\n    }\n    calcMaxChromaHpluv() {\n        const r0 = Hsluv.distanceFromOrigin(this.r0s, this.r0i);\n        const r1 = Hsluv.distanceFromOrigin(this.r1s, this.r1i);\n        const g0 = Hsluv.distanceFromOrigin(this.g0s, this.g0i);\n        const g1 = Hsluv.distanceFromOrigin(this.g1s, this.g1i);\n        const b0 = Hsluv.distanceFromOrigin(this.b0s, this.b0i);\n        const b1 = Hsluv.distanceFromOrigin(this.b1s, this.b1i);\n        return Hsluv.min6(r0, r1, g0, g1, b0, b1);\n    }\n    calcMaxChromaHsluv(h) {\n        const hueRad = h / 360 * Math.PI * 2;\n        const r0 = Hsluv.distanceFromOriginAngle(this.r0s, this.r0i, hueRad);\n        const r1 = Hsluv.distanceFromOriginAngle(this.r1s, this.r1i, hueRad);\n        const g0 = Hsluv.distanceFromOriginAngle(this.g0s, this.g0i, hueRad);\n        const g1 = Hsluv.distanceFromOriginAngle(this.g1s, this.g1i, hueRad);\n        const b0 = Hsluv.distanceFromOriginAngle(this.b0s, this.b0i, hueRad);\n        const b1 = Hsluv.distanceFromOriginAngle(this.b1s, this.b1i, hueRad);\n        return Hsluv.min6(r0, r1, g0, g1, b0, b1);\n    }\n    hsluvToLch() {\n        if (this.hsluv_l > 99.9999999) {\n            this.lch_l = 100;\n            this.lch_c = 0;\n        }\n        else if (this.hsluv_l < 0.00000001) {\n            this.lch_l = 0;\n            this.lch_c = 0;\n        }\n        else {\n            this.lch_l = this.hsluv_l;\n            this.calculateBoundingLines(this.hsluv_l);\n            const max = this.calcMaxChromaHsluv(this.hsluv_h);\n            this.lch_c = max / 100 * this.hsluv_s;\n        }\n        this.lch_h = this.hsluv_h;\n    }\n    lchToHsluv() {\n        if (this.lch_l > 99.9999999) {\n            this.hsluv_s = 0;\n            this.hsluv_l = 100;\n        }\n        else if (this.lch_l < 0.00000001) {\n            this.hsluv_s = 0;\n            this.hsluv_l = 0;\n        }\n        else {\n            this.calculateBoundingLines(this.lch_l);\n            const max = this.calcMaxChromaHsluv(this.lch_h);\n            this.hsluv_s = this.lch_c / max * 100;\n            this.hsluv_l = this.lch_l;\n        }\n        this.hsluv_h = this.lch_h;\n    }\n    hpluvToLch() {\n        if (this.hpluv_l > 99.9999999) {\n            this.lch_l = 100;\n            this.lch_c = 0;\n        }\n        else if (this.hpluv_l < 0.00000001) {\n            this.lch_l = 0;\n            this.lch_c = 0;\n        }\n        else {\n            this.lch_l = this.hpluv_l;\n            this.calculateBoundingLines(this.hpluv_l);\n            const max = this.calcMaxChromaHpluv();\n            this.lch_c = max / 100 * this.hpluv_p;\n        }\n        this.lch_h = this.hpluv_h;\n    }\n    lchToHpluv() {\n        if (this.lch_l > 99.9999999) {\n            this.hpluv_p = 0;\n            this.hpluv_l = 100;\n        }\n        else if (this.lch_l < 0.00000001) {\n            this.hpluv_p = 0;\n            this.hpluv_l = 0;\n        }\n        else {\n            this.calculateBoundingLines(this.lch_l);\n            const max = this.calcMaxChromaHpluv();\n            this.hpluv_p = this.lch_c / max * 100;\n            this.hpluv_l = this.lch_l;\n        }\n        this.hpluv_h = this.lch_h;\n    }\n    hsluvToRgb() {\n        this.hsluvToLch();\n        this.lchToLuv();\n        this.luvToXyz();\n        this.xyzToRgb();\n    }\n    hpluvToRgb() {\n        this.hpluvToLch();\n        this.lchToLuv();\n        this.luvToXyz();\n        this.xyzToRgb();\n    }\n    hsluvToHex() {\n        this.hsluvToRgb();\n        this.rgbToHex();\n    }\n    hpluvToHex() {\n        this.hpluvToRgb();\n        this.rgbToHex();\n    }\n    rgbToHsluv() {\n        this.rgbToXyz();\n        this.xyzToLuv();\n        this.luvToLch();\n        this.lchToHpluv();\n        this.lchToHsluv();\n    }\n    rgbToHpluv() {\n        this.rgbToXyz();\n        this.xyzToLuv();\n        this.luvToLch();\n        this.lchToHpluv();\n        this.lchToHpluv();\n    }\n    hexToHsluv() {\n        this.hexToRgb();\n        this.rgbToHsluv();\n    }\n    hexToHpluv() {\n        this.hexToRgb();\n        this.rgbToHpluv();\n    }\n}\nexports.Hsluv = Hsluv;\nHsluv.hexChars = \"0123456789abcdef\";\nHsluv.refY = 1.0;\nHsluv.refU = 0.19783000664283;\nHsluv.refV = 0.46831999493879;\nHsluv.kappa = 903.2962962;\nHsluv.epsilon = 0.0088564516;\nHsluv.m_r0 = 3.240969941904521;\nHsluv.m_r1 = -1.537383177570093;\nHsluv.m_r2 = -0.498610760293;\nHsluv.m_g0 = -0.96924363628087;\nHsluv.m_g1 = 1.87596750150772;\nHsluv.m_g2 = 0.041555057407175;\nHsluv.m_b0 = 0.055630079696993;\nHsluv.m_b1 = -0.20397695888897;\nHsluv.m_b2 = 1.056971514242878;\n", "'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n  , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n  Events.prototype = Object.create(null);\n\n  //\n  // This hack is needed because the `__proto__` property is still inherited in\n  // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n  //\n  if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n  this.fn = fn;\n  this.context = context;\n  this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n  if (typeof fn !== 'function') {\n    throw new TypeError('The listener must be a function');\n  }\n\n  var listener = new EE(fn, context || emitter, once)\n    , evt = prefix ? prefix + event : event;\n\n  if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n  else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n  else emitter._events[evt] = [emitter._events[evt], listener];\n\n  return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n  if (--emitter._eventsCount === 0) emitter._events = new Events();\n  else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n  this._events = new Events();\n  this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n  var names = []\n    , events\n    , name;\n\n  if (this._eventsCount === 0) return names;\n\n  for (name in (events = this._events)) {\n    if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n  }\n\n  if (Object.getOwnPropertySymbols) {\n    return names.concat(Object.getOwnPropertySymbols(events));\n  }\n\n  return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n  var evt = prefix ? prefix + event : event\n    , handlers = this._events[evt];\n\n  if (!handlers) return [];\n  if (handlers.fn) return [handlers.fn];\n\n  for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n    ee[i] = handlers[i].fn;\n  }\n\n  return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n  var evt = prefix ? prefix + event : event\n    , listeners = this._events[evt];\n\n  if (!listeners) return 0;\n  if (listeners.fn) return 1;\n  return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n  var evt = prefix ? prefix + event : event;\n\n  if (!this._events[evt]) return false;\n\n  var listeners = this._events[evt]\n    , len = arguments.length\n    , args\n    , i;\n\n  if (listeners.fn) {\n    if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n    switch (len) {\n      case 1: return listeners.fn.call(listeners.context), true;\n      case 2: return listeners.fn.call(listeners.context, a1), true;\n      case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n      case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n      case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n      case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n    }\n\n    for (i = 1, args = new Array(len -1); i < len; i++) {\n      args[i - 1] = arguments[i];\n    }\n\n    listeners.fn.apply(listeners.context, args);\n  } else {\n    var length = listeners.length\n      , j;\n\n    for (i = 0; i < length; i++) {\n      if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n      switch (len) {\n        case 1: listeners[i].fn.call(listeners[i].context); break;\n        case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n        case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n        case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n        default:\n          if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n            args[j - 1] = arguments[j];\n          }\n\n          listeners[i].fn.apply(listeners[i].context, args);\n      }\n    }\n  }\n\n  return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n  return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n  return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n  var evt = prefix ? prefix + event : event;\n\n  if (!this._events[evt]) return this;\n  if (!fn) {\n    clearEvent(this, evt);\n    return this;\n  }\n\n  var listeners = this._events[evt];\n\n  if (listeners.fn) {\n    if (\n      listeners.fn === fn &&\n      (!once || listeners.once) &&\n      (!context || listeners.context === context)\n    ) {\n      clearEvent(this, evt);\n    }\n  } else {\n    for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n      if (\n        listeners[i].fn !== fn ||\n        (once && !listeners[i].once) ||\n        (context && listeners[i].context !== context)\n      ) {\n        events.push(listeners[i]);\n      }\n    }\n\n    //\n    // Reset the array, or remove it completely if we have no more listeners.\n    //\n    if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n    else clearEvent(this, evt);\n  }\n\n  return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n  var evt;\n\n  if (event) {\n    evt = prefix ? prefix + event : event;\n    if (this._events[evt]) clearEvent(this, evt);\n  } else {\n    this._events = new Events();\n    this._eventsCount = 0;\n  }\n\n  return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n  module.exports = EventEmitter;\n}\n", "/** @license React v16.13.1\n * react-is.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n\n\nif (process.env.NODE_ENV !== \"production\") {\n  (function() {\n'use strict';\n\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;\nvar REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;\nvar REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;\nvar REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;\nvar REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;\nvar REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;\nvar REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary\n// (unstable) APIs that have been removed. Can we remove the symbols?\n\nvar REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;\nvar REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;\nvar REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;\nvar REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;\nvar REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;\nvar REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;\nvar REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;\nvar REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;\nvar REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;\nvar REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;\nvar REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;\n\nfunction isValidElementType(type) {\n  return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.\n  type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);\n}\n\nfunction typeOf(object) {\n  if (typeof object === 'object' && object !== null) {\n    var $$typeof = object.$$typeof;\n\n    switch ($$typeof) {\n      case REACT_ELEMENT_TYPE:\n        var type = object.type;\n\n        switch (type) {\n          case REACT_ASYNC_MODE_TYPE:\n          case REACT_CONCURRENT_MODE_TYPE:\n          case REACT_FRAGMENT_TYPE:\n          case REACT_PROFILER_TYPE:\n          case REACT_STRICT_MODE_TYPE:\n          case REACT_SUSPENSE_TYPE:\n            return type;\n\n          default:\n            var $$typeofType = type && type.$$typeof;\n\n            switch ($$typeofType) {\n              case REACT_CONTEXT_TYPE:\n              case REACT_FORWARD_REF_TYPE:\n              case REACT_LAZY_TYPE:\n              case REACT_MEMO_TYPE:\n              case REACT_PROVIDER_TYPE:\n                return $$typeofType;\n\n              default:\n                return $$typeof;\n            }\n\n        }\n\n      case REACT_PORTAL_TYPE:\n        return $$typeof;\n    }\n  }\n\n  return undefined;\n} // AsyncMode is deprecated along with isAsyncMode\n\nvar AsyncMode = REACT_ASYNC_MODE_TYPE;\nvar ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;\nvar ContextConsumer = REACT_CONTEXT_TYPE;\nvar ContextProvider = REACT_PROVIDER_TYPE;\nvar Element = REACT_ELEMENT_TYPE;\nvar ForwardRef = REACT_FORWARD_REF_TYPE;\nvar Fragment = REACT_FRAGMENT_TYPE;\nvar Lazy = REACT_LAZY_TYPE;\nvar Memo = REACT_MEMO_TYPE;\nvar Portal = REACT_PORTAL_TYPE;\nvar Profiler = REACT_PROFILER_TYPE;\nvar StrictMode = REACT_STRICT_MODE_TYPE;\nvar Suspense = REACT_SUSPENSE_TYPE;\nvar hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated\n\nfunction isAsyncMode(object) {\n  {\n    if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n      hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint\n\n      console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');\n    }\n  }\n\n  return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;\n}\nfunction isConcurrentMode(object) {\n  return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;\n}\nfunction isContextConsumer(object) {\n  return typeOf(object) === REACT_CONTEXT_TYPE;\n}\nfunction isContextProvider(object) {\n  return typeOf(object) === REACT_PROVIDER_TYPE;\n}\nfunction isElement(object) {\n  return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\nfunction isForwardRef(object) {\n  return typeOf(object) === REACT_FORWARD_REF_TYPE;\n}\nfunction isFragment(object) {\n  return typeOf(object) === REACT_FRAGMENT_TYPE;\n}\nfunction isLazy(object) {\n  return typeOf(object) === REACT_LAZY_TYPE;\n}\nfunction isMemo(object) {\n  return typeOf(object) === REACT_MEMO_TYPE;\n}\nfunction isPortal(object) {\n  return typeOf(object) === REACT_PORTAL_TYPE;\n}\nfunction isProfiler(object) {\n  return typeOf(object) === REACT_PROFILER_TYPE;\n}\nfunction isStrictMode(object) {\n  return typeOf(object) === REACT_STRICT_MODE_TYPE;\n}\nfunction isSuspense(object) {\n  return typeOf(object) === REACT_SUSPENSE_TYPE;\n}\n\nexports.AsyncMode = AsyncMode;\nexports.ConcurrentMode = ConcurrentMode;\nexports.ContextConsumer = ContextConsumer;\nexports.ContextProvider = ContextProvider;\nexports.Element = Element;\nexports.ForwardRef = ForwardRef;\nexports.Fragment = Fragment;\nexports.Lazy = Lazy;\nexports.Memo = Memo;\nexports.Portal = Portal;\nexports.Profiler = Profiler;\nexports.StrictMode = StrictMode;\nexports.Suspense = Suspense;\nexports.isAsyncMode = isAsyncMode;\nexports.isConcurrentMode = isConcurrentMode;\nexports.isContextConsumer = isContextConsumer;\nexports.isContextProvider = isContextProvider;\nexports.isElement = isElement;\nexports.isForwardRef = isForwardRef;\nexports.isFragment = isFragment;\nexports.isLazy = isLazy;\nexports.isMemo = isMemo;\nexports.isPortal = isPortal;\nexports.isProfiler = isProfiler;\nexports.isStrictMode = isStrictMode;\nexports.isSuspense = isSuspense;\nexports.isValidElementType = isValidElementType;\nexports.typeOf = typeOf;\n  })();\n}\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n  module.exports = require('./cjs/react-is.production.min.js');\n} else {\n  module.exports = require('./cjs/react-is.development.js');\n}\n", "'use strict';\n\nvar reactIs = require('react-is');\n\n/**\n * Copyright 2015, Yahoo! Inc.\n * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.\n */\nvar REACT_STATICS = {\n  childContextTypes: true,\n  contextType: true,\n  contextTypes: true,\n  defaultProps: true,\n  displayName: true,\n  getDefaultProps: true,\n  getDerivedStateFromError: true,\n  getDerivedStateFromProps: true,\n  mixins: true,\n  propTypes: true,\n  type: true\n};\nvar KNOWN_STATICS = {\n  name: true,\n  length: true,\n  prototype: true,\n  caller: true,\n  callee: true,\n  arguments: true,\n  arity: true\n};\nvar FORWARD_REF_STATICS = {\n  '$$typeof': true,\n  render: true,\n  defaultProps: true,\n  displayName: true,\n  propTypes: true\n};\nvar MEMO_STATICS = {\n  '$$typeof': true,\n  compare: true,\n  defaultProps: true,\n  displayName: true,\n  propTypes: true,\n  type: true\n};\nvar TYPE_STATICS = {};\nTYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;\nTYPE_STATICS[reactIs.Memo] = MEMO_STATICS;\n\nfunction getStatics(component) {\n  // React v16.11 and below\n  if (reactIs.isMemo(component)) {\n    return MEMO_STATICS;\n  } // React v16.12 and above\n\n\n  return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;\n}\n\nvar defineProperty = Object.defineProperty;\nvar getOwnPropertyNames = Object.getOwnPropertyNames;\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar getPrototypeOf = Object.getPrototypeOf;\nvar objectPrototype = Object.prototype;\nfunction hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {\n  if (typeof sourceComponent !== 'string') {\n    // don't hoist over string (html) components\n    if (objectPrototype) {\n      var inheritedComponent = getPrototypeOf(sourceComponent);\n\n      if (inheritedComponent && inheritedComponent !== objectPrototype) {\n        hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);\n      }\n    }\n\n    var keys = getOwnPropertyNames(sourceComponent);\n\n    if (getOwnPropertySymbols) {\n      keys = keys.concat(getOwnPropertySymbols(sourceComponent));\n    }\n\n    var targetStatics = getStatics(targetComponent);\n    var sourceStatics = getStatics(sourceComponent);\n\n    for (var i = 0; i < keys.length; ++i) {\n      var key = keys[i];\n\n      if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {\n        var descriptor = getOwnPropertyDescriptor(sourceComponent, key);\n\n        try {\n          // Avoid failures from read-only properties\n          defineProperty(targetComponent, key, descriptor);\n        } catch (e) {}\n      }\n    }\n  }\n\n  return targetComponent;\n}\n\nmodule.exports = hoistNonReactStatics;\n", "/* Font Face Observer v2.2.0 - \u00A9 Bram Stein. License: BSD-3-Clause */(function(){function p(a,c){document.addEventListener?a.addEventListener(\"scroll\",c,!1):a.attachEvent(\"scroll\",c)}function u(a){document.body?a():document.addEventListener?document.addEventListener(\"DOMContentLoaded\",function b(){document.removeEventListener(\"DOMContentLoaded\",b);a()}):document.attachEvent(\"onreadystatechange\",function g(){if(\"interactive\"==document.readyState||\"complete\"==document.readyState)document.detachEvent(\"onreadystatechange\",g),a()})};function w(a){this.g=document.createElement(\"div\");this.g.setAttribute(\"aria-hidden\",\"true\");this.g.appendChild(document.createTextNode(a));this.h=document.createElement(\"span\");this.i=document.createElement(\"span\");this.m=document.createElement(\"span\");this.j=document.createElement(\"span\");this.l=-1;this.h.style.cssText=\"max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;\";this.i.style.cssText=\"max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;\";\nthis.j.style.cssText=\"max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;\";this.m.style.cssText=\"display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;\";this.h.appendChild(this.m);this.i.appendChild(this.j);this.g.appendChild(this.h);this.g.appendChild(this.i)}\nfunction x(a,c){a.g.style.cssText=\"max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:\"+c+\";\"}function B(a){var c=a.g.offsetWidth,b=c+100;a.j.style.width=b+\"px\";a.i.scrollLeft=b;a.h.scrollLeft=a.h.scrollWidth+100;return a.l!==c?(a.l=c,!0):!1}function C(a,c){function b(){var e=g;B(e)&&null!==e.g.parentNode&&c(e.l)}var g=a;p(a.h,b);p(a.i,b);B(a)};function D(a,c,b){c=c||{};b=b||window;this.family=a;this.style=c.style||\"normal\";this.weight=c.weight||\"normal\";this.stretch=c.stretch||\"normal\";this.context=b}var E=null,F=null,G=null,H=null;function I(a){null===F&&(M(a)&&/Apple/.test(window.navigator.vendor)?(a=/AppleWebKit\\/([0-9]+)(?:\\.([0-9]+))(?:\\.([0-9]+))/.exec(window.navigator.userAgent),F=!!a&&603>parseInt(a[1],10)):F=!1);return F}function M(a){null===H&&(H=!!a.document.fonts);return H}\nfunction N(a,c){var b=a.style,g=a.weight;if(null===G){var e=document.createElement(\"div\");try{e.style.font=\"condensed 100px sans-serif\"}catch(q){}G=\"\"!==e.style.font}return[b,g,G?a.stretch:\"\",\"100px\",c].join(\" \")}\nD.prototype.load=function(a,c){var b=this,g=a||\"BESbswy\",e=0,q=c||3E3,J=(new Date).getTime();return new Promise(function(K,L){if(M(b.context)&&!I(b.context)){var O=new Promise(function(r,t){function h(){(new Date).getTime()-J>=q?t(Error(\"\"+q+\"ms timeout exceeded\")):b.context.document.fonts.load(N(b,'\"'+b.family+'\"'),g).then(function(n){1<=n.length?r():setTimeout(h,25)},t)}h()}),P=new Promise(function(r,t){e=setTimeout(function(){t(Error(\"\"+q+\"ms timeout exceeded\"))},q)});Promise.race([P,O]).then(function(){clearTimeout(e);\nK(b)},L)}else u(function(){function r(){var d;if(d=-1!=k&&-1!=l||-1!=k&&-1!=m||-1!=l&&-1!=m)(d=k!=l&&k!=m&&l!=m)||(null===E&&(d=/AppleWebKit\\/([0-9]+)(?:\\.([0-9]+))/.exec(window.navigator.userAgent),E=!!d&&(536>parseInt(d[1],10)||536===parseInt(d[1],10)&&11>=parseInt(d[2],10))),d=E&&(k==y&&l==y&&m==y||k==z&&l==z&&m==z||k==A&&l==A&&m==A)),d=!d;d&&(null!==f.parentNode&&f.parentNode.removeChild(f),clearTimeout(e),K(b))}function t(){if((new Date).getTime()-J>=q)null!==f.parentNode&&f.parentNode.removeChild(f),\nL(Error(\"\"+q+\"ms timeout exceeded\"));else{var d=b.context.document.hidden;if(!0===d||void 0===d)k=h.g.offsetWidth,l=n.g.offsetWidth,m=v.g.offsetWidth,r();e=setTimeout(t,50)}}var h=new w(g),n=new w(g),v=new w(g),k=-1,l=-1,m=-1,y=-1,z=-1,A=-1,f=document.createElement(\"div\");f.dir=\"ltr\";x(h,N(b,\"sans-serif\"));x(n,N(b,\"serif\"));x(v,N(b,\"monospace\"));f.appendChild(h.g);f.appendChild(n.g);f.appendChild(v.g);b.context.document.body.appendChild(f);y=h.g.offsetWidth;z=n.g.offsetWidth;A=v.g.offsetWidth;t();\nC(h,function(d){k=d;r()});x(h,N(b,'\"'+b.family+'\",sans-serif'));C(n,function(d){l=d;r()});x(n,N(b,'\"'+b.family+'\",serif'));C(v,function(d){m=d;r()});x(v,N(b,'\"'+b.family+'\",monospace'))})})};\"object\"===typeof module?module.exports=D:(window.FontFaceObserver=D,window.FontFaceObserver.prototype.load=D.prototype.load);}());\n", "import { forwardRef, isValidElement, useEffect } from \"react\"\nimport { isPromise } from \"../utils/utils.ts\"\nimport { lazyModulesCache } from \"./lazyModulesCache.ts\"\nimport { lazyModulesCollector } from \"./lazyModulesCollector.ts\"\nimport type { ComponentWithPreload, MaybePromise } from \"./types.ts\"\n\n// biome-ignore lint/suspicious/noExplicitAny: any is intended\nconst preloadKey: keyof ComponentWithPreload<any> = \"preload\"\n\n/**\n * @internal\n */\nexport function isLazyComponentType<T extends React.ComponentType>(\n\tcomponentType?: unknown,\n): componentType is ComponentWithPreload<T> {\n\treturn (\n\t\ttypeof componentType === \"object\" &&\n\t\tcomponentType !== null &&\n\t\t!isValidElement(componentType) &&\n\t\tpreloadKey in componentType\n\t)\n}\n\ntype Module<T> = Record<string, T> | { default: T }\n\nfunction getLoadedComponent<T>(module: Module<T>, moduleName: string): T {\n\tif (moduleName in module) {\n\t\treturn module[moduleName as keyof Module<T>]\n\t}\n\tthrow new Error(`Module does not contain export '${moduleName}'`)\n}\n\n/**\n * Returns a React component with a `preload` function that can be used to preload the component before it's mounted.\n *\n * @param factory Must be a function that returns the `import(...)` promise. It's important to keep this outside of `lazy` so that esbuild can statically analyze the bundle (e.g. `import(importUrl)` breaks it).\n * @param moduleName The name of the export to use from the module (default: \"default\")\n * @param cacheHash Optional hash of the module filename, used for cache optimization. During build, this is automatically injected as a compact hash of the filename extracted from the original HTTPS URL (e.g., \"YouTube.js\" \u2192 hash).\n * @internal\n */\nexport function lazy<T extends React.ComponentType>(\n\tfactory: () => Promise<Module<T>>,\n\tmoduleName = \"default\",\n\tcacheHash?: string,\n): ComponentWithPreload<T> {\n\t// biome-ignore lint/suspicious/noConfusingVoidType: void is correct here\n\tlet factoryPromise: Promise<void | T> | undefined\n\tlet LoadedComponent: T | undefined\n\n\tlet error: Error | undefined\n\n\tconst updateFromCache = () => {\n\t\tif (LoadedComponent || !cacheHash || !lazyModulesCache.has(cacheHash)) return\n\n\t\tconst maybeModule = lazyModulesCache.get(cacheHash) as MaybePromise<Module<T>>\n\t\tif (isPromise(maybeModule)) {\n\t\t\tvoid load(() => maybeModule)\n\t\t} else {\n\t\t\tLoadedComponent = getLoadedComponent(maybeModule, moduleName)\n\t\t}\n\t}\n\n\tconst load = (factoryFn: () => Promise<Module<T>>) => {\n\t\tif (LoadedComponent) return Promise.resolve(LoadedComponent)\n\n\t\tif (!factoryPromise) {\n\t\t\tfactoryPromise = factoryFn()\n\t\t\t\t.then(module => {\n\t\t\t\t\tconst component = getLoadedComponent(module, moduleName)\n\t\t\t\t\tLoadedComponent = component\n\t\t\t\t\treturn component\n\t\t\t\t})\n\t\t\t\t.catch(err => {\n\t\t\t\t\t// A preload is optional in most cases, so we don't want to handle the error\n\t\t\t\t\t// here. We record it instead and during render handle it.\n\t\t\t\t\terror = err\n\t\t\t\t})\n\t\t}\n\n\t\treturn factoryPromise\n\t}\n\n\tlet hasRendered = false\n\n\tconst Component = forwardRef(function LazyWithPreload(\n\t\tprops: JSX.LibraryManagedAttributes<T, object>,\n\t\tref: React.Ref<React.ComponentRef<T>>,\n\t) {\n\t\tuseEffect(() => {\n\t\t\thasRendered = true\n\t\t}, [])\n\n\t\tif (error) {\n\t\t\tthrow error\n\t\t}\n\n\t\tupdateFromCache()\n\n\t\t// Collect the URL hash for SSG to track which lazy modules are used\n\t\tif (cacheHash !== undefined && lazyModulesCollector !== undefined) {\n\t\t\tlazyModulesCollector.add(cacheHash)\n\t\t}\n\n\t\t// We prefer manually throwing here over `React.lazy` as the native lazy method will\n\t\t// *always* Suspend during the 1st render, even if the component has already loaded.\n\t\tif (!LoadedComponent) {\n\t\t\tthrow load(factory)\n\t\t}\n\n\t\treturn <LoadedComponent ref={ref} {...props} />\n\t}) as unknown as ComponentWithPreload<T>\n\n\tComponent.preload = () => {\n\t\tupdateFromCache()\n\t\treturn load(factory)\n\t}\n\n\tComponent.getStatus = () => {\n\t\treturn {\n\t\t\thasLoaded: LoadedComponent !== undefined,\n\t\t\thasRendered,\n\t\t}\n\t}\n\n\treturn Component\n}\n", "// Shallow type checkers\n\nexport function isFunction(value: unknown): value is (...parameters: unknown[]) => unknown {\n\treturn typeof value === \"function\"\n}\n\nexport function isBoolean(value: unknown): value is boolean {\n\treturn typeof value === \"boolean\"\n}\n\nexport function isString(value: unknown): value is string {\n\treturn typeof value === \"string\"\n}\n\nexport function isNumber(value: unknown): value is number {\n\treturn Number.isFinite(value)\n}\n\nexport function isArray<T>(value: unknown): value is T[] {\n\treturn Array.isArray(value)\n}\n\n/**\n * We can't check for readonly at runtime. But unfortunately TypeScript sees readonly arrays as a\n * completely different type as regular arrays. So we can't check for both with a single function.\n */\nexport function isReadonlyArray(value: unknown): value is readonly unknown[] {\n\treturn Array.isArray(value)\n}\n\nexport function isObject(value: unknown): value is Record<string, unknown> {\n\treturn value !== null && typeof value === \"object\" && !isArray(value)\n}\n\nexport function isEmptyObject<Key extends string | number>(object: Partial<Record<Key, unknown>>): boolean {\n\tfor (const _ in object) return false\n\treturn true\n}\n\nexport function isUndefined(value: unknown): value is undefined {\n\treturn typeof value === \"undefined\"\n}\n\nexport function isNull(value: unknown): value is null {\n\treturn value === null\n}\n\nexport function isNullish(value: unknown): value is null | undefined {\n\t// this is faster than checking value === null || value === undefined in V8.\n\treturn value == null\n}\n\nexport function isValidDate(value: unknown): value is Date {\n\treturn value instanceof Date && !Number.isNaN(value.getTime())\n}\n\nexport function isGenerator(value: unknown): value is Generator {\n\treturn isObject(value) && isFunction(value.return)\n}\n\nexport function isPromiseLike(value: unknown): value is PromiseLike<unknown> {\n\treturn isObject(value) && isFunction(value.then)\n}\n\nexport function isPromise(value: unknown): value is Promise<unknown> {\n\treturn value instanceof Promise\n}\n\nexport const noop = /* @__PURE__ */ () => {}\n\nexport const isWindow = typeof window !== \"undefined\"\n\n/**\n * Determines if the provided userAgent is a bot that likely executes JavaScript.\n *\n * @internal\n */\nexport const isBot = /* @__PURE__ */ (() =>\n\tisWindow &&\n\t(navigator.webdriver || /bot|-google|google-|yandex|ia_archiver|crawl|spider/iu.test(navigator.userAgent)))()\n\n// eslint-disable-next-line compat/compat,framer-studio/tscompat\nexport const supportsRequestIdleCallback = isWindow && typeof window.requestIdleCallback === \"function\"\n\nexport const requestIdleCallback = /* @__PURE__ */ (() =>\n\t// eslint-disable-next-line compat/compat,framer-studio/tscompat\n\tsupportsRequestIdleCallback ? window.requestIdleCallback : setTimeout)()\n\n/**\n * Returns a data URI for the given SVG string that can be used in CSS.\n *\n * Encodes only `#` (https://www.phpied.com/truth-encoding-svg-data-uris/) and `'` for use in `url('...')`.\n */\nexport function encodeSVGForCSS(svg: string) {\n\treturn `url('${encodeSVGForURL(svg)}')`\n}\n\nexport function encodeSVGForURL(svg: string) {\n\treturn `data:image/svg+xml,${svg.replaceAll(\"#\", \"%23\").replaceAll(\"'\", \"%27\").replaceAll('\"', \"%22\")}`\n}\n\nexport function getPleaseReportMessage(message?: string, error?: unknown) {\n\tconst formattedError = error instanceof Error ? (error.stack ?? error.message) : error\n\treturn `${message ? `${message}\\n` : \"\"}In case the issue persists, report this to the Framer team via https://www.framer.com/contact/${formattedError ? `:\\n${formattedError}` : \".\"}`\n}\n\nexport const noopSubscribe = () => () => {}\nexport const returnTrue = () => true\nexport const returnFalse = () => false\n", "import { isWindow, noop } from \"../utils/utils.ts\"\n\n/**\n * Module-scoped cache for lazy-loaded modules handed over from SSG.\n * This cache is populated before hydration starts, allowing lazy components\n * to load synchronously during hydration.\n *\n * @internal\n */\nexport const lazyModulesCache: Map<string, unknown | Promise<unknown>> = new Map()\n\n/**\n * Initialize lazy modules cache by preloading modules from link tags.\n * Should be called during hydration to populate the cache.\n * @internal\n */\nexport function initLazyModulesCache() {\n\tif (!isWindow) return\n\n\tconst lazyPreloadLinks = document.querySelectorAll('[rel=\"modulepreload\"][data-framer-lazy]')\n\n\tfor (const link of lazyPreloadLinks) {\n\t\tconst hash = link.getAttribute(\"data-framer-lazy\")\n\t\tconst url = link.getAttribute(\"href\")\n\t\tif (!hash || !url) continue\n\n\t\tconst promise = import(url)\n\t\t\t.then(module => {\n\t\t\t\tlazyModulesCache.set(hash, module)\n\t\t\t\treturn module\n\t\t\t})\n\t\t\t.catch(error => {\n\t\t\t\t// Remove failed entries to allow retry\n\t\t\t\tlazyModulesCache.delete(hash)\n\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: intentional\n\t\t\t\tconsole.warn(`Failed to import lazy module: ${url}`, error)\n\n\t\t\t\tthrow error\n\t\t\t})\n\n\t\t// Prevent unhandled rejection warnings - errors will be handled by lazy components\n\t\tpromise.catch(noop)\n\n\t\tlazyModulesCache.set(hash, promise)\n\t}\n}\n\nexport const testing = {\n\tclear() {\n\t\tlazyModulesCache.clear()\n\t},\n}\n", "import { isWindow } from \"../utils/utils.ts\"\n\n/**\n * @internal\n */\nexport const lazyModulesCollector = /* @__PURE__ */ isWindow ? undefined : new Set<string>()\n", "import React from \"react\"\nimport { useCurrentRoute } from \"./useCurrentRoute.tsx\"\nimport { useRoute } from \"./useRoute.ts\"\nimport { getRouteElementId } from \"./utils.ts\"\n\nexport function useRouteElementId(id: string, targetRouteId?: string) {\n\tconst currentRoute = useCurrentRoute()\n\tconst route = useRoute(targetRouteId) ?? currentRoute\n\n\treturn React.useMemo(() => {\n\t\tif (!route) return id\n\t\treturn getRouteElementId(route, id)\n\t}, [id, route])\n}\n", "import React, { useContext, useMemo } from \"react\"\nimport { isEqual } from \"../render/utils/isEqual.ts\"\nimport { useRouter } from \"./RouterContext.tsx\"\nimport type { ActiveRoute, RouteId } from \"./types.ts\"\n\ninterface CurrentRouteContextValue {\n\trouteId?: RouteId\n\tpathVariables?: Record<string, unknown>\n}\nconst CurrentRouteContext = /* @__PURE__ */ (() => React.createContext<CurrentRouteContextValue>({}))()\n\n/**\n * @FIXME - Now that we support ControlType.Link any user code component could\n * choose to use the value of a ControlType.Link prop as a string that is\n * rendered on the canvas. To ensure that framer page link values used in this\n * way look as expected, we need to provide the entire router on the canvas so\n * that any framer-page consumed in this way are properly resolved to paths.\n *\n * Component to only provide the current routeId. Used by the CanvasRenderer\n * component to provide the current routeId on the canvas\n * @returns\n */\nexport function CurrentRouteProvider({\n\trouteId,\n\tpathVariables,\n\tchildren,\n}: React.PropsWithChildren<{ routeId?: RouteId; pathVariables?: Record<string, unknown> }>) {\n\tconst value = useMemo(() => ({ routeId, pathVariables }), [routeId, pathVariables])\n\treturn <CurrentRouteContext.Provider value={value}>{children}</CurrentRouteContext.Provider>\n}\n\nexport function useCurrentRoute(): ActiveRoute | undefined {\n\tconst router = useRouter()\n\tconst override = useContext(CurrentRouteContext)\n\tconst id = override?.routeId ?? router.currentRouteId\n\tconst pathVariables = override?.routeId ? override.pathVariables : router.currentPathVariables\n\tconst route = id ? router.getRoute?.(id) : undefined\n\n\treturn useMemo(() => {\n\t\tif (!id || !route) return undefined\n\n\t\treturn {\n\t\t\t...route,\n\t\t\tid,\n\t\t\tpathVariables,\n\t\t} satisfies ActiveRoute\n\t}, [id, pathVariables, route])\n}\n\n/**\n * When effects need to rerun when the route changes, using the routeId is not enough as the id can\n * stay the same but the path variables can change.\n */\nexport function useCurrentRouteKey() {\n\tconst currentRoute = useCurrentRoute()\n\tif (!currentRoute) return undefined\n\treturn `${currentRoute.id}-${JSON.stringify(currentRoute.pathVariables)}`\n}\n\n/** @deprecated Prefer `useCurrentRoute` instead. */\nexport function useCurrentRouteId(): RouteId | undefined {\n\treturn useCurrentRoute()?.id\n}\n\n/**\n * Execute a side-effect *during render* when the route changes. This includes when the slug of a collection detail\n * page changes.\n */\nexport function useOnRouteChange(cb: (route: ActiveRoute) => void) {\n\tconst currentRoute = useCurrentRoute()\n\tconst lastRoute = React.useRef<ActiveRoute | undefined>(currentRoute)\n\n\tif (isEqual(lastRoute.current, currentRoute) || !currentRoute) return\n\n\t// Writing to the ref here is safe, as it's guarded by the check above, as we run the side-effect only once.\n\tlastRoute.current = currentRoute\n\tcb(currentRoute)\n}\n", "/**\n * A convenience alternative to the following:\n *\n * ```ts\n * const keys = Object.keys(foo) as (keyof typeof foo)[]\n * ```\n *\n * **Use with caution!** [There's a reason why TypeScript doesn't do this out of the\n * box](https://stackoverflow.com/a/55012175/242684).\n */\nexport const objectKeys = Object.keys as <T>(obj: T) => (keyof T)[]\n", "import { objectKeys } from \"../../utils/objectKeys.ts\"\n\nfunction hasProp<K extends string, T extends object>(o: T, prop: K): o is T & Record<K, unknown> {\n\treturn Object.prototype.hasOwnProperty.call(o, prop)\n}\n\nexport interface WithEquals {\n\tequals: (value: unknown) => boolean\n}\n\nconst equalsKey = \"equals\" satisfies keyof WithEquals\n\nfunction withEquals(o: object): o is WithEquals {\n\tif (o === null) return false\n\tif (!(equalsKey in o)) return false\n\n\treturn typeof o.equals === \"function\"\n}\n\nfunction valueEqual(a: unknown, b: unknown): boolean {\n\tif (a === b) return true\n\t// True if a and b are NaN, otherwise false\n\t// biome-ignore lint/suspicious/noSelfCompare: <explanation>\n\treturn a !== a && b !== b\n}\n\nfunction arrayShallowEqual(a: unknown[], b: unknown[]): boolean {\n\tconst length = a.length\n\tif (length !== b.length) return false\n\tfor (let i = length; i-- !== 0; ) {\n\t\tif (!valueEqual(a[i], b[i])) return false\n\t}\n\treturn true\n}\n\nfunction arrayDeepEqual(a: unknown[], b: unknown[]): boolean {\n\tconst length = a.length\n\tif (length !== b.length) return false\n\tfor (let i = length; i-- !== 0; ) {\n\t\tif (!equal(a[i], b[i], true)) return false\n\t}\n\treturn true\n}\n\nfunction mapShallowEqual(a: Map<unknown, unknown>, b: Map<unknown, unknown>): boolean {\n\tif (a.size !== b.size) return false\n\tfor (const [key, aValue] of a.entries()) {\n\t\tif (!valueEqual(aValue, b.get(key))) return false\n\t}\n\treturn true\n}\n\nfunction mapDeepEqual(a: Map<unknown, unknown>, b: Map<unknown, unknown>): boolean {\n\tif (a.size !== b.size) return false\n\tfor (const [key, aValue] of a.entries()) {\n\t\tif (!equal(aValue, b.get(key), true)) return false\n\t}\n\treturn true\n}\n\nfunction setEqual(a: Set<unknown>, b: Set<unknown>): boolean {\n\tif (a.size !== b.size) return false\n\tfor (const aValue of a.keys()) {\n\t\tif (!b.has(aValue)) return false\n\t}\n\treturn true\n}\n\nfunction objectShallowEqual(a: object, b: object): boolean {\n\tconst keys = objectKeys(a)\n\tif (keys.length !== objectKeys(b).length) return false\n\tfor (const key of keys) {\n\t\tif (!hasProp(b, key)) return false\n\t\tif (key === \"_owner\" && hasProp(a, \"$$typeof\") && a.$$typeof) {\n\t\t\t// React-specific: avoid traversing React elements' _owner.\n\t\t\tcontinue\n\t\t}\n\t\tif (!valueEqual(a[key], b[key])) return false\n\t}\n\treturn true\n}\n\nfunction objectDeepEqual(a: object, b: object): boolean {\n\tconst keys = objectKeys(a)\n\tif (keys.length !== objectKeys(b).length) return false\n\tfor (const key of keys) {\n\t\tif (!hasProp(b, key)) return false\n\t\tif (key === \"_owner\" && hasProp(a, \"$$typeof\") && a.$$typeof) {\n\t\t\t// React-specific: avoid traversing React elements' _owner.\n\t\t\tcontinue\n\t\t}\n\t\tif (!equal(a[key], b[key], true)) return false\n\t}\n\treturn true\n}\n\n// Adapted from react-fast-compare (https://github.com/FormidableLabs/react-fast-compare)\nfunction equal(a: unknown, b: unknown, deep: boolean): boolean {\n\tif (a === b) return true\n\n\t// True if a and b are both NaN, otherwise false.\n\t// biome-ignore lint/suspicious/noSelfCompare: <explanation>\n\tif (!a || !b) return a !== a && b !== b\n\n\tconst typeA = typeof a\n\tconst typeB = typeof b\n\tif (typeA !== typeB) return false\n\tif (typeA !== \"object\") return false\n\n\t// Arrays\n\tconst aIsArray = Array.isArray(a)\n\tconst bIsArray = Array.isArray(b)\n\tif (aIsArray && bIsArray) {\n\t\tif (deep) {\n\t\t\treturn arrayDeepEqual(a, b)\n\t\t} else {\n\t\t\treturn arrayShallowEqual(a, b)\n\t\t}\n\t} else if (aIsArray !== bIsArray) {\n\t\treturn false\n\t}\n\n\t// Maps\n\tconst aIsMap = a instanceof Map\n\tconst bIsMap = b instanceof Map\n\tif (aIsMap && bIsMap) {\n\t\tif (deep) {\n\t\t\treturn mapDeepEqual(a, b)\n\t\t} else {\n\t\t\treturn mapShallowEqual(a, b)\n\t\t}\n\t} else if (aIsMap !== bIsMap) {\n\t\treturn false\n\t}\n\n\t// Sets\n\tconst aIsSet = a instanceof Set\n\tconst bIsSet = b instanceof Set\n\tif (aIsSet && bIsSet) {\n\t\treturn setEqual(a, b)\n\t} else if (aIsSet !== bIsSet) {\n\t\treturn false\n\t}\n\n\t// Date\n\tconst dateA = a instanceof Date\n\tconst dateB = b instanceof Date\n\tif (dateA && dateB) {\n\t\treturn a.getTime() === b.getTime()\n\t} else if (dateA !== dateB) {\n\t\treturn false\n\t}\n\n\t// Regex\n\tconst regexpA = a instanceof RegExp\n\tconst regexpB = b instanceof RegExp\n\tif (regexpA && regexpB) {\n\t\treturn a.toString() === b.toString()\n\t} else if (regexpA !== regexpB) {\n\t\treturn false\n\t}\n\n\tif (withEquals(a) && withEquals(b)) {\n\t\treturn a.equals(b)\n\t}\n\n\tif (deep) {\n\t\treturn objectDeepEqual(a, b)\n\t} else {\n\t\treturn objectShallowEqual(a, b)\n\t}\n}\n\n/**\n * Deep by default.\n *\n * @internal\n */\nexport function isEqual<A, B>(a: A, b: B, deep = true) {\n\ttry {\n\t\treturn equal(a, b, deep)\n\t} catch (error) {\n\t\tif (error instanceof Error && /stack|recursion/iu.exec(error.message)) {\n\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\tconsole.warn(\"Warning: isEqual does not handle circular references.\", error.name, error.message)\n\t\t\treturn false\n\t\t}\n\t\tthrow error\n\t}\n}\n", "import React, { useMemo } from \"react\"\nimport type { RouterAPI, Routes } from \"./types.ts\"\nimport { useGetRouteCallback } from \"./useGetRouteCallback.ts\"\n\nconst RouterContext = /* @__PURE__ */ (() => React.createContext<Partial<RouterAPI>>({}))()\n\n/**\n * @public\n */\nexport function RouterAPIProvider({ api, children }: React.PropsWithChildren<{ api: RouterAPI }>) {\n\treturn <RouterContext.Provider value={api}>{children}</RouterContext.Provider>\n}\n\n/**\n * @public\n */\nexport function useRouter(): Partial<RouterAPI> {\n\treturn React.useContext(RouterContext)\n}\n\n/**\n *\n * Component to only provide the routes. Used by the Navigation component to\n * still be able to look up routes by id\n * @returns\n */\nexport function RoutesProvider({ routes, children }: React.PropsWithChildren<{ routes: Routes }>) {\n\tconst getRoute = useGetRouteCallback(routes)\n\tconst api = useMemo(() => ({ getRoute }), [getRoute])\n\treturn <RouterContext.Provider value={api}>{children}</RouterContext.Provider>\n}\n", "import React from \"react\"\nimport type { Route, RouteId, RouterAPI, Routes } from \"./types.ts\"\n\nexport function useGetRouteCallback(routes: Routes): RouterAPI[\"getRoute\"] {\n\treturn React.useCallback((routeId: RouteId): Route | undefined => routes[routeId], [routes])\n}\n", "import { useRouter } from \"./RouterContext.tsx\"\nimport type { Route, RouteId } from \"./types.ts\"\n\nexport function useRoute(routeId: RouteId | undefined): Route | undefined {\n\tconst routerAPI = useRouter()\n\tif (!routeId) return undefined\n\treturn routerAPI.getRoute?.(routeId)\n}\n", "import type { Hash, Route } from \"./types.ts\"\n\n/**\n * Retrieve the human readable element id from the Route definition, if it\n * exists.\n *\n * @internal\n */\nexport function getRouteElementId(route?: Route, hash?: Hash) {\n\tif (hash && route) {\n\t\tif (route.elements && hash in route.elements) {\n\t\t\treturn route.elements[hash]\n\t\t} else {\n\t\t\treturn hash\n\t\t}\n\t}\n\n\treturn undefined\n}\n\nexport const EMPTY_ARRAY = [] as const\n\nexport function monitorINPRelatedInputs(signal?: AbortSignal) {\n\t// We omit \"click\" as either of the pointer events comes before.\n\tconst inpRelatedInputs = [\"pointerdown\", \"pointerup\", \"keydown\", \"keyup\"]\n\n\tconst inpRelatedInputHandler = (event: Event) => {\n\t\tconst type = event.type\n\t\tif (!inpRelatedInputs.includes(type)) return\n\t\tperformance.mark(`framer-navigation-input`, {\n\t\t\tdetail: {\n\t\t\t\ttype,\n\t\t\t},\n\t\t})\n\t}\n\n\tfor (let i = 0; i < inpRelatedInputs.length; i++) {\n\t\t// biome-ignore lint/style/noNonNullAssertion: it exists\n\t\tdocument.addEventListener(inpRelatedInputs[i]!, inpRelatedInputHandler, { signal })\n\t}\n\n\treturn () => {\n\t\tfor (let i = 0; i < inpRelatedInputs.length; i++) {\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: it exists\n\t\t\tdocument.removeEventListener(inpRelatedInputs[i]!, inpRelatedInputHandler)\n\t\t}\n\t}\n}\n", "import { useCurrentRoute } from \"./useCurrentRoute.tsx\"\n\n/** @deprecated Prefer `useCurrentRoute` instead. */\nexport function useCurrentPathVariables(): Record<string, unknown> | undefined {\n\treturn useCurrentRoute()?.pathVariables\n}\n", "import React from \"react\"\nimport { useRouter } from \"./RouterContext.tsx\"\nimport type { RouteId } from \"./types.ts\"\nimport { useRoutePreloader } from \"./useRoutePreloader.ts\"\n\nexport function useRouteHandler(routeId: RouteId, preload: boolean = false, elementId?: string): () => void {\n\tconst { navigate } = useRouter()\n\n\tuseRoutePreloader([routeId], preload)\n\n\t// FIXME: This doesn't support using path variables from the current scope (e.g. Repeater).\n\tconst handler = React.useCallback(() => navigate?.(routeId, elementId), [navigate, elementId, routeId])\n\treturn handler\n}\n", "import { useCallback, useEffect } from \"react\"\nimport { useLibraryFeatures } from \"../modules/LibraryFeaturesContext.ts\"\nimport { type CollectionUtilsCacheContextValue, useCollectionUtils } from \"../modules/cms/CollectionUtilsCache.tsx\"\nimport type { ComponentLoader, LoaderContext } from \"../modules/loader/loaderTypes.ts\"\nimport { isBot } from \"../utils/utils.ts\"\nimport { yieldToMain } from \"../utils/yield.ts\"\nimport { useRouter } from \"./RouterContext.tsx\"\nimport { isLazyComponentType } from \"./lazy.tsx\"\nimport type { Locale, Route, RouteId } from \"./types.ts\"\n\n// we don't want to cause preloads for bots executing JS.\n// ref: https://github.com/framer/company/issues/25235\nexport const shouldPreloadBasedOnUA = !isBot\n\n/**\n * Context for preloading a route's data.\n */\nexport interface PreloadRouteContext {\n\trouteId: RouteId\n\tpathVariables?: LinkContext[\"pathVariables\"]\n\tlocale?: LinkContext[\"locale\"]\n\tcollectionUtils?: CollectionUtilsCacheContextValue\n\tsignal?: AbortSignal\n}\n\nexport interface LinkContext {\n\tpathVariables?: Record<string, unknown>\n\tlocale?: Locale\n}\n\n/**\n * Hook that returns a preload function with locale and collectionUtils already bound.\n * Use this instead of calling preloadRoute directly to ensure proper context.\n *\n * @example\n * const preload = usePreloadRoute()\n * preload(route, routeId, pathVariables) // preloads code + data\n * preload(route) // preloads code only\n */\nexport function usePreloadRoute(): (\n\trouteId: RouteId,\n\tlinkContext: LinkContext,\n\tyieldBeforePreload?: boolean,\n\tshouldLoadRouteData?: boolean,\n) => Promise<void> | undefined {\n\tconst collectionUtils = useCollectionUtils()\n\tconst { autobahnNavigation: autobahnNavigationEnabled } = useLibraryFeatures()\n\tconst { getRoute } = useRouter()\n\n\treturn useCallback(\n\t\t(routeId, linkContext, yieldBeforePreload = true, shouldLoadRouteData = true) => {\n\t\t\tif (!routeId || !getRoute) return\n\n\t\t\tconst route = getRoute(routeId)\n\t\t\tconst { pathVariables, locale } = linkContext\n\t\t\treturn preloadRoute(\n\t\t\t\troute,\n\t\t\t\t{ routeId, pathVariables, locale, collectionUtils },\n\t\t\t\tyieldBeforePreload,\n\t\t\t\tshouldLoadRouteData && autobahnNavigationEnabled,\n\t\t\t)\n\t\t},\n\t\t[getRoute, collectionUtils, autobahnNavigationEnabled],\n\t)\n}\n\n/**\n * @deprecated see https://framer-team.slack.com/archives/CR3CYA1D4/p1714029035087469.\n */\nexport function useRoutePreloader(routeIds: RouteId[], enabled = true) {\n\tconst preload = usePreloadRoute()\n\n\tuseEffect(() => {\n\t\tif (!enabled || !shouldPreloadBasedOnUA) return\n\n\t\t// To ensure that the navigate action is not delayed by having to\n\t\t// fetch the source code of the target page, we preload the target page\n\t\t// of the navigate action after the component mounts.\n\t\tfor (const routeId of routeIds) {\n\t\t\tvoid preload(routeId, {})\n\t\t}\n\t}, [routeIds, enabled, preload])\n}\n\n/**\n * Preloads a route's component module and optionally its data.\n *\n * @param route - The route to preload\n * @param context - Optional context for data preloading (routeId, pathVariables, locale, collectionUtils)\n */\nexport async function preloadRoute(\n\troute?: Route,\n\tcontext?: PreloadRouteContext,\n\tyieldBeforePreload = true,\n\tshouldLoadRouteData = true,\n): Promise<void> {\n\tif (!shouldPreloadBasedOnUA || !route) return\n\n\tconst component = route.page\n\tif (!component || !isLazyComponentType(component)) return\n\n\t// by yielding first, we make sure chained `import` tasks do not create long tasks, see: https://github.com/whatwg/html/issues/4400\n\tif (yieldBeforePreload) {\n\t\tawait yieldToMain()\n\t}\n\n\ttry {\n\t\t// Preload the component module (code)\n\t\tconst loadedComponent = await component.preload()\n\n\t\t// Preload data if component has a loader and context is provided\n\t\tif (shouldLoadRouteData && context && loadedComponent) {\n\t\t\tawait loadRouteData(loadedComponent, context)\n\t\t}\n\t} catch (e) {\n\t\t// biome-ignore lint/suspicious/noConsole: debug log\n\t\tif (process.env.NODE_ENV !== \"production\") console.warn(\"Preload failed\", route, e)\n\t\t// we can just swallow the error here, preloading routes is not critical.\n\t}\n}\n\n/**\n * Preloads a component's data using its loader.\n * This is called after the component module is loaded.\n */\nasync function loadRouteData(\n\tcomponent: React.ComponentType<unknown> & { loader?: ComponentLoader },\n\tcontext: PreloadRouteContext,\n): Promise<void> {\n\tconst loader = component.loader\n\tif (!loader?.load) return\n\n\tconst loaderContext: LoaderContext = {\n\t\tsignal: context.signal ?? new AbortController().signal,\n\t\tpathVariables: context.pathVariables ?? {},\n\t\trouteId: context.routeId,\n\t\tlocale: context.locale,\n\t\tcollectionUtils: context.collectionUtils,\n\t}\n\n\ttry {\n\t\t// Call the loader - it returns Promise.allSettled so individual failures don't break\n\t\tawait loader.load({}, loaderContext)\n\t} catch (e) {\n\t\t// biome-ignore lint/suspicious/noConsole: debug log\n\t\tif (process.env.NODE_ENV !== \"production\") console.warn(\"Route data preload failed\", e)\n\t\t// Don't block navigation on data preload failures\n\t}\n}\n", "import React from \"react\"\n\nexport interface LibraryFeatures {\n\teditorBarDisableFrameAncestorsSecurity?: boolean\n\tmotionDivToDiv?: boolean\n\tyieldOnTap?: boolean\n\tsynchronousNavigationOnDesktop?: boolean\n\tonPageMoveTool?: boolean\n\tonPageLocalizationSupport?: boolean\n\tautobahnNavigation?: boolean\n\tdisableCustomCode?: boolean\n}\n\nexport const LibraryFeaturesContext = /* @__PURE__ */ React.createContext<LibraryFeatures | undefined>(undefined)\nLibraryFeaturesContext.displayName = \"LibraryFeaturesContext\"\nexport const LibraryFeaturesProvider = /* @__PURE__ */ (() => LibraryFeaturesContext.Provider)()\n\nexport const useLibraryFeatures = (): LibraryFeatures => {\n\tconst context = React.useContext(LibraryFeaturesContext)\n\treturn context ?? {}\n}\n", "import { createContext, useContext, useMemo } from \"react\"\nimport {\n\ttype CollectionUtils,\n\ttype Locale,\n\ttype MaybePromise,\n\ttype UtilsByCollectionId,\n\ttype UtilsFactory,\n\tdefaultLocaleId,\n} from \"../../router/types.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport { getPleaseReportMessage, isPromise } from \"../../utils/utils.ts\"\nimport { LazyValue } from \"../LazyValue.ts\"\nimport { HandoverDataType, getHandoverData, handoverCollector, hasHandoverData } from \"../dataHandover/dataHandover.ts\"\n\nconst handoverDataType = /* @__PURE__ */ (() => HandoverDataType.CollectionUtilsCache)()\n\nfunction getLocaleKey(locale: Locale | undefined) {\n\treturn locale?.id ?? defaultLocaleId\n}\n\nfunction makeHandoverKey(method: string, collectionId: string, localeKey: string, id: string) {\n\treturn `${method}|${collectionId}|${localeKey}|${id}`\n}\n\n/**\n * @internal\n */\nexport interface CollectionModule {\n\t[exportIdentifier: string]: CollectionUtils\n}\n\nlet utilsCache = new WeakMap<UtilsFactory, CollectionUtilsCache>()\n\nfunction getCollectionUtilsCache(collectionUtils: UtilsByCollectionId | undefined) {\n\treturn (collectionId: string) => {\n\t\tif (!collectionUtils) return\n\n\t\tconst utilsFactory = collectionUtils[collectionId]\n\t\tif (!utilsFactory) return undefined\n\n\t\tif (utilsCache.has(utilsFactory)) return utilsCache.get(utilsFactory)\n\n\t\tconst cache = new CollectionUtilsCache(utilsFactory, collectionId)\n\t\tutilsCache.set(utilsFactory, cache)\n\t\treturn cache\n\t}\n}\n\nexport type CollectionUtilsCacheContextValue = { get: ReturnType<typeof getCollectionUtilsCache> } | undefined\nconst CollectionUtilsCacheContext = /* @__PURE__ */ createContext<CollectionUtilsCacheContextValue>(undefined)\n\nexport function CollectionUtilsCacheProvider({\n\tchildren,\n\tcollectionUtils,\n}: {\n\tchildren: React.ReactNode\n\tcollectionUtils: UtilsByCollectionId | undefined\n}) {\n\tconst getCollectionUtilsCacheMemoized = useMemo(() => {\n\t\treturn {\n\t\t\tget: getCollectionUtilsCache(collectionUtils),\n\t\t}\n\t}, [collectionUtils])\n\n\treturn (\n\t\t<CollectionUtilsCacheContext.Provider value={getCollectionUtilsCacheMemoized}>\n\t\t\t{children}\n\t\t</CollectionUtilsCacheContext.Provider>\n\t)\n}\n\nexport function useCollectionUtils(): CollectionUtilsCacheContextValue | undefined {\n\treturn useContext(CollectionUtilsCacheContext)\n}\n\n/**\n * This is a type that is used to ensure that the CollectionUtilsCache implements the\n * CollectionUtils interface. With the difference, only-async functions become a MaybePromise.\n */\ntype ICollectionUtilsCache = {\n\t[K in keyof CollectionUtils]: K extends \"getSlugByRecordId\" | \"getRecordIdBySlug\"\n\t\t? (...args: Parameters<CollectionUtils[K]>) => MaybePromise<Awaited<ReturnType<CollectionUtils[K]>>>\n\t\t: CollectionUtils[K]\n}\n\n/**\n * Manages collection utils caches and makes the CollectionUtils functions server-client-handover aware.\n * When updating the implementation, keep in mind the collection utils generation in `exportToHTML`.\n *\n * Every instance manages its own slug/recordId cache, but they share a global collection utils\n * import cache.\n */\nexport class CollectionUtilsCache implements ICollectionUtilsCache {\n\tprivate readonly module: LazyValue<CollectionUtils | undefined>\n\n\t/**\n\t * Stores returned values from CollectionUtils.\n\t * The values must be cached so that they can be returned synchronously when a React component unsuspends.\n\t */\n\tprivate readonly cacheMap = new Map<string, LazyValue<string | undefined> | undefined>()\n\n\tconstructor(\n\t\tutilFactory: () => Promise<CollectionUtils> | undefined,\n\t\tprivate readonly collectionId: string,\n\t) {\n\t\tthis.module = new LazyValue(async () => {\n\t\t\ttry {\n\t\t\t\tconst utils = await utilFactory()\n\t\t\t\tassert(utils, \"Couldn't find CollectionUtils\")\n\t\t\t\treturn utils\n\t\t\t} catch (error) {\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: Actionable error\n\t\t\t\tconsole.error(getPleaseReportMessage(\"Failed to import collection module.\", error))\n\n\t\t\t\t// If CollectionUtils aren't found the page shouldn't crash.\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate callUtilsMethod<T extends keyof CollectionUtils>(\n\t\tmethod: T,\n\t\tid: string,\n\t\tlocale: Locale | undefined,\n\t): MaybePromise<string | undefined> {\n\t\tconst localeKey = getLocaleKey(locale)\n\t\tconst entryKey = makeHandoverKey(method, this.collectionId, localeKey, id)\n\n\t\tif (this.cacheMap.has(entryKey)) {\n\t\t\tconst cached = this.cacheMap.get(entryKey)\n\t\t\tconst value = cached?.readMaybeAsync()\n\n\t\t\t// On cache hit during SSG, populate handover collector with cached value.\n\t\t\tif (handoverCollector !== undefined) {\n\t\t\t\tif (isPromise(value)) {\n\t\t\t\t\treturn value.then(result => {\n\t\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: we check for it above; during SSG, handoverCollector cannot be undefined.\n\t\t\t\t\t\thandoverCollector!.set(handoverDataType, entryKey, result)\n\t\t\t\t\t\treturn result\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\thandoverCollector.set(handoverDataType, entryKey, value)\n\t\t\t}\n\n\t\t\treturn value\n\t\t}\n\n\t\tif (hasHandoverData(handoverDataType, entryKey)) {\n\t\t\tconst data = getHandoverData(handoverDataType, entryKey)\n\t\t\tthis.cacheMap.set(entryKey, new LazyValue(() => data))\n\t\t\treturn data\n\t\t}\n\n\t\tconst maybeUtils = this.module.readMaybeAsync()\n\t\tconst utilsIsPromise = isPromise(maybeUtils)\n\n\t\tlet maybeResult: Promise<string | undefined> | undefined\n\t\ttry {\n\t\t\tmaybeResult = utilsIsPromise\n\t\t\t\t? maybeUtils.then(utils => utils?.[method](id, locale))\n\t\t\t\t: maybeUtils?.[method](id, locale)\n\t\t} catch (error) {\n\t\t\t// biome-ignore lint/suspicious/noConsole: Actionable error\n\t\t\tconsole.error(getPleaseReportMessage(\"Failed to call CollectionUtils method.\", error))\n\t\t\tmaybeResult = undefined\n\t\t}\n\n\t\tif (maybeResult === undefined) {\n\t\t\tif (handoverCollector !== undefined) {\n\t\t\t\thandoverCollector.set(handoverDataType, entryKey, maybeResult)\n\t\t\t}\n\t\t\tthis.cacheMap.set(entryKey, maybeResult)\n\t\t\treturn\n\t\t}\n\n\t\tconst lazyValue = new LazyValue<string | undefined>(() =>\n\t\t\tmaybeResult\n\t\t\t\t.then(result => {\n\t\t\t\t\tif (handoverCollector !== undefined) {\n\t\t\t\t\t\thandoverCollector.set(handoverDataType, entryKey, result)\n\t\t\t\t\t}\n\t\t\t\t\treturn result\n\t\t\t\t})\n\t\t\t\t.catch(error => {\n\t\t\t\t\t// biome-ignore lint/suspicious/noConsole: Actionable error\n\t\t\t\t\tconsole.error(getPleaseReportMessage(\"Failed to call CollectionUtils method.\", error))\n\t\t\t\t\treturn undefined\n\t\t\t\t}),\n\t\t)\n\n\t\tthis.cacheMap.set(entryKey, lazyValue)\n\t\treturn lazyValue.readMaybeAsync()\n\t}\n\n\tgetSlugByRecordId(recordId: string, locale: Locale | undefined): MaybePromise<string | undefined> {\n\t\treturn this.callUtilsMethod(\"getSlugByRecordId\", recordId, locale)\n\t}\n\n\tgetRecordIdBySlug(slug: string, locale: Locale | undefined): MaybePromise<string | undefined> {\n\t\treturn this.callUtilsMethod(\"getRecordIdBySlug\", slug, locale)\n\t}\n}\n\nexport const testing = {\n\tclear() {\n\t\tutilsCache = new WeakMap()\n\t},\n}\n", "import type { PageviewEventData } from \"../utils/sendTrackingEvent.ts\"\nimport type { MonitorNextPaintAfterRender } from \"./useMonitorNextPaintAfterRender.ts\"\n\nexport type RouteId = string\nexport type RoutePath = string\nexport type ElementId = string\nexport type Hash = ElementId | string\n\n/**\n * @public\n * A unique id for a locale.\n */\nexport type LocaleId = string\n\nexport const defaultLocaleId: LocaleId = \"default\"\n\n/**\n * @public\n * The direction of the text, either \"ltr\" (left-to-right) or \"rtl\" (right-to-left).\n */\nexport type TextDirection = \"ltr\" | \"rtl\"\n\nexport interface RouteStatus {\n\thasLoaded: boolean\n\thasRendered: boolean\n}\n\n/**\n * @public\n */\n// biome-ignore lint/suspicious/noExplicitAny: intended\nexport type ComponentWithPreload<T extends React.ComponentType<any>> = T & {\n\t// biome-ignore lint/suspicious/noConfusingVoidType: void is correct here\n\tpreload: () => Promise<void | T>\n\tgetStatus: () => RouteStatus\n\tcacheHash?: string\n}\n\n/**\n * @public\n */\n// biome-ignore lint/suspicious/noExplicitAny: intended\nexport type RouteComponent<P = any> =\n\t| React.ReactElement<P>\n\t| React.ComponentType<P>\n\t| ComponentWithPreload<React.ComponentType<P>>\n\n/**\n * @public\n */\nexport type Elements = Record<ElementId, string>\n\n/**\n * @public\n */\nexport interface RouteInfo {\n\tpath?: RoutePath\n\tpathLocalized?: Record<LocaleId, RoutePath>\n\telements?: Elements\n\tcollectionId?: string\n\tincludedLocales?: LocaleId[]\n\tabTestId?: string\n\tabTestingParentId?: string\n\tabTestingVariantId?: string\n}\n\nexport type UtilsFactory = () => Promise<CollectionUtils> | undefined\n\nexport type UtilsByCollectionId = Record<string, UtilsFactory>\n\nexport type MaybePromise<T> = T | Promise<T>\n\nexport interface CollectionUtils {\n\tgetSlugByRecordId: (id: string, locale: Locale | undefined) => Promise<string | undefined>\n\tgetRecordIdBySlug: (slug: string, locale: Locale | undefined) => Promise<string | undefined>\n}\n\n/**\n * @public\n */\nexport interface Route extends RouteInfo {\n\tpage: RouteComponent\n}\n\n/**\n * @public\n */\nexport interface ActiveRoute extends Route {\n\tid: RouteId\n\tpathVariables: Record<string, unknown> | undefined\n}\n\n/**\n * @public\n */\nexport type Routes = Record<RouteId, Route>\n\n/**\n * @public\n */\nexport type RouteHandler = () => void\n\nexport interface RouterAPI {\n\tnavigate(\n\t\trouteId: RouteId,\n\t\telementId?: Hash,\n\t\tpathVariables?: Record<string, unknown>,\n\t\tsmoothScroll?: boolean,\n\t\tbeforeUrlUpdate?: () => void,\n\t): void\n\tgetRoute(routeId: RouteId): Route | undefined\n\tcurrentRouteId: RouteId\n\tcurrentPathVariables?: Record<string, unknown>\n\troutes: Routes\n\t/**\n\t * @deprecated Prefer `useCollectionUtils`.\n\t */\n\tcollectionUtils?: UtilsByCollectionId\n\tpreserveQueryParams?: boolean\n\t/**\n\t * This is a mutable reference to the pageview event data.\n\t * The data may be kept in a promise, because we need to resolve\n\t * collection item data in `useSendPageView`.\n\t */\n\tpageviewEventData: React.MutableRefObject<PageviewEventData | Promise<PageviewEventData> | undefined>\n\tsiteCanonicalURL?: string\n\tisInitialNavigation: boolean\n}\n\n/**\n * @public\n * A unique locale with an id, code (e.g. \"en-US\"), name, slug, and optional fallback.\n */\nexport interface Locale {\n\t/** Unique id. */\n\treadonly id: LocaleId\n\t/** Language and optional region code (e.g. \"en-US\"). */\n\treadonly code: string\n\t/** Display name, for example used by the locale picker component. */\n\treadonly name: string\n\t/** Locale slug is inserted as the first path segment when non empty. */\n\treadonly slug: string\n\t/** Optional fallback locale, used when resolving localized values. */\n\treadonly fallback?: Locale\n\t/** Either \"ltr\" (left-to-right) or \"rtl\" (right-to-left). */\n\treadonly textDirection?: TextDirection\n}\n\n/**\n * @public\n * @deprecated Use `LocaleInfo` instead.\n */\nexport interface LocalizationInfo {\n\treadonly activeLocalization: Locale | null\n\treadonly localizations: readonly Locale[]\n\treadonly setLocalization: (localization: Locale) => void\n}\n\n/**\n * @public\n * The active locale, all of the available locales, and a way to change the active locale.\n */\nexport interface LocaleInfo {\n\t/** The locale currently active. */\n\treadonly activeLocale: Locale | null\n\t/** All of the available locales. */\n\treadonly locales: readonly Locale[]\n\t/** Update the active locale by passing in either a locale or locale id. */\n\treadonly setLocale: (locale: Locale | LocaleId) => Promise<void>\n}\n\nexport interface PaginationInfo {\n\tcurrentPage: number\n\ttotalPages: number\n\tisLoading: boolean\n}\n\nexport type UpdateURL = () => Promise<void>\n\nexport interface NavigationPerformanceDetail {\n\tcached?: boolean\n\tpreloaded?: boolean\n\tpopstate?: boolean\n\tlocalized?: boolean\n}\n\nexport type SetCurrentRouteId = (\n\trouteId: RouteId,\n\tlocaleId: LocaleId | undefined,\n\thash: string | undefined,\n\tpathnameWithHash: string,\n\tpathVariables: Record<string, unknown> | undefined,\n\tisHistoryTransition: boolean,\n\tnextRender: ReturnType<MonitorNextPaintAfterRender<NavigationPerformanceDetail>>,\n\tsmoothScroll?: boolean,\n\tupdateURL?: (ignorePushStateWrapper?: boolean) => ReturnType<UpdateURL>,\n) => void\n", "// NOTE: This file is a copy of `framerjs/shared/src/assert.ts` this was done to\n// prevent pulling in files from outside library.\n\n/**\n * Throws an error when the condition is falsy, optionally pass in a message to\n * describe the error.\n *\n * Best to use asserts where data is about to be stored. Then errors are caught\n * early, close to the cause. Otherwise data with broken expectation might hang\n * around, only to cause errors when used later on, with no pointer back to what\n * caused that bad state.\n *\n * Note that when an assert fails, consider that a fatal error caused by buggy\n * code. The program should halt, or perhaps do some kind of high level\n * recovery, and the bug should be reported and fixed. Asserts are not well\n * suited to use as defensive programming, but are good to use to quickly\n * highlight mistakes while writing new code.\n *\n * Also note asserts should not have side effects, the program should continue\n * to work when asserts are compiled away. Because asserts might be compiled\n * away in production code.\n *\n * And finally, both the condition should be cheap, and the message should not\n * do string interpolation, instead you can pass in multiple parts of the\n * message.\n */\nexport function assert(condition: unknown, ...msg: unknown[]): asserts condition {\n\tif (condition) return\n\n\tconst e = Error(\"Assertion Error\" + (msg.length > 0 ? \": \" + msg.join(\" \") : \"\"))\n\t// Hack the stack so the assert call itself disappears. Works in jest and in chrome.\n\tif (e.stack) {\n\t\ttry {\n\t\t\tconst lines = e.stack.split(\"\\n\")\n\t\t\tif (lines[1]?.includes(\"assert\")) {\n\t\t\t\tlines.splice(1, 1)\n\t\t\t\te.stack = lines.join(\"\\n\")\n\t\t\t} else if (lines[0]?.includes(\"assert\")) {\n\t\t\t\tlines.splice(0, 1)\n\t\t\t\te.stack = lines.join(\"\\n\")\n\t\t\t}\n\t\t} catch {\n\t\t\t// nothing\n\t\t}\n\t}\n\tthrow e\n}\n\n/**\n * Asserts that a code path is never entered. Additionally, asserts that the provided\n * value is evaluated to `never` by the type system, which means all possible discrete\n * types have been exhaustively checked by the time this statement is reached.\n */\nexport function assertNever(x: never, error?: unknown): never {\n\tif (error instanceof Error) {\n\t\tthrow error\n\t}\n\n\tif (error !== undefined) {\n\t\tthrow new Error(String(error))\n\t}\n\n\tthrow new Error(x ? `Unexpected value: ${x}` : \"Application entered invalid state\")\n}\n", "import { lazyModulesCache } from \"../router/lazyModulesCache.ts\"\nimport { lazyModulesCollector } from \"../router/lazyModulesCollector.ts\"\nimport type { MaybePromise } from \"../router/types.ts\"\nimport { isPromise } from \"../utils/utils.ts\"\n\nconst PromiseState = {\n\tPending: \"pending\",\n\tFulfilled: \"fulfilled\",\n\tRejected: \"rejected\",\n} as const\n\n/**\n * LazyValue is a PromiseLike class that can resolve or reject lazily.\n * Designed with the same API as https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled.\n */\nexport class LazyValue<Value = void> implements PromiseLike<Value> {\n\tstatic is<Value>(value: unknown): value is LazyValue<Value> {\n\t\treturn value instanceof LazyValue\n\t}\n\n\tprivate promiseState: (typeof PromiseState)[keyof typeof PromiseState] = PromiseState.Pending\n\tprivate preloadPromise?: Promise<void>\n\n\tvalue!: Value\n\treason!: unknown\n\n\t/**\n\t * Gets the status and preloads the value if it's not already preloaded.\n\t */\n\tget status() {\n\t\t// React reads `status` when using the React 19+ `use` hook. So it should kick-off the preload.\n\t\t// https://deepwiki.com/search/how-is-the-use-hook-implemente_51724b79-78a2-4359-83b7-94f75ffd3789\n\t\tvoid this.preload()\n\t\treturn this.state\n\t}\n\n\tget state() {\n\t\treturn this.promiseState\n\t}\n\n\t/**\n\t * @param resolver Function that returns the value or promise\n\t * @param cacheHash Optional hash of the module filename, used for cache optimization. During build, this is automatically injected as a compact hash of the filename extracted from the original HTTPS URL (e.g., \"YouTube.js\" \u2192 hash).\n\t */\n\tconstructor(\n\t\tprivate readonly resolver: () => MaybePromise<Value>,\n\t\tprivate readonly cacheHash?: string,\n\t) {}\n\n\t// biome-ignore lint/suspicious/noThenProperty: This is a PromiseLike class.\n\tthen<TResult1 = Value, TResult2 = never>(\n\t\tonfulfilled?: null | ((value: Value) => MaybePromise<TResult1>),\n\t\tonrejected?: null | ((reason: unknown) => MaybePromise<TResult2>),\n\t): Promise<TResult1 | TResult2> {\n\t\t// If already fulfilled/rejected, return resolved/rejected promise\n\t\tif (this.promiseState === PromiseState.Fulfilled) {\n\t\t\treturn Promise.resolve(this.value).then(onfulfilled, onrejected)\n\t\t}\n\n\t\tif (this.promiseState === PromiseState.Rejected) {\n\t\t\treturn Promise.reject(this.reason).then(onfulfilled, onrejected)\n\t\t}\n\n\t\treturn this.readAsync().then(onfulfilled, onrejected)\n\t}\n\n\t/**\n\t * Preload the value so it can be read() later.\n\t *\n\t * @returns The promise that resolves or rejects. `undefined` if the value has already been preloaded or is synchronously readable.\n\t */\n\tpreload(): Promise<void> | undefined {\n\t\t// The value was already preloaded.\n\t\tif (this.promiseState !== PromiseState.Pending) return\n\n\t\t// The value is currently preloading.\n\t\tif (this.preloadPromise) return this.preloadPromise\n\n\t\tif (this.cacheHash !== undefined && lazyModulesCollector !== undefined) {\n\t\t\tlazyModulesCollector.add(this.cacheHash)\n\t\t}\n\n\t\tconst fulfill = (value: Value) => {\n\t\t\tthis.promiseState = PromiseState.Fulfilled\n\t\t\tthis.value = value\n\t\t}\n\n\t\tconst reject = (reason: unknown) => {\n\t\t\tthis.promiseState = PromiseState.Rejected\n\t\t\tthis.reason = reason\n\t\t}\n\n\t\tlet maybeValue: MaybePromise<Value>\n\t\ttry {\n\t\t\tmaybeValue =\n\t\t\t\tthis.cacheHash && lazyModulesCache.has(this.cacheHash)\n\t\t\t\t\t? (lazyModulesCache.get(this.cacheHash) as MaybePromise<Value>)\n\t\t\t\t\t: this.resolver()\n\t\t} catch (e) {\n\t\t\treject(e)\n\t\t\treturn\n\t\t}\n\n\t\t// The value is not a promise and is synchronously available\n\t\tif (!isPromise(maybeValue)) {\n\t\t\tfulfill(maybeValue)\n\t\t\treturn\n\t\t}\n\n\t\tconst valuePromise = maybeValue.then(fulfill, reject)\n\t\tthis.preloadPromise = valuePromise\n\t\treturn valuePromise\n\t}\n\n\t/** Synchronously read the value after calling preload() before. */\n\tread = (): Value => {\n\t\tif (this.promiseState === PromiseState.Fulfilled) {\n\t\t\treturn this.value\n\t\t}\n\n\t\tif (this.promiseState === PromiseState.Rejected) {\n\t\t\tthrow this.reason\n\t\t}\n\n\t\tthrow new Error(\"Need to call preload() before read()\")\n\t}\n\n\t/**\n\t * @deprecated Use readMaybeAsync() instead.\n\t * @important Don't remove it - was used in code-gen before October 2025.\n\t */\n\tasync readAsync(): Promise<Value> {\n\t\treturn this.readMaybeAsync()\n\t}\n\n\t/**\n\t * Loads the value if it's not already loaded.\n\t *\n\t * @returns The value or a promise that resolves to the value.\n\t */\n\treadMaybeAsync(): MaybePromise<Value> {\n\t\tconst preloadPromise = this.preload()\n\t\tif (preloadPromise) return preloadPromise.then(this.read)\n\n\t\treturn this.read()\n\t}\n\n\t/**\n\t * FIXME: With React 19, mark this as deprecated and use the official `use` hook instead (just pass in the LazyValue instance).\n\t */\n\tuse(): Value {\n\t\tconst promise = this.preload()\n\t\tif (promise) throw promise\n\n\t\treturn this.read()\n\t}\n}\n", "/** @type {Record<string, string>} */\nexport const escaped = {\n\t'<': '\\\\u003C',\n\t'\\\\': '\\\\\\\\',\n\t'\\b': '\\\\b',\n\t'\\f': '\\\\f',\n\t'\\n': '\\\\n',\n\t'\\r': '\\\\r',\n\t'\\t': '\\\\t',\n\t'\\u2028': '\\\\u2028',\n\t'\\u2029': '\\\\u2029'\n};\n\nexport class DevalueError extends Error {\n\t/**\n\t * @param {string} message\n\t * @param {string[]} keys\n\t * @param {any} [value] - The value that failed to be serialized\n\t * @param {any} [root] - The root value being serialized\n\t */\n\tconstructor(message, keys, value, root) {\n\t\tsuper(message);\n\t\tthis.name = 'DevalueError';\n\t\tthis.path = keys.join('');\n\t\tthis.value = value;\n\t\tthis.root = root;\n\t}\n}\n\n/** @param {any} thing */\nexport function is_primitive(thing) {\n\treturn Object(thing) !== thing;\n}\n\nconst object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(\n\tObject.prototype\n)\n\t.sort()\n\t.join('\\0');\n\n/** @param {any} thing */\nexport function is_plain_object(thing) {\n\tconst proto = Object.getPrototypeOf(thing);\n\n\treturn (\n\t\tproto === Object.prototype ||\n\t\tproto === null ||\n\t\tObject.getPrototypeOf(proto) === null ||\n\t\tObject.getOwnPropertyNames(proto).sort().join('\\0') === object_proto_names\n\t);\n}\n\n/** @param {any} thing */\nexport function get_type(thing) {\n\treturn Object.prototype.toString.call(thing).slice(8, -1);\n}\n\n/** @param {string} char */\nfunction get_escaped_char(char) {\n\tswitch (char) {\n\t\tcase '\"':\n\t\t\treturn '\\\\\"';\n\t\tcase '<':\n\t\t\treturn '\\\\u003C';\n\t\tcase '\\\\':\n\t\t\treturn '\\\\\\\\';\n\t\tcase '\\n':\n\t\t\treturn '\\\\n';\n\t\tcase '\\r':\n\t\t\treturn '\\\\r';\n\t\tcase '\\t':\n\t\t\treturn '\\\\t';\n\t\tcase '\\b':\n\t\t\treturn '\\\\b';\n\t\tcase '\\f':\n\t\t\treturn '\\\\f';\n\t\tcase '\\u2028':\n\t\t\treturn '\\\\u2028';\n\t\tcase '\\u2029':\n\t\t\treturn '\\\\u2029';\n\t\tdefault:\n\t\t\treturn char < ' '\n\t\t\t\t? `\\\\u${char.charCodeAt(0).toString(16).padStart(4, '0')}`\n\t\t\t\t: '';\n\t}\n}\n\n/** @param {string} str */\nexport function stringify_string(str) {\n\tlet result = '';\n\tlet last_pos = 0;\n\tconst len = str.length;\n\n\tfor (let i = 0; i < len; i += 1) {\n\t\tconst char = str[i];\n\t\tconst replacement = get_escaped_char(char);\n\t\tif (replacement) {\n\t\t\tresult += str.slice(last_pos, i) + replacement;\n\t\t\tlast_pos = i + 1;\n\t\t}\n\t}\n\n\treturn `\"${last_pos === 0 ? str : result + str.slice(last_pos)}\"`;\n}\n\n/** @param {Record<string | symbol, any>} object */\nexport function enumerable_symbols(object) {\n\treturn Object.getOwnPropertySymbols(object).filter(\n\t\t(symbol) => Object.getOwnPropertyDescriptor(object, symbol).enumerable\n\t);\n}\n\nconst is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;\n\n/** @param {string} key */\nexport function stringify_key(key) {\n\treturn is_identifier.test(key) ? '.' + key : '[' + JSON.stringify(key) + ']';\n}\n\n/** @param {string} s */\nfunction is_valid_array_index(s) {\n\tif (s.length === 0) return false;\n\tif (s.length > 1 && s.charCodeAt(0) === 48) return false; // leading zero\n\tfor (let i = 0; i < s.length; i++) {\n\t\tconst c = s.charCodeAt(i);\n\t\tif (c < 48 || c > 57) return false;\n\t}\n\t// by this point we know it's a string of digits, but it has to be within the range of valid array indices\n\tconst n = +s;\n\tif (n >= 2 ** 32 - 1) return false;\n\tif (n < 0) return false;\n\treturn true;\n}\n\n/**\n * Finds the populated indices of an array.\n * @param {unknown[]} array\n */\nexport function valid_array_indices(array) {\n\tconst keys = Object.keys(array);\n\tfor (var i = keys.length - 1; i >= 0; i--) {\n\t\tif (is_valid_array_index(keys[i])) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tkeys.length = i + 1;\n\treturn keys;\n}\n", "/**\n * Base64 Encodes an arraybuffer\n * @param {ArrayBuffer} arraybuffer\n * @returns {string}\n */\nexport function encode64(arraybuffer) {\n  const dv = new DataView(arraybuffer);\n  let binaryString = \"\";\n\n  for (let i = 0; i < arraybuffer.byteLength; i++) {\n    binaryString += String.fromCharCode(dv.getUint8(i));\n  }\n\n  return binaryToAscii(binaryString);\n}\n\n/**\n * Decodes a base64 string into an arraybuffer\n * @param {string} string\n * @returns {ArrayBuffer}\n */\nexport function decode64(string) {\n  const binaryString = asciiToBinary(string);\n  const arraybuffer = new ArrayBuffer(binaryString.length);\n  const dv = new DataView(arraybuffer);\n\n  for (let i = 0; i < arraybuffer.byteLength; i++) {\n    dv.setUint8(i, binaryString.charCodeAt(i));\n  }\n\n  return arraybuffer;\n}\n\nconst KEY_STRING =\n  \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\n/**\n * Substitute for atob since it's deprecated in node.\n * Does not do any input validation.\n *\n * @see https://github.com/jsdom/abab/blob/master/lib/atob.js\n *\n * @param {string} data\n * @returns {string}\n */\nfunction asciiToBinary(data) {\n  if (data.length % 4 === 0) {\n    data = data.replace(/==?$/, \"\");\n  }\n\n  let output = \"\";\n  let buffer = 0;\n  let accumulatedBits = 0;\n\n  for (let i = 0; i < data.length; i++) {\n    buffer <<= 6;\n    buffer |= KEY_STRING.indexOf(data[i]);\n    accumulatedBits += 6;\n    if (accumulatedBits === 24) {\n      output += String.fromCharCode((buffer & 0xff0000) >> 16);\n      output += String.fromCharCode((buffer & 0xff00) >> 8);\n      output += String.fromCharCode(buffer & 0xff);\n      buffer = accumulatedBits = 0;\n    }\n  }\n  if (accumulatedBits === 12) {\n    buffer >>= 4;\n    output += String.fromCharCode(buffer);\n  } else if (accumulatedBits === 18) {\n    buffer >>= 2;\n    output += String.fromCharCode((buffer & 0xff00) >> 8);\n    output += String.fromCharCode(buffer & 0xff);\n  }\n  return output;\n}\n\n/**\n * Substitute for btoa since it's deprecated in node.\n * Does not do any input validation.\n *\n * @see https://github.com/jsdom/abab/blob/master/lib/btoa.js\n *\n * @param {string} str\n * @returns {string}\n */\nfunction binaryToAscii(str) {\n  let out = \"\";\n  for (let i = 0; i < str.length; i += 3) {\n    /** @type {[number, number, number, number]} */\n    const groupsOfSix = [undefined, undefined, undefined, undefined];\n    groupsOfSix[0] = str.charCodeAt(i) >> 2;\n    groupsOfSix[1] = (str.charCodeAt(i) & 0x03) << 4;\n    if (str.length > i + 1) {\n      groupsOfSix[1] |= str.charCodeAt(i + 1) >> 4;\n      groupsOfSix[2] = (str.charCodeAt(i + 1) & 0x0f) << 2;\n    }\n    if (str.length > i + 2) {\n      groupsOfSix[2] |= str.charCodeAt(i + 2) >> 6;\n      groupsOfSix[3] = str.charCodeAt(i + 2) & 0x3f;\n    }\n    for (let j = 0; j < groupsOfSix.length; j++) {\n      if (typeof groupsOfSix[j] === \"undefined\") {\n        out += \"=\";\n      } else {\n        out += KEY_STRING[groupsOfSix[j]];\n      }\n    }\n  }\n  return out;\n}\n", "export const UNDEFINED = -1;\nexport const HOLE = -2;\nexport const NAN = -3;\nexport const POSITIVE_INFINITY = -4;\nexport const NEGATIVE_INFINITY = -5;\nexport const NEGATIVE_ZERO = -6;\nexport const SPARSE = -7;\n", "import { decode64 } from './base64.js';\nimport {\n\tHOLE,\n\tNAN,\n\tNEGATIVE_INFINITY,\n\tNEGATIVE_ZERO,\n\tPOSITIVE_INFINITY,\n\tSPARSE,\n\tUNDEFINED\n} from './constants.js';\n\n/**\n * Revive a value serialized with `devalue.stringify`\n * @param {string} serialized\n * @param {Record<string, (value: any) => any>} [revivers]\n */\nexport function parse(serialized, revivers) {\n\treturn unflatten(JSON.parse(serialized), revivers);\n}\n\n/**\n * Revive a value flattened with `devalue.stringify`\n * @param {number | any[]} parsed\n * @param {Record<string, (value: any) => any>} [revivers]\n */\nexport function unflatten(parsed, revivers) {\n\tif (typeof parsed === 'number') return hydrate(parsed, true);\n\n\tif (!Array.isArray(parsed) || parsed.length === 0) {\n\t\tthrow new Error('Invalid input');\n\t}\n\n\tconst values = /** @type {any[]} */ (parsed);\n\n\tconst hydrated = Array(values.length);\n\n\t/**\n\t * A set of values currently being hydrated with custom revivers,\n\t * used to detect invalid cyclical dependencies\n\t * @type {Set<number> | null}\n\t */\n\tlet hydrating = null;\n\n\t/**\n\t * @param {number} index\n\t * @returns {any}\n\t */\n\tfunction hydrate(index, standalone = false) {\n\t\tif (index === UNDEFINED) return undefined;\n\t\tif (index === NAN) return NaN;\n\t\tif (index === POSITIVE_INFINITY) return Infinity;\n\t\tif (index === NEGATIVE_INFINITY) return -Infinity;\n\t\tif (index === NEGATIVE_ZERO) return -0;\n\n\t\tif (standalone || typeof index !== 'number') {\n\t\t\tthrow new Error(`Invalid input`);\n\t\t}\n\n\t\tif (index in hydrated) return hydrated[index];\n\n\t\tconst value = values[index];\n\n\t\tif (!value || typeof value !== 'object') {\n\t\t\thydrated[index] = value;\n\t\t} else if (Array.isArray(value)) {\n\t\t\tif (typeof value[0] === 'string') {\n\t\t\t\tconst type = value[0];\n\n\t\t\t\tconst reviver =\n\t\t\t\t\trevivers && Object.hasOwn(revivers, type)\n\t\t\t\t\t\t? revivers[type]\n\t\t\t\t\t\t: undefined;\n\n\t\t\t\tif (reviver) {\n\t\t\t\t\tlet i = value[1];\n\t\t\t\t\tif (typeof i !== 'number') {\n\t\t\t\t\t\t// if it's not a number, it was serialized by a builtin reviver\n\t\t\t\t\t\t// so we need to munge it into the format expected by a custom reviver\n\t\t\t\t\t\ti = values.push(value[1]) - 1;\n\t\t\t\t\t}\n\n\t\t\t\t\thydrating ??= new Set();\n\n\t\t\t\t\tif (hydrating.has(i)) {\n\t\t\t\t\t\tthrow new Error('Invalid circular reference');\n\t\t\t\t\t}\n\n\t\t\t\t\thydrating.add(i);\n\t\t\t\t\thydrated[index] = reviver(hydrate(i));\n\t\t\t\t\thydrating.delete(i);\n\n\t\t\t\t\treturn hydrated[index];\n\t\t\t\t}\n\n\t\t\t\tswitch (type) {\n\t\t\t\t\tcase 'Date':\n\t\t\t\t\t\thydrated[index] = new Date(value[1]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Set':\n\t\t\t\t\t\tconst set = new Set();\n\t\t\t\t\t\thydrated[index] = set;\n\t\t\t\t\t\tfor (let i = 1; i < value.length; i += 1) {\n\t\t\t\t\t\t\tset.add(hydrate(value[i]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Map':\n\t\t\t\t\t\tconst map = new Map();\n\t\t\t\t\t\thydrated[index] = map;\n\t\t\t\t\t\tfor (let i = 1; i < value.length; i += 2) {\n\t\t\t\t\t\t\tmap.set(hydrate(value[i]), hydrate(value[i + 1]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'RegExp':\n\t\t\t\t\t\thydrated[index] = new RegExp(value[1], value[2]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Object':\n\t\t\t\t\t\tconst object = Object(value[1]);\n\n\t\t\t\t\t\tif (Object.hasOwn(object, '__proto__')) {\n\t\t\t\t\t\t\tthrow new Error('Cannot parse an object with a `__proto__` property');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\thydrated[index] = object;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'BigInt':\n\t\t\t\t\t\thydrated[index] = BigInt(value[1]);\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'null':\n\t\t\t\t\t\tconst obj = Object.create(null);\n\t\t\t\t\t\thydrated[index] = obj;\n\t\t\t\t\t\tfor (let i = 1; i < value.length; i += 2) {\n\t\t\t\t\t\t\tif (value[i] === '__proto__') {\n\t\t\t\t\t\t\t\tthrow new Error('Cannot parse an object with a `__proto__` property');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tobj[value[i]] = hydrate(value[i + 1]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Int8Array':\n\t\t\t\t\tcase 'Uint8Array':\n\t\t\t\t\tcase 'Uint8ClampedArray':\n\t\t\t\t\tcase 'Int16Array':\n\t\t\t\t\tcase 'Uint16Array':\n\t\t\t\t\tcase 'Int32Array':\n\t\t\t\t\tcase 'Uint32Array':\n\t\t\t\t\tcase 'Float32Array':\n\t\t\t\t\tcase 'Float64Array':\n\t\t\t\t\tcase 'BigInt64Array':\n\t\t\t\t\tcase 'BigUint64Array': {\n\t\t\t\t\t\tif (values[value[1]][0] !== 'ArrayBuffer') {\n\t\t\t\t\t\t\t// without this, if we receive malformed input we could\n\t\t\t\t\t\t\t// end up trying to hydrate in a circle or allocate\n\t\t\t\t\t\t\t// huge amounts of memory when we call `new TypedArrayConstructor(buffer)`\n\t\t\t\t\t\t\tthrow new Error('Invalid data');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst TypedArrayConstructor = globalThis[type];\n\t\t\t\t\t\tconst buffer = hydrate(value[1]);\n\t\t\t\t\t\tconst typedArray = new TypedArrayConstructor(buffer);\n\n\t\t\t\t\t\thydrated[index] =\n\t\t\t\t\t\t\tvalue[2] !== undefined\n\t\t\t\t\t\t\t\t? typedArray.subarray(value[2], value[3])\n\t\t\t\t\t\t\t\t: typedArray;\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'ArrayBuffer': {\n\t\t\t\t\t\tconst base64 = value[1];\n\t\t\t\t\t\tif (typeof base64 !== 'string') {\n\t\t\t\t\t\t\tthrow new Error('Invalid ArrayBuffer encoding');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst arraybuffer = decode64(base64);\n\t\t\t\t\t\thydrated[index] = arraybuffer;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'Temporal.Duration':\n\t\t\t\t\tcase 'Temporal.Instant':\n\t\t\t\t\tcase 'Temporal.PlainDate':\n\t\t\t\t\tcase 'Temporal.PlainTime':\n\t\t\t\t\tcase 'Temporal.PlainDateTime':\n\t\t\t\t\tcase 'Temporal.PlainMonthDay':\n\t\t\t\t\tcase 'Temporal.PlainYearMonth':\n\t\t\t\t\tcase 'Temporal.ZonedDateTime': {\n\t\t\t\t\t\tconst temporalName = type.slice(9);\n\t\t\t\t\t\t// @ts-expect-error TS doesn't know about Temporal yet\n\t\t\t\t\t\thydrated[index] = Temporal[temporalName].from(value[1]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'URL': {\n\t\t\t\t\t\tconst url = new URL(value[1]);\n\t\t\t\t\t\thydrated[index] = url;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'URLSearchParams': {\n\t\t\t\t\t\tconst url = new URLSearchParams(value[1]);\n\t\t\t\t\t\thydrated[index] = url;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new Error(`Unknown type ${type}`);\n\t\t\t\t}\n\t\t\t} else if (value[0] === SPARSE) {\n\t\t\t\t// Sparse array encoding: [SPARSE, length, idx, val, idx, val, ...]\n\t\t\t\tconst len = value[1];\n\n\t\t\t\tif (!Number.isInteger(len) || len < 0) {\n\t\t\t\t\tthrow new Error('Invalid input');\n\t\t\t\t}\n\n\t\t\t\tconst array = new Array(len);\n\t\t\t\thydrated[index] = array;\n\n\t\t\t\tfor (let i = 2; i < value.length; i += 2) {\n\t\t\t\t\tconst idx = value[i];\n\n\t\t\t\t\tif (!Number.isInteger(idx) || idx < 0 || idx >= len) {\n\t\t\t\t\t\tthrow new Error('Invalid input');\n\t\t\t\t\t}\n\n\t\t\t\t\tarray[idx] = hydrate(value[i + 1]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst array = new Array(value.length);\n\t\t\t\thydrated[index] = array;\n\n\t\t\t\tfor (let i = 0; i < value.length; i += 1) {\n\t\t\t\t\tconst n = value[i];\n\t\t\t\t\tif (n === HOLE) continue;\n\n\t\t\t\t\tarray[i] = hydrate(n);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t/** @type {Record<string, any>} */\n\t\t\tconst object = {};\n\t\t\thydrated[index] = object;\n\n\t\t\tfor (const key of Object.keys(value)) {\n\t\t\t\tif (key === '__proto__') {\n\t\t\t\t\tthrow new Error('Cannot parse an object with a `__proto__` property');\n\t\t\t\t}\n\n\t\t\t\tconst n = value[key];\n\t\t\t\tobject[key] = hydrate(n);\n\t\t\t}\n\t\t}\n\n\t\treturn hydrated[index];\n\t}\n\n\treturn hydrate(0);\n}\n", "import {\n\tDevalueError,\n\tenumerable_symbols,\n\tget_type,\n\tis_plain_object,\n\tis_primitive,\n\tstringify_key,\n\tstringify_string,\n\tvalid_array_indices\n} from './utils.js';\nimport {\n\tHOLE,\n\tNAN,\n\tNEGATIVE_INFINITY,\n\tNEGATIVE_ZERO,\n\tPOSITIVE_INFINITY,\n\tSPARSE,\n\tUNDEFINED\n} from './constants.js';\nimport { encode64 } from './base64.js';\n\n/**\n * Turn a value into a JSON string that can be parsed with `devalue.parse`\n * @param {any} value\n * @param {Record<string, (value: any) => any>} [reducers]\n */\nexport function stringify(value, reducers) {\n\t/** @type {any[]} */\n\tconst stringified = [];\n\n\t/** @type {Map<any, number>} */\n\tconst indexes = new Map();\n\n\t/** @type {Array<{ key: string, fn: (value: any) => any }>} */\n\tconst custom = [];\n\tif (reducers) {\n\t\tfor (const key of Object.getOwnPropertyNames(reducers)) {\n\t\t\tcustom.push({ key, fn: reducers[key] });\n\t\t}\n\t}\n\n\t/** @type {string[]} */\n\tconst keys = [];\n\n\tlet p = 0;\n\n\t/** @param {any} thing */\n\tfunction flatten(thing) {\n\t\tif (thing === undefined) return UNDEFINED;\n\t\tif (Number.isNaN(thing)) return NAN;\n\t\tif (thing === Infinity) return POSITIVE_INFINITY;\n\t\tif (thing === -Infinity) return NEGATIVE_INFINITY;\n\t\tif (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO;\n\n\t\tif (indexes.has(thing)) return indexes.get(thing);\n\n\t\tconst index = p++;\n\t\tindexes.set(thing, index);\n\n\t\tfor (const { key, fn } of custom) {\n\t\t\tconst value = fn(thing);\n\t\t\tif (value) {\n\t\t\t\tstringified[index] = `[\"${key}\",${flatten(value)}]`;\n\t\t\t\treturn index;\n\t\t\t}\n\t\t}\n\n\t\tif (typeof thing === 'function') {\n\t\t\tthrow new DevalueError(`Cannot stringify a function`, keys, thing, value);\n\t\t}\n\n\t\tlet str = '';\n\n\t\tif (is_primitive(thing)) {\n\t\t\tstr = stringify_primitive(thing);\n\t\t} else {\n\t\t\tconst type = get_type(thing);\n\n\t\t\tswitch (type) {\n\t\t\t\tcase 'Number':\n\t\t\t\tcase 'String':\n\t\t\t\tcase 'Boolean':\n\t\t\t\t\tstr = `[\"Object\",${stringify_primitive(thing)}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'BigInt':\n\t\t\t\t\tstr = `[\"BigInt\",${thing}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Date':\n\t\t\t\t\tconst valid = !isNaN(thing.getDate());\n\t\t\t\t\tstr = `[\"Date\",\"${valid ? thing.toISOString() : ''}\"]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'URL':\n\t\t\t\t\tstr = `[\"URL\",${stringify_string(thing.toString())}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'URLSearchParams':\n\t\t\t\t\tstr = `[\"URLSearchParams\",${stringify_string(thing.toString())}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RegExp':\n\t\t\t\t\tconst { source, flags } = thing;\n\t\t\t\t\tstr = flags\n\t\t\t\t\t\t? `[\"RegExp\",${stringify_string(source)},\"${flags}\"]`\n\t\t\t\t\t\t: `[\"RegExp\",${stringify_string(source)}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Array': {\n\t\t\t\t\t// For dense arrays (no holes), we iterate normally.\n\t\t\t\t\t// When we encounter the first hole, we call Object.keys\n\t\t\t\t\t// to determine the sparseness, then decide between:\n\t\t\t\t\t//   - HOLE encoding: [-2, val, -2, ...] (default)\n\t\t\t\t\t//   - Sparse encoding: [-7, length, idx, val, ...] (for very sparse arrays)\n\t\t\t\t\t// Only the sparse path avoids iterating every slot, which\n\t\t\t\t\t// is what protects against the DoS of e.g. `arr[1000000] = 1`.\n\t\t\t\t\tlet mostly_dense = false;\n\n\t\t\t\t\tstr = '[';\n\n\t\t\t\t\tfor (let i = 0; i < thing.length; i += 1) {\n\t\t\t\t\t\tif (i > 0) str += ',';\n\n\t\t\t\t\t\tif (Object.hasOwn(thing, i)) {\n\t\t\t\t\t\t\tkeys.push(`[${i}]`);\n\t\t\t\t\t\t\tstr += flatten(thing[i]);\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t} else if (mostly_dense) {\n\t\t\t\t\t\t\t// Use dense encoding. The heuristic guarantees the\n\t\t\t\t\t\t\t// array is only mildly sparse, so iterating over every\n\t\t\t\t\t\t\t// slot is fine.\n\t\t\t\t\t\t\tstr += HOLE;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Decide between HOLE encoding and sparse encoding.\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// HOLE encoding: each hole is serialized as the HOLE\n\t\t\t\t\t\t\t// sentinel (-2). For example, [, \"a\", ,] becomes\n\t\t\t\t\t\t\t// [-2, 0, -2]. Each hole costs 3 chars (\"-2\" + comma).\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// Sparse encoding: lists only populated indices.\n\t\t\t\t\t\t\t// For example, [, \"a\", ,] becomes [-7, 3, 1, 0] \u2014 the\n\t\t\t\t\t\t\t// -7 sentinel, the array length (3), then index-value\n\t\t\t\t\t\t\t// pairs. This avoids paying per-hole, but each element\n\t\t\t\t\t\t\t// costs extra chars to write its index.\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// The values are the same size either way, so the\n\t\t\t\t\t\t\t// choice comes down to structural overhead:\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t//   HOLE overhead:\n\t\t\t\t\t\t\t//     3 chars per hole (\"-2\" + comma)\n\t\t\t\t\t\t\t//     = (L - P) * 3\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t//   Sparse overhead:\n\t\t\t\t\t\t\t//     \"-7,\"          \u2014 3 chars (sparse sentinel + comma)\n\t\t\t\t\t\t\t//     + length + \",\" \u2014 (d + 1) chars (array length + comma)\n\t\t\t\t\t\t\t//     + per element: index + \",\" \u2014 (d + 1) chars\n\t\t\t\t\t\t\t//     = (4 + d) + P * (d + 1)\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// where L is the array length, P is the number of\n\t\t\t\t\t\t\t// populated elements, and d is the number of digits\n\t\t\t\t\t\t\t// in L (an upper bound on the digits in any index).\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// Sparse encoding is cheaper when:\n\t\t\t\t\t\t\t//   (4 + d) + P * (d + 1) < (L - P) * 3\n\t\t\t\t\t\t\tconst populated_keys = valid_array_indices(/** @type {any[]} */ (thing));\n\t\t\t\t\t\t\tconst population = populated_keys.length;\n\t\t\t\t\t\t\tconst d = String(thing.length).length;\n\n\t\t\t\t\t\t\tconst hole_cost = (thing.length - population) * 3;\n\t\t\t\t\t\t\tconst sparse_cost = 4 + d + population * (d + 1);\n\n\t\t\t\t\t\t\tif (hole_cost > sparse_cost) {\n\t\t\t\t\t\t\t\tstr = '[' + SPARSE + ',' + thing.length;\n\t\t\t\t\t\t\t\tfor (let j = 0; j < populated_keys.length; j++) {\n\t\t\t\t\t\t\t\t\tconst key = populated_keys[j];\n\t\t\t\t\t\t\t\t\tkeys.push(`[${key}]`);\n\t\t\t\t\t\t\t\t\tstr += ',' + key + ',' + flatten(thing[key]);\n\t\t\t\t\t\t\t\t\tkeys.pop();\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\t} else {\n\t\t\t\t\t\t\t\tmostly_dense = true;\n\t\t\t\t\t\t\t\tstr += HOLE;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'Set':\n\t\t\t\t\tstr = '[\"Set\"';\n\n\t\t\t\t\tfor (const value of thing) {\n\t\t\t\t\t\tstr += `,${flatten(value)}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Map':\n\t\t\t\t\tstr = '[\"Map\"';\n\n\t\t\t\t\tfor (const [key, value] of thing) {\n\t\t\t\t\t\tkeys.push(\n\t\t\t\t\t\t\t`.get(${is_primitive(key) ? stringify_primitive(key) : '...'})`\n\t\t\t\t\t\t);\n\t\t\t\t\t\tstr += `,${flatten(key)},${flatten(value)}`;\n\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Int8Array':\n\t\t\t\tcase 'Uint8Array':\n\t\t\t\tcase 'Uint8ClampedArray':\n\t\t\t\tcase 'Int16Array':\n\t\t\t\tcase 'Uint16Array':\n\t\t\t\tcase 'Int32Array':\n\t\t\t\tcase 'Uint32Array':\n\t\t\t\tcase 'Float32Array':\n\t\t\t\tcase 'Float64Array':\n\t\t\t\tcase 'BigInt64Array':\n\t\t\t\tcase 'BigUint64Array': {\n\t\t\t\t\t/** @type {import(\"./types.js\").TypedArray} */\n\t\t\t\t\tconst typedArray = thing;\n\t\t\t\t\tstr = '[\"' + type + '\",' + flatten(typedArray.buffer);\n\n\t\t\t\t\tconst a = thing.byteOffset;\n\t\t\t\t\tconst b = a + thing.byteLength;\n\n\t\t\t\t\t// handle subarrays\n\t\t\t\t\tif (a > 0 || b !== typedArray.buffer.byteLength) {\n\t\t\t\t\t\tconst m = +/(\\d+)/.exec(type)[1] / 8;\n\t\t\t\t\t\tstr += `,${a / m},${b / m}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'ArrayBuffer': {\n\t\t\t\t\t/** @type {ArrayBuffer} */\n\t\t\t\t\tconst arraybuffer = thing;\n\t\t\t\t\tconst base64 = encode64(arraybuffer);\n\n\t\t\t\t\tstr = `[\"ArrayBuffer\",\"${base64}\"]`;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'Temporal.Duration':\n\t\t\t\tcase 'Temporal.Instant':\n\t\t\t\tcase 'Temporal.PlainDate':\n\t\t\t\tcase 'Temporal.PlainTime':\n\t\t\t\tcase 'Temporal.PlainDateTime':\n\t\t\t\tcase 'Temporal.PlainMonthDay':\n\t\t\t\tcase 'Temporal.PlainYearMonth':\n\t\t\t\tcase 'Temporal.ZonedDateTime':\n\t\t\t\t\tstr = `[\"${type}\",${stringify_string(thing.toString())}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tif (!is_plain_object(thing)) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify arbitrary non-POJOs`,\n\t\t\t\t\t\t\tkeys,\n\t\t\t\t\t\t\tthing,\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (enumerable_symbols(thing).length > 0) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify POJOs with symbolic keys`,\n\t\t\t\t\t\t\tkeys,\n\t\t\t\t\t\t\tthing,\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Object.getPrototypeOf(thing) === null) {\n\t\t\t\t\t\tstr = '[\"null\"';\n\t\t\t\t\t\tfor (const key of Object.keys(thing)) {\n\t\t\t\t\t\t\tif (key === '__proto__') {\n\t\t\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t\t\t`Cannot stringify objects with __proto__ keys`,\n\t\t\t\t\t\t\t\t\tkeys,\n\t\t\t\t\t\t\t\t\tthing,\n\t\t\t\t\t\t\t\t\tvalue\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\tkeys.push(stringify_key(key));\n\t\t\t\t\t\t\tstr += `,${stringify_string(key)},${flatten(thing[key])}`;\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr += ']';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstr = '{';\n\t\t\t\t\t\tlet started = false;\n\t\t\t\t\t\tfor (const key of Object.keys(thing)) {\n\t\t\t\t\t\t\tif (key === '__proto__') {\n\t\t\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t\t\t`Cannot stringify objects with __proto__ keys`,\n\t\t\t\t\t\t\t\t\tkeys,\n\t\t\t\t\t\t\t\t\tthing,\n\t\t\t\t\t\t\t\t\tvalue\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\tif (started) str += ',';\n\t\t\t\t\t\t\tstarted = true;\n\t\t\t\t\t\t\tkeys.push(stringify_key(key));\n\t\t\t\t\t\t\tstr += `${stringify_string(key)}:${flatten(thing[key])}`;\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr += '}';\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tstringified[index] = str;\n\t\treturn index;\n\t}\n\n\tconst index = flatten(value);\n\n\t// special case \u2014\u00A0value is represented as a negative index\n\tif (index < 0) return `${index}`;\n\n\treturn `[${stringified.join(',')}]`;\n}\n\n/**\n * @param {any} thing\n * @returns {string}\n */\nfunction stringify_primitive(thing) {\n\tconst type = typeof thing;\n\tif (type === 'string') return stringify_string(thing);\n\tif (thing instanceof String) return stringify_string(thing.toString());\n\tif (thing === void 0) return UNDEFINED.toString();\n\tif (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO.toString();\n\tif (type === 'bigint') return `[\"BigInt\",\"${thing}\"]`;\n\treturn String(thing);\n}\n", "import type { ServerSafeWindow } from \"../global.d.ts\"\nimport { isWindow } from \"./utils.ts\"\n\nconst mockWindow: ServerSafeWindow = {\n\taddEventListener: () => {},\n\tremoveEventListener: () => {},\n\tdispatchEvent: () => false,\n\tResizeObserver: undefined,\n\tonpointerdown: false,\n\tonpointermove: false,\n\tonpointerup: false,\n\tontouchstart: false,\n\tontouchmove: false,\n\tontouchend: false,\n\tonmousedown: false,\n\tonmousemove: false,\n\tonmouseup: false,\n\tdevicePixelRatio: 1,\n\tscrollX: 0,\n\tscrollY: 0,\n\tlocation: {\n\t\thash: \"\",\n\t\thostname: \"\",\n\t\thref: \"\",\n\t\torigin: \"\",\n\t\tpathname: \"\",\n\t\tsearch: \"\",\n\t},\n\tdocument: {\n\t\tbaseURI: \"\",\n\t\tcookie: \"\",\n\t\treferrer: null,\n\t},\n\tsetTimeout: () => 0,\n\tclearTimeout: () => {},\n\tsetInterval: () => 0,\n\tclearInterval: () => {},\n\trequestAnimationFrame: () => 0,\n\tcancelAnimationFrame: () => {},\n\trequestIdleCallback: () => 0,\n\tgetSelection: () => null,\n\tmatchMedia: (query: string) => {\n\t\treturn {\n\t\t\tmatches: false,\n\t\t\tmedia: query,\n\t\t\tonchange: () => {},\n\t\t\taddEventListener: () => {},\n\t\t\tremoveEventListener: () => {},\n\t\t\taddListener: () => {},\n\t\t\tremoveListener: () => {},\n\t\t\tdispatchEvent: () => false,\n\t\t}\n\t},\n\tinnerHeight: 0,\n\tinnerWidth: 0,\n\tSVGSVGElement: {} as typeof SVGSVGElement,\n\tscheduler: undefined,\n\topen: function (\n\t\t_url?: string | URL | undefined,\n\t\t_target?: string | undefined,\n\t\t_features?: string | undefined,\n\t): void {},\n\t__framer_events: [],\n}\n\n/**\n * Creates a server-safe reference to `window`, returning a mock if none is available.\n *\n * @internal\n */\n// eslint-disable-next-line no-undef\nexport const safeWindow = !isWindow ? mockWindow : window\n", "import { safeWindow } from \"./safeWindow.ts\"\nimport { isString } from \"./utils.ts\"\n\n/**\n * Bump this when changing the schema of the pageview event or\n * any event that inherits from PageviewEventData.\n */\nexport const pageviewEventVersion = 2\n\nexport type PageviewEventData = {\n\t// Version of the event data\n\tversion: number\n\t// Framer specific properties\n\tabTestId: string | undefined\n\tframerSiteId: string | null\n\troutePath: string\n\tcollectionItemId: string | null\n\tframerLocale: string | null\n\twebPageId: string | null\n\t// Browser environment properties\n\treferrer: string | null\n\turl: string\n\thostname: string\n\tpathname: string\n\tsearch: string | null\n\thash: string | null\n\ttimezone: string | null\n\tlocale: string | null\n}\n\nexport type LinkClickEventData = PageviewEventData & {\n\tnodeId: string | null\n\thref: string | null\n\ttrackingId: string | null\n\ttargetRoutePath: string | null\n\ttargetCollectionItemId: string | null\n\ttargetWebPageId: string | null\n}\n\nexport type FormSubmitEventData = PageviewEventData & {\n\tnodeId: string | null\n\ttrackingId: string | null\n}\n\nexport type CustomEventData = PageviewEventData & {\n\tnodeId: string | null\n\ttrackingId: string | null\n}\n\nexport type TriggerInvokeEventData = PageviewEventData & {\n\tnodeId: string | null\n\ttrackingId: string | null\n}\n\ntype SiteLoadErrorEventData = {\n\tmessage: string\n\tstack?: string | null\n}\n\ntype SiteLoadRecoverableErrorEventData = {\n\tmessage: string\n\tstack?: string | null\n\tcomponentStack?: string | null\n}\n\ninterface EventData {\n\tpublished_site_click: LinkClickEventData\n\tpublished_site_pageview: PageviewEventData\n\tpublished_site_load_error: SiteLoadErrorEventData\n\tpublished_site_load_recoverable_error: SiteLoadRecoverableErrorEventData\n\tpublished_site_form_submit: FormSubmitEventData\n\tpublished_site_custom_event: CustomEventData\n\tpublished_site_trigger_invoke: TriggerInvokeEventData\n}\n\nexport function sendTrackingEvent<T extends keyof EventData>(\n\teventType: T,\n\teventData: EventData[T],\n\tsendOn: \"lazy\" | \"eager\" = \"lazy\",\n): void {\n\tsafeWindow.__framer_events?.push([eventType, eventData, sendOn])\n\n\tswitch (eventType) {\n\t\tcase \"published_site_click\": {\n\t\t\tconst { trackingId, href } = eventData as EventData[\"published_site_click\"]\n\t\t\tif (trackingId) {\n\t\t\t\tdocument.dispatchEvent(new CustomEvent(\"framer:click\", { detail: { trackingId, href } }))\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tcase \"published_site_form_submit\": {\n\t\t\tconst { trackingId } = eventData as EventData[\"published_site_form_submit\"]\n\t\t\tif (trackingId) {\n\t\t\t\tdocument.dispatchEvent(new CustomEvent(\"framer:formsubmit\", { detail: { trackingId } }))\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\t// NOTE: keep in sync with exportToHTML.ts, the initial pageview is sent from there\n\t\tcase \"published_site_pageview\": {\n\t\t\tconst { framerLocale } = eventData as EventData[\"published_site_pageview\"]\n\t\t\tdocument.dispatchEvent(new CustomEvent(\"framer:pageview\", { detail: { framerLocale } }))\n\t\t\tbreak\n\t\t}\n\t\tcase \"published_site_trigger_invoke\": {\n\t\t\tconst { trackingId } = eventData as EventData[\"published_site_trigger_invoke\"]\n\t\t\tif (trackingId) {\n\t\t\t\tdocument.dispatchEvent(new CustomEvent(\"framer:triggerinvoke\", { detail: { trackingId } }))\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n}\n\n// Tracking IDs must be lowercase alphanumeric with hyphens as separators only.\n// Empty string is allowed (converted to null trackingId when sent).\nconst validTrackingIdRegExp = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u\n\nexport function isValidTrackingId(trackingId: unknown): boolean {\n\treturn isString(trackingId) && (trackingId === \"\" || validTrackingIdRegExp.test(trackingId))\n}\n", "import { parse, stringify } from \"devalue\"\nimport { sendTrackingEvent } from \"../../utils/sendTrackingEvent.ts\"\nimport { getPleaseReportMessage, isWindow, requestIdleCallback } from \"../../utils/utils.ts\"\nimport type { SerializableQueryResult } from \"../cms/QueryEngine.ts\"\n\nexport const HandoverDataType = {\n\tQueryCache: 0,\n\tCollectionUtilsCache: 1,\n} as const\n\n/**\n * Supported types: https://github.com/rich-harris/devalue. Including cyclic references, Infinity, NaN, -0, undefined.\n */\ninterface HandoverTypes {\n\t[HandoverDataType.QueryCache]: SerializableQueryResult\n\t[HandoverDataType.CollectionUtilsCache]: string | undefined\n}\n\ntype HandoverDataTypeKey = keyof HandoverTypes\n\ntype HandoverPayload = {\n\t[K in HandoverDataTypeKey]: Map<string, HandoverTypes[K]>\n}\n\nlet hydratedData: HandoverPayload | undefined\n\nfunction createEmptyPayload(): HandoverPayload {\n\treturn {\n\t\t[HandoverDataType.QueryCache]: new Map(),\n\t\t[HandoverDataType.CollectionUtilsCache]: new Map(),\n\t}\n}\n\nfunction parseHandoverData(): HandoverPayload | undefined {\n\tif (\n\t\t!isWindow ||\n\t\t// some tests set window, but don't set document.\n\t\t(process.env.NODE_ENV === \"test\" && typeof document !== \"object\")\n\t) {\n\t\treturn\n\t}\n\n\tif (hydratedData !== undefined) return hydratedData\n\n\tlet script = document.getElementById(\"__framer__handoverData\") as HTMLScriptElement | null\n\tif (!script) return\n\n\ttry {\n\t\thydratedData = parse(script.text) ?? createEmptyPayload()\n\t} catch (error) {\n\t\thydratedData = createEmptyPayload()\n\t\t// biome-ignore lint/suspicious/noConsole: intentional warning for debugging hydration\n\t\tconsole.warn(\"Failed to parse handover data. Falling back to network.\", error)\n\t}\n\n\t// Free up memory.\n\trequestIdleCallback(() => {\n\t\tscript?.remove()\n\t\tscript = null\n\t})\n\n\treturn hydratedData\n}\n\nexport function handleHydrationError(error: unknown, key: string) {\n\t// biome-ignore lint/suspicious/noConsole: This is an actionable warning.\n\tconsole.warn(\n\t\tgetPleaseReportMessage(\n\t\t\t`Failed to resolve raw query result from DOM during hydration for: ${key}. This might make the page load slightly slower.`,\n\t\t),\n\t)\n\n\tconst sampleRate = Math.random()\n\n\t// 1% sample rate to avoid flooding the data pipeline\n\tif (sampleRate < 0.01) {\n\t\tconst stack = error instanceof Error && typeof error.stack === \"string\" ? error.stack : null\n\t\tsendTrackingEvent(\"published_site_load_error\", {\n\t\t\tmessage: String(error),\n\t\t\tstack,\n\t\t})\n\t}\n}\n\nexport function hasHandoverData<T extends HandoverDataTypeKey>(dataType: T, key: string): boolean {\n\tconst data = parseHandoverData()\n\tif (!data) return false\n\treturn data[dataType].has(key)\n}\n\n/**\n * Consumes `key` from `dataType` of handed over data.\n * Set `remove` to true if the you write handover data to another cache manager.\n *\n * The returned value is undefined if the key or dataType is not found, but also *can* be undefined if the value is actually undefined.\n * @see {@link hasHandoverData} to check if the key is present.\n */\nexport function getHandoverData<T extends HandoverDataTypeKey>(dataType: T, key: string): HandoverTypes[T] | undefined {\n\tconst data = parseHandoverData()\n\tif (!data) return\n\tconst map = data[dataType]\n\tif (!map.has(key)) return\n\n\tconst value = map.get(key)\n\tmap.delete(key)\n\treturn value\n}\n\nclass HandoverCollector {\n\tprivate payload: HandoverPayload = createEmptyPayload()\n\tprivate isEmpty = true\n\n\tset<T extends HandoverDataTypeKey>(dataType: T, key: string, value: HandoverTypes[T]) {\n\t\tthis.payload[dataType].set(key, value)\n\t\tthis.isEmpty = false\n\t}\n\n\thas<T extends HandoverDataTypeKey>(dataType: T, key: string): boolean {\n\t\treturn this.payload[dataType].has(key)\n\t}\n\n\tget<T extends HandoverDataTypeKey>(dataType: T, key: string): HandoverTypes[T] | undefined {\n\t\treturn this.payload[dataType].get(key)\n\t}\n\n\t/**\n\t * Serializes the handover data to a string safe to use inside `<script>` tags.\n\t */\n\ttoString(): string | undefined {\n\t\tif (this.isEmpty) return undefined\n\t\ttry {\n\t\t\treturn stringify(this.payload)\n\t\t} catch (error) {\n\t\t\t// biome-ignore lint/suspicious/noConsole: Handover is an optimization, so if it fails, it's not the end of the world.\n\t\t\tconsole.error(\"Failed to serialize handover data.\", error)\n\t\t\treturn undefined\n\t\t}\n\t}\n\n\tclear() {\n\t\tfor (const map of Object.values(this.payload)) {\n\t\t\tmap.clear()\n\t\t}\n\t\tthis.isEmpty = true\n\t}\n}\n\nexport const handoverCollector = /* @__PURE__ */ (() => (isWindow ? undefined : new HandoverCollector()))()\n\nexport const testing = {\n\tsetData(data: typeof hydratedData) {\n\t\thydratedData = data\n\t},\n\tHandoverCollector,\n}\n", "import { frame } from \"framer-motion\"\nimport { safeWindow } from \"./safeWindow.ts\"\nimport { noop } from \"./utils.ts\"\n\ninterface SchedulerOptions {\n\t/**\n\t * 'user-blocking' will resolve within a microtask in older browsers.\n\t * @see https://www.notion.so/framer/All-things-performance-of-Sites-1bbadf6e8c9680768a4ff2aa05f93c0a#1bbadf6e8c968089a1cafabd7d49c7de for examples for each priority.\n\t */\n\tpriority?: \"user-blocking\" | \"user-visible\" | \"background\"\n\tsignal?: AbortSignal\n}\n\nconst canUseYield = /* @__PURE__ */ (() => safeWindow.scheduler && \"yield\" in safeWindow.scheduler)()\nconst canUsePostTask = /* @__PURE__ */ (() => safeWindow.scheduler && \"postTask\" in safeWindow.scheduler)()\n\n/** A set to keep track of all unresolved yield promises */\nconst pendingResolvers = new Set<VoidFunction>()\n\n/** Resolves all unresolved yield promises and clears the set. */\nfunction resolvePendingPromises() {\n\tfor (const resolve of pendingResolvers) resolve()\n\tpendingResolvers.clear()\n}\n\n/**\n * Returns a promise that, if the document is visible, will resolve _earliest_ after the next paint.\n * If the document is not visible or the tab becomes hidden, the promise is resolved immediately.\n *\n * \u201Cunless urgent\u201D: If the document changes to hidden prior to the promise resolving,\n * we assume it\u2019s about to be closed, so we resolve the promise synchronously (\"urgently\").\n * This gives it a chance to complete its work before the document is destroyed.\n * (We also resolve immediately if the document is already hidden, but that\u2019s simply\n * because when the document is backgrounded, there\u2019s no chance of INP events.)\n *\n * Modified from Philip Walton's original snippet.\n * See also https://kurtextrem.de/posts/improve-inp#exit-event-handlers-yieldunlessurgent\n */\nfunction yieldUnlessUrgent(options?: SchedulerOptions): Promise<void> {\n\treturn new Promise<void>(resolve => {\n\t\tpendingResolvers.add(resolve)\n\t\tif (document.hidden) {\n\t\t\t// Page is hidden, let's resolve all promises immediately\n\t\t\tresolvePendingPromises()\n\t\t\treturn\n\t\t}\n\n\t\t// visibilitychange + pagehide is needed to reliably (\u00B197%) detect when the page is hidden cross-browser\n\t\t// see https://nicj.net/beaconing-in-practice-fetchlater/#beaconing-in-practice-fetchlater-onload-or-pagehide-or-visibilitychange\n\t\t// (note: as we pass the same listener fn every time, the listener is only ever added once)\n\t\tdocument.addEventListener(\"visibilitychange\", resolvePendingPromises)\n\t\tdocument.addEventListener(\"pagehide\", resolvePendingPromises)\n\n\t\t// await-interaction-response without a setTimeout fallback, as the fallbacks are the event listeners above\n\t\tframe.read(() => {\n\t\t\tconst resolveFn = () => {\n\t\t\t\tpendingResolvers.delete(resolve)\n\n\t\t\t\tif (options?.signal?.aborted) return\n\t\t\t\tresolve()\n\t\t\t}\n\n\t\t\tvoid schedulerYield(options).then(resolveFn)\n\t\t})\n\t\treturn\n\t})\n}\n\n/**\n * Similar to `yieldToMain`, but waits for the next paint before resolving (with a fallback of 100ms if the animation frame never fires).\n * Compared to `yieldToMain`, it guarantees improved INP, but might make processing a little slower. Use only if necessary.\n * @see yieldToMain\n */\nfunction interactionResponse(options?: SchedulerOptions): Promise<void> {\n\treturn new Promise<void>(resolve => {\n\t\tsetTimeout(resolve, 100) // Fallback for the case where the animation frame never fires.\n\t\tframe.read(\n\t\t\t() => {\n\t\t\t\tvoid schedulerYield(options).then(resolve)\n\t\t\t},\n\t\t\tfalse,\n\t\t\t// In some cases, interactionResponse might be called in a rAF. This means, we should right away call `schedulerYield`, as the next paint follows immediately.\n\t\t\ttrue,\n\t\t)\n\t})\n}\n\nfunction schedulerYield(options?: SchedulerOptions): Promise<void> {\n\tconst priority = options?.priority\n\tconst canUseModernAPI = canUseYield || canUsePostTask\n\tif (!canUseModernAPI) {\n\t\t// Resolve synchronously if we can't use the modern APIs for user-blocking tasks\n\t\tif (priority === \"user-blocking\") {\n\t\t\t// `setTimeout` could suffer from being delayed for longer: https://developer.chrome.com/blog/introducing-scheduler-yield-origin-trial#the_problem_with_current_yielding_strategies\n\t\t\t// so for browsers not supporting yield, we guarantee execution for high priority actions, but this does not create space for a paint opportunity as trade-off.\n\t\t\t// We use a microtask to ensure we don't start relying on sync behaviors somewhere.\n\t\t\treturn Promise.resolve()\n\t\t}\n\n\t\treturn new Promise<void>(resolve => {\n\t\t\tsetTimeout(resolve, priority === \"background\" ? 1 : 0)\n\t\t})\n\t}\n\n\tif (priority === \"background\") {\n\t\t// If it isn't important, we can use a timeout with lowest prio (delay=1) instead.\n\t\treturn new Promise<void>(resolve => {\n\t\t\tsetTimeout(resolve, 1)\n\t\t})\n\t}\n\n\tif (canUseYield) {\n\t\t// biome-ignore lint/style/noNonNullAssertion: we know it exists at this point\n\t\treturn safeWindow.scheduler!.yield!(options).catch(noop)\n\t}\n\n\t// biome-ignore lint/style/noNonNullAssertion: we know it exists at this point\n\treturn safeWindow.scheduler!.postTask!(() => {}, options).catch(noop)\n}\n\nexport type YieldOptions = SchedulerOptions &\n\t(\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * @see `yield` \u2014 {@link yieldToMain} yield to the main thread before continuing execution (scheduler.yield/postTask/setTimeout).\n\t\t\t\t * @see `paint` \u2014 {@link interactionResponse} awaits the next paint and then yields before continuing execution.\n\t\t\t\t *\n\t\t\t\t * See also https://kurtextrem.de/posts/improve-inp.\n\t\t\t\t */\n\t\t\t\tcontinueAfter?: \"yield\" | \"paint\"\n\t\t\t\tensureContinueBeforeUnload?: false\n\t\t  }\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * If true, the promise is guaranteed to resolve right before the user closes the tab and runs earliest after the next paint.\n\t\t\t\t * @see {@link yieldUnlessUrgent} - https://kurtextrem.de/posts/improve-inp#exit-event-handlers-yieldunlessurgent\n\t\t\t\t */\n\t\t\t\tensureContinueBeforeUnload: true\n\t\t\t\tcontinueAfter: \"paint\"\n\t\t  }\n\t)\n\n/**\n * Yields to main thread before continuing execution.\n *\n * Options:\n * @param options.priority {@link YieldOptions.priority}: if not set, might implicitly inherit the priority, see [spec](https://github.com/WICG/scheduling-apis/blob/main/explainers/yield-and-continuation.md#:~:text=highest%20scheduler%20priority.-,scheduler.yield(),-If%20a%20priority).\n * @param options.continueAfter {@link YieldOptions.continueAfter} `\"yield\"` is the default. `\"paint\"` guarantees continuation only happens after the next paint.\n * @param options.ensureContinueBeforeUnload {@link YieldOptions.ensureContinueBeforeUnload} ensures the promise is resolved right before the user closes the tab if it hasn't resolved before.\n *\n * Note: If `ensureContinueBeforeUnload: true` is passed, you must set `continueAfter: \"paint\"`, as this is the only supported combination currently.\n *\n * @usage `options.continueAfter: \"paint\"` for user interaction handlers (like `onTap`, `onClick`, etc.) to keep INP low.\n * @usage `options.ensureContinueBeforeUnload: true` for code that should execute eventually (analytics, storing form data, etc.).\n */\nexport function yieldToMain(options?: YieldOptions): Promise<void> {\n\tconst { continueAfter, ensureContinueBeforeUnload, ...schedulerOptions } = options ?? {}\n\tif (ensureContinueBeforeUnload) {\n\t\treturn yieldUnlessUrgent(schedulerOptions)\n\t}\n\n\tif (continueAfter === \"paint\") {\n\t\treturn interactionResponse(schedulerOptions)\n\t}\n\n\treturn schedulerYield(schedulerOptions)\n}\n", "import type { MutableRefObject } from \"react\"\nimport { useCallback, useEffect, useLayoutEffect, useRef } from \"react\"\nimport { useCollectionUtils } from \"../modules/cms/CollectionUtilsCache.tsx\"\nimport { sendTrackingEvent } from \"../utils/sendTrackingEvent.ts\"\nimport { isObject, isString, isWindow } from \"../utils/utils.ts\"\nimport { computeRelativePath } from \"./computeRelativePath.ts\"\nimport { customNotFoundPagePaths } from \"./customNotFoundPagePaths.ts\"\nimport { fillPathVariables } from \"./fillPathVariables.ts\"\nimport { forwardCurrentQueryParams } from \"./forwardQueryParams.ts\"\nimport type { GetNavigationPathOptions } from \"./getLocalizedNavigationPath.ts\"\nimport { getLocalizedNavigationPath } from \"./getLocalizedNavigationPath.ts\"\nimport { getSitePrefix } from \"./getSitePrefix.ts\"\nimport { useViewTransition } from \"./pageEffects/useViewTransition.ts\"\nimport { pathVariablesRegExpGlobal } from \"./pathVariables.ts\"\nimport { announceNavigation, updateCanonicalURL } from \"./routerDomUtils.ts\"\nimport type {\n\tLocale,\n\tLocaleId,\n\tNavigationPerformanceDetail,\n\tPaginationInfo,\n\tRoute,\n\tRouteId,\n\tSetCurrentRouteId,\n\tUpdateURL,\n} from \"./types.ts\"\nimport { useMonitorNextPaintAfterRender } from \"./useMonitorNextPaintAfterRender.ts\"\nimport { getRouteElementId, monitorINPRelatedInputs } from \"./utils.ts\"\n\nexport async function pushRouteState(\n\trouteId: RouteId,\n\troute: Route,\n\t{\n\t\tcurrentRoutePath,\n\t\tcurrentRoutePathLocalized,\n\t\tcurrentPathVariables,\n\t\thash,\n\t\tpathVariables,\n\t\tlocaleId,\n\t\tpreserveQueryParams,\n\t\tsiteCanonicalURL,\n\t}: RoutePathOptions,\n\tisNavigationTransition = false,\n): ReturnType<UpdateURL> {\n\tconst { path } = route\n\tif (!path) return\n\n\t// Use a relative path if possible, because the site might be served\n\t// at a sub-path, e.g.:\n\t// - site served at www.framer.com/sites/my-site/\n\t// - current URL: www.framer.com/sites/my-site/one\n\t// - pushing /two would result in www.framer.com/two\n\t// - computing a relative path \"./two\" and pushing that works better\n\tconst newPath = getPathForRoute(route, {\n\t\tcurrentRoutePath,\n\t\tcurrentRoutePathLocalized,\n\t\tcurrentPathVariables,\n\t\thash,\n\t\tpathVariables,\n\t\tpreserveQueryParams,\n\t\tsiteCanonicalURL,\n\t\tlocaleId,\n\t})\n\n\t// When navigating between two items of the same dynamic route, `getPathForRoute` preserves\n\t// active filter params in the new URL. The `queryParamBackAnchorSearch` field tracks the\n\t// pre-filter search and is what `forwardCurrentQueryParams` uses to know which params are\n\t// \"filter params\" and should be stripped on cross-route navigation. If we drop it here, a\n\t// later cross-route link click from the new entry would forward the full filter query to\n\t// unrelated routes.\n\tconst isSameRouteNavigation = currentRoutePath !== undefined && currentRoutePath === path\n\tconst previousState = isHistoryState(window.history.state) ? window.history.state : undefined\n\tconst queryParamBackAnchorSearch = isSameRouteNavigation ? previousState?.queryParamBackAnchorSearch : undefined\n\n\ttry {\n\t\treturn await pushHistoryState(\n\t\t\t{ routeId, hash, pathVariables, localeId, queryParamBackAnchorSearch },\n\t\t\tnewPath,\n\t\t\tisNavigationTransition,\n\t\t)\n\t} catch {\n\t\t// pushState can throw on null origins, e.g., when browsing\n\t\t// an exported prototype on file://, or in sandboxed iframes\n\t}\n}\n\nexport interface HistoryState {\n\trouteId: RouteId\n\thash?: string\n\tpathVariables?: Record<string, unknown>\n\tlocaleId?: LocaleId\n\t/** The search string before the first filter push, used to detect when all filters are cleared. */\n\tqueryParamBackAnchorSearch?: string\n\tpaginationInfo?: {\n\t\t[hash: string]: PaginationInfo\n\t}\n}\n\nexport function isHistoryState(data: unknown): data is HistoryState {\n\tconst routeIdKey: keyof HistoryState = \"routeId\"\n\treturn isObject(data) && isString(data[routeIdKey])\n}\n\nexport function replaceHistoryState(data: HistoryState, url?: string, ignoreReplaceStateWrapper = false): void {\n\tperformance.mark(\"framer-history-replace\")\n\n\tif (url) {\n\t\tupdateCanonicalURL(url, window.location.href)\n\t}\n\n\t// @ts-expect-error -- we walk the prototype chain to skip any proxies/wrappers on replaceState.\n\tconst replaceState = ignoreReplaceStateWrapper ? window.history.__proto__.replaceState : window.history.replaceState\n\treplaceState.call(window.history, data, \"\", url)\n}\n\nlet maybeHasPopstateBug = true\nconst isImpactedPopstateBugChromiumVersion = /* #__PURE__ */ (() => {\n\tif (typeof navigator === \"undefined\") return false\n\t// we can't use `navigator.userAgentData` here since some default Edge settings will just return an empty object.\n\tconst userAgent = navigator.userAgent\n\tconst chromePos = userAgent.indexOf(\"Chrome/\")\n\tconst chromiumVersion = +userAgent.slice(chromePos + 7, userAgent.indexOf(\".\", chromePos)) // 'Chrome'.length = 7, so we extract what follows 'Chrome/' in the user agent str before the next dot\n\t// In Chromium < 128, `intercept()` triggers `popstate`. Fixed in Chromium 128, so only Chromium versions 102-127 are affected (supports navigation API & has the popstate bug)\n\t// see https://issues.chromium.org/issues/352436133\n\treturn chromiumVersion > 101 && chromiumVersion < 128\n})()\n\n/**\n * Pushes a new history state to the browser's history after yielding to the main thread.\n * If it's important that the URL state is updated before re-rendering UI, use `await pushHistoryState(...)`\n * If not, use `void pushHistoryState(...)` so that the history state update is done asynchronously.\n *\n * @param isNavigationTransition - Set this if this pushState is part of a Navigation API transition, i.e., one where we want to show the native loading spinner. Navigation transitions in Chrome < 128 incorrectly trigger popstate handlers, which can cause duplicate tracking events if a tracking library is hooking into both popstate and pushState. With this flag set, we'll apply a mitigation to make sure only one of those gets called.\n */\nexport async function pushHistoryState(\n\tdata: HistoryState,\n\turl: string,\n\tisNavigationTransition = false,\n): ReturnType<UpdateURL> {\n\tperformance.mark(\"framer-history-push\")\n\n\t// needed so that browsers use the correct URL for the share sheet - https://github.com/framer/company/issues/29317\n\tupdateCanonicalURL(url, window.location.href)\n\n\tif (!isNavigationTransition) {\n\t\t// if it's not part of a transition, it means we never call `intercept()`, so we don't have to account for the chromium bug mentioned below\n\t\twindow.history.pushState(data, \"\", url)\n\t\treturn\n\t}\n\n\t// we rely on the event / error log *if* another browser happens to implement the same bug at some point\n\t// but if we know the browser doesn't have this behavior, we can just skip the check on the next invocation\n\tlet popstateCalled = false,\n\t\tpopstateListener: Parameters<typeof window.addEventListener>[1]\n\tif (maybeHasPopstateBug) {\n\t\tpopstateListener = () => {\n\t\t\tpopstateCalled = true\n\n\t\t\tif (isImpactedPopstateBugChromiumVersion) return\n\n\t\t\t// This is a safe-guard if another browser vendor happens to 'implement' the same bug at some point.\n\t\t\tconst msg = \"Popstate called after intercept(). Please report this to the Framer team.\"\n\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\tconsole.error(msg)\n\t\t\tsendTrackingEvent(\"published_site_load_recoverable_error\", {\n\t\t\t\tmessage: msg,\n\t\t\t})\n\t\t}\n\t\twindow.addEventListener(\"popstate\", popstateListener, { once: true })\n\t}\n\n\tif (isImpactedPopstateBugChromiumVersion && maybeHasPopstateBug) {\n\t\t// @ts-expect-error -- we walk the prototype chain to skip any proxies/wrappers on pushState, which avoids duplicate tracking calls, as the call of the `popstate` event triggers tracking calls\n\t\twindow.history.__proto__.pushState.call(window.history, data, \"\", url)\n\t} else {\n\t\twindow.history.pushState(data, \"\", url)\n\t}\n\n\tif (maybeHasPopstateBug) {\n\t\tqueueMicrotask(() => {\n\t\t\tif (popstateCalled) return\n\n\t\t\tmaybeHasPopstateBug = false\n\t\t\twindow.removeEventListener(\"popstate\", popstateListener)\n\t\t\treturn\n\t\t})\n\t}\n}\n\nexport function useReplaceInitialState({\n\tdisabled,\n\trouteId,\n\tinitialPathVariables,\n\tinitialLocaleId,\n}: {\n\tdisabled?: boolean\n\trouteId: RouteId\n\tinitialPathVariables?: Record<string, unknown>\n\tinitialLocaleId?: LocaleId\n}) {\n\t// we need to use layout effect here to ensure that the initial state is set before any other state changes happen.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: We explicitly want this to only happen once on load, because we should not touch the history state afterwards\n\tuseLayoutEffect(() => {\n\t\tif (disabled) return\n\n\t\tperformance.mark(\"framer-history-set-initial-state\")\n\t\tconst currentState = isObject(window.history.state) ? window.history.state : {}\n\t\tconst initialHash = window.location.hash ? window.location.hash.slice(1) : undefined\n\t\t// Make sure the initial route is set correctly. history.replaceState\n\t\t// can only throw if the `url` parameter is set, so no try/catch needed here\n\t\treplaceHistoryState(\n\t\t\t{\n\t\t\t\t...currentState,\n\t\t\t\trouteId,\n\t\t\t\thash: initialHash,\n\t\t\t\tpathVariables: initialPathVariables,\n\t\t\t\tlocaleId: initialLocaleId,\n\t\t\t},\n\t\t\tundefined,\n\t\t\ttrue,\n\t\t)\n\t}, [])\n}\n\n// \"navigation\" is a name that might be used by custom code or element IDs\n// so to be safe we check for the existence of the `back` function (which is part of the Navigation API and has the shortest name)\n// This check doesn't prevent people from breaking the Navigation API by overriding the global `window.navigation` object,\n// but it prevents errors from `<div id=\"navigation\">` elements.\n// As the Navigation API is only used for progressive enhancement, that's ok.\nconst supportsNavigationAPI = /* #__PURE__ */ (() => isWindow && typeof window.navigation?.back === \"function\")()\n\nexport function usePopStateHandler(currentRouteId: MutableRefObject<RouteId>, setCurrentRouteId: SetCurrentRouteId) {\n\tconst startViewTransition = useViewTransition()\n\tconst monitorNextPaintAfterRender = useMonitorNextPaintAfterRender<NavigationPerformanceDetail>(\"framer-route-change\")\n\n\tconst viewTransitionReady = useRef<{ resolve: VoidFunction; reject: VoidFunction } | undefined>(undefined)\n\n\tconst popStateHandler = useCallback(\n\t\tasync ({ state }: PopStateEvent) => {\n\t\t\t// popstate can be triggered after `pushState` due to a chromium bug: https://issues.chromium.org/issues/352436133\n\t\t\t// so we we should ignore if it's not a traverse action, where popstate fires after `intercept`.\n\t\t\tif (window.navigation?.transition && window.navigation?.transition?.navigationType !== \"traverse\") return\n\n\t\t\tif (!isObject(state)) return\n\t\t\tconst { routeId, hash, pathVariables, localeId } = state\n\t\t\tif (!isString(routeId)) return\n\n\t\t\t// ! Always keep the following lines first after the checks above:\n\t\t\tconst nextRender = monitorNextPaintAfterRender({\n\t\t\t\tpopstate: true,\n\t\t\t})\n\t\t\tconst stopMonitoringINPRelatedInputs = monitorINPRelatedInputs()\n\t\t\tvoid nextRender.promise.finally(stopMonitoringINPRelatedInputs)\n\n\t\t\tconst changeRoute = () => {\n\t\t\t\tsetCurrentRouteId(\n\t\t\t\t\trouteId,\n\t\t\t\t\tisString(localeId) ? localeId : undefined,\n\t\t\t\t\tisString(hash) ? hash : undefined,\n\t\t\t\t\twindow.location.pathname + window.location.search + window.location.hash,\n\t\t\t\t\tisObject(pathVariables) ? pathVariables : undefined,\n\t\t\t\t\ttrue,\n\t\t\t\t\tnextRender,\n\t\t\t\t\tfalse,\n\t\t\t\t)\n\t\t\t}\n\t\t\t// </!>\n\n\t\t\tconst viewTransition = await startViewTransition(currentRouteId.current, routeId, changeRoute)\n\t\t\tconst navigationTransition = window.navigation?.transition\n\n\t\t\t// If there's no page effect for this transition, we need\n\t\t\t// to immediately resolve the promise that is awaited in\n\t\t\t// the intercept handler for navigation events, otherwise\n\t\t\t// the page will show an infinite loading spinner!\n\t\t\tawait (viewTransition?.updateCallbackDone ?? Promise.resolve())\n\t\t\t\t.then(viewTransitionReady.current?.resolve)\n\t\t\t\t.catch(viewTransitionReady.current?.reject)\n\n\t\t\t// Await navigation to finish to make sure the navigation is complete before triggering side-effects\n\t\t\t// This avoids race conditions in Edge et al. where the announcement happens milliseconds\n\t\t\t// before the loading spinner disappears, and the screen reader reads \u201CLoading complete\u201D\n\t\t\t// instead of the announcement\n\t\t\tawait nextRender.promise\n\t\t\ttry {\n\t\t\t\tawait navigationTransition?.finished\n\t\t\t} catch (error: unknown) {\n\t\t\t\t// One known way this can reject is when the network is down.\n\t\t\t\t// Network down is not an issue on popstate, so we keep it a warning.\n\t\t\t\t// biome-ignore lint/suspicious/noConsole:\n\t\t\t\tconsole.warn(\"Popstate transition failed\", error)\n\t\t\t}\n\n\t\t\tannounceNavigation()\n\t\t\tupdateCanonicalURL(window.location.href)\n\t\t},\n\t\t[currentRouteId, monitorNextPaintAfterRender, setCurrentRouteId, startViewTransition],\n\t)\n\n\t// Intercept traversals via the Navigation API. If there's a view transition currently\n\t// being prepared (established via the popstate handler) we want to wait to restore\n\t// the popped state's scroll position until after the page has been updated.\n\t// Arguably the behaviour this is fixing is a bug https://bugs.chromium.org/p/chromium/issues/detail?id=1504749#c4\n\t// and may be fixed in the future.\n\tconst traversalHandler = useCallback((event: NavigationEventMap[\"navigate\"]) => {\n\t\tif (event.navigationType !== \"traverse\" || !event.canIntercept) return\n\n\t\tevent.intercept({\n\t\t\tasync handler() {\n\t\t\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\t\t\tviewTransitionReady.current = { resolve, reject }\n\t\t\t\t})\n\t\t\t\tviewTransitionReady.current = undefined\n\t\t\t},\n\t\t\tscroll: \"after-transition\",\n\t\t})\n\t}, [])\n\n\tuseEffect(() => {\n\t\twindow.addEventListener(\"popstate\", popStateHandler)\n\t\tif (supportsNavigationAPI) window.navigation.addEventListener(\"navigate\", traversalHandler)\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"popstate\", popStateHandler)\n\t\t\tif (supportsNavigationAPI) window.navigation.removeEventListener(\"navigate\", traversalHandler)\n\t\t}\n\t}, [popStateHandler, traversalHandler])\n}\n\ninterface RoutePathOptions {\n\tcurrentRoutePath: string | undefined\n\tcurrentRoutePathLocalized?: Record<string, string>\n\tcurrentPathVariables: Record<string, unknown> | undefined\n\thash?: string\n\tpathVariables?: Record<string, unknown>\n\thashVariables?: Record<string, unknown>\n\trelative?: boolean\n\tlocaleId?: string\n\tpreserveQueryParams: boolean | undefined\n\t/**\n\t * Resolve and return only the hash part of the link, useful when getting\n\t * the value of an element id.\n\t */\n\tonlyHash?: boolean\n\tsiteCanonicalURL: string | undefined\n}\n\nexport function getHashForRoute(\n\thash: string | undefined,\n\troute: Route | undefined,\n\thashVariables?: Record<string, unknown>,\n) {\n\tconst resolvedHash = getRouteElementId(route, hash)\n\tif (!resolvedHash) return undefined\n\tconst variables = Object.assign({}, route?.elements, hashVariables)\n\treturn resolvedHash.replace(pathVariablesRegExpGlobal, (m, p1) => variables[p1] ?? m)\n}\n\nexport function getPathForRoute(\n\troute: Route | undefined,\n\t{\n\t\tcurrentRoutePath,\n\t\tcurrentRoutePathLocalized,\n\t\tcurrentPathVariables,\n\t\thash,\n\t\tpathVariables,\n\t\thashVariables,\n\t\trelative = true,\n\t\tpreserveQueryParams,\n\t\tonlyHash = false,\n\t\tsiteCanonicalURL,\n\t\tlocaleId,\n\t}: RoutePathOptions,\n): string {\n\tconst resolvedHash = getHashForRoute(hash, route, hashVariables)\n\tif (onlyHash) return resolvedHash ?? \"\"\n\n\tlet currentPath = currentRoutePath ?? \"/\"\n\tif (currentRoutePathLocalized && localeId) {\n\t\tcurrentPath = currentRoutePathLocalized[localeId] ?? currentPath\n\t}\n\tif (currentPathVariables) {\n\t\tcurrentPath = currentPath.replace(pathVariablesRegExpGlobal, (m, p1) => String(currentPathVariables[p1] || m))\n\t}\n\n\tconst targetPathLocalized = localeId ? route?.pathLocalized?.[localeId] : undefined\n\tconst targetPath = targetPathLocalized ?? route?.path ?? \"/\"\n\n\tlet path = targetPath\n\tif (pathVariables) {\n\t\tpath = path.replace(pathVariablesRegExpGlobal, (m, p1) => String(pathVariables[p1] || m))\n\t}\n\n\tconst isSamePageHashNavigation = Boolean(currentPath === path && resolvedHash)\n\t// Navigating between different items of the same dynamic route \u2014 e.g. clicking a\n\t// \"next item\" link between CMS detail pages of `/blog/[slug]`. We compare the path\n\t// templates so the URL still keeps any active dynamic filter params; without this\n\t// the filter widgets would stay applied locally while the URL has dropped the params,\n\t// resulting in a desync that is also un-shareable.\n\tconst isSameDynamicRouteNavigation =\n\t\t!isSamePageHashNavigation &&\n\t\tpathVariables !== undefined &&\n\t\tcurrentRoutePath !== undefined &&\n\t\troute?.path !== undefined &&\n\t\tcurrentRoutePath === route.path &&\n\t\tcurrentPath !== path\n\n\tif (relative) {\n\t\tif (customNotFoundPagePaths.has(currentPath) && typeof window !== \"undefined\") {\n\t\t\t// Relative navigations from a 404 page need special treatment, because currentPath is /404 (or similar),\n\t\t\t// but in reality the 404 page can be served from anywhere, e.g., /doesnt/exist. Under normal circumstances,\n\t\t\t// this would lead to an incorrect relative path, e.g., going from /404 to /about = ./about, but if the\n\t\t\t// actual path is /doesnt/exist, then we end up at /doesnt/about.\n\t\t\t//\n\t\t\t// One of the reasons we don't use window.location.pathname by default is to correctly navigate on sites\n\t\t\t// hosted at a prefix, so let's make our best effort to retain that.\n\t\t\t//\n\t\t\t// Note that the the `typeof window !== \"undefined\"` check means we have a divergent behavior between the\n\t\t\t// server and the client. To alleviate that, we have fixRelativeLinks.ts, which will converge them on load.\n\t\t\tconst sitePrefix = getSitePrefix(siteCanonicalURL)\n\t\t\tpath = computeRelativePath(window.location.pathname, sitePrefix + path)\n\t\t} else {\n\t\t\tpath = computeRelativePath(currentPath, path)\n\t\t}\n\t}\n\n\t// Navigating to a scroll section on the same page should always retain query params, and so\n\t// should navigation between different items of the same dynamic route.\n\tconst ignoreBackAnchor = isSamePageHashNavigation || isSameDynamicRouteNavigation\n\tif (preserveQueryParams || ignoreBackAnchor) {\n\t\tpath = forwardCurrentQueryParams(path, ignoreBackAnchor)\n\t}\n\t// Append the hash *after* the query params.\n\tif (resolvedHash) {\n\t\tpath = `${path}#${resolvedHash}`\n\t}\n\n\treturn path\n}\n\n/**\n * If a slug is missing when switching locales it could be this item is hidden\n * in said locale. Customers can add redirects for these paths to redirect to\n * other pages, but redirects are client side only. We check if such a redirect\n * exists and if so we do a full page reload to the next page instead of client\n * side navigation.\n */\nasync function handleRedirectForMissingSlugs(\n\troute: Route,\n\tpathVariables: Record<string, unknown> | undefined,\n\tnextLocale: Locale,\n): Promise<boolean> {\n\tif (!route.path) return false\n\tif (!pathVariables) return false\n\n\tconst prefix = nextLocale.slug ? `/${nextLocale.slug}` : \"\"\n\tconst nextLocaleWithDefaultSlugPath = `${prefix}${fillPathVariables(route.path, pathVariables)}`\n\n\tconst response = await fetch(nextLocaleWithDefaultSlugPath, {\n\t\tmethod: \"HEAD\",\n\t\tredirect: \"manual\",\n\t})\n\n\tconst isRedirect = response.type === \"opaqueredirect\"\n\tif (isRedirect) {\n\t\twindow.location.href = window.location.origin + nextLocaleWithDefaultSlugPath\n\t\treturn true\n\t}\n\n\treturn false\n}\n\nexport function useSwitchLocale() {\n\tconst collectionUtils = useCollectionUtils()\n\treturn useCallback(\n\t\t(options: Omit<GetNavigationPathOptions, \"collectionUtils\">) => {\n\t\t\treturn switchLocale({ ...options, collectionUtils })\n\t\t},\n\t\t[collectionUtils],\n\t)\n}\n\nexport async function switchLocale(options: GetNavigationPathOptions) {\n\tconst result = await getLocalizedNavigationPath(options)\n\tif (!result) return\n\n\ttry {\n\t\tlocalStorage.preferredLocale = options.nextLocale.code\n\t} catch {\n\t\t// Failing to set this is ok, we just won't be able to auto-redirect the user on future\n\t\t// visits if the site has \"Automatic Locale\" enabled.\n\t}\n\n\ttry {\n\t\tif (!isString(result.path)) {\n\t\t\tthrow new Error(\"Expected result.path to be a string\")\n\t\t}\n\n\t\tif (result.isMissingInLocale) {\n\t\t\tconst hasRedirect = await handleRedirectForMissingSlugs(options.route, result.pathVariables, options.nextLocale)\n\n\t\t\tif (hasRedirect) return\n\t\t}\n\t} catch {\n\t\t// pushState can throw on null origins, e.g., when browsing\n\t\t// an exported prototype on file://, or in sandboxed iframes\n\t}\n\n\treturn result\n}\n\nexport function pushLoadMoreHistory(hash: string, paginationInfo: PaginationInfo) {\n\ttry {\n\t\tconst currentHistoryState: HistoryState = window.history.state\n\t\tif (!isHistoryState(currentHistoryState)) return\n\n\t\t// if we don't have the paginationInfo for this hash, it means this is the initial load after a navigation.\n\t\t// thus, we want to skip any replaceState wrappers to avoid repeated GTM page views.\n\t\t// see https://framer-team.slack.com/archives/C01B14R6E22/p1720777938284699?thread_ts=1720519780.513099&cid=C01B14R6E22\n\t\tconst isInitialLoad =\n\t\t\tcurrentHistoryState?.paginationInfo === undefined || currentHistoryState.paginationInfo[hash] === undefined\n\n\t\tconst newPaginationInfo = { ...currentHistoryState.paginationInfo, [hash]: paginationInfo }\n\t\treplaceHistoryState({ ...currentHistoryState, paginationInfo: newPaginationInfo }, undefined, isInitialLoad)\n\t} catch {\n\t\t// pushState can throw on null origins, e.g., when browsing\n\t\t// an exported prototype on file://, or in sandboxed iframes\n\t}\n}\n\n/**\n * Starts a native loading spinner that stops when `promise` resolves or if aborted.\n */\nexport function useNativeLoadingSpinner(): (\n\tpromise: Promise<void>,\n\tupdateURL: (isNavigationTransition?: boolean) => ReturnType<UpdateURL>,\n\tcontroller?: AbortController,\n) => void {\n\tconst navigationPromise = useRef<Promise<void>>(Promise.resolve())\n\tconst navigationController = useRef<AbortController>()\n\n\tconst navigateListener = useCallback((navigateEvent: NavigateEvent) => {\n\t\t// we don't want to intercept browser back/forward navigation here (as it's handled by the popstate handler)\n\t\tif (navigateEvent.navigationType === \"traverse\" || !navigateEvent.canIntercept) return\n\n\t\tconst controller = navigationController.current\n\t\tcontroller?.signal.addEventListener(\"abort\", () => {\n\t\t\tcontroller.abort(\"user aborted\")\n\t\t})\n\n\t\tnavigateEvent.intercept({\n\t\t\thandler: () => navigationPromise.current,\n\t\t})\n\t}, [])\n\n\treturn useCallback(\n\t\t(promise, updateURL, controller) => {\n\t\t\tif (!supportsNavigationAPI) {\n\t\t\t\tvoid updateURL()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tnavigationPromise.current = promise\n\t\t\tnavigationController.current = controller\n\t\t\twindow.navigation.addEventListener(\"navigate\", navigateListener)\n\n\t\t\t// Due to a Chromium bug in < v128, `intercept()` triggers `popstate`, see https://issues.chromium.org/issues/352436133.\n\t\t\t// As GTM tacks page views based on `pushState` wrappers and `popstate` events,\n\t\t\t// we want to use the proto chain here, so we avoid triggering the `pushstate` wrapper.\n\t\t\t// see also https://framer-team.slack.com/archives/C01B14R6E22/p1720519780513099\n\t\t\tvoid updateURL(true)\n\n\t\t\tvoid promise.finally(() => {\n\t\t\t\t// only once the navigation is finished, we no longer want to intercept navigation events.\n\t\t\t\twindow.navigation.removeEventListener(\"navigate\", navigateListener)\n\t\t\t})\n\t\t},\n\t\t[navigateListener],\n\t)\n}\n", "export function computeRelativePath(from: string, to: string) {\n\tif (!from.startsWith(\"/\") || !to.startsWith(\"/\")) {\n\t\tthrow new Error(\"from/to paths are expected to be absolute\")\n\t}\n\n\tconst [fromDir] = getDirAndFile(from)\n\tconst [toDir, toFile] = getDirAndFile(to)\n\n\t// Note: relative() only operates on directories.\n\tlet relativePath = relative(fromDir, toDir)\n\n\t// Make sure all our relative path starts with \".\" or \"/\", since that's how\n\t// we determine if a URL is internal. See `isInternalURL`:\n\t// https://github.com/framer/FramerStudio/blob/cf100be43e6a912b5a63b9992752f0adb2619b19/src/library/src/modules/Link.tsx#L24\n\tif (relativePath === \"\") relativePath = \".\"\n\n\tif (!relativePath.startsWith(\".\") && !relativePath.startsWith(\"/\")) {\n\t\trelativePath = \"./\" + relativePath\n\t}\n\t// Note: relative() never returns a path with a trailing slash.\n\treturn relativePath + \"/\" + toFile\n}\n\n/**\n * Takes a URL path and returns the \"directory\" part and the \"file\" part.\n *\n * For example:\n * - `getDirAndFile(\"/one/two\") === [\"/one/\", \"two\"]`\n * - `getDirAndFile(\"/one/two/\") === [\"/one/two/\", \"\"]`\n *\n * This matters for the purposes of the `.` and `..` \"operators\", which consider\n * the \"directories\" and not \"files\".\n *\n * (There are no actual \"directories\" and \"files\" in URL paths, only path\n *  segments, so these are metaphorical, hence the quotes. The metaphor holds\n *  quite well in practice!)\n */\nfunction getDirAndFile(path: string): [string, string] {\n\tconst index = path.lastIndexOf(\"/\")\n\treturn [path.substring(0, index + 1), path.substring(index + 1)]\n}\n\n// #region Code ported from Node.js.\n\nconst CHAR_DOT = 46\nconst CHAR_FORWARD_SLASH = 47\n\nconst StringPrototypeCharCodeAt = (str: string, index: number) => str.charCodeAt(index)\nconst StringPrototypeLastIndexOf = (str: string, searchString: string) => str.lastIndexOf(searchString)\nconst StringPrototypeSlice = (str: string, start?: number, end?: number) => str.slice(start, end)\n\n/**\n * `path.relative`, ported from Node.js.\n *\n * Alterations are marked with the /* comments.\n *\n * https://nodejs.org/docs/latest-v14.x/api/path.html#path_path_relative_from_to\n * https://github.com/nodejs/node/blob/dd52c05046bcc65746e26e2de65699dffcd454ee/lib/path.js#L1190\n */\nfunction relative(from: string, to: string) {\n\t/*\n    validateString(from, \"from\")\n    validateString(to, \"to\")\n     */\n\n\tif (from === to) return \"\"\n\n\t/*\n    // Trim leading forward slashes.\n    from = posix.resolve(from)\n    to = posix.resolve(to)\n     */\n\n\t/*\n    This mimics what posix.resolve does when called with a single, absolute path:\n    https://github.com/nodejs/node/blob/dd52c05046bcc65746e26e2de65699dffcd454ee/lib/path.js#L1091\n     */\n\tfrom = \"/\" + normalizeString(from)\n\tto = \"/\" + normalizeString(to)\n\n\tif (from === to) return \"\"\n\n\tconst fromStart = 1\n\tconst fromEnd = from.length\n\tconst fromLen = fromEnd - fromStart\n\tconst toStart = 1\n\tconst toLen = to.length - toStart\n\n\t// Compare paths to find the longest common path from root\n\tconst length = fromLen < toLen ? fromLen : toLen\n\tlet lastCommonSep = -1\n\tlet i = 0\n\tfor (; i < length; i++) {\n\t\tconst fromCode = StringPrototypeCharCodeAt(from, fromStart + i)\n\t\tif (fromCode !== StringPrototypeCharCodeAt(to, toStart + i)) break\n\t\telse if (fromCode === CHAR_FORWARD_SLASH) lastCommonSep = i\n\t}\n\tif (i === length) {\n\t\tif (toLen > length) {\n\t\t\tif (StringPrototypeCharCodeAt(to, toStart + i) === CHAR_FORWARD_SLASH) {\n\t\t\t\t// We get here if `from` is the exact base path for `to`.\n\t\t\t\t// For example: from='/foo/bar'; to='/foo/bar/baz'\n\t\t\t\treturn StringPrototypeSlice(to, toStart + i + 1)\n\t\t\t}\n\t\t\tif (i === 0) {\n\t\t\t\t// We get here if `from` is the root\n\t\t\t\t// For example: from='/'; to='/foo'\n\t\t\t\treturn StringPrototypeSlice(to, toStart + i)\n\t\t\t}\n\t\t} else if (fromLen > length) {\n\t\t\tif (StringPrototypeCharCodeAt(from, fromStart + i) === CHAR_FORWARD_SLASH) {\n\t\t\t\t// We get here if `to` is the exact base path for `from`.\n\t\t\t\t// For example: from='/foo/bar/baz'; to='/foo/bar'\n\t\t\t\tlastCommonSep = i\n\t\t\t} else if (i === 0) {\n\t\t\t\t// We get here if `to` is the root.\n\t\t\t\t// For example: from='/foo/bar'; to='/'\n\t\t\t\tlastCommonSep = 0\n\t\t\t}\n\t\t}\n\t}\n\n\tlet out = \"\"\n\t// Generate the relative path based on the path difference between `to`\n\t// and `from`.\n\tfor (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n\t\tif (i === fromEnd || StringPrototypeCharCodeAt(from, i) === CHAR_FORWARD_SLASH) {\n\t\t\tout += out.length === 0 ? \"..\" : \"/..\"\n\t\t}\n\t}\n\n\t// Lastly, append the rest of the destination (`to`) path that comes after\n\t// the common path parts.\n\treturn `${out}${StringPrototypeSlice(to, toStart + lastCommonSep)}`\n}\n\nconst allowAboveRoot = false\nconst separator = \"/\"\nconst isPathSeparator = (code: number) => code === CHAR_FORWARD_SLASH\n\n/**\n * Ported from Node.js. This is an internal function of the `path` module. The\n * last three arguments are hard-coded above to fit our needs.\n *\n * https://github.com/nodejs/node/blob/dd52c05046bcc65746e26e2de65699dffcd454ee/lib/path.js#L66\n */\nfunction normalizeString(path: string) {\n\tlet res = \"\"\n\tlet lastSegmentLength = 0\n\tlet lastSlash = -1\n\tlet dots = 0\n\tlet code = 0\n\tfor (let i = 0; i <= path.length; ++i) {\n\t\tif (i < path.length) code = StringPrototypeCharCodeAt(path, i)\n\t\telse if (isPathSeparator(code)) break\n\t\telse code = CHAR_FORWARD_SLASH\n\n\t\tif (isPathSeparator(code)) {\n\t\t\tif (lastSlash === i - 1 || dots === 1) {\n\t\t\t\t// NOOP\n\t\t\t} else if (dots === 2) {\n\t\t\t\tif (\n\t\t\t\t\tres.length < 2 ||\n\t\t\t\t\tlastSegmentLength !== 2 ||\n\t\t\t\t\tStringPrototypeCharCodeAt(res, res.length - 1) !== CHAR_DOT ||\n\t\t\t\t\tStringPrototypeCharCodeAt(res, res.length - 2) !== CHAR_DOT\n\t\t\t\t) {\n\t\t\t\t\tif (res.length > 2) {\n\t\t\t\t\t\tconst lastSlashIndex = StringPrototypeLastIndexOf(res, separator)\n\t\t\t\t\t\tif (lastSlashIndex === -1) {\n\t\t\t\t\t\t\tres = \"\"\n\t\t\t\t\t\t\tlastSegmentLength = 0\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tres = StringPrototypeSlice(res, 0, lastSlashIndex)\n\t\t\t\t\t\t\tlastSegmentLength = res.length - 1 - StringPrototypeLastIndexOf(res, separator)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlastSlash = i\n\t\t\t\t\t\tdots = 0\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t} else if (res.length !== 0) {\n\t\t\t\t\t\tres = \"\"\n\t\t\t\t\t\tlastSegmentLength = 0\n\t\t\t\t\t\tlastSlash = i\n\t\t\t\t\t\tdots = 0\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (allowAboveRoot) {\n\t\t\t\t\tres += res.length > 0 ? `${separator}..` : \"..\"\n\t\t\t\t\tlastSegmentLength = 2\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (res.length > 0) res += `${separator}${StringPrototypeSlice(path, lastSlash + 1, i)}`\n\t\t\t\telse res = StringPrototypeSlice(path, lastSlash + 1, i)\n\t\t\t\tlastSegmentLength = i - lastSlash - 1\n\t\t\t}\n\t\t\tlastSlash = i\n\t\t\tdots = 0\n\t\t} else if (code === CHAR_DOT && dots !== -1) {\n\t\t\t++dots\n\t\t} else {\n\t\t\tdots = -1\n\t\t}\n\t}\n\treturn res\n}\n\n// #endregion\n", "// This is used in the tracking backend to count 404 pages, see:\n// https://github.com/framer/tinybird/blob/826b76e284c303270c3767517b6e7d8e1adbdaa0/endpoints/site_not_found_pages_ep.pipe#L26\nexport const customNotFoundPagePaths = new Set([`/404.html`, `/404`, `/404/`])\n\n// \"404\", \"404.html\"\nexport const customNotFoundPageSegments = /* @__PURE__ */ (() =>\n\tnew Set(Array.from(customNotFoundPagePaths).map(path => path.replaceAll(\"/\", \"\"))))()\n", "export const pathVariablesRegExpRaw = \":([a-z]\\\\w*)\"\nexport const pathVariablesRegExp = /* @__PURE__ */ new RegExp(pathVariablesRegExpRaw, \"i\")\nexport const pathVariablesRegExpGlobal = /* @__PURE__ */ new RegExp(pathVariablesRegExpRaw, \"gi\")\n", "import { pathVariablesRegExpGlobal } from \"./pathVariables.ts\"\n\nexport function fillPathVariables(path: string, variables: Record<string, unknown>): string {\n\treturn path.replace(pathVariablesRegExpGlobal, (match, name) => {\n\t\tconst value = variables[name]\n\t\tif (typeof value !== \"string\" || value.length === 0) return match\n\t\treturn encodeURIComponent(value)\n\t})\n}\n", "import type { HistoryState } from \"./history.ts\"\n\n/**\n * \u26A0\uFE0F\n *\n * Please be careful about adding dependencies and non-shakable code[^1] to this file, as it's being used in\n * rewriteLinksWithQueryParams.ts, which ends up inlined into the published site's HTML!\n *\n * [^1]: As defined by esbuild, so probably more than you think: https://esbuild.github.io/api/#tree-shaking-and-side-effects\n */\n\n/**\n * Forwards query params from the current `location` URL to the given `href`, merging them if necessary.\n *\n * When merging, params in the `href` take precedence.\n *\n * When `history.state.queryParamBackAnchorSearch` is a string (pre-filter search), uses that instead\n * of `location.search` so links preserve only pre-filter params and not dynamic filter params.\n *\n * When `ignoreBackAnchor` is set, always uses `location.search` instead of `queryParamBackAnchorSearch`.\n * This is used for same-page hash navigation, which should keep active filter params.\n *\n * Safe for server-side rendering, in which case it'll return `href` as-is.\n */\nexport function forwardCurrentQueryParams(href: string, ignoreBackAnchor = false): string {\n\tlet queryParamsString = \"\"\n\tif (typeof window !== \"undefined\") {\n\t\tif (ignoreBackAnchor) {\n\t\t\tqueryParamsString = window.location.search\n\t\t} else {\n\t\t\tconst backAnchor = (window.history?.state as HistoryState | null)?.queryParamBackAnchorSearch\n\t\t\tif (backAnchor === undefined) {\n\t\t\t\tqueryParamsString = window.location.search\n\t\t\t} else {\n\t\t\t\tqueryParamsString = backAnchor === \"\" ? \"\" : `?${backAnchor}`\n\t\t\t}\n\t\t}\n\t}\n\tif (!queryParamsString) {\n\t\treturn href\n\t}\n\treturn forwardQueryParams(queryParamsString, href)\n}\n\nconst FRAMER_VARIANT_KEY = \"framer_variant\"\n\n/**\n * Forwards query params given by the `queryParamsString` to the given `href`, merging them if necessary.\n *\n * When merging, params in the `href` take precedence.\n *\n * @param queryParamsString Usually `window.location.search`, should include the leading `?` if not empty\n */\nexport function forwardQueryParams(queryParamsString: string, href: string): string {\n\tconst startOfHash = href.indexOf(\"#\")\n\tconst hrefWithoutHash = startOfHash === -1 ? href : href.substring(0, startOfHash)\n\tconst hash = startOfHash === -1 ? \"\" : href.substring(startOfHash)\n\n\tconst startOfSearch = hrefWithoutHash.indexOf(\"?\")\n\tconst baseUrl = startOfSearch === -1 ? hrefWithoutHash : hrefWithoutHash.substring(0, startOfSearch)\n\tconst searchString = startOfSearch === -1 ? \"\" : hrefWithoutHash.substring(startOfSearch)\n\n\t// Merge current params into new params, skipping duplicates and `framer_variant`\n\tconst newSearchParams = new URLSearchParams(searchString)\n\tconst currentSearchParams = new URLSearchParams(queryParamsString)\n\tfor (const [key, value] of currentSearchParams) {\n\t\tif (newSearchParams.has(key)) continue\n\t\tif (key === FRAMER_VARIANT_KEY) continue\n\t\tnewSearchParams.append(key, value)\n\t}\n\n\tconst newSearchString = newSearchParams.toString()\n\tif (newSearchString === \"\") {\n\t\treturn hrefWithoutHash + hash\n\t}\n\n\treturn baseUrl + \"?\" + newSearchString + hash\n}\n", "import type { CollectionUtilsCacheContextValue } from \"../modules/cms/CollectionUtilsCache.tsx\"\nimport { isPromise, isString } from \"../utils/utils.ts\"\nimport { forwardCurrentQueryParams } from \"./forwardQueryParams.ts\"\nimport { pathVariablesRegExpGlobal } from \"./pathVariables.ts\"\nimport type { Locale, Route } from \"./types.ts\"\n\nexport interface GetLocalizedNavigationPathResult {\n\tpath: string | undefined\n\tpathVariables: Record<string, unknown> | undefined\n\t// If a slug is missing for a locale, it is hidden for the locale a\n\t// user is switching to. We keep track of this to detect any redirects later\n\tisMissingInLocale: boolean\n}\n\n/**\n * Replaces path variables in a path with their (potentially) localized counterparts\n */\nasync function replacePathVariables(\n\tpath: string,\n\tcurrentLocale: Locale | null,\n\tnextLocale: Locale,\n\tdefaultLocale: Locale | undefined,\n\tcollectionId: string,\n\tpathVariables: Record<string, unknown>,\n\tcollectionUtils: CollectionUtilsCacheContextValue,\n): Promise<GetLocalizedNavigationPathResult> {\n\tlet resultPath = path\n\tlet isMissingInLocale: boolean = false\n\n\tconst resultPathVariables = { ...pathVariables }\n\n\tconst matches = Array.from(resultPath.matchAll(pathVariablesRegExpGlobal))\n\n\t// Collect replacements for all pathVariables first\n\tconst replacements = await Promise.all(\n\t\tmatches.map(async match => {\n\t\t\tconst pathVariableWithDelimiter = match?.[0]\n\t\t\tconst pathVariableValue = match?.[1]\n\n\t\t\tif (!pathVariableWithDelimiter || !pathVariableValue) {\n\t\t\t\tthrow new Error(\"Failed to replace path variables: unexpected regex match group\")\n\t\t\t}\n\n\t\t\tconst currentSlug = pathVariables[pathVariableValue]\n\t\t\tif (!currentSlug || !isString(currentSlug)) {\n\t\t\t\tthrow new Error(`No slug found for path variable ${pathVariableValue}`)\n\t\t\t}\n\n\t\t\tconst utils = collectionUtils?.get(collectionId)\n\t\t\tif (!utils || !currentLocale) {\n\t\t\t\treturn currentSlug\n\t\t\t}\n\n\t\t\tconst maybeRecordId = utils.getRecordIdBySlug(currentSlug, currentLocale)\n\t\t\tconst recordId = isPromise(maybeRecordId) ? await maybeRecordId : maybeRecordId\n\t\t\tif (!recordId) return currentSlug\n\n\t\t\tconst maybeNextSlug = utils.getSlugByRecordId(recordId, nextLocale)\n\t\t\tconst nextSlug = isPromise(maybeNextSlug) ? await maybeNextSlug : maybeNextSlug\n\t\t\tif (!nextSlug) {\n\t\t\t\tisMissingInLocale = true\n\t\t\t\tconst maybeDefaultLocaleSlug = utils.getSlugByRecordId(recordId, defaultLocale)\n\t\t\t\tconst defaultLocaleSlug = isPromise(maybeDefaultLocaleSlug)\n\t\t\t\t\t? await maybeDefaultLocaleSlug\n\t\t\t\t\t: maybeDefaultLocaleSlug\n\t\t\t\tif (defaultLocaleSlug) {\n\t\t\t\t\tresultPathVariables[pathVariableValue] = defaultLocaleSlug\n\t\t\t\t}\n\n\t\t\t\treturn defaultLocaleSlug ?? currentSlug\n\t\t\t}\n\n\t\t\tresultPathVariables[pathVariableValue] = nextSlug\n\n\t\t\treturn nextSlug\n\t\t}),\n\t)\n\n\tlet lastIndex = 0\n\tlet replacedPath = \"\"\n\tlet hasMatch = false\n\n\t// Apply the replacements\n\tfor (let i = 0; i < matches.length; i++) {\n\t\tconst match = matches[i]\n\t\tconst replacement = replacements[i]\n\n\t\tif (!match || !replacement) continue\n\n\t\treplacedPath += resultPath.substring(lastIndex, match.index)\n\t\tlastIndex = (match.index ?? 0) + (match[0]?.length ?? 0)\n\n\t\treplacedPath += replacements[i]\n\t\thasMatch = true\n\t}\n\n\tif (hasMatch) {\n\t\t// Add any remaining text after the last variable\n\t\treplacedPath += resultPath.substring(lastIndex)\n\n\t\tresultPath = replacedPath\n\t}\n\n\treturn {\n\t\tpath: resultPath,\n\t\tpathVariables: resultPathVariables,\n\t\tisMissingInLocale,\n\t}\n}\n\ntype CurrentLocale = Locale\ntype NextLocale = Locale\n\nexport interface GetNavigationPathOptions {\n\tdefaultLocale: Locale | undefined\n\tcurrentLocale: CurrentLocale | null\n\tnextLocale: NextLocale\n\troute: Route\n\trouteId: string\n\tpathVariables: Record<string, unknown> | undefined\n\tcollectionUtils: CollectionUtilsCacheContextValue\n\tpreserveQueryParams: boolean | undefined\n}\n\n/**\n * Generates a new path and its associated pathVariables for navigation to the\n * next locale. This is needed because slug translation can result in different\n * paths for different locales.\n */\nexport async function getLocalizedNavigationPath({\n\tcurrentLocale,\n\tnextLocale,\n\tdefaultLocale,\n\troute,\n\tpathVariables,\n\tcollectionUtils,\n\tpreserveQueryParams,\n}: GetNavigationPathOptions): Promise<GetLocalizedNavigationPathResult> {\n\tconst { path: basePath, pathLocalized } = route\n\n\tconst path = pathLocalized?.[nextLocale.id] ?? basePath\n\n\tlet result: GetLocalizedNavigationPathResult = {\n\t\tpath,\n\t\tpathVariables,\n\t\tisMissingInLocale: false,\n\t}\n\n\tif (!path) return result\n\n\tif (pathVariables && route.collectionId) {\n\t\ttry {\n\t\t\tconst pathReplacement = await replacePathVariables(\n\t\t\t\tpath,\n\t\t\t\tcurrentLocale,\n\t\t\t\tnextLocale,\n\t\t\t\tdefaultLocale,\n\t\t\t\troute.collectionId,\n\t\t\t\tpathVariables,\n\t\t\t\tcollectionUtils,\n\t\t\t)\n\n\t\t\tresult = pathReplacement\n\t\t} catch {\n\t\t\t// Don't act and stay on the same route if we fail to replace the path variables\n\t\t\t// TODO: tracking?\n\t\t}\n\t}\n\n\tif (nextLocale.slug) {\n\t\tresult.path = \"/\" + nextLocale.slug + result.path\n\t}\n\n\tif (preserveQueryParams && result.path) {\n\t\tresult.path = forwardCurrentQueryParams(result.path, true)\n\t}\n\n\treturn result\n}\n", "/**\n * If this site is hosted (reverse-proxied) at a prefix, e.g., https://www.framer.com/sites, and the user is visiting\n * the site as such (as opposed to, e.g., accessing the site via its staging domain), returns that prefix, e.g., /sites,\n * always without a trailing slash. Otherwise, returns an empty string. Note that the last two qualities mean you can\n * trivially concatenate the result with a route path (which always starts with a slash) to get the full path.\n *\n * Because we use the canonical URL to determine the prefix, it requires it to be configured correctly (via custom AKA\n * advanced canonical URL) for reverse-proxied sites.\n */\nexport function getSitePrefix(siteCanonicalURL: string | undefined): string {\n\tif (!siteCanonicalURL) return \"\"\n\n\tlet url: URL\n\ttry {\n\t\turl = new URL(siteCanonicalURL)\n\t} catch {\n\t\treturn \"\"\n\t}\n\n\tif (url.pathname === \"/\" || window.location.origin !== url.origin) return \"\"\n\n\treturn url.pathname.endsWith(\"/\") ? url.pathname.slice(0, -1) : url.pathname\n}\n", "import { useCallback, useEffect, useRef } from \"react\"\nimport { usePageEffects } from \"./PageEffectsContext.tsx\"\nimport { getPageEffectForRoute } from \"./getPageEffect.ts\"\nimport type { ViewTransition } from \"./viewTransition.ts\"\nimport { startViewTransition } from \"./viewTransition.ts\"\n\nexport function useViewTransition(): (\n\tcurrentRouteId: string,\n\tnextRouteId: string,\n\tupdate: VoidFunction,\n\tsignal?: AbortSignal,\n) => Promise<ViewTransition | undefined> | ViewTransition | undefined {\n\tconst sitePageEffects = usePageEffects()\n\n\tconst resolveHasPainted = useRef<VoidFunction | undefined>(undefined)\n\tuseEffect(() => {\n\t\tif (resolveHasPainted.current) {\n\t\t\tresolveHasPainted.current()\n\t\t\tresolveHasPainted.current = undefined\n\t\t}\n\t})\n\n\treturn useCallback(\n\t\t(currentRouteId, nextRouteId, update, signal): Promise<ViewTransition | undefined> | undefined => {\n\t\t\tconst pageEffect = getPageEffectForRoute(currentRouteId, nextRouteId, sitePageEffects)\n\t\t\tif (pageEffect) {\n\t\t\t\tconst hasPainted = new Promise<void>(resolve => {\n\t\t\t\t\tresolveHasPainted.current = resolve\n\t\t\t\t})\n\n\t\t\t\treturn startViewTransition(\n\t\t\t\t\tasync () => {\n\t\t\t\t\t\tupdate()\n\t\t\t\t\t\tawait hasPainted\n\t\t\t\t\t},\n\t\t\t\t\tpageEffect,\n\t\t\t\t\tsignal,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tupdate()\n\t\t},\n\t\t[sitePageEffects],\n\t)\n}\n", "import React from \"react\"\nimport type { PageEffect, RoutePageEffects } from \"./types.ts\"\n\nexport interface SitePageEffects {\n\tglobal: PageEffect | undefined\n\troutes: {\n\t\t[routeId: string]: RoutePageEffects\n\t}\n}\n\nconst defaultSitePageEffects = { global: undefined, routes: {} }\n\nexport const PageEffectsContext = /* @__PURE__ */ React.createContext<SitePageEffects>(defaultSitePageEffects)\n\nexport function PageEffectsProvider({ children, value }: React.PropsWithChildren<{ value: SitePageEffects }>) {\n\treturn <PageEffectsContext.Provider value={value}>{children}</PageEffectsContext.Provider>\n}\n\nexport function usePageEffects() {\n\treturn React.useContext(PageEffectsContext)\n}\n", "import type { SitePageEffects } from \"./PageEffectsContext.tsx\"\nimport type { PageEffect } from \"./types.ts\"\n\nexport function getPageEffectForRoute(\n\tcurrentRouteId: string,\n\tnextRouteId: string,\n\t{ global, routes }: SitePageEffects,\n): PageEffect | undefined {\n\treturn routes[currentRouteId]?.[nextRouteId] || global\n}\n", "export interface AnimationState<V> {\n\tvalue: V\n\tdone: boolean\n}\n\nexport interface KeyframeGenerator<V> {\n\tnext: (t: number) => AnimationState<V>\n}\n\nconst step = 10 // ms\nconst maxDuration = 10000 // ms\nexport function createLinearEasing(generator: KeyframeGenerator<number>) {\n\tlet time = step\n\tlet state = generator.next(0)\n\tconst keyframes = [state.value]\n\n\twhile (!state.done && time < maxDuration) {\n\t\tstate = generator.next(time)\n\t\tkeyframes.push(state.value)\n\t\ttime += step\n\t}\n\n\t/**\n\t * If generating an animation that didn't actually move,\n\t * generate a second keyframe so we have an origin and target.\n\t */\n\tif (keyframes.length === 1) keyframes.push(state.value)\n\n\treturn {\n\t\teasing: `linear(${keyframes.join(\",\")})`,\n\t\tduration: time - step,\n\t}\n}\n", "import type { BlindsMask, CircleMask, ConicMask, InsetMask, Mask, PageTransitionUnit, WipeMask } from \"../types.ts\"\n\nexport interface MaskGenerator<MaskType = Mask> {\n\tmakeKeyframe?: (mask: Mask & MaskType, progress: \"start\" | \"end\", page: \"exit\" | \"enter\") => string\n\tmakeStyles?: (mask: Mask & MaskType, page: \"exit\" | \"enter\") => string\n\tmakePropertyRules?: (mask: Mask & MaskType) => string\n}\n\nconst cssVariable = (name: string) => `--view-transition-${name}`\n\nfunction parseUnit(value: PageTransitionUnit): [number, \"%\" | \"px\"] {\n\treturn [parseFloat(value), value.endsWith(\"px\") ? \"px\" : \"%\"]\n}\n\nfunction calcMaskPosition(mask: InsetMask | CircleMask) {\n\tconst { innerWidth, innerHeight } = window\n\n\tconst [x, xUnit] = parseUnit(mask.x)\n\tconst [y, yUnit] = parseUnit(mask.y)\n\n\treturn {\n\t\tx: xUnit === \"px\" ? x : innerWidth * (x / 100),\n\t\ty: yUnit === \"px\" ? y : innerHeight * (y / 100),\n\t}\n}\n\nconst conic: MaskGenerator<ConicMask> = {\n\tmakeKeyframe: (mask, progress, page) => {\n\t\tlet percentage = 0\n\n\t\tif (\n\t\t\t(page === \"exit\" && mask.angularDirection === \"clockwise\" && progress === \"start\") ||\n\t\t\t(page === \"exit\" && mask.angularDirection === \"counter-clockwise\" && progress === \"end\") ||\n\t\t\t(page === \"enter\" && mask.angularDirection === \"counter-clockwise\" && progress === \"start\") ||\n\t\t\t(page === \"enter\" && mask.angularDirection === \"clockwise\" && progress === \"end\")\n\t\t) {\n\t\t\tpercentage = (mask.sweepAngle / 360) * 100\n\t\t}\n\n\t\treturn `${cssVariable(\"conic-offset\")}: ${percentage}%;`\n\t},\n\tmakeStyles: (mask, page) => {\n\t\tconst offsetToken = `var(${cssVariable(\"conic-offset\")})`\n\t\tconst isTransparentToBlack =\n\t\t\t(page === \"exit\" && mask.angularDirection === \"clockwise\") ||\n\t\t\t(page === \"enter\" && mask.angularDirection === \"counter-clockwise\")\n\t\tconst firstColor = isTransparentToBlack ? \"transparent\" : \"black\"\n\t\tconst secondColor = isTransparentToBlack ? \"black\" : \"transparent\"\n\n\t\tlet gradient = `conic-gradient(from `\n\t\tgradient += `${mask.angle}deg at ${mask.x} ${mask.y}, `\n\t\tgradient += `${firstColor} 0%, ${firstColor} ${offsetToken}, `\n\t\tgradient += `${secondColor} ${offsetToken}, ${secondColor} 100%)`\n\n\t\treturn `mask-image: ${gradient}; -webkit-mask-image: ${gradient};`\n\t},\n\tmakePropertyRules: () => `\n        @property ${cssVariable(\"conic-offset\")} {\n            syntax: '<percentage>';\n            initial-value: 0%;\n            inherits: false;\n        }\n    `,\n}\n\nconst circle: MaskGenerator<CircleMask> = {\n\tmakeKeyframe: (mask, progress) => {\n\t\tconst { x, y } = calcMaskPosition(mask)\n\t\tif (progress === \"start\") {\n\t\t\treturn `clip-path: circle(0 at ${x}px ${y}px);`\n\t\t} else {\n\t\t\tconst endRadius = Math.hypot(Math.max(x, window.innerWidth - x), Math.max(y, window.innerHeight - y))\n\t\t\treturn `clip-path: circle(${endRadius}px at ${x}px ${y}px);`\n\t\t}\n\t},\n}\n\nconst inset: MaskGenerator<InsetMask> = {\n\tmakeKeyframe: (mask, progress) => {\n\t\tconst { x, y } = calcMaskPosition(mask)\n\t\tconst bottom = window.innerHeight - y\n\t\tconst right = window.innerWidth - x\n\n\t\treturn progress === \"start\"\n\t\t\t? `clip-path: inset(${y}px ${right}px ${bottom}px ${x}px round ${mask.round}px);`\n\t\t\t: `clip-path: inset(0 round 0);`\n\t},\n}\n\nconst blinds: MaskGenerator<BlindsMask> = {\n\tmakeKeyframe: (mask, progress, page) => {\n\t\tconst [, unit] = parseUnit(mask.width)\n\t\tlet width = `0${unit}`\n\n\t\tif ((progress === \"start\" && page === \"exit\") || (progress === \"end\" && page === \"enter\")) {\n\t\t\twidth = mask.width\n\t\t}\n\n\t\treturn `${cssVariable(\"blinds-width\")}: ${width};`\n\t},\n\tmakeStyles: (mask, page) => {\n\t\tconst widthToken = `var(${cssVariable(\"blinds-width\")})`\n\t\tconst firstColor = page === \"exit\" ? \"transparent\" : \"black\"\n\t\tconst secondColor = page === \"exit\" ? \"black\" : \"transparent\"\n\n\t\tlet gradient = `repeating-linear-gradient(`\n\t\tgradient += mask.angle + 90 + \"deg, \"\n\t\tgradient += `${firstColor} 0px, ${firstColor} ${widthToken}, `\n\t\tgradient += `${secondColor} ${widthToken}, ${secondColor} ${mask.width})`\n\n\t\treturn `mask-image: ${gradient}; -webkit-mask-image: ${gradient};`\n\t},\n\tmakePropertyRules: () => {\n\t\treturn `\n            @property ${cssVariable(\"blinds-width\")} {\n                syntax: '<length-percentage>';\n                initial-value: 0px;\n                inherits: false;\n            }\n        `\n\t},\n}\n\nconst wipe: MaskGenerator<WipeMask> = {\n\tmakeKeyframe: (_mask, progress, page) => {\n\t\tconst offset = (progress === \"start\" && page === \"exit\") || (progress === \"end\" && page === \"enter\") ? 1 : 0\n\t\treturn `${cssVariable(\"wipe-offset\")}: ${offset};`\n\t},\n\tmakeStyles: (mask, page) => {\n\t\tconst offsetToken = `var(${cssVariable(\"wipe-offset\")})`\n\t\tconst firstColor = page === \"exit\" ? \"transparent\" : \"black\"\n\t\tconst secondColor = page === \"exit\" ? \"black\" : \"transparent\"\n\n\t\tlet gradient = `linear-gradient(`\n\t\tgradient += mask.angle + 90 + \"deg, \"\n\n\t\tgradient += `${firstColor} calc(calc(0% - ${mask.width}) + calc(calc(100% + ${mask.width}) * ${offsetToken})), `\n\t\tgradient += `${secondColor} calc(calc(100% + ${mask.width}) * ${offsetToken}))`\n\n\t\treturn `mask-image: ${gradient}; -webkit-mask-image: ${gradient};`\n\t},\n\tmakePropertyRules: () => {\n\t\treturn `\n            @property ${cssVariable(\"wipe-offset\")} {\n                syntax: '<number>';\n                initial-value: 0;\n                inherits: false;\n            }\n        `\n\t},\n}\n\nexport const maskGenerators = { circle, conic, inset, blinds, wipe } as const\n", "import { spring } from \"framer-motion\"\nimport type { Mask, PageTransition } from \"../types.ts\"\nimport { createLinearEasing } from \"./linearEasing.ts\"\nimport type { MaskGenerator } from \"./masks.ts\"\nimport { maskGenerators } from \"./masks.ts\"\n\nexport type TransitionValues = Omit<PageTransition, \"transition\" | \"rotate3d\">\n\nconst restState: TransitionValues = {\n\topacity: 1,\n\tx: \"0px\",\n\ty: \"0px\",\n\tscale: 1,\n\trotate: 0,\n\trotateX: 0,\n\trotateY: 0,\n\tmask: undefined,\n}\n\nexport function valuesToCSSKeyframes(\n\tvalues: TransitionValues,\n\tprogress: \"start\" | \"end\",\n\tpage: \"exit\" | \"enter\",\n\tmaskGenerator?: MaskGenerator<typeof values.mask>,\n) {\n\tlet keyframes = `\n      opacity: ${values.opacity};\n      transform: translate(${values.x}, ${values.y}) scale(${values.scale}) rotateX(${values.rotateX}deg) rotateY(${values.rotateY}deg) rotateZ(${values.rotate}deg);\n    `\n\n\tif (values.mask) {\n\t\tkeyframes += maskGenerator?.makeKeyframe?.(values.mask, progress, page) || \"\"\n\t}\n\n\treturn keyframes\n}\n\nfunction getMaskGenerator<T extends Mask[\"type\"]>(type?: T): undefined | MaskGenerator<Extract<Mask, { type: T }>> {\n\treturn type ? maskGenerators[type] : undefined\n}\n\nexport function createPageTransitionRules(page: \"enter\" | \"exit\", { transition, ...values }: PageTransition): string {\n\tconst name = \"view-transition-\" + page\n\tconst settings = { duration: \"0s\", easing: \"linear\" }\n\n\tif (transition.type === \"tween\") {\n\t\tsettings.duration = transition.duration + \"s\"\n\t\tsettings.easing = `cubic-bezier(${transition.ease.join(\",\")})`\n\t} else if (isSpringTransition(transition)) {\n\t\tconst { easing, duration } = createLinearEasing(\n\t\t\tspring({\n\t\t\t\tkeyframes: [0, 1],\n\t\t\t\t...getSpringOptions(transition),\n\t\t\t\trestDelta: 0.001,\n\t\t\t\trestSpeed: 0.0001,\n\t\t\t}),\n\t\t)\n\n\t\tsettings.duration = duration + \"ms\"\n\t\tsettings.easing = easing\n\t}\n\n\tconst maskGenerator = getMaskGenerator(values?.mask?.type)\n\n\tlet startKeyframes = valuesToCSSKeyframes(values, \"start\", page, maskGenerator)\n\tlet endKeyframes = valuesToCSSKeyframes({ ...restState, mask: values.mask }, \"end\", page, maskGenerator)\n\n\tif (page === \"exit\") {\n\t\t;[startKeyframes, endKeyframes] = [endKeyframes, startKeyframes]\n\t}\n\n\treturn `\n        ${values.mask && maskGenerator?.makePropertyRules ? maskGenerator.makePropertyRules(values.mask) : \"\"}\n\n        @keyframes ${name} {\n            0% {\n                ${startKeyframes}\n            }\n\n            100% {\n                ${endKeyframes}\n            }\n        }\n\n        ::view-transition-${page === \"enter\" ? \"new\" : \"old\"}(root) {\n            animation-name: ${name};\n            animation-duration: ${settings.duration};\n            animation-delay: ${transition.delay}s;\n            animation-timing-function: ${settings.easing};\n            animation-fill-mode: both;\n            ${values.mask && maskGenerator?.makeStyles ? maskGenerator.makeStyles(values.mask, page) : \"\"}\n        }\n    `\n}\n\nfunction isSpringTransition(\n\ttransition: PageTransition[\"transition\"],\n): transition is PageTransition[\"transition\"] & { type: \"spring\" } {\n\treturn transition.type === \"spring\"\n}\n\nfunction getSpringOptions(transition: PageTransition[\"transition\"] & { type: \"spring\" }) {\n\tif (transition.durationBasedSpring) {\n\t\treturn {\n\t\t\tduration: transition.duration * 1000,\n\t\t\tbounce: transition.bounce,\n\t\t}\n\t}\n\n\treturn {\n\t\tstiffness: transition.stiffness,\n\t\tdamping: transition.damping,\n\t\tmass: transition.mass,\n\t}\n}\n", "import { frame } from \"framer-motion\"\nimport { requestIdleCallback } from \"../../../utils/utils.ts\"\nimport type { PageEffect, PageTransition } from \"../types.ts\"\nimport { createPageTransitionRules } from \"./page.ts\"\n\nconst VIEW_TRANSITION_STYLES_ID = \"view-transition-styles\"\n\nconst 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\nexport function createViewTransitionStylesheet({ exit = defaultPageTransition, enter }: PageEffect) {\n\tconst styleElement = document.createElement(\"style\")\n\tstyleElement.id = VIEW_TRANSITION_STYLES_ID\n\n\tlet styleContent = `\n        @media (prefers-reduced-motion) {\n            ::view-transition-group(*),\n            ::view-transition-old(*),\n            ::view-transition-new(*) {\n                animation: none !important;\n            }\n        }\n    `\n\n\t/**\n\t * mix-blend-mode: plus-lighter allows the crossfade of two elements without\n\t * dips in overall luminence. But is unnecessary or looks unpleasent when\n\t * combined with masks, when there's no crossfade, or if the crossfading element\n\t * animations are offset by delay.\n\t */\n\tconst disableMixPlusLighter =\n\t\texit.mask || enter.mask || exit.opacity || enter.opacity || exit.transition.delay || enter.transition.delay\n\n\tif (disableMixPlusLighter) {\n\t\tstyleContent += `\n            ::view-transition-old(*),\n            ::view-transition-new(*) {\n                mix-blend-mode: normal;\n            }\n        `\n\t}\n\n\t/**\n\t * Disable backface visibility to better support 3D rotate.\n\t */\n\tstyleContent += `\n        ::view-transition-old(*),\n        ::view-transition-new(*) {\n            backface-visibility: hidden;\n        }\n    `\n\n\tstyleContent += createPageTransitionRules(\"exit\", exit)\n\tstyleContent += createPageTransitionRules(\"enter\", enter)\n\tstyleElement.textContent = styleContent\n\tdocument.head.appendChild(styleElement)\n}\n\nexport function removeViewTransitionStylesheet() {\n\trequestIdleCallback(() => {\n\t\tframe.render(() => {\n\t\t\tperformance.mark(\"framer-vt-remove\")\n\t\t\tconst element = document.getElementById(VIEW_TRANSITION_STYLES_ID)\n\t\t\tif (element) {\n\t\t\t\tdocument.head.removeChild(element)\n\t\t\t}\n\t\t})\n\t})\n}\n", "import { frame } from \"framer-motion\"\nimport { createViewTransitionStylesheet, removeViewTransitionStylesheet } from \"./cssGeneration/index.ts\"\nimport type { PageEffect } from \"./types.ts\"\n\nexport type UpdateView = () => void | Promise<void>\n\nexport interface ViewTransition {\n\tfinished: Promise<void>\n\tready: Promise<void>\n\tupdateCallbackDone: Promise<void>\n\tskipTransition: () => void\n}\n\nconst noop = () => {}\n\nexport function supportsViewTransitions() {\n\t// eslint-disable-next-line framer-studio/tscompat -- We check for support here.\n\treturn Boolean(document.startViewTransition)\n}\n\nexport function addVTStylesheetAfterInRender(effect: PageEffect) {\n\treturn new Promise<void>(resolve => {\n\t\tframe.render(() => {\n\t\t\t// we wrap this in a rAF, as it writes to DOM.\n\t\t\tperformance.mark(\"framer-vt-style\")\n\t\t\tcreateViewTransitionStylesheet(effect)\n\t\t\tresolve()\n\t\t})\n\t})\n}\n\nexport async function startViewTransition(\n\tupdateView: UpdateView,\n\teffect: PageEffect,\n\tsignal?: AbortSignal,\n): Promise<ViewTransition | undefined> {\n\tif (!supportsViewTransitions()) {\n\t\tvoid updateView()\n\t\treturn\n\t}\n\t/* eslint-disable framer-studio/tscompat -- We check for support above. */\n\n\t// batch style recalcs caused by the DOM insert of styles\n\tawait addVTStylesheetAfterInRender(effect)\n\tif (signal?.aborted) return\n\n\tperformance.mark(\"framer-vt\")\n\tconst transition = document.startViewTransition(async () => {\n\t\tperformance.mark(\"framer-vt-freeze\")\n\n\t\tif (signal?.aborted) return\n\t\t// we can skip the view transition (React render is already on-going)\n\t\telse signal?.addEventListener(\"abort\", () => transition.skipTransition())\n\n\t\tawait updateView()\n\t})\n\n\ttransition.updateCallbackDone\n\t\t.then(() => {\n\t\t\tperformance.mark(\"framer-vt-unfreeze\")\n\t\t})\n\t\t.catch(noop)\n\n\tPromise.all([transition.ready, transition.finished])\n\t\t.then(() => {\n\t\t\tperformance.mark(\"framer-vt-finished\")\n\t\t\tremoveViewTransitionStylesheet()\n\t\t})\n\t\t// Catch the transition so that if it fails to prepare or to finish\n\t\t// there won't be a fail state or blocking error.\n\t\t.catch(noop)\n\n\treturn transition\n}\n", "import { requestIdleCallback } from \"../utils/utils.ts\"\n\n/**\n * Updated the canonical meta tag, so that browsers use the correct URL for the share sheet - https://github.com/framer/company/issues/29317\n */\nexport function updateCanonicalURL(url: string, prevUrl?: string) {\n\trequestIdleCallback(() => {\n\t\tconst canonical = document.querySelector(\"link[rel='canonical']\")\n\t\tif (!canonical) return\n\t\tconst newURL = new URL(url, prevUrl)\n\t\tnewURL.search = \"\"\n\t\tcanonical.setAttribute(\"href\", newURL.toString())\n\t})\n}\n\n// eslint-disable-next-line spaced-comment -- license comment\n//! Credit to Astro | MIT License\nlet announceDiv: HTMLDivElement | undefined\nexport const announceNavigation = () => {\n\tif (!announceDiv) {\n\t\tannounceDiv = document.createElement(\"div\")\n\t\tannounceDiv.setAttribute(\"aria-live\", \"assertive\")\n\t\tannounceDiv.setAttribute(\"aria-atomic\", \"true\")\n\n\t\t// from https://www.scottohara.me/blog/2023/03/21/visually-hidden-hack.html\n\t\tannounceDiv.style.position = \"absolute\"\n\t\tannounceDiv.style.transform = \"scale(0)\"\n\n\t\tdocument.body.append(announceDiv)\n\t}\n\n\tsetTimeout(() => {\n\t\t// biome-ignore lint/style/noNonNullAssertion: we create announceDiv above\n\t\tannounceDiv!.textContent = document.title\n\n\t\t// Much thought went into this magic number; the gist is that screen readers\n\t\t// need to see that the element changed and might not do so if it happens\n\t\t// too quickly.\n\t}, 60)\n}\n", "import { useCallback, useRef } from \"react\"\nimport { useAfterPaintEffect } from \"../utils/useAfterPaintEffect.ts\"\n\nexport type MonitorNextPaintAfterRender<T> = (measureDetail?: T) => {\n\tpromise: Promise<void>\n\tmeasureDetail: T | undefined\n\tignore: VoidFunction | null\n}\n\n/**\n * Monitor the length of time it takes for the component to rerender and paint.\n */\nexport function useMonitorNextPaintAfterRender<T>(label: string): MonitorNextPaintAfterRender<T> {\n\tconst resolveHasPainted = useRef<VoidFunction | undefined>(undefined)\n\tuseAfterPaintEffect(\n\t\t() => {\n\t\t\tif (resolveHasPainted.current) {\n\t\t\t\tresolveHasPainted.current()\n\t\t\t\tresolveHasPainted.current = undefined\n\t\t\t}\n\t\t},\n\t\tundefined,\n\t\t// user-blocking ensures we get the correct timings here. Other priorities might delay this effect a little bit.\n\t\t{ priority: \"user-blocking\" },\n\t)\n\n\treturn useCallback<MonitorNextPaintAfterRender<T>>(\n\t\tmeasureDetail => {\n\t\t\tconst hasPainted = new Promise<void>(resolve => {\n\t\t\t\tresolveHasPainted.current = resolve\n\t\t\t})\n\n\t\t\tif (!label) return { promise: hasPainted, measureDetail, ignore: null }\n\n\t\t\tconst startLabel = `${label}-start`\n\t\t\tconst endLabel = `${label}-end`\n\t\t\tlet ignore = false\n\n\t\t\tperformance.mark(startLabel)\n\t\t\thasPainted\n\t\t\t\t.finally(() => {\n\t\t\t\t\t// we explicitly don't clear the previous startLabel here, as perf.measure always uses the latest startLabel anyway\n\t\t\t\t\tif (ignore) return\n\n\t\t\t\t\tperformance.mark(endLabel)\n\t\t\t\t\tperformance.measure(label, {\n\t\t\t\t\t\tstart: startLabel,\n\t\t\t\t\t\tend: endLabel,\n\t\t\t\t\t\tdetail: measureDetail,\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t\t.catch(e => {\n\t\t\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\t\t\tconsole.error(e)\n\t\t\t\t})\n\n\t\t\treturn {\n\t\t\t\tpromise: hasPainted,\n\t\t\t\tmeasureDetail,\n\t\t\t\tignore: () => {\n\t\t\t\t\tignore = true\n\t\t\t\t\tresolveHasPainted.current?.()\n\t\t\t\t\tresolveHasPainted.current = undefined\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t\t[label],\n\t)\n}\n", "import { useLayoutEffect } from \"react\"\nimport { yieldToMain } from \"./yield.ts\"\nimport type { YieldOptions } from \"./yield.ts\"\n\n/**\n * Runs `fn` after the next paint. Similar to `useEffect`, but guarantees to run after the next paint (both cleanup and effect).\n * @see https://thoughtspile.github.io/2021/11/15/unintentional-layout-effect/ - use this when effects run after state updates in event handlers\n *\n * @param useEffectFn pass `useEffect` for less important updates (those will mostly run after the 2nd paint instead)\n */\nexport function useAfterPaintEffect(\n\teffectFn: Parameters<typeof useLayoutEffect>[0],\n\tdeps: Parameters<typeof useLayoutEffect>[1],\n\toptions?: YieldOptions,\n\tuseEffectFn = useLayoutEffect,\n) {\n\tuseEffectFn(() => {\n\t\tconst runAfterPaint = async (fn: typeof effectFn | (() => void)) => {\n\t\t\tawait yieldToMain({ ...options, continueAfter: \"paint\" })\n\t\t\treturn fn()\n\t\t}\n\t\tconst runPromise = runAfterPaint(effectFn)\n\n\t\treturn () => {\n\t\t\tvoid (async () => {\n\t\t\t\tconst cleanup = await runPromise\n\t\t\t\tif (!cleanup) return\n\t\t\t\tvoid runAfterPaint(cleanup)\n\t\t\t})()\n\t\t}\n\t}, deps)\n}\n", "import { useCallback, useContext } from \"react\"\nimport { useRouter } from \"../router/RouterContext.tsx\"\nimport { type PageviewEventData, isValidTrackingId, sendTrackingEvent } from \"../utils/sendTrackingEvent.ts\"\nimport { trimDashes } from \"../utils/slugify.ts\"\nimport { NodeIdContext } from \"./NodeIdContext.tsx\"\n\nconst nonSlugCharactersRegExp = /[^\\p{Letter}\\p{Number}()]+/gu\nexport function getTrackingId(value: string): string {\n\treturn trimDashes(value.toLowerCase().replace(nonSlugCharactersRegExp, \"-\"))\n}\n\n/**\n * @public\n */\ntype AlphaNumericChar =\n\t| \"a\"\n\t| \"b\"\n\t| \"c\"\n\t| \"d\"\n\t| \"e\"\n\t| \"f\"\n\t| \"g\"\n\t| \"h\"\n\t| \"i\"\n\t| \"j\"\n\t| \"k\"\n\t| \"l\"\n\t| \"m\"\n\t| \"n\"\n\t| \"o\"\n\t| \"p\"\n\t| \"q\"\n\t| \"r\"\n\t| \"s\"\n\t| \"t\"\n\t| \"u\"\n\t| \"v\"\n\t| \"w\"\n\t| \"x\"\n\t| \"y\"\n\t| \"z\"\n\t| \"0\"\n\t| \"1\"\n\t| \"2\"\n\t| \"3\"\n\t| \"4\"\n\t| \"5\"\n\t| \"6\"\n\t| \"7\"\n\t| \"8\"\n\t| \"9\"\n\n/**\n * @public\n */\ntype IsAlphaNumeric<S extends string> = S extends `${infer Head}${infer Tail}`\n\t? Head extends AlphaNumericChar\n\t\t? IsAlphaNumeric<Tail>\n\t\t: false\n\t: true\n\n/**\n * @public\n */\ntype ValidTrackingId<S extends string> = S extends `-${string}` | `${string}-` | `${string}--${string}` | \"\"\n\t? `Error: Invalid hyphen usage or empty string.`\n\t: S extends `${infer P1}-${infer P2}`\n\t\t? IsAlphaNumeric<P1> extends true\n\t\t\t? // Check if the recursive call on P2 is valid\n\t\t\t\tValidTrackingId<P2> extends P2\n\t\t\t\t? // If P2 is valid, the whole string S is valid.\n\t\t\t\t\tS\n\t\t\t\t: // Otherwise, propagate the error from P2's validation.\n\t\t\t\t\tValidTrackingId<P2>\n\t\t\t: `Error: The part '${P1}' should only contain lowercase alphanumeric characters (a to z, 0 to 9). Example: 'my-id' is correct, 'My-ID' is not.`\n\t\t: IsAlphaNumeric<S> extends true\n\t\t\t? S\n\t\t\t: `Error: The part '${S}' should only contain lowercase alphanumeric characters (a to z, 0 to 9). Example: 'my-id' is correct, 'My-ID' is not.`\n\n/**\n * Function type for tracking custom events with a valid tracking ID.\n * Throws an error if the tracking ID is invalid.\n *\n * @param trackingId - Valid format: lowercase alphanumeric + hyphens as separators\n * - No leading/trailing hyphens or consecutive hyphens\n * - Examples: \"button-click\", \"form-submit\", \"video-play\", \"nav-item-1\"\n *\n * @public\n */\nexport type TrackCustomEvent = <T extends string>(\n\ttrackingId: ValidTrackingId<T> extends T ? T : ValidTrackingId<T>,\n) => void\n\n/**\n * React hook for tracking custom events on published Framer sites.\n *\n * @returns {TrackCustomEvent} Function that sends tracking events with valid IDs.\n * Throws an error if the tracking ID is invalid.\n *\n * Tracking ID rules:\n * - Lowercase letters (a-z) and numbers (0-9) only\n * - Hyphens (-) as separators (no leading/trailing or consecutive hyphens)\n * - Valid: \"button-click\", \"form-submit\", \"video-play\", \"nav-item-1\"\n * - Invalid: \"Button-Click\", \"form--submit\", \"-button-click\", \"button_utils\"\n *\n * @example\n *\n * ```\n * function MyButton() {\n *     const trackEvent = useTracking()\n *     return <button onClick={() => trackEvent(\"button-click\")}>Click me</button>\n * }\n * ```\n *\n * @public\n */\nexport function useTracking(): TrackCustomEvent {\n\tconst router = useRouter()\n\tconst nodeId = useContext(NodeIdContext)\n\n\treturn useCallback(\n\t\ttrackingId => {\n\t\t\tif (!router.pageviewEventData?.current) return\n\n\t\t\t// Validate tracking ID\n\t\t\tif (!isValidTrackingId(trackingId)) {\n\t\t\t\tthrow new Error(`Invalid tracking ID: ${trackingId}`)\n\t\t\t}\n\n\t\t\t// We assume router.pageviewEventData is set at this point.\n\t\t\t// It looks like a race-condition in theory, but isn't in practice: The routers\n\t\t\t// `useEffect` runs pretty early during page load and we disable Reacts\n\t\t\t// event replaying system for improved INP in\n\t\t\t// src/library/src/router/hydration/reactHydrationINPOptimizer.ts\n\t\t\t// This means, this callback in practice doesn't trigger before the useEffect has run.\n\t\t\tif (router.pageviewEventData.current instanceof Promise) {\n\t\t\t\tvoid router.pageviewEventData.current.then(eventData => sendCustomTrackingEvent(eventData, nodeId, trackingId))\n\t\t\t} else {\n\t\t\t\tsendCustomTrackingEvent(router.pageviewEventData.current, nodeId, trackingId)\n\t\t\t}\n\t\t},\n\t\t[router, nodeId],\n\t)\n}\n\nfunction sendCustomTrackingEvent(eventData: PageviewEventData, nodeId: null | string, trackingId: string) {\n\tsendTrackingEvent(\n\t\t\"published_site_custom_event\",\n\t\t{\n\t\t\t...eventData,\n\t\t\tnodeId,\n\t\t\t// Don't attach a tracking ID if it's empty\n\t\t\ttrackingId: trackingId || null,\n\t\t},\n\t\t\"eager\",\n\t)\n}\n", "// Note: We don't use the \"slugify\" package here because we want a very specific\n// behavior for our CMS and web pages. Make sure to pick the right slugify\n// function for your use case!\n\n// Characters that are problematic in URLs and should be replaced with dashes:\n// - Whitespace (\\s)\n// - URL reserved delimiters: ? # [ ] @\n// - Characters with special meaning: ! $ & ' * + , ; : = \" < > % { } | \\ ^ ` /\n//   - : denotes paths on MacOS / reserved for drive letters on Windows\n// All other characters (including unicode letters, numbers, symbols) are kept.\nconst unsafeSlugCharactersRegExp = /[\\s?#[\\]@!$&'*+,;:=\"<>%{}|\\\\^`/]+/gu\n\n/**\n * Trim leading and trailing dashes from a string.\n * We can't use a regexp, because matching e.g. /-+$/gu leads to polynomial backtracking with e.g. '-'.repeat(54773) + '\\x00-'\n */\nexport function trimDashes(str: string): string {\n\tlet start = 0\n\tlet end = str.length\n\twhile (start < end && str[start] === \"-\") start++\n\twhile (end > start && str[end - 1] === \"-\") end--\n\treturn str.slice(start, end)\n}\n\n/**\n * Takes a freeform string and converts it to a URL-safe slug.\n * Replaces problematic URL characters and combinations with dashes while preserving:\n * - Unicode letters and numbers\n * - Unicode symbols (\u00B1, \u00A7, etc.)\n * - URL-safe punctuation: - . ~ ( ) _\n */\nexport function slugify(value: string): string {\n\treturn trimDashes(value.trim().toLowerCase().replace(unsafeSlugCharactersRegExp, \"-\"))\n}\n", "import React from \"react\"\n\n/**\n * React context used to track the current node ID in the component hierarchy.\n * This is used by the `useTracking` hook to associate events with specific nodes.\n * @internal\n */\nexport const NodeIdContext = /* @__PURE__ */ React.createContext<string | null>(null)\n", "import {\n\ttype PropsWithChildren,\n\tcreateContext,\n\tstartTransition,\n\tuseCallback,\n\tuseContext,\n\tuseDeferredValue,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n\tuseSyncExternalStore,\n\tuseEffect,\n} from \"react\"\nimport { useRenderTargetEnvironment } from \"../modules/RenderTargetEnvironmentContext.tsx\"\nimport { useCollectionUtils } from \"../modules/cms/CollectionUtilsCache.tsx\"\nimport { isEqual } from \"../render/utils/isEqual.ts\"\nimport { assert } from \"../utils/assert.ts\"\nimport { useMemoOne } from \"../utils/useMemoOne.ts\"\nimport { isArray, isBoolean, isNumber, isPromise, isString, isUndefined } from \"../utils/utils.ts\"\nimport { yieldToMain } from \"../utils/yield.ts\"\nimport { useRouter } from \"./RouterContext.tsx\"\nimport { type HistoryState, pushHistoryState, replaceHistoryState } from \"./history.ts\"\nimport type { Locale, MaybePromise } from \"./types.ts\"\nimport { useLocaleInfo } from \"./useLocale.ts\"\nimport { EMPTY_ARRAY } from \"./utils.ts\"\n\nconst urlSearchStringSubscribers = new Set<() => void>()\n\nfunction getURLSearchStringSnapshot() {\n\treturn window.location.search\n}\n\nfunction getServerURLSearchStringSnapshot() {\n\treturn \"\"\n}\n\nfunction subscribeToURLSearchString(callback: () => void) {\n\turlSearchStringSubscribers.add(callback)\n\twindow.addEventListener(\"popstate\", callback)\n\n\treturn () => {\n\t\turlSearchStringSubscribers.delete(callback)\n\t\twindow.removeEventListener(\"popstate\", callback)\n\t}\n}\n\nfunction notifyURLSearchStringSubscribers() {\n\tfor (const subscriber of urlSearchStringSubscribers) subscriber()\n}\n\nconst URLSearchParamsContext = /* @__PURE__ */ (() => {\n\tconst Context = createContext<{\n\t\turlSearchParams: URLSearchParams\n\t\treplaceSearchParams: (replacer: (currentParams: URLSearchParams) => URLSearchParams) => Promise<void>\n\t}>({\n\t\turlSearchParams: new URLSearchParams(),\n\t\treplaceSearchParams: async () => {},\n\t})\n\tContext.displayName = \"URLSearchParamsContext\"\n\treturn Context\n})()\n\nexport function URLSearchParamsProvider({ children }: PropsWithChildren) {\n\tconst renderTargetEnvironment = useRenderTargetEnvironment()\n\tconst isPreview = renderTargetEnvironment === \"preview\"\n\tconst [previewURLSearchString, setPreviewURLSearchString] = useState(\"\")\n\t// eslint-disable-next-line framer-studio/no-usesyncexternalstore -- fine here, because we use useDeferredValue to defer + `useMemoOne` to memoize the value\n\tconst siteURLSearchString = useSyncExternalStore(\n\t\tsubscribeToURLSearchString,\n\t\tgetURLSearchStringSnapshot,\n\t\tgetServerURLSearchStringSnapshot,\n\t)\n\tconst deferredURLSearchString = useDeferredValue(siteURLSearchString)\n\n\t// The router navigates between routes via `pushState`, which doesn't fire `popstate`. Without\n\t// an event we can subscribe to, but reading its context still re-renders this provider after\n\t// router-driven URL changes so the external store can pick up the latest location.search.\n\tuseRouter()\n\n\tconst urlSearchString = isPreview ? previewURLSearchString : deferredURLSearchString\n\n\tconst replaceSearchParams = useCallback(\n\t\tasync (replacer: (currentParams: URLSearchParams) => URLSearchParams) => {\n\t\t\tif (isPreview) {\n\t\t\t\tstartTransition(() => {\n\t\t\t\t\tsetPreviewURLSearchString(currentSearchString => {\n\t\t\t\t\t\tconst currentParams = new URLSearchParams(currentSearchString)\n\t\t\t\t\t\treturn replacer(currentParams).toString()\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tawait yieldToMain({ continueAfter: \"paint\" })\n\n\t\t\tconst currentHistoryState: HistoryState = window.history.state\n\t\t\tconst url = new URL(window.location.href)\n\t\t\tconst newSearchString = replacer(url.searchParams).toString()\n\t\t\turl.search = newSearchString\n\n\t\t\t// First filter change: pushState so browser back clears all filters.\n\t\t\t// Intermediate changes: replaceState so they collapse into one history step.\n\t\t\t// When all filters are cleared: pushState so back/forward toggles between\n\t\t\t// \"filters on\" and \"filters off\" instead of leaving identical ghost entries.\n\t\t\t// We store the pre-push search string so we can detect full clear, even when\n\t\t\t// non-filter params like utm_source keep the URL non-empty.\n\t\t\tconst originalSearch = currentHistoryState?.queryParamBackAnchorSearch\n\t\t\tconst currentSearch = window.location.search.slice(1)\n\t\t\tconst isFirstFilterChange = originalSearch === undefined && newSearchString !== currentSearch\n\t\t\tconst filtersCleared = originalSearch !== undefined && newSearchString === originalSearch\n\t\t\tconst nextHistoryState: HistoryState = {\n\t\t\t\t...currentHistoryState,\n\t\t\t\tqueryParamBackAnchorSearch: filtersCleared\n\t\t\t\t\t? undefined\n\t\t\t\t\t: (originalSearch ?? (isFirstFilterChange ? currentSearch : undefined)),\n\t\t\t}\n\n\t\t\tconst urlString = url.toString()\n\t\t\tif (isFirstFilterChange || filtersCleared) {\n\t\t\t\tawait pushHistoryState(nextHistoryState, urlString)\n\t\t\t} else {\n\t\t\t\treplaceHistoryState(nextHistoryState, urlString)\n\t\t\t}\n\t\t\tnotifyURLSearchStringSubscribers()\n\t\t},\n\t\t[isPreview],\n\t)\n\n\tconst value = useMemoOne(\n\t\t() => ({\n\t\t\turlSearchParams: new URLSearchParams(urlSearchString),\n\t\t\treplaceSearchParams,\n\t\t}),\n\t\t[urlSearchString, replaceSearchParams],\n\t)\n\n\treturn <URLSearchParamsContext.Provider value={value}>{children}</URLSearchParamsContext.Provider>\n}\n\ntype UseQueryParamResult<T> = [T, (newValue: T) => Promise<void>]\nexport type OptionalFlag = boolean | undefined\nexport type OptionalValue<T, Optional extends OptionalFlag> = Optional extends true ? T | undefined : T\n\ninterface UseStringArrayQueryParamOptions {\n\tparameterName: string\n}\n\nfunction useStringArrayQueryParam({\n\tparameterName,\n}: UseStringArrayQueryParamOptions): [readonly string[], (newValues: readonly string[]) => Promise<void>] {\n\t// We don't support changing the parameter name after the initial render, so ignore updates.\n\tconst parameterNameRef = useRef(parameterName)\n\n\tconst { urlSearchParams, replaceSearchParams } = useContext(URLSearchParamsContext)\n\n\tconst value = useMemo<readonly string[]>(() => {\n\t\treturn urlSearchParams.getAll(parameterNameRef.current)\n\t}, [urlSearchParams])\n\n\tconst setValue = useCallback(\n\t\tasync (newValues: readonly string[]) => {\n\t\t\tif (!isArray(newValues)) return\n\n\t\t\tawait replaceSearchParams(currentSearchParams => {\n\t\t\t\tconst name = parameterNameRef.current\n\t\t\t\tconst next = new URLSearchParams()\n\n\t\t\t\tlet inserted = false\n\n\t\t\t\tfor (const [key, originalValue] of currentSearchParams.entries()) {\n\t\t\t\t\tif (key !== name) {\n\t\t\t\t\t\tnext.append(key, originalValue)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif (inserted) continue\n\t\t\t\t\tinserted = true\n\n\t\t\t\t\tfor (const newValue of newValues) {\n\t\t\t\t\t\tif (!isString(newValue)) continue\n\t\t\t\t\t\tnext.append(name, newValue)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!inserted) {\n\t\t\t\t\tfor (const newValue of newValues) {\n\t\t\t\t\t\tif (!isString(newValue)) continue\n\t\t\t\t\t\tnext.append(name, newValue)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn next\n\t\t\t})\n\t\t},\n\t\t[replaceSearchParams],\n\t)\n\n\treturn [value, setValue]\n}\n\ninterface UseStringQueryParamOptions<Optional extends OptionalFlag = undefined> {\n\tinitialValue: OptionalValue<string, Optional>\n\tparameterName: string\n\toptional?: Optional\n}\n\nexport function useStringQueryParam<Optional extends OptionalFlag = undefined>({\n\tinitialValue,\n\tparameterName,\n\toptional,\n}: UseStringQueryParamOptions<Optional>): UseQueryParamResult<OptionalValue<string, Optional>> {\n\tconst initialValueRef = useRef(optional ? undefined : isString(initialValue) ? initialValue : \"\")\n\tconst [arrayValue, setArrayValue] = useStringArrayQueryParam({ parameterName })\n\n\tconst value = useMemo<OptionalValue<string, Optional>>(() => {\n\t\tif (arrayValue.length === 0) return initialValueRef.current as OptionalValue<string, Optional>\n\t\treturn arrayValue[0] ?? \"\"\n\t}, [arrayValue])\n\n\tconst setValue = useCallback(\n\t\tasync (newValue: OptionalValue<string, Optional>) => {\n\t\t\tconst initial = initialValueRef.current\n\t\t\tif (newValue === initial) return setArrayValue(EMPTY_ARRAY)\n\t\t\tif (!isString(newValue)) return\n\t\t\treturn setArrayValue([newValue])\n\t\t},\n\t\t[setArrayValue],\n\t)\n\n\treturn [value, setValue]\n}\n\nconst BOOLEAN_YES = \"yes\"\nconst BOOLEAN_NO = \"no\"\n\ninterface UseBooleanQueryParamOptions<Optional extends OptionalFlag = undefined> {\n\tinitialValue: OptionalValue<boolean, Optional>\n\tparameterName: string\n\toptional?: Optional\n}\n\nexport function useBooleanQueryParam<Optional extends OptionalFlag = undefined>({\n\tinitialValue,\n\tparameterName,\n\toptional,\n}: UseBooleanQueryParamOptions<Optional>): UseQueryParamResult<OptionalValue<boolean, Optional>> {\n\tconst initialValueRef = useRef<OptionalValue<string, Optional>>(\n\t\t(optional ? undefined : initialValue ? BOOLEAN_YES : BOOLEAN_NO) as OptionalValue<string, Optional>,\n\t)\n\n\tconst [stringValue, setStringValue] = useStringQueryParam({\n\t\tinitialValue: initialValueRef.current,\n\t\tparameterName,\n\t\toptional,\n\t})\n\n\tconst value = useMemo<OptionalValue<boolean, Optional>>(() => {\n\t\tif (stringValue === BOOLEAN_YES) return true\n\t\tif (stringValue === BOOLEAN_NO) return false\n\t\tif (isUndefined(stringValue)) return undefined as OptionalValue<boolean, Optional>\n\t\tif (initialValueRef.current === BOOLEAN_YES) return true\n\t\tif (initialValueRef.current === BOOLEAN_NO) return false\n\t\treturn undefined as OptionalValue<boolean, Optional>\n\t}, [stringValue])\n\n\tconst setValue = useCallback(\n\t\tasync (newValue: OptionalValue<boolean, Optional>) => {\n\t\t\tif (isUndefined(newValue)) return setStringValue(undefined as OptionalValue<string, Optional>)\n\t\t\tif (!isBoolean(newValue)) return\n\t\t\treturn setStringValue(newValue ? BOOLEAN_YES : BOOLEAN_NO)\n\t\t},\n\t\t[setStringValue],\n\t)\n\n\treturn [value, setValue]\n}\n\nfunction parseNumberQueryParam(value: string): number | undefined {\n\t// If the value contains both comma and dot, it's invalid.\n\tconst includesComma = value.includes(\",\")\n\tconst includesDot = value.includes(\".\")\n\tif (includesComma && includesDot) return undefined\n\n\tconst normalizedValue = includesComma ? value.replace(\",\", \".\") : value\n\tconst parsed = Number(normalizedValue)\n\n\tif (!isNumber(parsed)) return undefined\n\treturn parsed\n}\n\nfunction serializeNumberQueryParam(value: number): string {\n\treturn String(value)\n}\n\ninterface UseNumberQueryParamOptions<Optional extends OptionalFlag = undefined> {\n\tinitialValue: OptionalValue<number, Optional>\n\tparameterName: string\n\toptional?: Optional\n}\n\nexport function useNumberQueryParam<Optional extends OptionalFlag = undefined>({\n\tinitialValue,\n\tparameterName,\n\toptional,\n}: UseNumberQueryParamOptions<Optional>): UseQueryParamResult<OptionalValue<number, Optional>> {\n\tconst initialNumberValueRef = useRef(\n\t\t(optional ? undefined : isNumber(initialValue) ? initialValue : 0) as OptionalValue<number, Optional>,\n\t)\n\tconst initialStringValueRef = useRef<OptionalValue<string, Optional>>(\n\t\tisNumber(initialNumberValueRef.current)\n\t\t\t? serializeNumberQueryParam(initialNumberValueRef.current)\n\t\t\t: (undefined as OptionalValue<string, Optional>),\n\t)\n\n\tconst [stringValue, setStringValue] = useStringQueryParam({\n\t\tinitialValue: initialStringValueRef.current,\n\t\tparameterName,\n\t\toptional,\n\t})\n\n\tconst value = useMemo(() => {\n\t\tif (isUndefined(stringValue)) return undefined as OptionalValue<number, Optional>\n\t\tconst parsed = parseNumberQueryParam(stringValue)\n\t\tif (isNumber(parsed)) return parsed\n\t\treturn initialNumberValueRef.current\n\t}, [stringValue])\n\n\tconst setValue = useCallback(\n\t\tasync (newValue: OptionalValue<number, Optional>) => {\n\t\t\tif (!isNumber(newValue)) return setStringValue(undefined as OptionalValue<string, Optional>)\n\t\t\treturn setStringValue(serializeNumberQueryParam(newValue))\n\t\t},\n\t\t[setStringValue],\n\t)\n\n\treturn [value, setValue]\n}\n\nconst dateOnlyLength = 10 // 2025-01-01\nconst dateTimeLength = 16 // 2025-01-01T00:00\nconst isoDateTimeCompletionTemplate = \"0000-00-00T00:00:00.000Z\"\n\nfunction getCompleteDateTime(value: string): string | undefined {\n\ttry {\n\t\tconst completeDate = value + isoDateTimeCompletionTemplate.slice(value.length)\n\t\tconst date = new Date(completeDate)\n\n\t\t// Check if the date is valid.\n\t\tif (Number.isNaN(date.getTime())) return undefined\n\n\t\t// Check if the date is valid according to the ISO 8601 format. Checking against the ISO\n\t\t// string prevents having to parse the value manually.\n\t\tif (!date.toISOString().startsWith(value)) return undefined\n\n\t\treturn completeDate\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\nfunction parseDateQueryParam(value: string): string | undefined {\n\tif (\n\t\tvalue.length === dateOnlyLength ||\n\t\tvalue.length === dateTimeLength ||\n\t\tvalue.length === isoDateTimeCompletionTemplate.length\n\t) {\n\t\treturn getCompleteDateTime(value)\n\t}\n\n\treturn undefined\n}\n\nfunction serializeDateQueryParam(value: string, displayTime: boolean): string | undefined {\n\tconst completeDate = getCompleteDateTime(value)\n\tif (!completeDate) return undefined\n\n\tif (!displayTime) return completeDate.slice(0, dateOnlyLength)\n\treturn completeDate.slice(0, dateTimeLength)\n}\n\ninterface UseDateQueryParamOptions<Optional extends OptionalFlag = undefined> {\n\tinitialValue: OptionalValue<string | undefined, Optional>\n\tparameterName: string\n\tdisplayTime?: boolean\n\toptional?: Optional\n}\n\nexport function useDateQueryParam<Optional extends OptionalFlag = undefined>({\n\tinitialValue,\n\tparameterName,\n\tdisplayTime,\n\toptional,\n}: UseDateQueryParamOptions<Optional>): UseQueryParamResult<OptionalValue<string, Optional>> {\n\tconst displayTimeRef = useRef(isBoolean(displayTime) ? displayTime : false)\n\tconst initialStringValueRef = useRef(\n\t\toptional || !isString(initialValue) ? undefined : serializeDateQueryParam(initialValue, displayTimeRef.current),\n\t)\n\n\tconst [stringValue, setStringValue] = useStringQueryParam({\n\t\tinitialValue: initialStringValueRef.current,\n\t\tparameterName,\n\t\toptional: isUndefined(initialStringValueRef.current),\n\t})\n\n\tconst value = useMemo<OptionalValue<string, Optional>>(() => {\n\t\tif (isUndefined(stringValue)) return undefined as OptionalValue<string, Optional>\n\t\tconst date = parseDateQueryParam(stringValue) as OptionalValue<string, Optional>\n\t\tif (isString(date)) return date\n\t\tconst initialDate = initialStringValueRef.current\n\t\tif (!isString(initialDate)) return undefined as OptionalValue<string, Optional>\n\t\treturn parseDateQueryParam(initialDate) as OptionalValue<string, Optional>\n\t}, [stringValue])\n\n\tconst setValue = useCallback(\n\t\tasync (newValue: OptionalValue<string, Optional>): Promise<void> => {\n\t\t\tif (isUndefined(newValue)) return setStringValue(undefined as OptionalValue<string, Optional>)\n\t\t\tif (!isString(newValue)) return\n\t\t\tconst serializedDate = serializeDateQueryParam(newValue, displayTimeRef.current)\n\t\t\tif (!isString(serializedDate)) return\n\t\t\treturn setStringValue(serializedDate)\n\t\t},\n\t\t[setStringValue],\n\t)\n\n\treturn [value, setValue]\n}\n\ninterface UseCollectionReferenceQueryParamOptions<Optional extends OptionalFlag = undefined> {\n\tcollectionId: string\n\tinitialValue: OptionalValue<string | undefined, Optional>\n\tparameterName: string\n\toptional?: Optional\n}\n\nexport function useCollectionReferenceQueryParam<Optional extends OptionalFlag = undefined>({\n\tcollectionId,\n\tinitialValue,\n\tparameterName,\n\toptional,\n}: UseCollectionReferenceQueryParamOptions<Optional>): UseQueryParamResult<string | undefined> {\n\tconst collectionUtils = useCollectionUtils()\n\tconst locale = useLocaleInfo().activeLocale ?? undefined\n\n\tconst initialValueRef = useRef(optional ? undefined : initialValue)\n\n\tconst [slug, setSlug] = useStringQueryParam({\n\t\tinitialValue: undefined,\n\t\tparameterName,\n\t\toptional: true,\n\t})\n\n\tconst id = useMemo(() => {\n\t\tif (!isString(slug)) return initialValueRef.current\n\t\tconst cache = getCollectionUtilsCache(collectionUtils, collectionId)\n\t\treturn use(cache.getRecordIdBySlug(slug, locale))\n\t}, [collectionUtils, collectionId, locale, slug])\n\n\tconst setId = useCallback(\n\t\tasync (newId: OptionalValue<string, Optional>) => {\n\t\t\tif (isUndefined(newId)) return setSlug(undefined)\n\t\t\tconst cache = getCollectionUtilsCache(collectionUtils, collectionId)\n\t\t\tconst newSlug = await cache.getSlugByRecordId(newId, locale)\n\t\t\tif (!isString(newSlug)) return\n\t\t\tawait setSlug(newSlug)\n\t\t},\n\t\t[collectionUtils, collectionId, locale, setSlug],\n\t)\n\n\treturn [id, setId]\n}\n\ninterface UseMultiCollectionReferenceQueryParamOptions<Optional extends OptionalFlag = undefined> {\n\tcollectionId: string\n\tinitialValue: OptionalValue<readonly string[], Optional>\n\tparameterName: string\n\toptional?: Optional\n}\n\nexport function useMultiCollectionReferenceQueryParam<Optional extends OptionalFlag = undefined>({\n\tcollectionId,\n\tinitialValue,\n\tparameterName,\n\toptional,\n}: UseMultiCollectionReferenceQueryParamOptions<Optional>): UseQueryParamResult<\n\tOptionalValue<readonly string[], Optional>\n> {\n\ttype ValueType = OptionalValue<readonly string[], Optional>\n\n\tconst collectionUtils = useCollectionUtils()\n\tconst locale = useLocaleInfo().activeLocale ?? undefined\n\n\tconst initialArrayValue = useRef<ValueType>(\n\t\t(optional ? undefined : isArray(initialValue) ? initialValue : EMPTY_ARRAY) as ValueType,\n\t)\n\n\tconst [slugs, setSlugs] = useStringArrayQueryParam({ parameterName })\n\n\tconst ids = useMemo<OptionalValue<readonly string[], Optional>>(() => {\n\t\tif (slugs.length === 0) return initialArrayValue.current\n\n\t\tconst cache = getCollectionUtilsCache(collectionUtils, collectionId)\n\t\t// TODO: make CollectionUtilsCache be able to resolve these in a single query\n\t\tconst maybePromises = slugs.filter(isNonEmptyString).map(slug => cache.getRecordIdBySlug(slug, locale))\n\n\t\tconst supportsOptional = isUndefined(initialArrayValue.current)\n\n\t\t// biome-ignore lint/correctness/useHookAtTopLevel: not a hook\n\t\tconst resolvedIds = useAll(maybePromises).filter(isString)\n\t\tif (resolvedIds.length === 0 && supportsOptional) return undefined as OptionalValue<readonly string[], Optional>\n\t\treturn resolvedIds as OptionalValue<readonly string[], Optional>\n\t}, [collectionUtils, collectionId, locale, slugs])\n\n\tconst setIds = useCallback(\n\t\tasync (newIds: OptionalValue<readonly string[], Optional>) => {\n\t\t\tif (isUndefined(newIds)) return setSlugs(EMPTY_ARRAY)\n\t\t\tif (!isArray(newIds)) return\n\n\t\t\tconst initialArray = initialArrayValue.current\n\t\t\tif (newIds.length === 0 && isArray(initialArray) && !isEqual(newIds, initialArray)) {\n\t\t\t\treturn setSlugs([\"\"])\n\t\t\t}\n\n\t\t\tconst cache = getCollectionUtilsCache(collectionUtils, collectionId)\n\t\t\tconst newSlugs = await Promise.all(newIds.map(id => cache.getSlugByRecordId(id, locale)))\n\t\t\tawait setSlugs(newSlugs.filter(isString))\n\t\t},\n\t\t[collectionUtils, collectionId, locale, setSlugs],\n\t)\n\n\treturn [ids, setIds]\n}\n\nfunction isNonEmptyString(value: unknown): value is Exclude<string, \"\"> {\n\treturn isString(value) && value !== \"\"\n}\n\nexport interface UseEnumQueryParamOptions<Optional extends OptionalFlag = undefined> {\n\tinitialValue: OptionalValue<string, Optional>\n\tparameterName: string\n\toptions: readonly string[] | undefined\n\tgetOptionTitle: ((id: string, locale?: Locale) => string | undefined) | undefined\n\toptional?: Optional\n}\n\nconst noOpGetOptionTitle = () => undefined\n\nexport function useEnumQueryParam<Optional extends OptionalFlag = undefined>({\n\tinitialValue,\n\tparameterName,\n\toptions = EMPTY_ARRAY,\n\tgetOptionTitle = noOpGetOptionTitle,\n\toptional,\n}: UseEnumQueryParamOptions<Optional>): UseQueryParamResult<OptionalValue<string, Optional>> {\n\tuseEffect(() => {\n\t\tif (options === EMPTY_ARRAY || getOptionTitle === noOpGetOptionTitle) {\n\t\t\t// biome-ignore lint/suspicious/noConsole: intentional\n\t\t\tconsole.warn(\n\t\t\t\t\"[useEnumQueryParam]\",\n\t\t\t\t`The URL variable \\`${parameterName}\\` is misconfigured because the referenced Option field was removed from the collection. Filters using this variable are disabled, and updating the variable will have no effect.`,\n\t\t\t)\n\t\t}\n\t}, [options, getOptionTitle, parameterName])\n\n\tconst locale = useLocaleInfo().activeLocale ?? undefined\n\n\tconst titleToIdMap = useMemo(() => {\n\t\tconst map = new Map<string, string>()\n\n\t\tfor (const id of options) {\n\t\t\tconst title = getOptionTitle(id, locale)\n\t\t\tif (!title) continue\n\t\t\tmap.set(title, id)\n\t\t}\n\n\t\treturn map\n\t}, [locale, options, getOptionTitle])\n\n\tconst initialTitle = useMemo(() => {\n\t\tif (!initialValue) return undefined as OptionalValue<string, Optional>\n\t\tif (!options.includes(initialValue)) return undefined as OptionalValue<string, Optional>\n\t\treturn getOptionTitle(initialValue, locale) || \"\"\n\t}, [locale, initialValue, options, getOptionTitle])\n\n\tconst [titleValue, setTitleValue] = useStringQueryParam({\n\t\tinitialValue: initialTitle,\n\t\tparameterName,\n\t\toptional,\n\t})\n\n\tconst value = useMemo<OptionalValue<string, Optional>>(() => {\n\t\tconst validInitialId =\n\t\t\tinitialValue && options.includes(initialValue) ? initialValue : (undefined as OptionalValue<string, Optional>)\n\n\t\tif (isUndefined(titleValue)) {\n\t\t\treturn undefined as OptionalValue<string, Optional>\n\t\t}\n\t\tif (!titleValue) return validInitialId\n\n\t\tconst resolvedId = titleToIdMap.get(titleValue)\n\t\tif (!resolvedId) {\n\t\t\t// This can only happen if the URL parameters are invalid\n\t\t\t// (maybe the user manually changed it, maybe the enum option got deleted but the user had saved the URL)\n\t\t\tif (optional) return undefined as OptionalValue<string, Optional>\n\t\t\treturn validInitialId\n\t\t}\n\n\t\treturn resolvedId as OptionalValue<string, Optional>\n\t}, [titleValue, titleToIdMap, initialValue, options, optional])\n\n\tconst setValue = useCallback(\n\t\tasync (newValue: OptionalValue<string, Optional>): Promise<void> => {\n\t\t\tif (isUndefined(newValue)) {\n\t\t\t\treturn setTitleValue(undefined as OptionalValue<string, Optional>)\n\t\t\t}\n\n\t\t\tconst title = getOptionTitle(newValue, locale)\n\t\t\tif (title) {\n\t\t\t\treturn setTitleValue(title)\n\t\t\t}\n\t\t},\n\t\t[setTitleValue, locale, getOptionTitle],\n\t)\n\n\treturn [value, setValue]\n}\n\nfunction getCollectionUtilsCache(collectionUtils: ReturnType<typeof useCollectionUtils>, collectionId: string) {\n\tconst collectionUtilsCache = collectionUtils?.get(collectionId)\n\tassert(collectionUtilsCache, \"CollectionUtilsCache not found for collectionId:\", collectionId)\n\treturn collectionUtilsCache\n}\n\n// eslint-disable-next-line @eslint-react/hooks-extra/no-redundant-custom-hook,@eslint-react/hooks-extra/no-unnecessary-use-prefix\nfunction use<T>(maybePromise: MaybePromise<T>): T {\n\tif (isPromise(maybePromise)) throw maybePromise\n\treturn maybePromise\n}\n\n// eslint-disable-next-line @eslint-react/hooks-extra/no-redundant-custom-hook,@eslint-react/hooks-extra/no-unnecessary-use-prefix\nfunction useAll<T>(maybePromises: readonly MaybePromise<T>[]): readonly T[] {\n\tfor (const maybePromise of maybePromises) {\n\t\tif (isPromise(maybePromise)) {\n\t\t\tthrow Promise.all(maybePromises)\n\t\t}\n\t}\n\n\treturn maybePromises as readonly T[]\n}\n", "import type { PropsWithChildren } from \"react\"\nimport { createContext, useContext } from \"react\"\n\n/**\n * As opposed to {@link RenderTarget.preview}, which is true for both the in-editor preview AND published sites,\n * RenderTargetEnvironment is our internal way to differentiate them.\n *\n * We do not want to give this ability to the public because for their use cases, their sites should behave the same in\n * both environments.\n *\n * Use {@link useRenderTargetEnvironment} to read this value.\n *\n * @internal\n */\nexport type RenderTargetEnvironment = \"preview\" | \"site\"\n\nconst RenderTargetEnvironmentContext = /* @__PURE__ */ (() => {\n\tconst Context = createContext<RenderTargetEnvironment>(\"preview\")\n\tContext.displayName = \"RenderTargetEnvironmentContext\"\n\treturn Context\n})()\n\n/**\n * @internal\n */\nexport function RenderTargetEnvironmentProvider({\n\tchildren,\n\tvalue,\n}: PropsWithChildren<{ value: RenderTargetEnvironment }>) {\n\treturn <RenderTargetEnvironmentContext.Provider value={value}>{children}</RenderTargetEnvironmentContext.Provider>\n}\n\n/**\n * Returns whether the current RenderTarget is the in-app preview or the live site.\n *\n * @internal\n */\nexport function useRenderTargetEnvironment() {\n\treturn useContext(RenderTargetEnvironmentContext)\n}\n", "import { type DependencyList, useEffect, useRef, useState } from \"react\"\nimport { isEqual } from \"../render/utils/isEqual.ts\"\n\ninterface Cache<T> {\n\tinputs: DependencyList | undefined\n\tresult: T\n}\n\n/**\n * Like React.useMemo, but guarantees that it isn't garbage collected in the future.\n * Use this over the native `useMemo` when the memo ensures correctness.\n * If the memo is only intended as performance optimization (to prevent re-renders), use `useMemo` instead.\n *\n * @see React.useMemo\n * @see https://github.com/facebook/react/issues/15278 for why React.useMemo might be garbage collected in the future\n * @see https://bsky.app/profile/gsathya.bsky.social/post/3lbjz4g3czc2t\n *\n * Based on https://github.com/alexreardon/use-memo-one/blob/529e418f986d5401b4813bd6882884d5bfc0268d/src/index.js.\n */\nexport function useMemoOne<T>(factory: () => T, inputs?: DependencyList): T {\n\tconst initial: Cache<T> = useState(() => ({\n\t\tinputs,\n\t\tresult: factory(),\n\t}))[0]\n\tconst isFirstRun = useRef<boolean>(true)\n\tconst committed = useRef<Cache<T>>(initial)\n\n\t// Persist any uncommitted changes after they have been committed.\n\tconst useCache: boolean =\n\t\tisFirstRun.current ||\n\t\tBoolean(inputs && committed.current.inputs && isEqual(inputs, committed.current.inputs, false))\n\n\t// Create a new cache if required\n\tconst cache: Cache<T> = useCache\n\t\t? committed.current\n\t\t: {\n\t\t\t\tinputs,\n\t\t\t\tresult: factory(),\n\t\t\t}\n\n\t// Commit the cache. This is needed to ensure concurrent renders don't update the cache before React commits the final render.\n\tuseEffect(() => {\n\t\tisFirstRun.current = false\n\t\tcommitted.current = cache\n\t}, [cache])\n\n\treturn cache.result\n}\n\nexport function useCallbackOne<T extends (...args: unknown[]) => unknown>(callback: T, inputs?: DependencyList): T {\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: `inputs` is the dependency list for the callback, so no need to add `callback` itself as a dependency\n\treturn useMemoOne(() => callback, inputs)\n}\n", "import React from \"react\"\nimport { useCollectionUtils } from \"../modules/cms/CollectionUtilsCache.tsx\"\nimport { useRouter } from \"./RouterContext.tsx\"\nimport { getLocalesForCurrentRoute } from \"./getLocalesForCurrentRoute.ts\"\nimport type { Locale, LocaleInfo, LocalizationInfo, TextDirection } from \"./types.ts\"\n\nconst noopAsync = async () => {}\n\nconst defaultLocaleInfo: LocaleInfo = {\n\tactiveLocale: null,\n\tlocales: [],\n\tsetLocale: noopAsync,\n}\n\nexport const LocaleInfoContext = /* @__PURE__ */ (() => {\n\tconst Context = React.createContext<LocaleInfo>(defaultLocaleInfo)\n\tContext.displayName = \"LocaleInfoContext\"\n\treturn Context\n})()\n\n/**\n * @public\n * @returns The active locale, all of the available locales, and a way to change the active locale.\n */\nexport function useLocaleInfo(): LocaleInfo {\n\treturn React.useContext(LocaleInfoContext)\n}\n\n/**\n * @public\n * @returns The locales that are available for the current route.\n */\nexport function useLocalesForCurrentRoute(): readonly Locale[] {\n\tconst { currentRouteId, routes, currentPathVariables } = useRouter()\n\tconst { activeLocale, locales } = useLocaleInfo()\n\tconst [localesForCurrentRoute, setLocalesForCurrentRoute] = React.useState<readonly Locale[]>(() =>\n\t\tactiveLocale ? [activeLocale] : [],\n\t)\n\n\tconst currentRoute = currentRouteId ? routes?.[currentRouteId] : undefined\n\n\tconst collectionUtils = useCollectionUtils()\n\n\t// Each route may be hidden for certain locales, when the route changes\n\t// we need to recompute the selectable locales\n\tReact.useEffect(() => {\n\t\tlet active = true\n\n\t\tgetLocalesForCurrentRoute(activeLocale, locales, currentRoute, currentPathVariables, collectionUtils)\n\t\t\t.then(localesSubset => {\n\t\t\t\tif (!active) return\n\t\t\t\tReact.startTransition(() => {\n\t\t\t\t\tif (localesSubset) {\n\t\t\t\t\t\tsetLocalesForCurrentRoute(localesSubset)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetLocalesForCurrentRoute(activeLocale ? [activeLocale] : [])\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t\t\t.catch(() => {}) // Swallow any errors\n\n\t\treturn () => {\n\t\t\tactive = false\n\t\t}\n\t}, [activeLocale, locales, collectionUtils, currentRoute, currentPathVariables])\n\n\treturn localesForCurrentRoute\n}\n\n/**\n * Only used in code generation within our code on alpha.\n * @deprecated Use `useLocaleInfo` instead.\n */\nexport function useLocalizationInfo(): LocalizationInfo {\n\tconst { activeLocale, locales, setLocale } = useLocaleInfo()\n\treturn {\n\t\tactiveLocalization: activeLocale,\n\t\tlocalizations: locales,\n\t\tsetLocalization: setLocale,\n\t}\n}\n\n/**\n * @public\n * @returns The current locale code, which is a combination of the language and optional region,\n * e.g. \"en-US\".\n */\nexport function useLocaleCode(): string {\n\treturn useLocaleInfo().activeLocale?.code ?? \"en-US\"\n}\n\n/**\n * Used in code generation of user code.\n * @deprecated Use `useLocaleCode` instead.\n */\nexport function useLocale(): string {\n\treturn useLocaleCode()\n}\n\n/** @private */\nexport const LayoutDirectionContext = /* @__PURE__ */ (() => {\n\tconst Context = React.createContext<TextDirection>(\"ltr\")\n\tContext.displayName = \"LayoutDirectionContext\"\n\treturn Context\n})()\n\n/**\n * @public\n * @returns The current layout direction, either \"ltr\" (left-to-right) or \"rtl\" (right-to-left).\n */\nexport function useLayoutDirection(): TextDirection {\n\treturn React.useContext(LayoutDirectionContext)\n}\n", "import type { CollectionUtilsCacheContextValue } from \"../modules/cms/CollectionUtilsCache.tsx\"\nimport { isPromise, isString } from \"../utils/utils.ts\"\nimport { pathVariablesRegExpGlobal } from \"./pathVariables.ts\"\nimport type { Locale, LocaleId, Route } from \"./types.ts\"\n\ntype Slug = string\n\nexport async function getLocalesForCurrentRoute(\n\tactiveLocale: Locale | null,\n\tlocales: readonly Locale[],\n\tcurrentRoute: Route | undefined,\n\tpathVariables: Record<string, unknown> | undefined,\n\tcollectionUtils: CollectionUtilsCacheContextValue,\n): Promise<readonly Locale[]> {\n\tif (!currentRoute) return locales\n\n\tconst slugByLocaleIfCollectionPage = await getSlugByLocaleIfCollectionPage(\n\t\tactiveLocale,\n\t\tlocales,\n\t\tcurrentRoute,\n\t\tpathVariables,\n\t\tcollectionUtils,\n\t)\n\n\tconst includedLocalesForCurrentRoute = currentRoute.includedLocales\n\n\tconst localesForCurrentRoute: Locale[] = []\n\n\tfor (const locale of locales) {\n\t\t// Included locales are optional, if undefined all are included.\n\t\tif (includedLocalesForCurrentRoute) {\n\t\t\tif (!includedLocalesForCurrentRoute.includes(locale.id)) continue\n\t\t}\n\n\t\t// `slugByLocaleIfCollectionPage` is only defined if the current route is a collection page.\n\t\tif (slugByLocaleIfCollectionPage) {\n\t\t\tconst hasSlug = slugByLocaleIfCollectionPage.has(locale.id)\n\t\t\tif (!hasSlug) continue\n\t\t}\n\n\t\tlocalesForCurrentRoute.push(locale)\n\t}\n\n\treturn localesForCurrentRoute\n}\n\n/** Returns a lookup if the route has slugs, otherwise returns `null` */\nasync function getSlugByLocaleIfCollectionPage(\n\tactiveLocale: Locale | null,\n\tlocales: readonly Locale[],\n\tcurrentRoute: Route,\n\tpathVariables: Record<string, unknown> | undefined,\n\tcollectionUtils: CollectionUtilsCacheContextValue,\n): Promise<ReadonlyMap<LocaleId, Slug> | null> {\n\tconst { collectionId } = currentRoute\n\tif (!collectionId) return null\n\n\tif (!activeLocale) return null\n\tif (!pathVariables) return null\n\n\tconst { path } = currentRoute\n\tif (!path) return null\n\n\tconst matches = Array.from(path.matchAll(pathVariablesRegExpGlobal))\n\n\t// We currently only support one slug per path, but to be future proof we take the last match\n\tconst lastMatch = matches.pop()\n\tif (!lastMatch) return null\n\n\tconst pathVariableWithDelimiter = lastMatch?.[0]\n\tconst pathVariableValue = lastMatch?.[1]\n\n\tif (!pathVariableWithDelimiter || !pathVariableValue) {\n\t\tthrow new Error(\"Failed to replace path variables: unexpected regex match group\")\n\t}\n\n\tconst currentSlug = pathVariables[pathVariableValue]\n\tif (!currentSlug || !isString(currentSlug)) {\n\t\tthrow new Error(`No slug found for path variable ${pathVariableValue}`)\n\t}\n\n\tconst utils = collectionUtils?.get(collectionId)\n\tif (!utils) return null\n\n\tconst maybeRecordId = utils.getRecordIdBySlug(currentSlug, activeLocale)\n\tconst recordId = isPromise(maybeRecordId) ? await maybeRecordId : maybeRecordId\n\tif (!recordId) return null\n\n\tconst slugById: Map<LocaleId, Slug> = new Map()\n\n\tawait Promise.all(\n\t\tlocales.map(async (locale): Promise<void> => {\n\t\t\tconst maybeSlug = utils.getSlugByRecordId(recordId, locale)\n\t\t\tconst slug = isPromise(maybeSlug) ? await maybeSlug : maybeSlug\n\n\t\t\t// Ignore locales that don't have a slug.\n\t\t\tif (!slug) return\n\n\t\t\tslugById.set(locale.id, slug)\n\t\t}),\n\t)\n\n\treturn slugById\n}\n", "import React from \"react\"\nimport { useRouter } from \"./RouterContext.tsx\"\nimport { getPathForRoute } from \"./history.ts\"\nimport type { ElementId, Hash, RouteId } from \"./types.ts\"\nimport { useCurrentRouteId } from \"./useCurrentRoute.tsx\"\nimport { useLocaleInfo } from \"./useLocale.ts\"\nimport { useRoute } from \"./useRoute.ts\"\nimport { useRoutePreloader } from \"./useRoutePreloader.ts\"\n\ntype RouteAnchorProps = Pick<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\" | \"onClick\"> &\n\tReact.RefAttributes<HTMLAnchorElement>\n\ninterface Options {\n\thash?: Hash\n\t/** @deprecated */\n\telementId?: ElementId\n}\n\n/**\n * @deprecated no longer used; kept for backwards compatibility. Prefer {@link useRouteHandler} instead.\n */\nexport function useRouteAnchor(routeId: RouteId, { elementId, hash: linkHash }: Options = {}): RouteAnchorProps {\n\tconst { navigate, currentPathVariables, preserveQueryParams, siteCanonicalURL } = useRouter()\n\tconst { activeLocale } = useLocaleInfo()\n\tconst route = useRoute(routeId)\n\tconst currentRouteId = useCurrentRouteId()\n\tconst currentRoute = useRoute(currentRouteId ?? \"\")\n\n\tuseRoutePreloader([routeId], true)\n\n\tconst hash = linkHash ?? elementId\n\tconst href = React.useMemo(\n\t\t() =>\n\t\t\tgetPathForRoute(route, {\n\t\t\t\tcurrentRoutePath: currentRoute?.path,\n\t\t\t\tcurrentRoutePathLocalized: currentRoute?.pathLocalized,\n\t\t\t\tcurrentPathVariables,\n\t\t\t\thash,\n\t\t\t\tpreserveQueryParams,\n\t\t\t\tsiteCanonicalURL,\n\t\t\t\tlocaleId: activeLocale?.id,\n\t\t\t}),\n\t\t[currentRoute, currentPathVariables, hash, preserveQueryParams, route, siteCanonicalURL, activeLocale?.id],\n\t)\n\n\tconst navigateToRoute = React.useCallback(() => navigate?.(routeId, hash), [hash, navigate, routeId])\n\tconst onClick = React.useCallback(\n\t\t(event: React.MouseEvent<HTMLAnchorElement>) => {\n\t\t\tevent.preventDefault()\n\t\t\tnavigateToRoute()\n\t\t},\n\t\t[navigateToRoute],\n\t)\n\treturn { onClick, href }\n}\n", "// FIXME: Remove this once we have a better solution for preventing slow INP: https://github.com/framer/company/issues/29153\n// \u271D and holy water for us for writing this code.\n\nimport { useEffect } from \"react\"\nimport { isReplayEvent } from \"../../render/presentation/Forms/useReplayPreHydrationInput.ts\"\n\n// Whenever a user clicks in a Suspense boundary during concurrent hydration, React will prioritize it, see: https://3perf.com/talks/react-concurrency/#slide-29.\n// However, due to the mentioned bug we actually don't want this, because it causes very bad INP as hydration repeats N times for N events, which means hydration can become ultra slow (as seen by Debugbear / CrUX data).\n// So by preventing any events from reaching React during hydration, we:\n// - prevent the hydration from potentially becoming synchronous, at the expense of slightly slower hydration (due to concurrency, see also the 3perf link)\n// - avoid the repeated hydration bug\n// Users can still click on links during hydration, so they can effectively navigate (MPA navigation).\n// After hydration, we're undoing this prevention. See also SuspenseThatPreservesDom.tsx <OnHydrationEnd />.\n\n// source: https://github.com/facebook/react/blob/b5e5ce8e0a899345dab1ce71c74bc1d1c28c6a0d/packages/react-dom-bindings/src/events/ReactDOMEventReplaying.js#L85\nlet eventsToStop: string[] | undefined = [\n\t\"mousedown\",\n\t\"mouseup\",\n\t\"touchcancel\",\n\t\"touchend\",\n\t\"touchstart\",\n\t\"auxclick\",\n\t\"dblclick\",\n\t\"pointercancel\",\n\t\"pointerdown\",\n\t\"pointerup\",\n\t\"dragend\",\n\t\"dragstart\",\n\t\"drop\",\n\t\"compositionend\",\n\t\"compositionstart\",\n\t\"keydown\",\n\t\"keypress\",\n\t\"keyup\",\n\t\"input\",\n\t\"textInput\", // Intentionally camelCase\n\t\"copy\",\n\t\"cut\",\n\t\"paste\",\n\t\"click\",\n\t\"change\",\n\t\"contextmenu\",\n\t\"reset\",\n]\n\nconst stopFn = (event: Event) => {\n\tif (!(event.target as HTMLElement)?.closest?.(\"#main\")) return // event did not happen inside the react root\n\tif (isReplayEvent(event)) return // our custom replay event shouldn't be stopped\n\n\tevent.stopPropagation() // <-- this prevents React from receiving the event\n\t// we don't call e.preventDefault() because we want to allow the browser to handle the event\n\t// e.g. clicking on a link should trigger an MPA style navigation (sucks but better than freezing)\n\n\tperformance.mark(\"framer-react-event-handling-prevented\")\n}\n\nlet shouldTurnOnEventHandling = false\nexport function turnOffReactEventHandling() {\n\tif (!eventsToStop) return\n\tshouldTurnOnEventHandling = true\n\n\tperformance.mark(\"framer-react-event-handling-start\")\n\n\tconst options = { capture: true }\n\tconst body = document.body\n\teventsToStop.forEach(event => body.addEventListener(event, stopFn, options))\n}\n\nexport function TurnOnReactEventHandling(): null {\n\tuseEffect(() => {\n\t\tif (!shouldTurnOnEventHandling || !eventsToStop) return\n\n\t\tconst options = { capture: true }\n\t\tconst body = document.body\n\t\teventsToStop.forEach(event => body.removeEventListener(event, stopFn, options))\n\n\t\t// allow GC of the array\n\t\teventsToStop = undefined\n\n\t\tperformance.mark(\"framer-react-event-handling-end\")\n\t}, [])\n\treturn null\n}\n", "import { type ChangeEvent, useEffect, useRef, useSyncExternalStore } from \"react\"\nimport { isWindow, noopSubscribe, returnFalse } from \"../../../utils/utils.ts\"\n\n// React doesn't replay `onChange` events that happened before hydration. In other words, if a user\n// types \"a\" into an input, and then the page is hydrated, the input will show \"a\" as the value, but\n// the `onChange` event will not be fired even if the value is different to the passed value/defaultValue.\n// So React correctly retains user input, but we still need to fire `onChange` because e.g. query\n// params need to be updated.\n// Curiously, React does have a native solution for this:\n// https://github.com/facebook/react/blob/d4a325df/packages/react-dom-bindings/src/events/ReactDOMEventReplaying.js#L428-L451\n// ... but it's only enabled in Meta's React Native build (as of 2026-02-17).\n\nconst replayMarker = \"__f_replay\"\nconst replayMarkerIgnore = \"__f_replay_ignore\"\n\nfunction changeEvent() {\n\tconst event = new Event(\"change\", { bubbles: true })\n\t// @ts-ignore - React expects only `Event` objects so add a custom property to a regular `Event` object.\n\tevent[replayMarker] = 1\n\treturn event\n}\n\nfunction clickEvent() {\n\tconst event = new MouseEvent(\"click\", { bubbles: true })\n\t// @ts-ignore - React expects only `Event` objects so add a custom property to a regular `Event` object.\n\tevent[replayMarker] = 1\n\treturn event\n}\n\nfunction getValuePropFromElement<T extends HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>(element: T) {\n\tif (element instanceof HTMLInputElement && (element.type === \"checkbox\" || element.type === \"radio\")) {\n\t\treturn \"checked\"\n\t}\n\treturn \"value\"\n}\n\nexport function isReplayEvent(event: Event) {\n\treturn replayMarker in event && event[replayMarker] === 1\n}\n\nexport function shouldIgnoreReplayEvent(\n\tevent: ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>,\n) {\n\treturn replayMarkerIgnore in event.nativeEvent && event.nativeEvent[replayMarkerIgnore] === 1\n}\n\nconst isHydrationFn = () => isWindow\n\nexport function useReplayPreHydrationInput<T extends HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement, V>(\n\tvalue: V | undefined,\n) {\n\tconst didReplayRef = useRef(false)\n\tconst elementRef = useRef<T>(null)\n\n\t// eslint-disable-next-line framer-studio/no-usesyncexternalstore -- fine here, because nothing depends on the return value\n\tconst isHydration = useSyncExternalStore(noopSubscribe, returnFalse, isHydrationFn)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: The effect should only run during hydration.\n\tuseEffect(() => {\n\t\tif (!isHydration) return\n\n\t\tconst element = elementRef.current\n\t\tif (didReplayRef.current || !element) return\n\t\tdidReplayRef.current = true\n\n\t\tconst valueProp = getValuePropFromElement(element)\n\t\tconst currentDOMValue = element[valueProp as keyof typeof element]\n\t\tif (currentDOMValue === value) return\n\n\t\t// For radios, we only dispatch a click event if the radio got checked.\n\t\tif (element.type === \"radio\" && currentDOMValue === true) {\n\t\t\t;(element as HTMLInputElement).checked = false\n\t\t\telement.dispatchEvent(clickEvent())\n\t\t\treturn\n\t\t}\n\n\t\t// For checkboxes, click twice to replay the pre-hydration change: first click (with\n\t\t// `__f_replay` marker) resets to React's intended value and is ignored by the onChange\n\t\t// handler, second click replays the user's action to update DOM and React state.\n\t\tif (valueProp === \"checked\") {\n\t\t\tconst event = clickEvent()\n\t\t\t// @ts-ignore - React expects only `Event` objects so add a custom property to a regular `Event` object.\n\t\t\tevent[replayMarkerIgnore] = 1\n\t\t\telement.dispatchEvent(event)\n\t\t\telement.dispatchEvent(clickEvent())\n\t\t\treturn\n\t\t}\n\n\t\t// For selects, dispatching a change event is enough to trigger a React change event.\n\t\tif (element.nodeName === \"SELECT\") {\n\t\t\telement.dispatchEvent(changeEvent())\n\t\t\treturn\n\t\t}\n\n\t\t// For text inputs, React only calls `onChange` if it sees the value has changed\n\t\tconst nativeInputValueSetter = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(element), valueProp)?.set\n\t\tif (!nativeInputValueSetter) return\n\n\t\t// Set a different value to make React think the value has changed.\n\t\tnativeInputValueSetter.call(element, \"\")\n\n\t\tconst event = changeEvent()\n\t\t// @ts-ignore - React expects only `Event` objects so add a custom property to a regular `Event` object.\n\t\tevent[replayMarkerIgnore] = 1\n\t\telement.dispatchEvent(event)\n\n\t\t// React batches events, so we need to queue a microtask to make sure the event is seen only\n\t\t// after React \"completes\" the batching.\n\t\tqueueMicrotask(() => {\n\t\t\t// Set back to the intended value\n\t\t\tnativeInputValueSetter.call(element, currentDOMValue)\n\t\t\telement.dispatchEvent(changeEvent())\n\t\t})\n\t}, [isHydration])\n\n\treturn elementRef\n}\n", "/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { frame } from \"framer-motion\"\nimport { useEffect, useInsertionEffect, useLayoutEffect } from \"react\"\nimport { yieldToMain } from \"../../utils/yield.ts\"\nimport { onlyRunOnce } from \"./onlyRunOnce.ts\"\n\nfunction measureSafe(name: string, start: string | undefined, end?: string) {\n\ttry {\n\t\tperformance.measure(name, start, end)\n\t} catch (e) {\n\t\t// biome-ignore lint/suspicious/noConsole: this doesn't break anything, but should still be logged.\n\t\tconsole.warn(`Could not measure ${name}`, e)\n\t}\n}\n\nconst enum MarkNames {\n\tHydration = \"framer-hydration\",\n\tHydration_Start = \"framer-hydration-start\",\n\n\t//\n\t// During hydration, the page goes through the following stages:\n\t// 1) rendering the React tree (executing all React components)\n\t// 2) committing: mutation effects (updating the DOM)\n\t// 3) committing: running all updated useInsertionEffect hooks\n\t// 4) committing: running all updated useLayoutEffect hooks\n\t// 5) running browser rendering\n\t//   5.1) running requestAnimationFrame callbacks (which is still JS, but one not directly related to React)\n\t//   5.2) running layout, style, paint and composite stages\n\t// 6) committing: running all updated useEffect hooks\n\t//\n\t// Note that React might sometimes schedule step 6 before step 5 if e.g. layout effects trigger a state update,\n\t// or if a user interacts with the page: https://jser.dev/2023-08-09-effects-run-paint/\n\t//\n\t// The timings below correspond to these main stages of hydration.\n\t//\n\tReactRender = \"framer-hydration-render\",\n\tReactRender_Start = \"framer-hydration-render-start\",\n\tReactRender_End = \"framer-hydration-render-end\",\n\n\tMutationEffects = \"framer-hydration-commit\",\n\n\tUseInsertionEffects = \"framer-hydration-insertion-effects\",\n\tUseInsertionEffects_Start = \"framer-hydration-insertion-effects-start\",\n\t/** Indicates that the router insertion effects have started running. */\n\tUseInsertionEffect_RouterStart = \"framer-hydration-router-insertion-effect\",\n\tUseInsertionEffects_End = \"framer-hydration-insertion-effects-end\",\n\n\tUseLayoutEffects = \"framer-hydration-layout-effects\",\n\tUseLayoutEffects_Start = \"framer-hydration-layout-effects-start\",\n\t/** Indicates that the router layout effects have started running. */\n\tUseLayoutEffect_RouterStart = \"framer-hydration-router-layout-effect\",\n\tUseLayoutEffects_End = \"framer-hydration-layout-effects-end\",\n\n\t// The browser render stage is split into multiple substeps because we want to measure these individual substeps.\n\t/** A performance mark for when the browser starts running requestAnimationFrame callbacks. This indicates that stages 2-4 (and, possibly, 6) are done. */\n\tBrowserRender_RafStart = \"framer-hydration-browser-render-start\",\n\t/** A performance mark for when all requestAnimationFrame callbacks scheduled during hydration have finished running. */\n\tBrowserRender_RafEnd = \"framer-hydration-browser-raf-end\",\n\t/** A performance measure indicating how long requestAnimationFrames took to run. */\n\tBrowserRender_RafDuration = \"framer-hydration-raf\",\n\t/** This performance mark is unused because it\u2019s effectively the same as @see BrowserRender_RafEnd. */\n\tBrowserRender_LayoutStylePaintStart = \"_unused\",\n\t/** A performance mark for when the first paint happens after committing (stages 2-4 and, possibly, 6). */\n\tBrowserRender_LayoutStylePaintEnd = \"framer-hydration-first-paint\",\n\t/** A performance measure indicating how long the layout, style, paint and composite stages of browser rendering took: https://web.dev/articles/rendering-performance#the_pixel_pipeline. */\n\tBrowserRender_LayoutStylePaintDuration = \"framer-hydration-browser-render\",\n\n\tUseEffects = \"framer-hydration-effects\",\n\tUseEffects_Start = \"framer-hydration-effects-start\",\n\t/** Indicates that the router passive effects have started running. */\n\tUseEffects_RouterStart = \"framer-hydration-router-effect\",\n\tUseEffects_End = \"framer-hydration-effects-end\",\n\n\t//\n\t// Some other notable events that also happen during the page lifecycle\n\t//\n\t/** A performance measure indicating the time from the hydration start to the end of stage 5. */\n\tTimeToFirstPaint = \"framer-hydration-time-to-first-paint\",\n\t/**\n\t * A performance mark indicating that the passive effects ran synchronously after the mutation effects \u2013 i.e. that stage 6 happened before stage 5.\n\t * This could happen if e.g. layout effects schedule a state update, or if a user interacts with the page: https://jser.dev/2023-08-09-effects-run-paint/\n\t */\n\tUseEffectsAreSynchronous = \"framer-hydration-effects-sync\",\n\t/**\n\t * UHO: Unattributed hydration overhead, which measures the time between before the first paint and start of first paint.\n\t * This timing might also measure some other requestAnimationFrame callbacks.\n\t */\n\tUnattributedHydrationOverhead = \"framer-hydration-uho\",\n}\n\nclass HydrationMarker {\n\t@onlyRunOnce\n\tprivate markRenderStart(): void {\n\t\tperformance.mark(MarkNames.Hydration_Start)\n\t}\n\t@onlyRunOnce\n\tprivate markRenderEnd(): void {\n\t\tperformance.mark(MarkNames.ReactRender_End)\n\t\tmeasureSafe(MarkNames.ReactRender, MarkNames.Hydration_Start, MarkNames.ReactRender_End)\n\t}\n\n\t@onlyRunOnce\n\tprivate markUseInsertionEffectsStart(): void {\n\t\tperformance.mark(MarkNames.UseInsertionEffects_Start)\n\t}\n\t@onlyRunOnce\n\tprivate markUseInsertionEffectRouterStart(): void {\n\t\tperformance.mark(MarkNames.UseInsertionEffect_RouterStart)\n\t}\n\t@onlyRunOnce\n\tprivate markUseInsertionEffectsEnd(): void {\n\t\tperformance.mark(MarkNames.UseInsertionEffects_End)\n\t\tmeasureSafe(MarkNames.UseInsertionEffects, MarkNames.UseInsertionEffects_Start, MarkNames.UseInsertionEffects_End)\n\t}\n\n\t@onlyRunOnce\n\tprivate markUseLayoutEffectsStart(): void {\n\t\tperformance.mark(MarkNames.UseLayoutEffects_Start)\n\t}\n\t@onlyRunOnce\n\tprivate markRouterUseLayoutEffectStart(): void {\n\t\tperformance.mark(MarkNames.UseLayoutEffect_RouterStart)\n\t}\n\t@onlyRunOnce\n\tprivate markUseLayoutEffectsEnd(): void {\n\t\tperformance.mark(MarkNames.UseLayoutEffects_End)\n\t\tmeasureSafe(MarkNames.UseLayoutEffects, MarkNames.UseLayoutEffects_Start, MarkNames.UseLayoutEffects_End)\n\t}\n\n\t@onlyRunOnce\n\tprivate markUseEffectsStart(): void {\n\t\tperformance.mark(MarkNames.UseEffects_Start)\n\t}\n\t@onlyRunOnce\n\tprivate markUseEffectsRouterStart(): void {\n\t\tperformance.mark(MarkNames.UseEffects_RouterStart)\n\t}\n\t@onlyRunOnce\n\tprivate markUseEffectsAreSynchronous(): void {\n\t\tperformance.mark(MarkNames.UseEffectsAreSynchronous)\n\t}\n\t@onlyRunOnce\n\tprivate markUseEffectsEnd(): void {\n\t\tperformance.mark(MarkNames.UseEffects_End)\n\t\t// We want to measure *only* how long the mount effects take.\n\t\t// So if there was a paint before those, we measure from the paint on, else, straight after the layout effects end.\n\t\t// see: https://jser.dev/2023-08-09-effects-run-paint/ for more info when useEffect runs before paint:\n\t\t// - on user interaction\n\t\t// - useLayoutEffect causes state updates\n\t\tmeasureSafe(\n\t\t\tMarkNames.UseEffects,\n\t\t\tperformance.getEntriesByName(MarkNames.BrowserRender_LayoutStylePaintEnd)[0]?.name ??\n\t\t\t\tperformance.getEntriesByName(MarkNames.UseEffects_Start)[0]?.name,\n\t\t\tMarkNames.UseEffects_End,\n\t\t)\n\t}\n\n\t@onlyRunOnce\n\tprivate markRafStart(): void {\n\t\tthis.browserRendering.hasStarted = true\n\t\tperformance.mark(MarkNames.BrowserRender_RafStart)\n\t}\n\t@onlyRunOnce\n\tprivate markRafEnd(): void {\n\t\tperformance.mark(MarkNames.BrowserRender_RafEnd)\n\t\tmeasureSafe(MarkNames.BrowserRender_RafDuration, MarkNames.BrowserRender_RafStart, MarkNames.BrowserRender_RafEnd)\n\t}\n\t@onlyRunOnce\n\tprivate markLayoutStylePaintEnd(): void {\n\t\tperformance.mark(MarkNames.BrowserRender_LayoutStylePaintEnd)\n\t\tmeasureSafe(MarkNames.TimeToFirstPaint, MarkNames.Hydration_Start, MarkNames.BrowserRender_LayoutStylePaintEnd)\n\n\t\tmeasureSafe(\n\t\t\tMarkNames.BrowserRender_LayoutStylePaintDuration,\n\t\t\tMarkNames.BrowserRender_RafEnd,\n\t\t\tMarkNames.BrowserRender_LayoutStylePaintEnd,\n\t\t)\n\t}\n\n\t@onlyRunOnce\n\tprivate measureMutationEffects(): void {\n\t\t// FIXME: this makes no sense, mutation effects (DOM commit) should happen before layout effects. https://github.com/framer/FramerStudio/pull/20046#discussion_r1881263771\n\t\tmeasureSafe(MarkNames.MutationEffects, MarkNames.UseLayoutEffects_End, MarkNames.UseEffects_Start)\n\t}\n\n\t@onlyRunOnce\n\tprivate measureUnattributedHydrationOverhead(): void {\n\t\tmeasureSafe(\n\t\t\tMarkNames.UnattributedHydrationOverhead,\n\t\t\t// If effects have run before the start of the render pipeline, we measure from the effects end.\n\t\t\t// If not, the paint will happen before effects run, so we measure from the layout effects end.\n\t\t\tperformance.getEntriesByName(MarkNames.UseEffects_End)[0]?.name ??\n\t\t\t\tperformance.getEntriesByName(MarkNames.UseLayoutEffects_End)[0]?.name,\n\t\t\tMarkNames.BrowserRender_RafStart,\n\t\t)\n\t}\n\n\trender = {\n\t\tmarkStart: () => this.markRenderStart(),\n\t\tmarkEnd: () => this.markRenderEnd(),\n\t}\n\n\tmutationEffects = {\n\t\tmeasure: () => this.measureMutationEffects(),\n\t}\n\n\tuseInsertionEffects = {\n\t\tmarkStart: () => this.markUseInsertionEffectsStart(),\n\t\tmarkRouterStart: () => this.markUseInsertionEffectRouterStart(),\n\t\tmarkEnd: () => this.markUseInsertionEffectsEnd(),\n\t}\n\n\tuseLayoutEffects = {\n\t\tmarkStart: () => this.markUseLayoutEffectsStart(),\n\t\tmarkRouterStart: () => this.markRouterUseLayoutEffectStart(),\n\t\tmarkEnd: () => this.markUseLayoutEffectsEnd(),\n\t}\n\n\tuseEffects = {\n\t\tmarkStart: () => this.markUseEffectsStart(),\n\t\tmarkRouterStart: () => this.markUseEffectsRouterStart(),\n\t\tmarkEnd: () => this.markUseEffectsEnd(),\n\t\tmarkAreSynchronous: () => this.markUseEffectsAreSynchronous(),\n\t}\n\n\tbrowserRendering = {\n\t\thasStarted: false,\n\t\trequestAnimationFrame: {\n\t\t\tmarkStart: () => this.markRafStart(),\n\t\t\tmarkEnd: () => this.markRafEnd(),\n\t\t},\n\t\tlayoutStylePaint: {\n\t\t\tmarkEnd: () => this.markLayoutStylePaintEnd(),\n\t\t},\n\t}\n\n\tunattributedHydrationOverhead = {\n\t\tmeasure: () => this.measureUnattributedHydrationOverhead(),\n\t}\n}\n\n/**\n * Hydration marker is defined only when the page is hydrated. It will be undefined when the page is\n * client-side-rendered (e.g. because it\u2019s unoptimized), because we only want to measure hydration timings.\n */\nlet hydrationMarker: HydrationMarker | undefined\n\nexport function markHydrationStart() {\n\thydrationMarker = new HydrationMarker()\n\thydrationMarker.render.markStart()\n}\n\nexport function useMarkRouterEffects() {\n\tuseInsertionEffect(() => {\n\t\thydrationMarker?.useInsertionEffects.markRouterStart()\n\t}, [])\n\n\tuseLayoutEffect(() => {\n\t\thydrationMarker?.useLayoutEffects.markRouterStart()\n\t}, [])\n\n\tuseEffect(() => {\n\t\thydrationMarker?.useEffects.markRouterStart()\n\t}, [])\n}\n\n/* Tracks if the tab was opened in background, which causes rAFs to run late: https://framer-team.slack.com/archives/C05V49Q4NJ2/p1733747876734559 */\nlet wasInBackground = false\n\nfunction useMarkSuspenseEffectsStart() {\n\tuseInsertionEffect(() => {\n\t\t// We mark hydration render here, because we fetch & suspend the tree during hydration.\n\t\t// Previously, we did this in `Router`. While technically correct, it is not reflecting\n\t\t// the correct timing for us, as pretty much nothing is interactive, because we suspend\n\t\t// the rest of the tree during hydration for data fetching.\n\t\t// We do this in an insertion effect to exclude the time it took to commit & paint the DOM.\n\t\thydrationMarker?.render.markEnd()\n\t\thydrationMarker?.useInsertionEffects.markStart()\n\t}, [])\n\n\tuseLayoutEffect(() => {\n\t\thydrationMarker?.useLayoutEffects.markStart()\n\n\t\tif (document.visibilityState !== \"visible\") {\n\t\t\twasInBackground = true\n\t\t\treturn\n\t\t}\n\t\tframe.read(() => {\n\t\t\thydrationMarker?.browserRendering.requestAnimationFrame.markStart()\n\t\t\thydrationMarker?.unattributedHydrationOverhead.measure()\n\t\t})\n\t}, [])\n\n\tuseEffect(() => {\n\t\thydrationMarker?.useEffects.markStart()\n\n\t\tif (!hydrationMarker?.browserRendering.hasStarted) {\n\t\t\t// If paint hasn't started yet, we can measure the time it took to commit the DOM.\n\t\t\thydrationMarker?.mutationEffects.measure()\n\t\t\t// This indicates that the effects running now are synchronous.\n\t\t\thydrationMarker?.useEffects.markAreSynchronous()\n\t\t}\n\t}, [])\n}\n\n/**\n * Use this component as last child of the most top-level Suspense as a good-enough 'callback' for the end of hydration.\n * This works, because it's the last child of the `<Suspense>` boundary so the effects are only called once the boundary resolves.\n */\nfunction useMarkSuspenseEffectEnd() {\n\tuseInsertionEffect(() => {\n\t\thydrationMarker?.useInsertionEffects.markEnd()\n\t}, [])\n\n\tuseLayoutEffect(() => {\n\t\thydrationMarker?.useLayoutEffects.markEnd()\n\n\t\tif (wasInBackground || document.visibilityState !== \"visible\") return\n\t\tframe.read(() => {\n\t\t\thydrationMarker?.browserRendering.requestAnimationFrame.markEnd()\n\n\t\t\tvoid yieldToMain().then(() => {\n\t\t\t\thydrationMarker?.browserRendering.layoutStylePaint.markEnd()\n\t\t\t})\n\t\t})\n\t}, [])\n\n\tuseEffect(() => {\n\t\thydrationMarker?.useEffects.markEnd()\n\t}, [])\n}\n\n/**\n * Use this component as the firstmost sibling of a component that suspends.\n * It marks start timings of effects that run after the other sibling unsuspends,\n * as React executes components from inside out (= most nested first).\n */\nfunction MarkSuspenseEffectsStart(): null {\n\tuseMarkSuspenseEffectsStart()\n\treturn null\n}\n\n/**\n * Use this component as last child of the most top-level Suspense as a good-enough 'callback' for the end of hydration.\n * This works, because it's the last child of the `<Suspense>` boundary so the effects are only called once the boundary resolves.\n */\nfunction MarkSuspenseEffectsEnd(): null {\n\tuseMarkSuspenseEffectEnd()\n\treturn null\n}\n\nexport const MarkSuspenseEffects = { Start: MarkSuspenseEffectsStart, End: MarkSuspenseEffectsEnd }\n", "/** A decorator that ensures a method is only run once. It returns undefined if the method has already run. */\nexport function onlyRunOnce<This, Args extends unknown[], Return>(\n\toriginalMethod: (this: This, ...args: Args) => Return,\n): (this: This, ...args: Args) => Return | undefined {\n\tlet hasRun = false\n\treturn function (this: This, ...args: Args) {\n\t\tif (hasRun) return\n\t\thasRun = true\n\t\treturn originalMethod.apply(this, args)\n\t}\n}\n", "import type React from \"react\"\nimport { Component } from \"react\"\nimport { renderPage } from \"../renderPage.tsx\"\n\nexport class NotFoundError extends Error {}\n\ninterface Props {\n\tchildren?: React.ReactNode\n\tnotFoundPage?: React.ComponentType\n\tdefaultPageStyle: React.CSSProperties\n\tforceUpdateKey: number\n}\n\ninterface State {\n\terror?: unknown\n\tforceUpdateKey: number\n}\n\n/**\n * This error boundary catches and forwards errors, unless the error is `NotFoundError`, where it will render the 404 page.\n */\nexport class NotFoundErrorBoundary extends Component<Props, State> {\n\tconstructor(props: Props) {\n\t\tsuper(props)\n\t\tthis.state = { error: undefined, forceUpdateKey: props.forceUpdateKey }\n\t}\n\n\tstatic getDerivedStateFromError(error: unknown) {\n\t\treturn { error }\n\t}\n\n\t/** Resets the error when forceUpdateKey gets bumped. */\n\tstatic getDerivedStateFromProps(nextProps: Readonly<Props>, prevState: State) {\n\t\tif (nextProps.forceUpdateKey !== prevState.forceUpdateKey) {\n\t\t\tconst newState: Partial<State> = {\n\t\t\t\tforceUpdateKey: nextProps.forceUpdateKey,\n\t\t\t}\n\t\t\tif (prevState.error) {\n\t\t\t\tnewState.error = undefined\n\t\t\t}\n\t\t\treturn newState\n\t\t}\n\t\treturn null\n\t}\n\n\toverride render() {\n\t\tif (this.state.error === undefined) {\n\t\t\treturn this.props.children\n\t\t}\n\n\t\tif (!(this.state.error instanceof NotFoundError)) {\n\t\t\tthrow this.state.error\n\t\t}\n\n\t\tconst { notFoundPage, defaultPageStyle } = this.props\n\t\tif (!notFoundPage) {\n\t\t\tthrow this.state.error\n\t\t}\n\n\t\treturn renderPage(notFoundPage, defaultPageStyle)\n\t}\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport React from \"react\"\nimport type { RouteComponent } from \"./types.ts\"\n\nexport function renderPage(Page: RouteComponent<{ style?: MotionStyle }>, defaultPageStyle: React.CSSProperties) {\n\t// Note: `data-framer-root` must match the selector in ssg/src/ssg-sandbox-renderer/worker/generatePage.ts\n\tconst props = { style: defaultPageStyle, \"data-framer-root\": \"\" }\n\treturn React.isValidElement(Page) ? React.cloneElement(Page, props) : <Page {...props} />\n}\n", "const frozenEmptyArray = Object.freeze([]) as readonly unknown[]\n\n/**\n * Returns a stable typed empty array for the given type.\n *\n * @example\n * // Get an empty array of strings\n * const myArray = emptyArray<string>();\n */\nexport function emptyArray<T>(): readonly T[] {\n\treturn frozenEmptyArray as readonly T[]\n}\n", "import { emptyArray } from \"@framerjs/shared/src/emptyArray.ts\"\nimport { assert } from \"../utils/assert.ts\"\nimport { pathVariablesRegExpGlobal } from \"./pathVariables.ts\"\nimport type { Locale, LocaleId, RouteId, Routes } from \"./types.ts\"\ninterface PathRoute {\n\tpath: string\n\tdepth: number\n\trouteId: string\n}\ninterface RouteInfoCache {\n\tpathRoutes: Record<string, PathRoute>\n\tpathRoutesLocalized: Record<LocaleId, Record<string, PathRoute>>\n\tpaths: PathRoute[]\n\tpathsLocalized: Record<LocaleId, PathRoute[]>\n\tlastRoutes: Routes | undefined\n}\n\nlet routeInfoCache: Readonly<RouteInfoCache> | undefined\n\nfunction getRouteInfoMemo(routes: Routes) {\n\t// Routes should always be equal by referential identity on a deployed site,\n\t// but should change in the framer preview when new routes are added or the\n\t// preview is rerendered. This should prevent needing to iterate through all\n\t// the routes every time any link is rendered on any page.\n\tif (routeInfoCache?.lastRoutes !== routes) {\n\t\tconst pathRoutes: RouteInfoCache[\"pathRoutes\"] = {}\n\t\tconst pathRoutesLocalized: RouteInfoCache[\"pathRoutesLocalized\"] = {}\n\t\tlet paths: RouteInfoCache[\"paths\"] = []\n\t\tconst pathsLocalized: RouteInfoCache[\"pathsLocalized\"] = {}\n\t\tconst lastRoutes: RouteInfoCache[\"lastRoutes\"] = routes\n\n\t\tfor (const routeId in routes) {\n\t\t\tconst route = routes[routeId]\n\t\t\tassert(route, \"route must be defined\")\n\t\t\tconst { path, pathLocalized } = route\n\n\t\t\tif (!path) continue\n\n\t\t\tconst depth = pathDepth(path)\n\t\t\tpathRoutes[path] = { path, depth, routeId }\n\n\t\t\tif (!pathLocalized) continue\n\n\t\t\tfor (const localeId in pathLocalized) {\n\t\t\t\tconst localizedPath = pathLocalized[localeId]\n\t\t\t\tassert(localizedPath, \"localizedPath must be defined\")\n\n\t\t\t\tconst localizedDepth = pathDepth(localizedPath)\n\n\t\t\t\tconst byLocale = (pathRoutesLocalized[localeId] ||= {})\n\t\t\t\tbyLocale[localizedPath] = {\n\t\t\t\t\tpath: localizedPath,\n\t\t\t\t\tdepth: localizedDepth,\n\t\t\t\t\trouteId,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpaths = Object.values(pathRoutes)\n\t\t// Sort by depth in descending order (deepest first).\n\t\tpaths.sort(({ depth: depth1 }, { depth: depth2 }) => depth2 - depth1)\n\n\t\tfor (const localeId in pathRoutesLocalized) {\n\t\t\tconst routesByPathLocalized = pathRoutesLocalized[localeId]\n\t\t\tif (!routesByPathLocalized) continue\n\n\t\t\tconst pathsForLocale = Object.values(routesByPathLocalized)\n\t\t\t// Sort by depth in descending order (deepest first).\n\t\t\tpathsForLocale.sort(({ depth: depth1 }, { depth: depth2 }) => depth2 - depth1)\n\t\t\tpathsLocalized[localeId] = pathsForLocale\n\t\t}\n\n\t\trouteInfoCache = {\n\t\t\tpathRoutes,\n\t\t\tpathRoutesLocalized,\n\t\t\tpaths,\n\t\t\tpathsLocalized,\n\t\t\tlastRoutes,\n\t\t}\n\t}\n\n\treturn {\n\t\tpathRoutes: routeInfoCache.pathRoutes,\n\t\tpaths: routeInfoCache.paths,\n\t\tpathRoutesLocalized: routeInfoCache.pathRoutesLocalized,\n\t\tpathsLocalized: routeInfoCache.pathsLocalized,\n\t}\n}\n\n/**\n * @deprecated\n * Use {@link inferInitialRouteFromPathAndLocales} instead.\n * Matching of localized paths without providing locales is not supported.\n * */\nexport function inferInitialRouteFromPath(\n\troutes: Routes,\n\tlocationPath: string,\n\tfallback: boolean = true,\n\tlocales: readonly Locale[] = emptyArray(),\n) {\n\treturn inferInitialRouteFromPathAndLocales(routes, locationPath, locales, fallback)\n}\n\nexport function inferInitialRouteFromPathAndLocales(\n\troutes: Routes,\n\tlocationPath: string,\n\tlocales: readonly Locale[],\n\tfallback: boolean = true,\n): { routeId: RouteId; localeId?: LocaleId; pathVariables?: Record<string, string> } {\n\tconst { pathRoutes, paths, pathRoutesLocalized, pathsLocalized } = getRouteInfoMemo(routes)\n\n\tlet activeLocale: Locale | undefined\n\tlet localeId: LocaleId | undefined\n\tlet hasNonDefaultLocale: boolean = false\n\n\tif (locales.length > 0) {\n\t\tconst firstPathSegment = locationPath.split(\"/\").find(Boolean)\n\t\tif (firstPathSegment) {\n\t\t\tactiveLocale = locales.find(({ slug }) => slug === firstPathSegment)\n\t\t\tif (activeLocale) {\n\t\t\t\tlocaleId = activeLocale.id\n\t\t\t\tlocationPath = locationPath.substring(activeLocale.slug.length + 1)\n\t\t\t\thasNonDefaultLocale = true\n\t\t\t}\n\t\t}\n\t\tif (!localeId) {\n\t\t\tconst defaultLocale = locales.find(({ slug }) => slug === \"\")\n\t\t\tif (defaultLocale) {\n\t\t\t\tlocaleId = defaultLocale.id\n\t\t\t}\n\t\t}\n\t}\n\n\t// Try to match the path directly to the map of route paths. This avoids\n\t// needing to iterate through every path for every rendered link on every\n\t// page.\n\n\t// If there is an exact match, confirm whether there should be path\n\t// variables. This could only happen in an extreme edge case where the\n\t// provided locationPath is `/blog/:slug`, the route path is\n\t// `/blog/:slug` and `:slug` is a valid path variable value. Otherwise\n\t// pathVariables will be `undefined` because you cannot exact match\n\t// `/blog/puppy` to `/blog/:slug`\n\n\tif (localeId && hasNonDefaultLocale) {\n\t\tconst localizedMap = pathRoutesLocalized[localeId]\n\t\tconst exactMatchForLocale = localizedMap ? localizedMap[locationPath] : undefined\n\t\tif (exactMatchForLocale) {\n\t\t\tconst match = matchPath(locationPath, exactMatchForLocale.path)\n\t\t\tif (match.isMatch) {\n\t\t\t\treturn { routeId: exactMatchForLocale.routeId, localeId, pathVariables: match.pathVariables }\n\t\t\t}\n\t\t}\n\t}\n\n\tconst exactMatch = pathRoutes[locationPath]\n\tif (exactMatch) {\n\t\tconst match = matchPath(locationPath, exactMatch.path)\n\t\tif (match.isMatch) return { routeId: exactMatch.routeId, localeId, pathVariables: match.pathVariables }\n\t}\n\n\t// If the path is not an exact match, it must be an invalid path, or include\n\t// path variables. Iterate through the routes and validate if there is a\n\t// match when replacing placeholders with values.\n\n\tif (localeId && hasNonDefaultLocale) {\n\t\tconst localizedList = pathsLocalized[localeId]\n\t\tif (localizedList) {\n\t\t\tfor (const { path, routeId } of localizedList) {\n\t\t\t\tconst match = matchPath(locationPath, path)\n\t\t\t\tif (match.isMatch) {\n\t\t\t\t\treturn { routeId, localeId, pathVariables: match.pathVariables }\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const { path, routeId } of paths) {\n\t\tconst match = matchPath(locationPath, path)\n\t\tif (match.isMatch) {\n\t\t\treturn { routeId, localeId, pathVariables: match.pathVariables }\n\t\t}\n\t}\n\t// If the function has not been flagged to fallback to the root route, or\n\t// the first route, throw an error to allow callers to know there was no\n\t// match.\n\tif (!fallback) throw new Error(\"No exact match found for path\")\n\n\tconst rootPath = pathRoutes[\"/\"]\n\tif (rootPath) return { routeId: rootPath.routeId, localeId }\n\n\t// No root path? Oh boy, let's try to render _something_.\n\tconst firstRoute = Object.keys(routes)[0]\n\tif (!firstRoute) throw new Error(\"Router should not have undefined routes\")\n\treturn { routeId: firstRoute, localeId }\n}\n\n/**\n * - \"/\" => 0\n * - \"/news\" => 1\n * - \"/news/\" => 1\n * - \"/news/michael-jackson-lives\" => 2\n */\nfunction pathDepth(path: string) {\n\tconst pathWithTrimmedSlashes = path.replace(/^\\/|\\/$/gu, \"\")\n\tif (pathWithTrimmedSlashes === \"\") return 0\n\treturn pathWithTrimmedSlashes.split(\"/\").length\n}\n\nfunction matchPath(\n\tpath: string,\n\troutePath: string,\n): { isMatch: false } | { isMatch: true; pathVariables?: Record<string, string> } {\n\t// Turn `/blog/:date/:slug` into a regexp: `/blog/([^/]+)/([^/]+)$`\n\t//\n\t// For maximum compatibility, we don't use named capture groups, and instead\n\t// manually collect the variable keys into pathVariablesKeys.\n\t//\n\t// Also note that we anchor the regexp at the end, but not at the start, to\n\t// support hosting sites at a prefix.\n\tconst pathVariablesKeys: string[] = []\n\tconst safeRoutePath = escapeStringRegExp(routePath)\n\tconst routePathRegExpString = safeRoutePath.replace(pathVariablesRegExpGlobal, (_, name) => {\n\t\tpathVariablesKeys.push(name)\n\t\treturn \"([^/]+)\"\n\t})\n\tconst routePathRegExp = new RegExp(routePathRegExpString + \"$\")\n\n\tconst matches = path.match(routePathRegExp)\n\tif (!matches) return { isMatch: false }\n\n\t// No submatches = no path variables\n\tif (matches.length === 1) return { isMatch: true }\n\n\tconst pathVariables: Record<string, string> = {}\n\tconst pathVariablesValues = matches.slice(1)\n\tfor (let i = 0; i < pathVariablesKeys.length; ++i) {\n\t\tconst key = pathVariablesKeys[i]\n\t\tif (key === undefined) continue\n\t\tconst value = pathVariablesValues[i]\n\t\tconst existingValue: string | undefined = pathVariables[key]\n\t\t// If a variable appears twice, e.g.:\n\t\t//\n\t\t//     /blog/archive-:year/:category/:year-:month-:day/:slug\n\t\t//\n\t\t// then we require that it has an identical value throughout, e.g.:\n\t\t//\n\t\t//     matches:\n\t\t//     - /blog/archive-2022/tech/2022-03-08/hello-world\n\t\t//\n\t\t//     doesn't match:\n\t\t//     - /blog/archive-1410/tech/2022-03-08/hello-world\n\t\tif (existingValue) {\n\t\t\tif (existingValue !== value) {\n\t\t\t\treturn { isMatch: false }\n\t\t\t} else {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif (value === undefined) {\n\t\t\tthrow new Error(\"Path variable values cannot be undefined\")\n\t\t}\n\t\tpathVariables[key] = value\n\t}\n\n\treturn { isMatch: true, pathVariables }\n}\n\nfunction escapeStringRegExp(string: string) {\n\treturn string.replace(/[|\\\\{}()[\\]^$+*?.]/gu, \"\\\\$&\").replace(/-/gu, \"\\\\x2d\")\n}\n", "import type { Routes } from \"./types.ts\"\n\n/**\n * Exported for testing purposes\n */\nexport function getVariantsFromServerTiming() {\n\tif (\"PerformanceServerTiming\" in window) {\n\t\tconst serverTiming = (performance.getEntriesByType(\"navigation\")[0] as PerformanceNavigationTiming | undefined)\n\t\t\t?.serverTiming\n\t\tif (!serverTiming || serverTiming.length === 0) return new URLSearchParams()\n\n\t\t// eslint-disable-next-line framer-studio/tscompat -- We check for support via the `in` condition.\n\t\tconst entry = serverTiming.find(it => it.name === \"abtests\")\n\t\tif (!entry) return new URLSearchParams()\n\n\t\t// eslint-disable-next-line framer-studio/tscompat -- We check for support via the `in` condition.\n\t\treturn new URLSearchParams(entry.description)\n\t}\n\n\treturn new URLSearchParams()\n}\n\nfunction patchRoute(routes: Routes, abTestId: string, abTestingVariantId: string) {\n\tconst route = routes[abTestingVariantId]\n\tif (!route) return\n\n\t// This can either be the variant or the control page route\n\tconst routeId = route.abTestingParentId ?? abTestingVariantId\n\tif (!routes[routeId]) return\n\n\tconst { abTestingParentId: _, ...patchingRoute } = route\n\n\t// Make the scroll sections work for variant pages\n\tconst elements =\n\t\troutes[routeId].elements || route.elements ? { ...routes[routeId].elements, ...route.elements } : undefined\n\n\troutes[routeId] = {\n\t\t...patchingRoute,\n\t\telements,\n\t\tabTestingVariantId,\n\t\tabTestId,\n\t}\n}\n\nfunction patchRoutesFromSearchParams(routes: Routes, variants: URLSearchParams) {\n\tfor (const [abTestId, abTestingVariantId] of variants) {\n\t\tpatchRoute(routes, abTestId, abTestingVariantId)\n\t}\n}\n\n/**\n * This function removes all routes that are route variants.\n *\n * A route variant is a route that has an abTestingParentId.\n * All patched control routes have the abTestingVariantId and doesn't have abTestingParentId.\n *\n * NOTE: This function is important as the route variants have the same path as the control route, breaking the `inferInitialRouteFromPath` function.\n */\nfunction removeRoutesVariants(routes: Routes) {\n\tfor (const routeId in routes) {\n\t\tif (routes[routeId]?.abTestingParentId) {\n\t\t\tdelete routes[routeId]\n\t\t}\n\t}\n}\n\n/**\n * This function patches the initial route with the variant route.\n * This is needed in case of browsers not supporting the server-timing header (Safari older than 16.4).\n * If we don't patch it this way, the page will flicker rendering the variant route from SSG and then hydrate with the control route.\n */\nfunction patchInitialRoute(routes: Routes, routeId: string) {\n\tif (!routes[routeId]) return\n\tif (!routes[routeId].abTestingParentId) return\n\n\tconst parentId = routes[routeId].abTestingParentId\n\tconst { abTestingParentId: _, ...route } = routes[routeId]\n\n\t// Make the scroll sections work for variant pages\n\tconst elements =\n\t\troutes[parentId]?.elements || route.elements ? { ...routes[parentId]?.elements, ...route.elements } : undefined\n\n\troutes[parentId] = {\n\t\t...route,\n\t\telements,\n\t\tabTestingVariantId: routeId,\n\t}\n}\n\n/**\n * Patches the routes based on route variants provided by the server-timing header or the cookie (testing purposes).\n * It replaces the original route with the variant route, most importantly the page component, and also sets the abTestingVariantId.\n *\n * The logic in this patching is the following:\n * 1. Patch the initial route in case it's a variant route\n * 2. Retrieve the assignments from the server-timing header and cookie\n * 3. The incoming value is a map of abTestId -> variantId\n * 4. For each entry in the map:\n *    a. Retrieve the original routeId from the variant route\n *    b. Retrieve the variant route\n *    c. Replace the original route with the variant route\n * 5. Remove all variant routes to not mess with the inferInitialRouteFromPath function\n * 6. Return the resolved initial route id, so if the initial route is a variant route, it will resolve to the control route, that was already patched\n *\n * The `abTestId` and `abTestingVariantId` are set here and used in the tracking events.\n *\n * With this patching logic, the entire site won't have to know about the variant routes,\n * the pages will navigate normally \"thinking\" that they are the original route, but rendering the variant route.\n */\nexport function patchRoutesForABTesting(routes: Routes, initialRouteId?: string): string | undefined {\n\t// Skip this during SSG\n\tif (typeof window === \"undefined\") return initialRouteId\n\n\t// This is used to change the initial route id if the initial route is a variant route\n\t// As the entire navigation logic relies on the control route id, and if the variant route id is propagated to the application, it will break the navigation\n\tlet resolvedInitialRouteId = initialRouteId\n\tif (initialRouteId) {\n\t\t// This replaces the initial route with the variant route if it's a variant route\n\t\t// Becoming safe to remove the variant routes later on\n\t\tpatchInitialRoute(routes, initialRouteId)\n\n\t\tconst parentRouteId = routes[initialRouteId]?.abTestingParentId\n\t\tif (parentRouteId) {\n\t\t\tresolvedInitialRouteId = parentRouteId\n\t\t}\n\t}\n\n\tpatchRoutesFromSearchParams(routes, getVariantsFromServerTiming())\n\n\tremoveRoutesVariants(routes)\n\n\treturn resolvedInitialRouteId\n}\n", "import * as React from \"react\"\n\nexport interface Metadata {\n\ttitle?: string\n\trobots?: string\n\tviewport?: string\n}\n\n/** @public */\nexport function useMetadata(metadata: Metadata) {\n\t// Place metadata-dependent functionality here, unless ...\n\tReact.useEffect(() => {\n\t\tif (metadata.robots) {\n\t\t\tlet robotsTag = document.querySelector('meta[name=\"robots\"]')\n\t\t\tif (robotsTag) {\n\t\t\t\trobotsTag.setAttribute(\"content\", metadata.robots)\n\t\t\t} else {\n\t\t\t\trobotsTag = document.createElement(\"meta\")\n\t\t\t\trobotsTag.setAttribute(\"name\", \"robots\")\n\t\t\t\trobotsTag.setAttribute(\"content\", metadata.robots)\n\t\t\t\tdocument.head.appendChild(robotsTag)\n\t\t\t}\n\t\t}\n\t}, [metadata.robots])\n\n\t// ... it touches style or layout related DOM elements or attributes, like setting styles, classes, css variables,\n\t// etc. We want those to run before the DOM commit to reduce the amount of style/layout runs.\n\tReact.useInsertionEffect(() => {\n\t\t// The tab title is very visible on desktops, so we want it to update ASAP during navigation, otherwise it might\n\t\t// update after the loading spinner stops, which results in bad UX.\n\t\tdocument.title = metadata.title || \"\"\n\t\tif (metadata.viewport) {\n\t\t\tdocument.querySelector('meta[name=\"viewport\"]')?.setAttribute(\"content\", metadata.viewport)\n\t\t}\n\t}, [metadata.title, metadata.viewport])\n}\n", "const warningMessages = new Set<string>()\n\n/** Report a warning to the console, but only once. The first string becomes the\n * key to suppress this and other warnings, so make sure it is fairly unique.\n *\n * Note, it is best to not use string interpolation, instead pass in multiple\n * fragments.\n */\nexport function warnOnce(keyMessage: string, ...rest: unknown[]) {\n\tif (warningMessages.has(keyMessage)) return\n\twarningMessages.add(keyMessage)\n\n\tconsole.warn(keyMessage, ...rest)\n}\n", "import { warnOnce } from \"./warnOnce.ts\"\n\nexport function deprecationWarning(removedItem: string, removalVersion: string, replacement?: string) {\n\tconst replacementText = replacement ? `, use ${replacement} instead` : \"\"\n\tconst warningText = `Deprecation warning: ${removedItem} will be removed in version ${removalVersion}${replacementText}.`\n\twarnOnce(warningText)\n}\n", "import type { Cancel, Change, TransactionId } from \"./Animatable.ts\"\n\n/**\n * @public\n */\nexport type UpdateFunction<Value> = (change: Change<Value> | undefined, transaction?: TransactionId) => void\n/**\n * @public\n */\nexport type FinishFunction = (transaction: TransactionId) => void\n/**\n * @public\n */\nexport type Observer<Value> =\n\t| {\n\t\t\tupdate: UpdateFunction<Value>\n\t\t\tfinish: FinishFunction\n\t  }\n\t| UpdateFunction<Value>\n\n/**\n * @public\n */\nexport interface UpdateObserver<Value> {\n\tonUpdate(handler: Observer<Value>): Cancel\n}\n\n/**\n * @internal\n */\nexport class Observers<Value> {\n\tprivate observers: Set<Observer<Value>> = new Set()\n\tprivate transactions: { [key: number]: Change<Value> } = {}\n\tadd(observer: Observer<Value>): Cancel {\n\t\tthis.observers.add(observer)\n\t\tlet isCalled = false\n\t\treturn () => {\n\t\t\tif (isCalled) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tisCalled = true\n\t\t\tthis.remove(observer)\n\t\t}\n\t}\n\n\tprivate remove(observer: Observer<Value>) {\n\t\tthis.observers.delete(observer)\n\t}\n\n\tnotify(change: Change<Value>, transaction?: TransactionId) {\n\t\tif (transaction) {\n\t\t\tconst accumulatedChange = this.transactions[transaction] || change\n\t\t\taccumulatedChange.value = change.value\n\t\t\tthis.transactions[transaction] = accumulatedChange\n\t\t} else {\n\t\t\tthis.callObservers(change)\n\t\t}\n\t}\n\n\tfinishTransaction(transaction: TransactionId) {\n\t\tconst accumulatedChange = this.transactions[transaction]\n\t\tdelete this.transactions[transaction]\n\t\treturn this.callObservers(accumulatedChange, transaction)\n\t}\n\n\tprivate callObservers(change: Change<Value> | undefined, transaction?: TransactionId) {\n\t\tconst finishObservers: FinishFunction[] = []\n\t\t// Make a copy and de-duplicate so we always call all handlers,\n\t\t// even if the handler array changes because of handler call\n\t\tnew Set(this.observers).forEach(observer => {\n\t\t\tif (typeof observer === \"function\") {\n\t\t\t\tobserver(change, transaction)\n\t\t\t} else {\n\t\t\t\tobserver.update(change, transaction)\n\t\t\t\tfinishObservers.push(observer.finish)\n\t\t\t}\n\t\t})\n\t\treturn finishObservers\n\t}\n}\n", "import type { MotionValue } from \"framer-motion\"\nimport type { Interpolation } from \"../../interpolation/Interpolation.ts\"\nimport { deprecationWarning } from \"../../utils/deprecation.ts\"\nimport type { FinishFunction, Observer, UpdateObserver } from \"./Observers.ts\"\nimport { Observers } from \"./Observers.ts\"\n\n/** @public */\nexport type Cancel = () => void\n\n/**\n * @public\n */\nexport type TransactionId = number\nexport interface Change<Value> {\n\tvalue: Value\n\toldValue?: Value\n}\n\nexport type ToAnimatable<PossiblyAnimatable> =\n\tPossiblyAnimatable extends Animatable<infer Value> ? Animatable<Value> : Animatable<PossiblyAnimatable>\n\nexport type FromAnimatable<PossiblyAnimatable> =\n\tPossiblyAnimatable extends Animatable<infer Value> ? Value : PossiblyAnimatable\n\nexport type ToAnimatableOrValue<PossiblyAnimatable> =\n\tPossiblyAnimatable extends Animatable<infer Value>\n\t\t? Value | Animatable<Value>\n\t\t: PossiblyAnimatable | Animatable<PossiblyAnimatable>\n\n/** @public */\nexport type AnimatableObject<T> = { [K in keyof T]: ToAnimatableOrValue<T[K]> }\n\n/**\n * @public\n * @deprecated\n */\nexport type DeprecatedAnimationTarget<Value> = Animatable<Value> | AnimatableObject<Value> | MotionValue<Value>\n\n/**\n * @public\n * @deprecated Use {@link useMotionValue} instead\n */\nexport interface Animatable<Value> extends UpdateObserver<Value> {\n\t/**\n\t * Get the current value out of this Animatable object\n\t * @remarks\n\t * ```jsx\n\t * const a = Animatable(0)\n\t * a.get() // returns 0\n\t * await animate(a, 42)\n\t * a.get() // returns 42\n\t * ```\n\t * @returns Current value\n\t * @public\n\t */\n\tget(): Value\n\t/**\n\t * Set a new value to a animatable object\n\t * @remarks\n\t * The passed value can be an Animatable value too\n\t * ```jsx\n\t * const a = Animatable(0)\n\t * const b = Animatable(100)\n\t * a.set(42)\n\t * a.get() // returns 42\n\t * a.set(b)\n\t * a.get() // returns 100\n\t * ```\n\t * @param value - New value to set to the animatable\n\t * @public\n\t */\n\tset(value: Value | Animatable<Value>): void\n\t/**\n\t * @public\n\t */\n\tset(value: Value | Animatable<Value>, transaction?: TransactionId): void\n\t/**\n\t * @internal\n\t */\n\tfinishTransaction(transaction: TransactionId): FinishFunction[]\n}\n\n/**\n * @public\n */\nexport const Animatable = /* @__PURE__ */ (() => {\n\t/**\n\t * Creates a Animatable object that can be animated. These objects can be passed into a {@link DeprecatedFrame} instead of a primitive like number\n\t * and afterwards animated with {@link (animate:function)}.\n\t * @remarks\n\t * ```jsx\n\t * const value = Animatable(0)\n\t * animate(value, 100)\n\t * ```\n\t * @param value - Value to animate\n\t * @returns Animatable value\n\t * @public\n\t * @deprecated Use {@link useMotionValue} instead\n\t */\n\tfunction Animatable<Value>(value: Value | Animatable<Value>): Animatable<Value> {\n\t\tdeprecationWarning(\"Animatable()\", \"2.0.0\", \"the new animation API (https://www.framer.com/api/animation/)\")\n\t\treturn isAnimatable(value) ? value : new AnimatableValue(value)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tAnimatable.transaction = (\n\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\t\tupdate: (updater: (animatable: Animatable<any>, value: any) => void, transactionId: TransactionId) => void,\n\t): void => {\n\t\tconst transactionId = Math.random()\n\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\t\tconst updatedValues: Set<Animatable<any>> = new Set()\n\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\t\tconst updater = (animatable: Animatable<any>, value: any): void => {\n\t\t\tanimatable.set(value, transactionId)\n\t\t\tupdatedValues.add(animatable)\n\t\t}\n\t\tupdate(updater, transactionId)\n\t\tconst finishObservers: FinishFunction[] = []\n\t\tupdatedValues.forEach(value => {\n\t\t\tfinishObservers.push(...value.finishTransaction(transactionId))\n\t\t})\n\t\tfinishObservers.forEach(finish => {\n\t\t\tfinish(transactionId)\n\t\t})\n\t}\n\n\t/**\n\t * @public\n\t */\n\tAnimatable.getNumber = (value: number | Animatable<number> | null | undefined, defaultValue: number = 0): number => {\n\t\treturn Animatable.get(value, defaultValue)\n\t}\n\n\t/** @internal */\n\tAnimatable.get = <Value>(value: Value | Animatable<Value> | null | undefined, defaultValue: Value): Value => {\n\t\tif (value === undefined || value === null) {\n\t\t\treturn defaultValue\n\t\t}\n\t\tif (isAnimatable(value)) {\n\t\t\treturn value.get()\n\t\t}\n\t\treturn value\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tAnimatable.objectToValues = <Object>(object: AnimatableObject<Object>): Object => {\n\t\tif (!object) {\n\t\t\treturn object\n\t\t}\n\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\t\tconst result: any = {}\n\t\tfor (const key in object) {\n\t\t\tconst value = object[key]\n\t\t\tif (isAnimatable(value)) {\n\t\t\t\tresult[key] = value.get()\n\t\t\t} else {\n\t\t\t\tresult[key] = value\n\t\t\t}\n\t\t}\n\t\treturn result\n\t}\n\n\treturn Animatable\n})()\n\nconst onUpdateKey: keyof AnimatableValue = \"onUpdate\"\nconst finishTransactionKey: keyof AnimatableValue = \"finishTransaction\"\n\n/**\n * @internal\n * @deprecated\n */\n// biome-ignore lint/suspicious/noExplicitAny: deprecated\nexport function isAnimatable(value: any): value is Animatable<any> {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === \"object\" &&\n\t\tonUpdateKey in value &&\n\t\tvalue[onUpdateKey] instanceof Function &&\n\t\tfinishTransactionKey in value &&\n\t\tvalue[finishTransactionKey] instanceof Function\n\t)\n}\n\nfunction animatableInterpolation<Value>(\n\tvalue: Animatable<Value>,\n\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\tcurrentInterpolation: Interpolation<any>,\n): Interpolation<Animatable<Value>> {\n\treturn {\n\t\tinterpolate(from: Animatable<Value>, to: Animatable<Value>): (progress: number) => Animatable<Value> {\n\t\t\tconst fromValue = from.get()\n\t\t\tconst toValue = to.get()\n\t\t\tconst result = Animatable(fromValue)\n\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\t\t\treturn (progress: number): Animatable<any> => {\n\t\t\t\tconst v = currentInterpolation.interpolate(fromValue, toValue)(progress)\n\t\t\t\tresult.set(v)\n\t\t\t\treturn result\n\t\t\t}\n\t\t},\n\t\tdifference(from: Animatable<Value>, to: Animatable<Value>): number {\n\t\t\tconst v = from.get()\n\t\t\treturn currentInterpolation.difference(v, to.get())\n\t\t},\n\t}\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: deprecated\nclass AnimatableValue<Value = any> implements Animatable<Value> {\n\tprivate observers = new Observers()\n\n\tconstructor(private value: Value) {}\n\n\tstatic interpolationFor<Value>(\n\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\t\tvalue: any,\n\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\t\tcurrentInterpolation: Interpolation<any>,\n\t): Interpolation<Animatable<Value>> | undefined {\n\t\tif (isAnimatable(value)) {\n\t\t\treturn animatableInterpolation<Value>(value, currentInterpolation)\n\t\t}\n\t}\n\n\tget(): Value {\n\t\treturn this.value\n\t}\n\n\tset(value: Value | Animatable<Value>, transaction?: TransactionId) {\n\t\tconst oldValue = this.value\n\t\tif (isAnimatable(value)) {\n\t\t\tvalue = value.get()\n\t\t}\n\t\tthis.value = value\n\t\tconst change = {\n\t\t\tvalue,\n\t\t\toldValue,\n\t\t}\n\t\tthis.observers.notify(change, transaction)\n\t}\n\n\tfinishTransaction(transaction: TransactionId) {\n\t\treturn this.observers.finishTransaction(transaction)\n\t}\n\n\tonUpdate(handler: Observer<Value>): Cancel {\n\t\treturn this.observers.add(handler)\n\t}\n}\n", "/** @internal */\nexport function roundedNumber(value: number, decimals: number): number {\n\tconst d = Math.round(Math.abs(decimals))\n\tconst multiplier = 10 ** d\n\treturn Math.round(value * multiplier) / multiplier\n}\n\n/** @internal */\nexport function roundedNumberString(value: number, decimals: number): string {\n\tconst result = value.toFixed(decimals)\n\treturn decimals === 0 ? result : `${+result}` // this drops any 0 at the end;\n}\n\n/** @internal */\nexport function roundWithOffset(value: number, offset: number): number {\n\tif (offset === 0) {\n\t\treturn Math.round(value)\n\t}\n\toffset -= offset | 0 // Remove everything before the comma\n\tif (offset < 0) {\n\t\toffset = 1 - offset\n\t}\n\treturn Math.round(value - offset) + offset\n}\n\n/** @internal */\nexport function roundToHalfPixel(value: number): number {\n\treturn Math.round(value * 2) / 2\n}\n", "import { roundWithOffset } from \"../utils/roundedNumber.ts\"\n\n/**\n * @public\n */\ninterface Point {\n\tx: number\n\ty: number\n}\n\n/**\n * @public\n */\nfunction Point(x: number, y: number): Point {\n\treturn { x, y }\n}\n\n/**\n * @public\n */\nnamespace Point {\n\t/** @internal */\n\texport const isQuadrilateralPoints = (points: Point[] | undefined): points is [Point, Point, Point, Point] => {\n\t\treturn points?.length === 4\n\t}\n\n\t/** @internal */\n\texport const add = (...args: Point[]): Point => {\n\t\treturn args.reduce(\n\t\t\t(previousValue, currentValue) => {\n\t\t\t\treturn { x: previousValue.x + currentValue.x, y: previousValue.y + currentValue.y }\n\t\t\t},\n\t\t\t{ x: 0, y: 0 },\n\t\t)\n\t}\n\n\t/** @internal */\n\texport const subtract = (a: Point, b: Point): Point => {\n\t\treturn { x: a.x - b.x, y: a.y - b.y }\n\t}\n\n\t/** @internal */\n\texport const multiply = (a: Point, b: number): Point => {\n\t\treturn { x: a.x * b, y: a.y * b }\n\t}\n\n\t/** @internal */\n\texport const divide = (a: Point, b: number): Point => {\n\t\treturn { x: a.x / b, y: a.y / b }\n\t}\n\n\t/** @internal */\n\texport const absolute = (point: Point): Point => {\n\t\treturn {\n\t\t\tx: Math.abs(point.x),\n\t\t\ty: Math.abs(point.y),\n\t\t}\n\t}\n\n\t/** @internal */\n\texport const reverse = (point: Point): Point => {\n\t\treturn {\n\t\t\tx: point.x * -1,\n\t\t\ty: point.y * -1,\n\t\t}\n\t}\n\n\t/** @internal */\n\texport const pixelAligned = (point: Point, offset: Point = { x: 0, y: 0 }): Point => {\n\t\treturn {\n\t\t\tx: roundWithOffset(point.x, offset.x),\n\t\t\ty: roundWithOffset(point.y, offset.y),\n\t\t}\n\t}\n\n\t/** @internal */\n\texport const distance = (a: Point, b: Point): number => {\n\t\tconst deltaX = Math.abs(a.x - b.x)\n\t\tconst deltaY = Math.abs(a.y - b.y)\n\t\treturn Math.sqrt(deltaX * deltaX + deltaY * deltaY)\n\t}\n\n\t/** @internal */\n\texport const angle = (a: Point, b: Point): number => {\n\t\treturn (Math.atan2(b.y - a.y, b.x - a.x) * 180) / Math.PI - 90\n\t}\n\n\t/**\n\t * Returns the angle (0~180\u00B0) between the x axis and the line formed by the given points, going clock-wise.\n\t *\n\t *              -90\u00B0\n\t *              \u2502\n\t *              \u2502\n\t *              \u2502\n\t *  180\u00B0 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500 0\u00B0\n\t *              \u2502\n\t *              \u2502\n\t *              \u2502\n\t *             90\u00B0\n\t *\n\t *\n\t *\n\t * @internal */\n\texport const angleFromX = (a: Point, b: Point): number => {\n\t\treturn (Math.atan2(b.y - a.y, b.x - a.x) * 180) / Math.PI\n\t}\n\n\t/** @public */\n\texport const isEqual = (a: Point, b: Point): boolean => {\n\t\treturn a.x === b.x && a.y === b.y\n\t}\n\n\t/** @internal */\n\texport const rotationNormalizer = () => {\n\t\tlet lastValue: number\n\n\t\treturn (value: number) => {\n\t\t\tif (typeof lastValue !== \"number\") {\n\t\t\t\tlastValue = value\n\t\t\t}\n\n\t\t\tconst diff = lastValue - value\n\t\t\tconst maxDiff = Math.abs(diff) + 180\n\t\t\tconst nTimes = Math.floor(maxDiff / 360)\n\n\t\t\tif (diff < 180) {\n\t\t\t\tvalue -= nTimes * 360\n\t\t\t}\n\t\t\tif (diff > 180) {\n\t\t\t\tvalue += nTimes * 360\n\t\t\t}\n\n\t\t\tlastValue = value\n\t\t\treturn value\n\t\t}\n\t}\n\n\t/** @internal */\n\texport function center(a: Point, b: Point) {\n\t\treturn {\n\t\t\tx: (a.x + b.x) / 2,\n\t\t\ty: (a.y + b.y) / 2,\n\t\t}\n\t}\n\n\t/** @internal */\n\texport function centroid(points: Point[]): Point {\n\t\tlet sumX = 0\n\t\tlet sumY = 0\n\n\t\tpoints.forEach(point => {\n\t\t\tsumX += point.x\n\t\t\tsumY += point.y\n\t\t})\n\n\t\tconst centroidX = sumX / points.length\n\t\tconst centroidY = sumY / points.length\n\n\t\treturn { x: centroidX, y: centroidY }\n\t}\n\n\t/** @internal */\n\texport function sortClockwise(points: Point[]): Point[] {\n\t\tconst centerPoint = Point.centroid(points)\n\t\tconst angles = new Map<Point, number>()\n\t\t// tan2 is slow. By precomputing the angles we limit the number of calls\n\t\t// to atan2 to the number of points. In a 4 point polygon, in Chrome,\n\t\t// this is >50% faster than simply calling atan2 for each point in the\n\t\t// sort function and doing no additional iterations.\n\t\tfor (let i = 0; i < points.length; i++) {\n\t\t\tconst point = points[i]\n\t\t\tif (!point) continue\n\t\t\tangles.set(point, Math.atan2(point.y - centerPoint.y, point.x - centerPoint.x))\n\t\t}\n\n\t\treturn points.sort((a, b) => (angles.get(a) ?? 0) - (angles.get(b) ?? 0))\n\t}\n}\n\nexport { Point }\n", "import type { Interpolation, Interpolator } from \"../../interpolation/Interpolation.ts\"\nimport { Point } from \"../../render/types/Point.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport type { Animator } from \"./Animator.ts\"\n\n/**\n * @public\n */\nexport enum Bezier {\n\tLinear = \"linear\",\n\tEase = \"ease\",\n\tEaseIn = \"ease-in\",\n\tEaseOut = \"ease-out\",\n\tEaseInOut = \"ease-in-out\",\n}\n\nexport const BezierDefaults: BezierOptions = {\n\tcurve: Bezier.Ease,\n\tduration: 1,\n}\n\nfunction controlPointsForCurve(curve: Bezier): ControlPoints {\n\tswitch (curve) {\n\t\tcase Bezier.Linear:\n\t\t\treturn [0, 0, 1, 1]\n\t\tcase Bezier.Ease:\n\t\t\treturn [0.25, 0.1, 0.25, 1]\n\t\tcase Bezier.EaseIn:\n\t\t\treturn [0.42, 0, 1, 1]\n\t\tcase Bezier.EaseOut:\n\t\t\treturn [0, 0, 0.58, 1]\n\t\tcase Bezier.EaseInOut:\n\t\t\treturn [0.42, 0, 0.58, 1]\n\t}\n}\n\nexport type ControlPoints = [number, number, number, number]\nexport type Curve = ControlPoints | Bezier\nexport interface BezierOptions {\n\tcurve: Curve\n\tduration: number\n}\n\n/**\n * Animator class using a bezier curve.\n * @internal\n * @deprecated Use the `transition` prop instead\n */\nexport class BezierAnimator<Value> implements Animator<Value, BezierOptions> {\n\tprivate unitBezier: UnitBezier\n\tprivate options: BezierOptions\n\n\tcurrent: Value | undefined\n\tdestination: Value | undefined\n\tinterpolator: Interpolator<Value> | undefined\n\tprogress = 0\n\tconstructor(\n\t\toptions: Partial<BezierOptions>,\n\t\tprivate interpolation: Interpolation<Value>,\n\t) {\n\t\tthis.options = { ...BezierDefaults, ...options }\n\t\tlet controlPoints: ControlPoints\n\t\tif (typeof this.options.curve === \"string\") {\n\t\t\tcontrolPoints = controlPointsForCurve(this.options.curve)\n\t\t} else {\n\t\t\tcontrolPoints = this.options.curve\n\t\t}\n\t\tconst [p1x, p1y, p2x, p2y] = controlPoints\n\t\tthis.unitBezier = new UnitBezier(Point(p1x, p1y), Point(p2x, p2y))\n\t}\n\n\tsetFrom(value: Value) {\n\t\tthis.current = value\n\t\tthis.updateInterpolator()\n\t}\n\n\tsetTo(value: Value) {\n\t\tthis.destination = value\n\t\tthis.updateInterpolator()\n\t}\n\n\tisReady(): boolean {\n\t\treturn this.interpolator !== undefined\n\t}\n\n\tupdateInterpolator() {\n\t\tif (this.current === undefined || this.destination === undefined) {\n\t\t\treturn\n\t\t}\n\t\tthis.interpolator = this.interpolation.interpolate(this.current, this.destination)\n\t}\n\n\tnext = (delta: number): Value => {\n\t\tconst { duration } = this.options\n\t\tthis.progress += delta / duration\n\t\tconst value = this.unitBezier.solve(this.progress, this.solveEpsilon(duration))\n\t\tassert(this.interpolator !== undefined, \"setFrom() or setTo() must be called before next()\")\n\t\tthis.current = this.interpolator(value)\n\t\treturn this.current\n\t}\n\n\tisFinished(): boolean {\n\t\treturn this.progress >= 1\n\t}\n\n\tsolveEpsilon(duration: number) {\n\t\treturn 1.0 / (200.0 * duration)\n\t}\n}\n\n// Based on WebKit implementation from https://github.com/WebKit/webkit/blob/master/PerformanceTests/MotionMark/resources/extensions.js#L379\nclass UnitBezier {\n\tprivate a: Point\n\tprivate b: Point\n\tprivate c: Point\n\n\tconstructor(point1: Point, point2: Point) {\n\t\t// Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1).\n\t\tthis.c = Point.multiply(point1, 3)\n\t\tthis.b = Point.subtract(Point.multiply(Point.subtract(point2, point1), 3), this.c)\n\t\tthis.a = Point.subtract(Point.subtract(Point(1, 1), this.c), this.b)\n\t}\n\tsolve(x: number, epsilon: number): number {\n\t\treturn this.sampleY(this.solveForT(x, epsilon))\n\t}\n\n\tsampleX(t: number): number {\n\t\t// `ax t^3 + bx t^2 + cx t' expanded using Horner's rule.\n\t\treturn ((this.a.x * t + this.b.x) * t + this.c.x) * t\n\t}\n\n\tsampleY(t: number): number {\n\t\treturn ((this.a.y * t + this.b.y) * t + this.c.y) * t\n\t}\n\n\tsampleDerivativeX(t: number): number {\n\t\treturn (3 * this.a.x * t + 2 * this.b.x) * t + this.c.x\n\t}\n\n\tsolveForT(x: number, epsilon: number): number {\n\t\tlet t0, t1, t2, x2, d2, i\n\t\tt2 = x\n\t\tfor (i = 0; i < 8; ++i) {\n\t\t\tx2 = this.sampleX(t2) - x\n\t\t\tif (Math.abs(x2) < epsilon) return t2\n\t\t\td2 = this.sampleDerivativeX(t2)\n\t\t\tif (Math.abs(d2) < epsilon) break\n\t\t\tt2 = t2 - x2 / d2\n\t\t}\n\n\t\tt0 = 0\n\t\tt1 = 1\n\t\tt2 = x\n\n\t\tif (t2 < t0) return t0\n\t\tif (t2 > t1) return t1\n\n\t\twhile (t0 < t1) {\n\t\t\tx2 = this.sampleX(t2)\n\t\t\tif (Math.abs(x2 - x) < epsilon) return t2\n\t\t\tif (x > x2) t0 = t2\n\t\t\telse t1 = t2\n\t\t\tt2 = (t1 - t0) * 0.5 + t0\n\t\t}\n\n\t\treturn t2\n\t}\n}\n", "/**\n * @internal\n */\nexport interface State {\n\tx: number\n\tv: number\n}\n\n/**\n * @internal\n */\nexport type AccelerationFunction = (state: State) => number\n\n/**\n * @internal\n */\ninterface Delta {\n\tdx: number\n\tdv: number\n}\n\n/**\n * @internal\n */\nexport class Integrator {\n\tprivate accelerationForState: AccelerationFunction\n\n\tpublic constructor(accelerationFunction: AccelerationFunction) {\n\t\tthis.accelerationForState = accelerationFunction\n\t}\n\n\tpublic integrateState(state: State, dt: number) {\n\t\tconst a = this.evaluateState(state)\n\t\tconst b = this.evaluateStateWithDerivative(state, dt * 0.5, a)\n\t\tconst c = this.evaluateStateWithDerivative(state, dt * 0.5, b)\n\t\tconst d = this.evaluateStateWithDerivative(state, dt, c)\n\n\t\tconst dxdt = (1.0 / 6.0) * (a.dx + 2.0 * (b.dx + c.dx) + d.dx)\n\t\tconst dvdt = (1.0 / 6.0) * (a.dv + 2.0 * (b.dv + c.dv) + d.dv)\n\n\t\tstate.x = state.x + dxdt * dt\n\t\tstate.v = state.v + dvdt * dt\n\n\t\treturn state\n\t}\n\n\tprivate evaluateState(initialState: State): Delta {\n\t\tconst dv = this.accelerationForState(initialState)\n\t\treturn { dx: initialState.v, dv: dv }\n\t}\n\n\tprivate evaluateStateWithDerivative(initialState: State, dt: number, derivative: Delta): Delta {\n\t\tconst state = {\n\t\t\tx: initialState.x + derivative.dx * dt,\n\t\t\tv: initialState.v + derivative.dv * dt,\n\t\t}\n\t\tconst output = {\n\t\t\tdx: state.v,\n\t\t\tdv: this.accelerationForState(state),\n\t\t}\n\t\treturn output\n\t}\n}\n", "import type { Animator } from \"./Animator.ts\"\nimport type { State } from \"./Integrator.ts\"\nimport { Integrator } from \"./Integrator.ts\"\n\nexport interface Options {\n\tvelocity: number\n\tfriction: number\n\ttolerance: number\n}\n/**\n * @internal\n * @deprecated\n */\nexport class FrictionAnimator implements Animator<number, Partial<Options>> {\n\toptions: Options\n\n\tprivate state: State\n\tprivate integrator: Integrator\n\tpublic constructor(options: Partial<Options>) {\n\t\tthis.options = {\n\t\t\tvelocity: 0,\n\t\t\tfriction: 2,\n\t\t\ttolerance: 1 / 10,\n\t\t}\n\t\tObject.assign(this.options, options)\n\t\tthis.state = {\n\t\t\tx: 0,\n\t\t\tv: this.options.velocity,\n\t\t}\n\n\t\tthis.integrator = new Integrator(state => -(this.options.friction * state.v))\n\t}\n\n\tpublic setFrom(value: number) {\n\t\tthis.state.x = value\n\t}\n\n\tpublic setTo(value: number) {}\n\n\tpublic setVelocity(velocity: number) {\n\t\tthis.state.v = velocity\n\t}\n\n\tpublic getState(): State {\n\t\treturn this.state\n\t}\n\n\tpublic isReady() {\n\t\treturn true\n\t}\n\n\tpublic next(delta: number): number {\n\t\tthis.state = this.integrator.integrateState(this.state, delta)\n\t\treturn this.state.x\n\t}\n\n\tpublic isFinished() {\n\t\treturn Math.abs(this.state.v) < this.options.tolerance\n\t}\n}\n", "/**\n * @internal\n */\nexport type Interpolator<Value> = (progress: number) => Value\n\n/**\n * @public\n */\nexport interface Interpolation<Value = any> {\n\t/**\n\t * @internal\n\t */\n\tinterpolate(from: Value, to: Value): Interpolator<Value>\n\t/**\n\t * difference(from, to) calculates a measure of difference between two values,\n\t * such that for every value of from, to and x holds:\n\t * interpolator = interpolate(from, to)\n\t * total = difference(from, to)\n\t * interpolator( difference(from, x) / total ) === x\n\t * @internal\n\t */\n\tdifference(from: Value, to: Value): number\n}\n\n/**\n * @internal\n */\nexport interface Interpolatable<Value> {\n\tinterpolationFor(value: Value, currentInterpolation: Interpolation): Interpolation<Value> | undefined\n}\n\n/**\n * @internal\n */\nexport function isInterpolatable<Value>(value: any): value is Interpolatable<Value> {\n\treturn typeof value === \"function\" && value.interpolationFor && typeof value.interpolationFor === \"function\"\n}\n\n/**\n * @public\n */\nexport const Interpolation = {\n\t/**\n\t * @param from -\n\t * @param to -\n\t * @internal\n\t */\n\thandleUndefined: <Value>(from: Value, to: Value): [Value, Value] => {\n\t\tif (from === undefined) {\n\t\t\tfrom = to\n\t\t}\n\t\tif (to === undefined) {\n\t\t\tto = from\n\t\t}\n\t\treturn [from, to]\n\t},\n}\n", "import { Interpolation } from \"./Interpolation.ts\"\n\nexport const NumberInterpolation: Interpolation<number> = {\n\tinterpolate(from: number, to: number): (progress: number) => number {\n\t\t;[from, to] = Interpolation.handleUndefined(from, to)\n\t\tconst a1 = from\n\t\tconst b1 = to - a1\n\t\treturn (progress: number): number => {\n\t\t\tconst value = a1 + b1 * progress\n\t\t\treturn value\n\t\t}\n\t},\n\tdifference(from: number, to: number): number {\n\t\treturn to - from\n\t},\n}\n", "const epsilon: number = 0.001\nconst minDuration: number = 0.01\nconst maxDuration: number = 10.0\nconst minDamping: number = /* @__PURE__ */ (() => Number.MIN_VALUE)()\nconst maxDamping: number = 1\ntype NumFunc = (num: number) => number\nexport interface CurveOptions {\n\ttension: number\n\tfriction: number\n\tvelocity: number\n}\n// Newton's method\nfunction approximateRoot(func: NumFunc, derivative: NumFunc, initialGuess: number, times: number = 12): number {\n\tlet result = initialGuess\n\tfor (let i = 1, end = times, asc = 1 <= end; asc ? i < end : i > end; asc ? i++ : i--) {\n\t\tresult = result - func(result) / derivative(result)\n\t}\n\treturn result\n}\n\nfunction angularFrequency(undampedFrequency: number, dampingRatio: number): number {\n\treturn undampedFrequency * Math.sqrt(1 - Math.pow(dampingRatio, 2))\n}\n\nexport const SpringCurveValueConverter = {\n\tcomputeDampingRatio: (tension: number, friction: number, mass: number = 1): number => {\n\t\treturn friction / (2 * Math.sqrt(mass * tension))\n\t},\n\n\t// Tries to compute the duration of a spring,\n\t// but can't for certain velocities and if dampingRatio >= 1\n\t// In those cases it will return null\n\tcomputeDuration: (tension: number, friction: number, velocity: number = 0, mass: number = 1): number | null => {\n\t\tlet duration\n\t\tconst dampingRatio = SpringCurveValueConverter.computeDampingRatio(tension, friction)\n\t\tconst undampedFrequency = Math.sqrt(tension / mass)\n\t\t// This is basically duration extracted out of the envelope functions\n\t\tif (dampingRatio < 1) {\n\t\t\tconst a = Math.sqrt(1 - Math.pow(dampingRatio, 2))\n\t\t\tconst b = velocity / (a * undampedFrequency)\n\t\t\tconst c = dampingRatio / a\n\t\t\tconst d = -((b - c) / epsilon)\n\t\t\tif (d <= 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tduration = Math.log(d) / (dampingRatio * undampedFrequency)\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t\treturn duration\n\t},\n\n\tcomputeDerivedCurveOptions: (\n\t\tdampingRatio: number,\n\t\tduration: number,\n\t\tvelocity: number = 0,\n\t\tmass: number = 1,\n\t): CurveOptions => {\n\t\tlet derivative: NumFunc, envelope: NumFunc\n\t\tdampingRatio = Math.max(Math.min(dampingRatio, maxDamping), minDamping)\n\t\tduration = Math.max(Math.min(duration, maxDuration), minDuration)\n\n\t\tif (dampingRatio < 1) {\n\t\t\tenvelope = function (envelopeUndampedFrequency) {\n\t\t\t\tconst exponentialDecay = envelopeUndampedFrequency * dampingRatio\n\t\t\t\tconst currentDisplacement = exponentialDecay * duration\n\t\t\t\tconst a = exponentialDecay - velocity\n\t\t\t\tconst b = angularFrequency(envelopeUndampedFrequency, dampingRatio)\n\t\t\t\tconst c = Math.exp(-currentDisplacement)\n\t\t\t\treturn epsilon - (a / b) * c\n\t\t\t}\n\n\t\t\tderivative = function (derivativeUndampedFrequency) {\n\t\t\t\tconst exponentialDecay = derivativeUndampedFrequency * dampingRatio\n\t\t\t\tconst currentDisplacement = exponentialDecay * duration\n\t\t\t\tconst d = currentDisplacement * velocity + velocity\n\t\t\t\tconst e = Math.pow(dampingRatio, 2) * Math.pow(derivativeUndampedFrequency, 2) * duration\n\t\t\t\tconst f = Math.exp(-currentDisplacement)\n\t\t\t\tconst g = angularFrequency(Math.pow(derivativeUndampedFrequency, 2), dampingRatio)\n\t\t\t\tconst factor = -envelope(derivativeUndampedFrequency) + epsilon > 0 ? -1 : 1\n\t\t\t\treturn (factor * ((d - e) * f)) / g\n\t\t\t}\n\t\t} else {\n\t\t\tenvelope = function (envelopeUndampedFrequency) {\n\t\t\t\tconst a = Math.exp(-envelopeUndampedFrequency * duration)\n\t\t\t\tconst b = (envelopeUndampedFrequency - velocity) * duration + 1\n\t\t\t\treturn -epsilon + a * b\n\t\t\t}\n\n\t\t\tderivative = function (derivativeUndampedFrequency) {\n\t\t\t\tconst a = Math.exp(-derivativeUndampedFrequency * duration)\n\t\t\t\tconst b = (velocity - derivativeUndampedFrequency) * Math.pow(duration, 2)\n\t\t\t\treturn a * b\n\t\t\t}\n\t\t}\n\n\t\tconst result = {\n\t\t\ttension: 100,\n\t\t\tfriction: 10,\n\t\t\tvelocity,\n\t\t}\n\n\t\tconst initialGuess = 5 / duration\n\t\tconst undampedFrequency = approximateRoot(envelope, derivative, initialGuess)\n\t\tif (!Number.isNaN(undampedFrequency)) {\n\t\t\tresult.tension = Math.pow(undampedFrequency, 2) * mass\n\t\t\tresult.friction = dampingRatio * 2 * Math.sqrt(mass * result.tension)\n\t\t}\n\t\treturn result\n\t},\n}\n", "import type { Interpolation, Interpolator } from \"../../interpolation/Interpolation.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport type { Animator } from \"./Animator.ts\"\nimport type { State } from \"./Integrator.ts\"\nimport { Integrator } from \"./Integrator.ts\"\nimport { SpringCurveValueConverter } from \"./SpringCurveValueConverter.ts\"\n\nexport const SpringTensionFrictionDefaults: TensionFrictionSpringOptions = /* @__PURE__ */ (() => ({\n\ttension: 500,\n\tfriction: 10,\n\ttolerance: 1 / 10000,\n\tvelocity: 0,\n}))()\n\nexport const SpringDampingDurationDefaults: DampingDurationSpringOptions = {\n\tdampingRatio: 1,\n\tduration: 1,\n\tvelocity: 0,\n\tmass: 1,\n}\n\nexport interface TensionFrictionSpringOptions {\n\ttension: number\n\tfriction: number\n\ttolerance: number\n\tvelocity: number\n}\n\nexport interface DampingDurationSpringOptions {\n\tdampingRatio: number\n\tduration: number\n\tvelocity: number\n\tmass: number\n}\n\nexport type SpringOptions = TensionFrictionSpringOptions | DampingDurationSpringOptions\n\nfunction isDampingDurationSpringOptions(options: Partial<SpringOptions>): options is DampingDurationSpringOptions {\n\tif (!options) {\n\t\treturn false\n\t}\n\treturn (\n\t\ttypeof (options as Partial<DampingDurationSpringOptions>).dampingRatio === \"number\" ||\n\t\ttypeof (options as Partial<DampingDurationSpringOptions>).duration === \"number\" ||\n\t\ttypeof (options as Partial<DampingDurationSpringOptions>).mass === \"number\"\n\t)\n}\n\n/**\n * Animator class using a spring curve\n * @internal\n * @deprecated Use the `transition` prop instead\n */\nexport class SpringAnimator<Value> implements Animator<Value, SpringOptions> {\n\tprivate options: TensionFrictionSpringOptions\n\tprivate current: Value | undefined\n\tprivate destination: Value | undefined\n\n\tprivate difference: number | undefined\n\tprivate state: State\n\tprivate integrator: Integrator\n\tprivate interpolator: Interpolator<Value> | undefined\n\n\tpublic constructor(\n\t\toptions: Partial<SpringOptions>,\n\t\tprivate interpolation: Interpolation<Value>,\n\t) {\n\t\tlet _opt: Partial<TensionFrictionSpringOptions>\n\t\tif (isDampingDurationSpringOptions(options)) {\n\t\t\tconst toPass = { ...SpringDampingDurationDefaults, ...options }\n\t\t\t_opt = SpringCurveValueConverter.computeDerivedCurveOptions(\n\t\t\t\ttoPass.dampingRatio,\n\t\t\t\ttoPass.duration,\n\t\t\t\ttoPass.velocity,\n\t\t\t\ttoPass.mass,\n\t\t\t)\n\t\t} else {\n\t\t\t_opt = options as Partial<TensionFrictionSpringOptions>\n\t\t}\n\t\tthis.options = { ...SpringTensionFrictionDefaults, ..._opt }\n\n\t\tthis.state = {\n\t\t\tx: 0,\n\t\t\tv: this.options.velocity,\n\t\t}\n\n\t\tthis.integrator = new Integrator(state => -this.options.tension * state.x - this.options.friction * state.v)\n\t}\n\n\tpublic isReady() {\n\t\treturn this.interpolator !== undefined && this.difference !== undefined\n\t}\n\n\tpublic next(delta: number): Value {\n\t\tthis.state = this.integrator.integrateState(this.state, delta)\n\t\tassert(this.interpolator !== undefined, \"setFrom() or setTo() must be called before next()\")\n\t\tconst value = this.interpolator(this.progress())\n\t\treturn value\n\t}\n\n\tpublic isFinished() {\n\t\tconst positionNearZero = Math.abs(this.state.x) < this.options.tolerance\n\t\tconst velocityNearZero = Math.abs(this.state.v) < this.options.tolerance\n\t\treturn positionNearZero && velocityNearZero\n\t}\n\n\tpublic setFrom(value: Value) {\n\t\tthis.current = value\n\t\tthis.updateInterpolator()\n\t}\n\n\tpublic setVelocity(velocity: number) {\n\t\tthis.state.v = velocity\n\t}\n\n\tprogress(): number {\n\t\tassert(this.difference !== undefined, \"setTo() must be called before progress()\")\n\t\treturn 1 - this.state.x / this.difference\n\t}\n\n\t// The spring always settles to 0, so we create an interpolation to the destination\n\t// And calculate the progress based on the current state and the span of the interpolation\n\t// This lets us integrate over state.x, even though Value is generic\n\tpublic setTo(value: Value) {\n\t\tassert(this.current !== undefined, \"setFrom() must be called before setTo()\")\n\t\tthis.destination = value\n\t\tthis.difference = this.interpolation.difference(this.destination, this.current)\n\t\tthis.state.x = this.difference\n\t\tthis.updateInterpolator()\n\t}\n\n\t/** @internal */\n\tpublic getState(): State {\n\t\treturn this.state\n\t}\n\n\tupdateInterpolator() {\n\t\tif (this.current === undefined || this.destination === undefined) {\n\t\t\treturn\n\t\t}\n\t\tthis.interpolator = this.interpolation.interpolate(this.current, this.destination)\n\t}\n}\n", "import { NumberInterpolation } from \"../../interpolation/NumberInterpolation.ts\"\nimport type { Animator } from \"./Animator.ts\"\nimport { FrictionAnimator } from \"./FrictionAnimator.ts\"\nimport type { State } from \"./Integrator.ts\"\nimport { SpringAnimator } from \"./SpringAnimator.ts\"\n\nexport const Defaults = {\n\tvelocity: 0,\n\tmin: 0,\n\tmax: 0,\n\tmomentum: {\n\t\tfriction: 2,\n\t\ttolerance: 10,\n\t},\n\tbounce: {\n\t\ttension: 500,\n\t\tfriction: 10,\n\t\ttolerance: 1,\n\t},\n}\n\nexport type Options = typeof Defaults\n\n/**\n * @internal\n * @deprecated\n */\nexport class InertialScrollAnimator implements Animator<number, Options> {\n\tprivate options: Options\n\tprivate current: number | undefined\n\tprivate frictionAnimator: FrictionAnimator\n\tprivate springAnimator: SpringAnimator<number>\n\tprivate useSpring: boolean\n\tpublic constructor(options: Partial<Options>) {\n\t\tthis.options = Object.assign({ ...Defaults }, options)\n\n\t\tthis.frictionAnimator = new FrictionAnimator({\n\t\t\tfriction: this.options.momentum.friction,\n\t\t\ttolerance: this.options.momentum.tolerance,\n\t\t\tvelocity: this.options.velocity,\n\t\t})\n\n\t\tthis.springAnimator = new SpringAnimator(\n\t\t\t{\n\t\t\t\ttension: this.options.bounce.tension,\n\t\t\t\tfriction: this.options.bounce.friction,\n\t\t\t\ttolerance: this.options.bounce.tolerance,\n\t\t\t\tvelocity: this.options.velocity,\n\t\t\t},\n\t\t\tNumberInterpolation,\n\t\t)\n\t\tthis.useSpring = false\n\t}\n\n\tpublic isReady() {\n\t\treturn true\n\t}\n\n\tpublic next(delta: number): number {\n\t\tthis.current = this.currentAnimator.next(delta)\n\t\tif (!this.useSpring) {\n\t\t\tthis.tryTransitionToSpring()\n\t\t}\n\t\t// console.log(this.current, this.useSpring)\n\t\treturn this.current\n\t}\n\n\tget currentAnimator(): SpringAnimator<number> | FrictionAnimator {\n\t\tif (this.useSpring) {\n\t\t\treturn this.springAnimator\n\t\t}\n\t\treturn this.frictionAnimator\n\t}\n\n\tpublic isFinished(): boolean {\n\t\treturn this.currentAnimator.isFinished()\n\t}\n\n\tget state(): State {\n\t\treturn this.currentAnimator.getState()\n\t}\n\n\tpublic setFrom(value: number) {\n\t\tthis.setState({ x: value, v: this.state.v })\n\t}\n\n\tpublic setState(state: State) {\n\t\tthis.frictionAnimator.setFrom(state.x)\n\t\tthis.frictionAnimator.setVelocity(state.v)\n\n\t\tif (this.isValidState()) {\n\t\t\treturn this.tryTransitionToSpring()\n\t\t} else {\n\t\t\tlet bound: number = 0\n\t\t\tif (this.state.x <= this.options.min) {\n\t\t\t\tbound = this.options.min\n\t\t\t}\n\t\t\tif (this.state.x >= this.options.max) {\n\t\t\t\tbound = this.options.max\n\t\t\t}\n\t\t\treturn this.transitionToSpring(bound)\n\t\t}\n\t}\n\n\tpublic setTo(destination: number) {\n\t\tthis.frictionAnimator.setTo(destination)\n\t\tthis.springAnimator.setTo(destination)\n\t}\n\n\tpublic setLimits(min: number, max: number) {\n\t\tthis.options.min = min\n\t\tthis.options.max = max\n\t}\n\n\t// If the position is outside the min and max bounds, and traveling\n\t// further away, then transition from friction to spring animation\n\n\tprivate tryTransitionToSpring() {\n\t\tconst belowMinWithVelocity = this.state.x < this.options.min && this.state.v <= 0\n\t\tconst aboveMaxWithVelocity = this.state.x > this.options.max && this.state.v >= 0\n\n\t\tif (belowMinWithVelocity || aboveMaxWithVelocity) {\n\t\t\tlet bound: number\n\t\t\tif (belowMinWithVelocity) {\n\t\t\t\tbound = this.options.min\n\t\t\t} else {\n\t\t\t\tbound = this.options.max\n\t\t\t}\n\t\t\tthis.transitionToSpring(bound)\n\t\t} else {\n\t\t\tthis.useSpring = false\n\t\t}\n\t}\n\n\tprivate transitionToSpring(bound: number) {\n\t\tthis.springAnimator.setFrom(this.state.x)\n\t\tthis.springAnimator.setVelocity(this.state.v)\n\t\tthis.springAnimator.setTo(bound)\n\t\tthis.useSpring = true\n\t}\n\n\t// If the position is outside the min and max bounds, but traveling\n\t// back towards the bounds, check if the velocity is sufficient to\n\t// carry the position back within bounds. If it is, let friction do the\n\t// work. If not, the state is invalid, so use the spring.\n\n\tprivate isValidState(): boolean {\n\t\t// Note that if velocity is 0, the state is still valid (should use spring,\n\t\t// not friction), and we don't want to divide by 0 later in the check.\n\t\tconst belowMinTravelingBack = this.state.x < this.options.min && this.state.v > 0\n\t\tconst aboveMaxTravelingBack = this.state.x > this.options.max && this.state.v < 0\n\n\t\tif (belowMinTravelingBack || aboveMaxTravelingBack) {\n\t\t\tlet bound: number\n\t\t\tif (belowMinTravelingBack) {\n\t\t\t\tbound = this.options.min\n\t\t\t} else {\n\t\t\t\tbound = this.options.max\n\t\t\t}\n\n\t\t\tconst friction = this.frictionAnimator.options.friction\n\t\t\tconst solution = 1 - (friction * (bound - this.state.x)) / this.state.v\n\n\t\t\treturn solution > 0\n\t\t}\n\n\t\treturn true\n\t}\n\n\t// The math behind _isValidState:\n\t//\n\t// 1. Integrate the friction animator's acceleration to find velocity\n\t//\n\t//         a = - k * v\n\t//     dv/dt = - k * v\n\t// Int(dv/v) = - k * Int(dt)\n\t//      ln v = - k * t + C\n\t//\n\t// => Solve for C at t = 0\n\t//\n\t// ln v(0) = - k * 0 + C\n\t// ln v(0) = C\n\t//\n\t// => Plug C back into v(t)\n\t//\n\t//     ln v = - k * t + ln v(0)\n\t// e^(ln v) = e^(- k * t) + e^(ln v(0))\n\t//        v = v(0) * e^(- k * t)\n\t//\n\t// 2. Integrate velocity to find position\n\t//\n\t// Int(v) = v(0) * Int(e^(- k * t))\n\t//      x = - v(0) * e^(-k * t) / k + C\n\t//\n\t// => Solve for C at t = 0\n\t//\n\t//            x(0) = - v(0) * e^(-k * 0) / k + C\n\t//            x(0) = - v(0) / k + C\n\t// x(0) + v(0) / k = C\n\t//\n\t// => Plug C back into x(t)\n\t//\n\t// x = - v(0) * e^(-k * t) / k + x(0) + v(0) / k\n\t//\n\t// 3. Check if a (real) solution exists for t for position x\n\t//\n\t//                                x = - v(0) * e^(-k * t) / k + x(0) + v(0) / k\n\t//                         x - x(0) = - v(0) * e^(-k * t) / k + v(0) / k\n\t//                   k * (x - x(0)) = - v(0) * e^(-k * t) + v(0)\n\t//            k * (x - x(0)) - v(0) = - v(0) * e^(-k * t)\n\t// (k * (x - x(0)) - v(0)) / - v(0) = e^(-k * t)\n\t//       1 - (k * (x - x(0)) / v(0) = e^(-k * t)\n\t//   ln(1 - (k * (x - x(0)) / v(0)) = -k * t\n\t//\n\t// Therefore, a real solution exists if 1 - (k * (x - x(0)) / v(0) > 0\n}\n", "export const cssNames: Record<string, string> = {\n\taliceblue: \"f0f8ff\",\n\tantiquewhite: \"faebd7\",\n\taqua: \"0ff\",\n\taquamarine: \"7fffd4\",\n\tazure: \"f0ffff\",\n\tbeige: \"f5f5dc\",\n\tbisque: \"ffe4c4\",\n\tblack: \"000\",\n\tblanchedalmond: \"ffebcd\",\n\tblue: \"00f\",\n\tblueviolet: \"8a2be2\",\n\tbrown: \"a52a2a\",\n\tburlywood: \"deb887\",\n\tburntsienna: \"ea7e5d\",\n\tcadetblue: \"5f9ea0\",\n\tchartreuse: \"7fff00\",\n\tchocolate: \"d2691e\",\n\tcoral: \"ff7f50\",\n\tcornflowerblue: \"6495ed\",\n\tcornsilk: \"fff8dc\",\n\tcrimson: \"dc143c\",\n\tcyan: \"0ff\",\n\tdarkblue: \"00008b\",\n\tdarkcyan: \"008b8b\",\n\tdarkgoldenrod: \"b8860b\",\n\tdarkgray: \"a9a9a9\",\n\tdarkgreen: \"006400\",\n\tdarkgrey: \"a9a9a9\",\n\tdarkkhaki: \"bdb76b\",\n\tdarkmagenta: \"8b008b\",\n\tdarkolivegreen: \"556b2f\",\n\tdarkorange: \"ff8c00\",\n\tdarkorchid: \"9932cc\",\n\tdarkred: \"8b0000\",\n\tdarksalmon: \"e9967a\",\n\tdarkseagreen: \"8fbc8f\",\n\tdarkslateblue: \"483d8b\",\n\tdarkslategray: \"2f4f4f\",\n\tdarkslategrey: \"2f4f4f\",\n\tdarkturquoise: \"00ced1\",\n\tdarkviolet: \"9400d3\",\n\tdeeppink: \"ff1493\",\n\tdeepskyblue: \"00bfff\",\n\tdimgray: \"696969\",\n\tdimgrey: \"696969\",\n\tdodgerblue: \"1e90ff\",\n\tfirebrick: \"b22222\",\n\tfloralwhite: \"fffaf0\",\n\tforestgreen: \"228b22\",\n\tfuchsia: \"f0f\",\n\tgainsboro: \"dcdcdc\",\n\tghostwhite: \"f8f8ff\",\n\tgold: \"ffd700\",\n\tgoldenrod: \"daa520\",\n\tgray: \"808080\",\n\tgreen: \"008000\",\n\tgreenyellow: \"adff2f\",\n\tgrey: \"808080\",\n\thoneydew: \"f0fff0\",\n\thotpink: \"ff69b4\",\n\tindianred: \"cd5c5c\",\n\tindigo: \"4b0082\",\n\tivory: \"fffff0\",\n\tkhaki: \"f0e68c\",\n\tlavender: \"e6e6fa\",\n\tlavenderblush: \"fff0f5\",\n\tlawngreen: \"7cfc00\",\n\tlemonchiffon: \"fffacd\",\n\tlightblue: \"add8e6\",\n\tlightcoral: \"f08080\",\n\tlightcyan: \"e0ffff\",\n\tlightgoldenrodyellow: \"fafad2\",\n\tlightgray: \"d3d3d3\",\n\tlightgreen: \"90ee90\",\n\tlightgrey: \"d3d3d3\",\n\tlightpink: \"ffb6c1\",\n\tlightsalmon: \"ffa07a\",\n\tlightseagreen: \"20b2aa\",\n\tlightskyblue: \"87cefa\",\n\tlightslategray: \"789\",\n\tlightslategrey: \"789\",\n\tlightsteelblue: \"b0c4de\",\n\tlightyellow: \"ffffe0\",\n\tlime: \"0f0\",\n\tlimegreen: \"32cd32\",\n\tlinen: \"faf0e6\",\n\tmagenta: \"f0f\",\n\tmaroon: \"800000\",\n\tmediumaquamarine: \"66cdaa\",\n\tmediumblue: \"0000cd\",\n\tmediumorchid: \"ba55d3\",\n\tmediumpurple: \"9370db\",\n\tmediumseagreen: \"3cb371\",\n\tmediumslateblue: \"7b68ee\",\n\tmediumspringgreen: \"00fa9a\",\n\tmediumturquoise: \"48d1cc\",\n\tmediumvioletred: \"c71585\",\n\tmidnightblue: \"191970\",\n\tmintcream: \"f5fffa\",\n\tmistyrose: \"ffe4e1\",\n\tmoccasin: \"ffe4b5\",\n\tnavajowhite: \"ffdead\",\n\tnavy: \"000080\",\n\toldlace: \"fdf5e6\",\n\tolive: \"808000\",\n\tolivedrab: \"6b8e23\",\n\torange: \"ffa500\",\n\torangered: \"ff4500\",\n\torchid: \"da70d6\",\n\tpalegoldenrod: \"eee8aa\",\n\tpalegreen: \"98fb98\",\n\tpaleturquoise: \"afeeee\",\n\tpalevioletred: \"db7093\",\n\tpapayawhip: \"ffefd5\",\n\tpeachpuff: \"ffdab9\",\n\tperu: \"cd853f\",\n\tpink: \"ffc0cb\",\n\tplum: \"dda0dd\",\n\tpowderblue: \"b0e0e6\",\n\tpurple: \"800080\",\n\trebeccapurple: \"663399\",\n\tred: \"f00\",\n\trosybrown: \"bc8f8f\",\n\troyalblue: \"4169e1\",\n\tsaddlebrown: \"8b4513\",\n\tsalmon: \"fa8072\",\n\tsandybrown: \"f4a460\",\n\tseagreen: \"2e8b57\",\n\tseashell: \"fff5ee\",\n\tsienna: \"a0522d\",\n\tsilver: \"c0c0c0\",\n\tskyblue: \"87ceeb\",\n\tslateblue: \"6a5acd\",\n\tslategray: \"708090\",\n\tslategrey: \"708090\",\n\tsnow: \"fffafa\",\n\tspringgreen: \"00ff7f\",\n\tsteelblue: \"4682b4\",\n\ttan: \"d2b48c\",\n\tteal: \"008080\",\n\tthistle: \"d8bfd8\",\n\ttomato: \"ff6347\",\n\tturquoise: \"40e0d0\",\n\tviolet: \"ee82ee\",\n\twheat: \"f5deb3\",\n\twhite: \"fff\",\n\twhitesmoke: \"f5f5f5\",\n\tyellow: \"ff0\",\n\tyellowgreen: \"9acd32\",\n}\n", "export function modulate(value: number, rangeA: [number, number], rangeB: [number, number], limit = false): number {\n\tconst [fromLow, fromHigh] = rangeA\n\tconst [toLow, toHigh] = rangeB\n\n\tconst fromDelta = fromHigh - fromLow\n\tif (fromDelta === 0) return (toHigh + toLow) / 2\n\tconst toDelta = toHigh - toLow\n\tif (toDelta === 0) return toLow\n\n\tconst result = toLow + ((value - fromLow) / fromDelta) * toDelta\n\tif (limit === true) {\n\t\tif (toLow < toHigh) {\n\t\t\tif (result < toLow) {\n\t\t\t\treturn toLow\n\t\t\t}\n\t\t\tif (result > toHigh) {\n\t\t\t\treturn toHigh\n\t\t\t}\n\t\t} else {\n\t\t\tif (result > toLow) {\n\t\t\t\treturn toLow\n\t\t\t}\n\t\t\tif (result < toHigh) {\n\t\t\t\treturn toHigh\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}\n\nexport function isNumeric(value: number): boolean {\n\treturn !Number.isNaN(value) && Number.isFinite(value)\n}\n\nexport function percentToFraction(val: string): number {\n\tconst digits = numberFromString(val)\n\tif (digits !== undefined) {\n\t\tif (val.includes(\"%\")) {\n\t\t\treturn digits / 100\n\t\t}\n\t\treturn digits\n\t}\n\treturn 0\n}\nexport function numberFromString(input: string): number | undefined {\n\t// eslint-disable-next-line redos-detector/no-unsafe-regex -- safe but matches a lot of things\n\tconst match = /\\d?\\.?\\d+/u.exec(input)\n\treturn match ? Number(match[0]) : undefined\n}\n", "// Used for inspection\n/** @public */\nexport enum ColorFormat {\n\tRGB = \"rgb\",\n\tHSL = \"hsl\",\n\tHSV = \"hsv\",\n\tHEX = \"hex\",\n\tNAME = \"name\",\n}\n\nexport interface ColorRGB {\n\tr: number\n\tg: number\n\tb: number\n}\n\n/** @public */\nexport type ColorRGBA = ColorRGB & {\n\ta: number\n}\n\n/** @public */\nexport type ColorTypeRGBA = ColorRGBA & {\n\tformat: ColorFormat\n}\n\n/** @public */\nexport interface ColorHSL {\n\th: number\n\ts: number\n\tl: number\n}\n\n/** @public */\nexport type ColorHSLA = ColorHSL & {\n\ta: number\n}\n\nexport type ColorTypeHSLA = ColorHSLA & {\n\tformat: ColorFormat\n}\n\n/** @public */\nexport interface ColorHSV {\n\th: number\n\ts: number\n\tv: number\n}\n\n/** @public */\nexport type ColorHSVA = ColorHSV & {\n\ta: number\n}\n\nexport type ColorTypeHSVA = ColorHSVA & {\n\tformat: ColorFormat\n}\n\nexport interface CompleteColor {\n\tformat: ColorFormat\n\tr: number\n\tg: number\n\tb: number\n\th: number\n\ts: number\n\tl: number\n\ta: number\n}\n\n/** @public */\nexport type IncomingColor = ColorRGB | ColorHSL | ColorRGBA | ColorHSLA | string\n\n/**\n * Various Color functions, such as {@link (Color:namespace).mix} and {@link\n * (Color:namespace).interpolate}, take an optional color model that\n * determines how two colors are mixed together.\n *\n * @remarks\n *\n * ```javascript\n * const newColor = Color.mix(Color(\"red\"), Color(\"blue\"), {model: ColorMixModelType.HSL})\n * ```\n *\n * @public\n */\nexport enum ColorMixModelType {\n\t/**\n\t * Use the {@link https://en.wikipedia.org/wiki/RGB_color_model | RGB color space} without an alpha value\n\t *\n\t * @remarks\n\t *\n\t * ```javascript\n\t * const newColor = Color.mix(Color(\"red\"), Color(\"blue\"), {model: ColorMixModelType.RGB})\n\t * ```\n\t *\n\t * @public\n\t */\n\tRGB = \"rgb\",\n\t/**\n\t * Use the {@link https://en.wikipedia.org/wiki/RGB_color_model | RGB color space} color space with an alpha value\n\t *\n\t * @remarks\n\t *\n\t * ```javascript\n\t * const newColor = Color.mix(Color(\"red\"), Color(\"blue\"), {model: ColorMixModelType.RGBA})\n\t * ```\n\t *\n\t * @public\n\t */\n\tRGBA = \"rgba\",\n\t/**\n\t * Use the {@link https://en.wikipedia.org/wiki/HSL_and_HSV | HSL} color space with an alpha value\n\t *\n\t * @remarks\n\t *\n\t * ```javascript\n\t * const newColor = Color.mix(Color(\"red\"), Color(\"blue\"), {model: ColorMixModelType.HSL})\n\t * ```\n\t *\n\t * @public\n\t */\n\tHSL = \"hsl\",\n\t/**\n\t * Use the {@link https://en.wikipedia.org/wiki/HSL_and_HSV | HSL} color space with an alpha value\n\t *\n\t * @remarks\n\t *\n\t * ```javascript\n\t * const newColor = Color.mix(Color(\"red\"), Color(\"blue\"), {model: ColorMixModelType.HSLA})\n\t * ```\n\t *\n\t * @public\n\t */\n\tHSLA = \"hsla\",\n\t/**\n\t * Use the {@link http://www.hsluv.org | HSLuv } human friendly color model\n\t *\n\t * @remarks\n\t *\n\t * ```javascript\n\t * const newColor = Color.mix(Color(\"red\"), Color(\"blue\"), {model: ColorMixModelType.HUSL})\n\t * ```\n\t *\n\t * @public\n\t */\n\tHUSL = \"husl\",\n}\n", "import { cssNames } from \"./CSSNames.ts\"\nimport { isNumeric, percentToFraction } from \"./Utils.ts\"\n/* eslint-disable regexp/no-useless-non-capturing-group */\n/* eslint-disable regexp/no-useless-escape */\nimport type { ColorHSL, ColorHSV, ColorRGB, ColorRGBA, ColorTypeHSLA, ColorTypeHSVA, ColorTypeRGBA } from \"./types.ts\"\nimport { ColorFormat } from \"./types.ts\"\n\n// Importing using `/* @__PURE__ */ require()` so that Hsluv can be tree-shaken properly.\nconst Hsluv: typeof import(\"hsluv\").Hsluv = /* @__PURE__ */ (() => require(\"hsluv\").Hsluv)()\n\nconst hsluvConverter = /* @__PURE__ */ new Hsluv()\n\nexport function rgbToHsluv(r: number, g: number, b: number): ColorHSL {\n\thsluvConverter.rgb_r = r / 255\n\thsluvConverter.rgb_g = g / 255\n\thsluvConverter.rgb_b = b / 255\n\thsluvConverter.rgbToHsluv()\n\treturn {\n\t\th: hsluvConverter.hsluv_h,\n\t\ts: hsluvConverter.hsluv_s,\n\t\tl: hsluvConverter.hsluv_l,\n\t}\n}\n\nexport function rgbaFromHusl(h: number, s: number, l: number, a = 1): ColorRGBA {\n\thsluvConverter.hsluv_h = h\n\thsluvConverter.hsluv_s = s\n\thsluvConverter.hsluv_l = l\n\thsluvConverter.hsluvToRgb()\n\treturn {\n\t\tr: hsluvConverter.rgb_r * 255,\n\t\tg: hsluvConverter.rgb_g * 255,\n\t\tb: hsluvConverter.rgb_b * 255,\n\t\ta: a,\n\t}\n}\nexport function hsvToStr(h: number, s: number, v: number, a?: number): string {\n\tconst _h = Math.round(h)\n\tconst _s = Math.round(s * 100)\n\tconst _v = Math.round(v * 100)\n\n\treturn a === undefined || a === 1\n\t\t? \"hsv(\" + _h + \", \" + _s + \"%, \" + _v + \"%)\"\n\t\t: \"hsva(\" + _h + \", \" + _s + \"%, \" + _v + \"%, \" + a + \")\"\n}\n\nexport function rgbToRgb(r: number, g: number, b: number): ColorRGB {\n\treturn {\n\t\tr: isNumeric(r) ? bound01(r, 255) * 255 : 0,\n\t\tg: isNumeric(g) ? bound01(g, 255) * 255 : 0,\n\t\tb: isNumeric(b) ? bound01(b, 255) * 255 : 0,\n\t}\n}\n\nexport function rgbToHex(r: number, g: number, b: number, allow3Char: boolean): string {\n\tconst hex: [string, string, string] = [\n\t\tpad2(Math.round(r).toString(16)),\n\t\tpad2(Math.round(g).toString(16)),\n\t\tpad2(Math.round(b).toString(16)),\n\t]\n\tif (\n\t\tallow3Char &&\n\t\thex[0].charAt(0) === hex[0].charAt(1) &&\n\t\thex[1].charAt(0) === hex[1].charAt(1) &&\n\t\thex[2].charAt(0) === hex[2].charAt(1)\n\t) {\n\t\treturn hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0)\n\t}\n\treturn hex.join(\"\")\n}\n\nexport function rgbToHsl(r: number | string, g: number | string, b: number | string): ColorHSL {\n\tlet l: number\n\tlet s: number\n\tconst _r: number = bound01(r, 255)\n\tconst _g: number = bound01(g, 255)\n\tconst _b: number = bound01(b, 255)\n\n\tconst max = Math.max(_r, _g, _b)\n\tconst min = Math.min(_r, _g, _b)\n\tlet h = (s = l = (max + min) / 2)\n\n\tif (max === min) {\n\t\th = s = 0\n\t} else {\n\t\tconst d = max - min\n\t\ts = l > 0.5 ? d / (2 - max - min) : d / (max + min)\n\t\tswitch (max) {\n\t\t\tcase _r:\n\t\t\t\th = (_g - _b) / d + (_g < _b ? 6 : 0)\n\t\t\t\tbreak\n\t\t\tcase _g:\n\t\t\t\th = (_b - _r) / d + 2\n\t\t\t\tbreak\n\t\t\tcase _b:\n\t\t\t\th = (_r - _g) / d + 4\n\t\t\t\tbreak\n\t\t}\n\t\th /= 6\n\t}\n\treturn { h: h * 360, s, l }\n}\n\nfunction hue2rgb(p: number, q: number, t: number): number {\n\tif (t < 0) {\n\t\tt += 1\n\t}\n\tif (t > 1) {\n\t\tt -= 1\n\t}\n\tif (t < 1 / 6) {\n\t\treturn p + (q - p) * 6 * t\n\t}\n\tif (t < 1 / 2) {\n\t\treturn q\n\t}\n\tif (t < 2 / 3) {\n\t\treturn p + (q - p) * (2 / 3 - t) * 6\n\t}\n\treturn p\n}\n\n// HSL to RGB\nexport function hslToRgb(h: number, s: number, l: number): ColorRGB {\n\tlet r: number\n\tlet g: number\n\tlet b: number\n\n\th = bound01(h, 360)\n\ts = bound01(s * 100, 100)\n\tl = bound01(l * 100, 100)\n\n\tif (s === 0) {\n\t\tr = g = b = l // Achromatic\n\t} else {\n\t\tconst q = l < 0.5 ? l * (1 + s) : l + s - l * s\n\t\tconst p = 2 * l - q\n\t\tr = hue2rgb(p, q, h + 1 / 3)\n\t\tg = hue2rgb(p, q, h)\n\t\tb = hue2rgb(p, q, h - 1 / 3)\n\t}\n\n\treturn { r: r * 255, g: g * 255, b: b * 255 }\n}\n\nexport function rgbToHsv(r: number, g: number, b: number): ColorHSV {\n\tr = bound01(r, 255)\n\tg = bound01(g, 255)\n\tb = bound01(b, 255)\n\n\tconst max = Math.max(r, g, b)\n\tconst min = Math.min(r, g, b)\n\tconst d = max - min\n\tlet h = 0\n\tconst s: number = max === 0 ? 0 : d / max\n\tconst v: number = max\n\n\tif (max === min) {\n\t\th = 0 // achromatic\n\t} else {\n\t\tswitch (max) {\n\t\t\tcase r:\n\t\t\t\th = (g - b) / d + (g < b ? 6 : 0)\n\t\t\t\tbreak\n\t\t\tcase g:\n\t\t\t\th = (b - r) / d + 2\n\t\t\t\tbreak\n\t\t\tcase b:\n\t\t\t\th = (r - g) / d + 4\n\t\t\t\tbreak\n\t\t}\n\t\th /= 6\n\t}\n\treturn { h, s, v }\n}\n\nexport function hsvToRgb(h: number, s: number, v: number): ColorRGB {\n\th = bound01(h, 360) * 6\n\ts = bound01(s * 100, 100)\n\tv = bound01(v * 100, 100)\n\n\tconst i = Math.floor(h)\n\tconst f = h - i\n\tconst p = v * (1 - s)\n\tconst q = v * (1 - f * s)\n\tconst t = v * (1 - (1 - f) * s)\n\tconst mod = i % 6\n\tconst r = [v, q, p, p, t, v][mod]\n\tconst g = [t, v, v, q, p, p][mod]\n\tconst b = [p, p, t, v, v, q][mod]\n\n\t// @ts-ignore: Suppress the noUncheckedIndexedAccess error on this line. The\n\t// modulo result should range from 0~5, so cannot go out of bound of the\n\t// array.\n\treturn { r: r * 255, g: g * 255, b: b * 255 }\n}\n\nfunction bound01(n: number | string, max: number | string): number {\n\tlet _max: number\n\tlet _n: number\n\tif (typeof max === \"string\") _max = parseFloat(max)\n\telse _max = max\n\n\tif (typeof n === \"string\") {\n\t\tif (isOnePointZero(n)) {\n\t\t\tn = \"100%\"\n\t\t}\n\t\tconst processPercent = isPercentage(n)\n\t\t_n = Math.min(_max, Math.max(0, parseFloat(n)))\n\n\t\t// Automatically convert percentage into number\n\t\tif (processPercent) {\n\t\t\t_n = Math.floor(_n * _max) / 100\n\t\t}\n\t} else {\n\t\t_n = n\n\t}\n\t// Handle floating point rounding errors\n\tif (Math.abs(_n - _max) < 0.000001) {\n\t\treturn 1\n\t}\n\t// Convert into [0, 1] range if it isn't already\n\treturn (_n % _max) / _max\n}\n\nfunction isOnePointZero(n: string | number) {\n\treturn typeof n === \"string\" && n.includes(\".\") && parseFloat(n) === 1\n}\n\nfunction isPercentage(n: string | number) {\n\treturn typeof n === \"string\" && n.includes(\"%\")\n}\n\nfunction pad2(char: string) {\n\tif (char.length === 1) {\n\t\treturn \"0\" + char\n\t} else {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-conversion -- creates a new string slice\n\t\treturn \"\" + char\n\t}\n}\n\nconst matchers = /* @__PURE__ */ (() => {\n\tconst cssInteger = \"[-\\\\+]?\\\\d+%?\"\n\tconst cssNumber = \"[-\\\\+]?\\\\d*\\\\.\\\\d+%?\"\n\tconst cssUnit = \"(?:\" + cssNumber + \")|(?:\" + cssInteger + \")\"\n\tconst permissiveMatch3 = \"[\\\\s|\\\\(]+(\" + cssUnit + \")[,|\\\\s]+(\" + cssUnit + \")[,|\\\\s]+(\" + cssUnit + \")\\\\s*\\\\)?\"\n\tconst permissiveMatch4 =\n\t\t\"[\\\\s|\\\\(]+(\" + cssUnit + \")[,|\\\\s]+(\" + cssUnit + \")[,|\\\\s]+(\" + cssUnit + \")[,|\\\\s]+(\" + cssUnit + \")\\\\s*\\\\)?\"\n\treturn {\n\t\trgb: new RegExp(\"rgb\" + permissiveMatch3),\n\t\trgba: new RegExp(\"rgba\" + permissiveMatch4),\n\t\thsl: new RegExp(\"hsl\" + permissiveMatch3),\n\t\thsla: new RegExp(\"hsla\" + permissiveMatch4),\n\t\thsv: new RegExp(\"hsv\" + permissiveMatch3),\n\t\thsva: new RegExp(\"hsva\" + permissiveMatch4),\n\t\thex3: /^([\\da-f])([\\da-f])([\\da-f])$/iu,\n\t\thex6: /^([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})$/iu,\n\t\thex4: /^#?([\\da-f])([\\da-f])([\\da-f])([\\da-f])$/iu,\n\t\thex8: /^#?([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})$/iu,\n\t}\n})()\n\nexport function stringToObject(inputColor: string): ColorTypeRGBA | ColorTypeHSLA | ColorTypeHSVA | false {\n\t// Early return for gradients\n\tif (inputColor.includes(\"gradient(\")) return false\n\n\t// Early return for variables\n\tif (inputColor.includes(\"var(\")) return false\n\n\tconst trimLeft = /^[\\s,#]+/u\n\n\tlet color = inputColor.replace(trimLeft, \"\").trimEnd().toLowerCase()\n\tconst namedColor = cssNames[color]\n\tif (namedColor) {\n\t\tcolor = namedColor\n\t}\n\tif (color === \"transparent\") {\n\t\treturn {\n\t\t\tr: 0,\n\t\t\tg: 0,\n\t\t\tb: 0,\n\t\t\ta: 0,\n\t\t\tformat: ColorFormat.NAME,\n\t\t}\n\t}\n\tlet match\n\tif ((match = matchers.rgb.exec(color))) {\n\t\treturn {\n\t\t\tr: parseInt(match[1] ?? \"\"),\n\t\t\tg: parseInt(match[2] ?? \"\"),\n\t\t\tb: parseInt(match[3] ?? \"\"),\n\t\t\ta: 1,\n\t\t\tformat: ColorFormat.RGB,\n\t\t} as ColorTypeRGBA\n\t}\n\tif ((match = matchers.rgba.exec(color))) {\n\t\treturn {\n\t\t\tr: parseInt(match[1] ?? \"\"),\n\t\t\tg: parseInt(match[2] ?? \"\"),\n\t\t\tb: parseInt(match[3] ?? \"\"),\n\t\t\ta: parseFloat(match[4] ?? \"\"),\n\t\t\tformat: ColorFormat.RGB,\n\t\t} as ColorTypeRGBA\n\t}\n\tif ((match = matchers.hsl.exec(color))) {\n\t\treturn {\n\t\t\th: parseInt(match[1] ?? \"\"),\n\t\t\ts: percentToFraction(match[2] ?? \"\"),\n\t\t\tl: percentToFraction(match[3] ?? \"\"),\n\t\t\ta: 1,\n\t\t\tformat: ColorFormat.HSL,\n\t\t} as ColorTypeHSLA\n\t}\n\tif ((match = matchers.hsla.exec(color))) {\n\t\treturn {\n\t\t\th: parseInt(match[1] ?? \"\"),\n\t\t\ts: percentToFraction(match[2] ?? \"\"),\n\t\t\tl: percentToFraction(match[3] ?? \"\"),\n\t\t\ta: parseFloat(match[4] ?? \"\"),\n\t\t\tformat: ColorFormat.HSL,\n\t\t} as ColorTypeHSLA\n\t}\n\tif ((match = matchers.hsv.exec(color))) {\n\t\treturn {\n\t\t\th: parseInt(match[1] ?? \"\"),\n\t\t\ts: percentToFraction(match[2] ?? \"\"),\n\t\t\tv: percentToFraction(match[3] ?? \"\"),\n\t\t\ta: 1,\n\t\t\tformat: ColorFormat.HSV,\n\t\t} as ColorTypeHSVA\n\t}\n\tif ((match = matchers.hsva.exec(color))) {\n\t\treturn {\n\t\t\th: parseInt(match[1] ?? \"\"),\n\t\t\ts: percentToFraction(match[2] ?? \"\"),\n\t\t\tv: percentToFraction(match[3] ?? \"\"),\n\t\t\ta: parseFloat(match[4] ?? \"\"),\n\t\t\tformat: ColorFormat.HSV,\n\t\t} as ColorTypeHSVA\n\t}\n\tif ((match = matchers.hex8.exec(color))) {\n\t\treturn {\n\t\t\tr: parseIntFromHex(match[1] ?? \"\"),\n\t\t\tg: parseIntFromHex(match[2] ?? \"\"),\n\t\t\tb: parseIntFromHex(match[3] ?? \"\"),\n\t\t\ta: convertHexToDecimal(match[4] ?? \"\"),\n\t\t\tformat: namedColor ? ColorFormat.NAME : ColorFormat.HEX,\n\t\t} as ColorTypeRGBA\n\t}\n\tif ((match = matchers.hex6.exec(color))) {\n\t\treturn {\n\t\t\tr: parseIntFromHex(match[1] ?? \"\"),\n\t\t\tg: parseIntFromHex(match[2] ?? \"\"),\n\t\t\tb: parseIntFromHex(match[3] ?? \"\"),\n\t\t\ta: 1,\n\t\t\tformat: namedColor ? ColorFormat.NAME : ColorFormat.HEX,\n\t\t} as ColorTypeRGBA\n\t}\n\tif ((match = matchers.hex4.exec(color))) {\n\t\treturn {\n\t\t\tr: parseIntFromHex(`${match[1]}${match[1]}`),\n\t\t\tg: parseIntFromHex(`${match[2]}${match[2]}`),\n\t\t\tb: parseIntFromHex(`${match[3]}${match[3]}`),\n\t\t\ta: convertHexToDecimal(match[4] + \"\" + match[4]),\n\t\t\tformat: namedColor ? ColorFormat.NAME : ColorFormat.HEX,\n\t\t} as ColorTypeRGBA\n\t}\n\tif ((match = matchers.hex3.exec(color))) {\n\t\treturn {\n\t\t\tr: parseIntFromHex(`${match[1]}${match[1]}`),\n\t\t\tg: parseIntFromHex(`${match[2]}${match[2]}`),\n\t\t\tb: parseIntFromHex(`${match[3]}${match[3]}`),\n\t\t\ta: 1,\n\t\t\tformat: namedColor ? ColorFormat.NAME : ColorFormat.HEX,\n\t\t} as ColorTypeRGBA\n\t} else {\n\t\treturn false\n\t}\n}\n\nfunction parseIntFromHex(hex: string): number {\n\treturn parseInt(hex, 16)\n}\n\nfunction convertHexToDecimal(h: string): number {\n\treturn parseIntFromHex(h) / 255\n}\n", "import type { ColorHSVA, ColorRGBA } from \"./types.ts\"\n\nconst p3Matcher =\n\t/^color\\(display-p3\\s+(?<r>\\d+\\.\\d+|\\d+|\\.\\d+)\\s+(?<g>\\d+\\.\\d+|\\d+|\\.\\d+)\\s+(?<b>\\d+\\.\\d+|\\d+|\\.\\d+)(?:\\s*\\/\\s*(?<a>\\d+\\.\\d+|\\d+|\\.\\d+))?\\)$/u\n\nexport function parseP3(color: string) {\n\tconst match = p3Matcher.exec(color)\n\tif (!match) return null\n\n\tconst { r = \"0\", g = \"0\", b = \"0\", a } = match.groups ?? {}\n\n\treturn {\n\t\tr: parseFloat(r),\n\t\tg: parseFloat(g),\n\t\tb: parseFloat(b),\n\t\ta: a ? parseFloat(a) : 1,\n\t}\n}\n\nfunction convertRGBChannelToLrgb(c = 0) {\n\tconst abs = Math.abs(c)\n\tif (abs <= 0.04045) return c / 12.92\n\treturn (Math.sign(c) || 1) * ((abs + 0.055) / 1.055) ** 2.4\n}\n\n/**\n * https://github.com/Evercoder/culori/blob/main/src/lrgb/convertLrgbToRgb.js\n */\nfunction convertRgbToLrgb({ r, g, b, a }: ColorRGBA) {\n\treturn {\n\t\tr: convertRGBChannelToLrgb(r),\n\t\tg: convertRGBChannelToLrgb(g),\n\t\tb: convertRGBChannelToLrgb(b),\n\t\ta,\n\t}\n}\n\nfunction convertLrgbChannelToRgb(c = 0) {\n\tconst abs = Math.abs(c)\n\tif (abs > 0.0031308) return (Math.sign(c) || 1) * (1.055 * abs ** (1 / 2.4) - 0.055)\n\treturn c * 12.92\n}\n\n/**\n * https://github.com/Evercoder/culori/blob/main/src/lrgb/convertRgbToLrgb.js\n */\nfunction convertLrgbToRgb({ r, g, b, a }: ColorRGBA) {\n\treturn {\n\t\tr: convertLrgbChannelToRgb(r),\n\t\tg: convertLrgbChannelToRgb(g),\n\t\tb: convertLrgbChannelToRgb(b),\n\t\ta,\n\t}\n}\n\ninterface XYZ65 {\n\tx: number\n\ty: number\n\tz: number\n\ta?: number\n}\n\n/**\n * https://github.com/Evercoder/culori/blob/main/src/p3/convertP3ToXyz65.js\n *\n * References:\n * https://drafts.csswg.org/css-color/#color-conversion-code\n * http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html\n */\nconst convertP3ToXyz65 = (color: ColorRGBA): XYZ65 => {\n\tconst { r, g, b, a } = convertRgbToLrgb(color)\n\treturn {\n\t\tx: 0.486570948648216 * r + 0.265667693169093 * g + 0.1982172852343625 * b,\n\t\ty: 0.2289745640697487 * r + 0.6917385218365062 * g + 0.079286914093745 * b,\n\t\tz: 0.0 * r + 0.0451133818589026 * g + 1.043944368900976 * b,\n\t\ta,\n\t}\n}\n\n/**\n * https://github.com/Evercoder/culori/blob/main/src/xyz65/convertXyz65ToRgb.js\n *\n * References:\n * https://drafts.csswg.org/css-color/#color-conversion-code\n * http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html\n * https://observablehq.com/@danburzo/color-matrix-calculator\n */\nconst convertXyz65ToRgb = ({ x = 0, y = 0, z = 0, a = 1 }: XYZ65) => {\n\treturn convertLrgbToRgb({\n\t\tr: x * 3.2409699419045226 - y * 1.5373831775700939 - 0.4986107602930034 * z,\n\t\tg: x * -0.9692436362808796 + y * 1.8759675015077204 + 0.0415550574071756 * z,\n\t\tb: x * 0.0556300796969936 - y * 0.2039769588889765 + 1.0569715142428784 * z,\n\t\ta,\n\t})\n}\n\n/**\n * https://github.com/Evercoder/culori/blob/main/src/xyz65/convertRgbToXyz65.js#L12\n *\n * References:\n * https://drafts.csswg.org/css-color/#color-conversion-code\n * http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html\n * https://observablehq.com/@danburzo/color-matrix-calculator\n */\nconst convertRgbToXyz65 = (color: ColorRGBA) => {\n\tconst { r, g, b, a } = convertRgbToLrgb(color)\n\treturn {\n\t\tx: 0.4123907992659593 * r + 0.357584339383878 * g + 0.1804807884018343 * b,\n\t\ty: 0.2126390058715102 * r + 0.715168678767756 * g + 0.0721923153607337 * b,\n\t\tz: 0.0193308187155918 * r + 0.119194779794626 * g + 0.9505321522496607 * b,\n\t\ta,\n\t}\n}\n\n/**\n * https://github.com/Evercoder/culori/blob/main/src/p3/convertXyz65ToP3.js\n *\n * References:\n * https://drafts.csswg.org/css-color/#color-conversion-code\n * http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html\n */\nconst convertXyz65ToP3 = ({ x = 0, y = 0, z = 0, a = 1 }: XYZ65) => {\n\treturn convertLrgbToRgb({\n\t\tr: x * 2.4934969119414263 - y * 0.9313836179191242 - 0.402710784450717 * z,\n\t\tg: x * -0.8294889695615749 + y * 1.7626640603183465 + 0.0236246858419436 * z,\n\t\tb: x * 0.0358458302437845 - y * 0.0761723892680418 + 0.9568845240076871 * z,\n\t\ta,\n\t})\n}\n\n/**\n * https://github.com/Evercoder/culori/blob/main/src/hsv/convertRgbToHsv.js\n *\n * Based on: https://en.wikipedia.org/wiki/HSL_and_HSV#Formal_derivation\n */\nexport function convertRGBToHSV({ r, g, b, a }: ColorRGBA): ColorHSVA {\n\tconst M = Math.max(r, g, b),\n\t\tm = Math.min(r, g, b)\n\tconst res: ColorHSVA = {\n\t\th: 0,\n\t\ts: M === 0 ? 0 : 1 - m / M,\n\t\tv: M,\n\t\ta,\n\t}\n\tif (M - m !== 0) {\n\t\tres.h =\n\t\t\t(M === r ? (g - b) / (M - m) + (g < b ? 6 : 0) : M === g ? (b - r) / (M - m) + 2 : (r - g) / (M - m) + 4) * 60\n\t}\n\treturn res\n}\n\nfunction normalizeHue(hue: number) {\n\treturn (hue = hue % 360) < 0 ? hue + 360 : hue\n}\n\n/**\n * https://github.com/Evercoder/culori/blob/main/src/hsv/convertHsvToRgb.js\n *\n * Based on: https://en.wikipedia.org/wiki/HSL_and_HSV#Converting_to_RGB\n */\nexport function convertHsvToRgb({ h = 0, s = 0, v = 0, a = 1 }: ColorHSVA) {\n\tconst hue = normalizeHue(h)\n\tconst f = Math.abs(((hue / 60) % 2) - 1)\n\tswitch (Math.floor(hue / 60)) {\n\t\tcase 0:\n\t\t\treturn { r: v, g: v * (1 - s * f), b: v * (1 - s), a }\n\t\tcase 1:\n\t\t\treturn { r: v * (1 - s * f), g: v, b: v * (1 - s), a }\n\t\tcase 2:\n\t\t\treturn { r: v * (1 - s), g: v, b: v * (1 - s * f), a }\n\t\tcase 3:\n\t\t\treturn { r: v * (1 - s), g: v * (1 - s * f), b: v, a }\n\t\tcase 4:\n\t\t\treturn { r: v * (1 - s * f), g: v * (1 - s), b: v, a }\n\t\tcase 5:\n\t\t\treturn { r: v, g: v * (1 - s), b: v * (1 - s * f), a }\n\t\tdefault:\n\t\t\treturn { r: v * (1 - s), g: v * (1 - s), b: v * (1 - s), a }\n\t}\n}\n\nexport function convertRgbToP3(color: ColorRGBA): ColorRGBA {\n\treturn convertXyz65ToP3(convertRgbToXyz65(color))\n}\n\nexport function convertP3ToRgb(color: ColorRGBA): ColorRGBA {\n\treturn convertXyz65ToRgb(convertP3ToXyz65(color))\n}\n", "import { interpolate } from \"framer-motion\"\nimport { isObject, isString } from \"../../../utils/utils.ts\"\nimport { cssNames } from \"./CSSNames.ts\"\nimport { isNumeric, modulate, numberFromString } from \"./Utils.ts\"\nimport {\n\thslToRgb,\n\thsvToRgb,\n\trgbToHex,\n\trgbToHsl,\n\trgbToHsl as rgbToHslConverter,\n\trgbToHsluv,\n\trgbToHsv,\n\trgbToRgb,\n\trgbaFromHusl,\n\tstringToObject,\n} from \"./converters.ts\"\nimport { convertHsvToRgb, convertP3ToRgb, convertRGBToHSV, convertRgbToP3, parseP3 } from \"./p3.ts\"\nimport type { ColorHSL, ColorHSLA, ColorHSVA, ColorRGB, ColorRGBA, CompleteColor, IncomingColor } from \"./types.ts\"\nimport { ColorFormat, ColorMixModelType } from \"./types.ts\"\n\n/** @public */\nexport interface ColorMixOptions {\n\tmodel?: ColorMixModelType\n}\n\n/**\n * P3 colors use a different sspace than srgb\n *\n * @TODO - Parse colors to 0-1 ranges, and use this class with the format.\n */\nexport class P3Color {\n\tformat = \"p3\" as const\n\tr: number\n\tg: number\n\tb: number\n\ta: number\n\n\tconstructor(color: ColorRGBA) {\n\t\tthis.r = color.r ?? 0\n\t\tthis.g = color.g ?? 0\n\t\tthis.b = color.b ?? 0\n\t\tthis.a = color.a ?? 1\n\t}\n\n\thsv(): ColorHSVA {\n\t\treturn convertRGBToHSV(this)\n\t}\n\n\trgb(): ColorRGBA {\n\t\treturn convertP3ToRgb(this)\n\t}\n\n\thsl(): ColorHSL {\n\t\treturn rgbToHsl(this.r, this.g, this.b)\n\t}\n\n\ttoString(space: \"p3\" | \"srgb\" = \"p3\", overrides?: Partial<ColorRGBA>): string {\n\t\tswitch (space) {\n\t\t\tcase \"p3\": {\n\t\t\t\tconst r = overrides?.r ?? this.r\n\t\t\t\tconst g = overrides?.g ?? this.g\n\t\t\t\tconst b = overrides?.b ?? this.b\n\t\t\t\tconst a = overrides?.a ?? this.a\n\n\t\t\t\treturn a === 1 ? `color(display-p3 ${r} ${g} ${b})` : `color(display-p3 ${r} ${g} ${b} / ${a})`\n\t\t\t}\n\t\t\tcase \"srgb\": {\n\t\t\t\tconst color = this.rgb()\n\t\t\t\tconst clampedR = Math.round(Math.max(0, Math.min(color.r, 1)) * 100) / 100\n\t\t\t\tconst clampedG = Math.round(Math.max(0, Math.min(color.g, 1)) * 100) / 100\n\t\t\t\tconst clampedB = Math.round(Math.max(0, Math.min(color.b, 1)) * 100) / 100\n\n\t\t\t\tconst r = overrides?.r ?? clampedR * 255\n\t\t\t\tconst g = overrides?.g ?? clampedG * 255\n\t\t\t\tconst b = overrides?.b ?? clampedB * 255\n\t\t\t\tconst a = overrides?.a ?? color.a ?? 1\n\n\t\t\t\treturn a === 1 ? `rgb(${r}, ${g}, ${b})` : `rgba(${r}, ${g}, ${b}, ${a})`\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic isP3String(color: string): boolean {\n\t\treturn color.startsWith(\"color(display-p3\")\n\t}\n\n\tstatic fromHSV(color: ColorHSVA, space: \"p3\" | \"srgb\" = \"p3\"): P3Color {\n\t\t// Imagine the HSV Color is in the P3 color space, so create a P3 color from its RGB\n\t\t// channels.\n\t\tswitch (space) {\n\t\t\tcase \"p3\":\n\t\t\t\treturn new P3Color(convertHsvToRgb(color))\n\t\t\tcase \"srgb\":\n\t\t\t\treturn new P3Color(convertRgbToP3(convertHsvToRgb(color)))\n\t\t}\n\t}\n\n\tstatic fromRGB(color: ColorRGBA): P3Color {\n\t\treturn new P3Color(\n\t\t\tconvertRgbToP3({\n\t\t\t\t// Converted an rgb value between 0-255 to a 0-1 decimal with 5 decimal places -> 0.78607.\n\t\t\t\tr: Math.round((color.r / 255) * 10_000) / 10_000,\n\t\t\t\tg: Math.round((color.g / 255) * 10_000) / 10_000,\n\t\t\t\tb: Math.round((color.b / 255) * 10_000) / 10_000,\n\t\t\t\ta: color.a ?? 1,\n\t\t\t}),\n\t\t)\n\t}\n\n\tstatic fromRGBString(color: string): P3Color | undefined {\n\t\tconst value = Color(color)\n\t\tif (!value) return undefined\n\t\treturn P3Color.fromRGB(value)\n\t}\n\n\tstatic fromString(color: string): P3Color | undefined {\n\t\tif (!P3Color.isP3String(color)) return undefined\n\t\tconst parsed = parseP3(color)\n\t\tif (!parsed) return undefined\n\t\treturn new P3Color({ r: parsed.r, g: parsed.g, b: parsed.b, a: parsed.a })\n\t}\n\n\tstatic srgbFromValue<T>(color: T): T | string {\n\t\tif (!isString(color) || !Color.isP3String(color)) return color\n\t\tconst value = P3Color.fromString(color)\n\t\tif (!value) return color\n\t\treturn value.toString(\"srgb\")\n\t}\n\n\tstatic multiplyAlpha(color: P3Color, alpha: number): P3Color {\n\t\treturn new P3Color({\n\t\t\tr: color.r,\n\t\t\tg: color.g,\n\t\t\tb: color.b,\n\t\t\ta: color.a * alpha,\n\t\t})\n\t}\n}\n\nexport function clampRGB<T>(color: T): T | string {\n\treturn P3Color.srgbFromValue(color)\n}\n\ntype Mixer = (from: string | Color, toColor: Color, options?: ColorMixOptions) => (p: number) => string\ntype MixerStateful = (toColor: Color, options?: ColorMixOptions) => (p: number) => string\n\n/**\n * @public\n */\nexport interface Color {\n\tr: number\n\tg: number\n\tb: number\n\th: number\n\ts: number\n\tl: number\n\ta: number\n\troundA: number\n\tformat: ColorFormat\n\tinitialValue?: string\n\tisValid?: boolean\n\tmix: Mixer | MixerStateful\n\ttoValue: () => string\n}\n\nconst cache = new Map<string, Color>()\n\n/**\n * The Color function can be used to define colors, either as a string value or as an object. All colors\n * are converted to a Color object with `r, g, b`, `h, s, l` and an `a` value.\n * There are also various helpers on the Color function for working with,\n * modifying and detecting colors.\n *\n * ```jsx\n * // HEX\n * const blue = Color(\"#0099FF\")\n *\n * // RGB\n * const blue = Color(\"rgb(0, 153, 255)\")\n * const blue = Color(0, 153, 255)\n * const blue = Color({r: 0, g: 153, b: 255})\n * const blue = Color({r: 0, g: 153, b: 255, a: 1})\n *\n * // HSL\n * const blue = Color(\"hsl(204, 100%, 50%)\")\n * const blue = Color({h: 204, s: 1, l: 0.5})\n * const blue = Color({h: 204, s: 1, l: 0.5, a: 1})\n * ```\n * @public\n */\nexport const Color = /* @__PURE__ */ (() => {\n\t/**\n\t * @public\n\t */\n\tfunction Color(color: IncomingColor | Color | number, r?: number, g?: number, b?: number): Color {\n\t\tif (typeof color === \"string\") {\n\t\t\tlet c = cache.get(color)\n\t\t\tif (c) return c\n\n\t\t\tc = createColor(color)\n\n\t\t\tif (c === undefined) return { ...Color(\"black\"), isValid: false }\n\t\t\tcache.set(color, c) // TODO: should be frozen?\n\t\t\treturn c\n\t\t}\n\t\tconst created = createColor(color, r, g, b)\n\t\treturn created !== undefined ? created : { ...Color(\"black\"), isValid: false }\n\t}\n\n\tfunction createColor(color: IncomingColor | Color | number, r?: number, g?: number, b?: number): Color | undefined {\n\t\tif (color === \"\") return undefined\n\t\tconst colorData = getCompleteColorStrategy(color, r, g, b)\n\n\t\tif (colorData) {\n\t\t\tconst newColor: Color = {\n\t\t\t\tr: colorData.r,\n\t\t\t\tg: colorData.g,\n\t\t\t\tb: colorData.b,\n\t\t\t\ta: colorData.a,\n\t\t\t\th: colorData.h,\n\t\t\t\ts: colorData.s,\n\t\t\t\tl: colorData.l,\n\t\t\t\tinitialValue: typeof color === \"string\" && colorData.format !== ColorFormat.HSV ? color : undefined,\n\t\t\t\troundA: Math.round(100 * colorData.a) / 100,\n\t\t\t\tformat: colorData.format,\n\t\t\t\tmix: Color.mix,\n\t\t\t\ttoValue: () => Color.toRgbString(newColor),\n\t\t\t}\n\n\t\t\treturn newColor\n\t\t} else {\n\t\t\treturn undefined\n\t\t}\n\t}\n\n\tconst ColorMixModel = {\n\t\tisRGB(colorModel: ColorMixModelType) {\n\t\t\treturn colorModel === ColorMixModelType.RGB || colorModel === ColorMixModelType.RGBA\n\t\t},\n\t\tisHSL(colorModel: ColorMixModelType) {\n\t\t\treturn colorModel === ColorMixModelType.HSL || colorModel === ColorMixModelType.HSLA\n\t\t},\n\t}\n\n\t/**\n\t * Formats a Color object into a readable string for debugging.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.inspect(blue)\n\t * ```\n\t *\n\t * @param color - The Color object to format\n\t * @param initialValue - A canonical hex string to be used instead of an rgba() value.\n\t */\n\tColor.inspect = (color: Color, initialValue?: string): string => {\n\t\tif (color.format === ColorFormat.HSL) {\n\t\t\treturn `<${color.constructor.name} h:${color.h} s:${color.s} l:${color.l} a:${color.a}>`\n\t\t} else if (color.format === ColorFormat.HEX || color.format === ColorFormat.NAME) {\n\t\t\treturn `<${color.constructor.name} \"${initialValue}\">`\n\t\t} else {\n\t\t\treturn `<${color.constructor.name} r:${color.r} g:${color.g} b:${color.b} a:${color.a}>`\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the value is a valid color object or color string. Returns true or false.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * Color.isColor(\"#0099FF\") // true\n\t * Color.isColor(Color(\"#0099FF\")) // true\n\t * ```\n\t *\n\t * @param color - The potential color value to validate\n\t */\n\tColor.isColor = (color: string | Color) => {\n\t\tif (typeof color === \"string\") {\n\t\t\treturn Color.isColorString(color)\n\t\t} else {\n\t\t\treturn Color.isColorObject(color)\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the value is a valid color string. Returns true or false.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * Color.isColorString(\"#0099FF\") // true\n\t * ```\n\t *\n\t * @param color - A string representing a color\n\t */\n\tColor.isColorString = (colorString: string | object): boolean => {\n\t\tif (typeof colorString === \"string\") {\n\t\t\treturn stringToObject(colorString) !== false\n\t\t}\n\t\treturn false\n\t}\n\n\t/**\n\t * Checks if the value is a valid Color object. Returns true or false.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.isColorObject(blue) // true\n\t * Color.isColorObject(\"#0099FF\") // false\n\t * ```\n\t *\n\t * @param color - An object representing a color.\n\t */\n\tColor.isColorObject = (color: unknown): color is object & Color => {\n\t\treturn (\n\t\t\tisObject(color) &&\n\t\t\ttypeof color.r === \"number\" &&\n\t\t\ttypeof color.g === \"number\" &&\n\t\t\ttypeof color.b === \"number\" &&\n\t\t\ttypeof color.h === \"number\" &&\n\t\t\ttypeof color.s === \"number\" &&\n\t\t\ttypeof color.l === \"number\" &&\n\t\t\ttypeof color.a === \"number\" &&\n\t\t\ttypeof color.roundA === \"number\" &&\n\t\t\ttypeof color.format === \"string\"\n\t\t)\n\t}\n\n\t/**\n\t * Formats a Color instance into an RGB string.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toString(blue) // \"rgb(0, 153, 255)\"\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toString = (color: Color): string => {\n\t\treturn Color.toRgbString(color)\n\t}\n\n\t/**\n\t * Formats a Color instance into an hexidecimal value.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toHex(blue) // \"0099FF\"\n\t * Color.toHex(Color(\"#FFAAFF\"), true) // \"FAF\"\n\t * ```\n\t *\n\t * @param color - The color to format\n\t * @param allow3Char - If true will return short hand colors if possible (defaults to false).\n\t */\n\tColor.toHex = (color: Color, allow3Char: boolean = false): string => {\n\t\treturn rgbToHex(color.r, color.g, color.b, allow3Char)\n\t}\n\n\t/**\n\t * Formats a Color instance into an hexidecimal string.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toHexString(blue) // \"#0099FF\"\n\t * Color.toHexString(Color(\"#FFAAFF\"), true) // \"#FAF\"\n\t * ```\n\t *\n\t * @param color - The color to format\n\t * @param allow3Char - If true will return short hand colors if possible (defaults to false).\n\t */\n\tColor.toHexString = (color: Color, allow3Char: boolean = false): string => {\n\t\treturn `#${Color.toHex(color, allow3Char)}`\n\t}\n\n\tColor.isP3String = (color: unknown): color is string => {\n\t\tif (typeof color !== \"string\") return false\n\t\treturn P3Color.isP3String(color)\n\t}\n\n\t/**\n\t * Formats a Color instance into an RGB string.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toRgbString(blue) // \"rgb(0, 153, 255)\"\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toRgbString = (color: Color): string => {\n\t\treturn color.a === 1\n\t\t\t? \"rgb(\" + Math.round(color.r) + \", \" + Math.round(color.g) + \", \" + Math.round(color.b) + \")\"\n\t\t\t: \"rgba(\" +\n\t\t\t\t\tMath.round(color.r) +\n\t\t\t\t\t\", \" +\n\t\t\t\t\tMath.round(color.g) +\n\t\t\t\t\t\", \" +\n\t\t\t\t\tMath.round(color.b) +\n\t\t\t\t\t\", \" +\n\t\t\t\t\tcolor.roundA +\n\t\t\t\t\t\")\"\n\t}\n\n\t/**\n\t * Formats a Color instance into an HUSL object.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toHusl(blue) // {h: 250, s: 100, l: 50, a: 1}\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toHusl = (color: Color): ColorHSLA => {\n\t\treturn {\n\t\t\t...rgbToHsluv(color.r, color.g, color.b),\n\t\t\ta: color.roundA,\n\t\t}\n\t}\n\n\t/**\n\t * Formats a Color instance into an HSL string.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toHslString(blue) // \"hsl(204, 100%, 50%)\"\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toHslString = (color: Color): string => {\n\t\tconst hsl = Color.toHsl(color)\n\t\tconst h = Math.round(hsl.h)\n\t\tconst s = Math.round(hsl.s * 100)\n\t\tconst l = Math.round(hsl.l * 100)\n\t\treturn color.a === 1\n\t\t\t? \"hsl(\" + h + \", \" + s + \"%, \" + l + \"%)\"\n\t\t\t: \"hsla(\" + h + \", \" + s + \"%, \" + l + \"%, \" + color.roundA + \")\"\n\t}\n\n\t/**\n\t * Formats a Color instance into an HSV object.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toHsv(blue) // {h: 204, s: 1, v: 1, a: 1}\"\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toHsv = (color: Color): ColorHSVA => {\n\t\tconst hsv = rgbToHsv(color.r, color.g, color.b)\n\t\treturn { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: color.a }\n\t}\n\n\t/**\n\t * Formats a Color instance into an HSV string.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toHslString(blue) // \"hsv(204, 100%, 50%)\"\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toHsvString = (color: Color): string => {\n\t\tconst hsv = rgbToHsv(color.r, color.g, color.b)\n\t\tconst h = Math.round(hsv.h * 360)\n\t\tconst s = Math.round(hsv.s * 100)\n\t\tconst v = Math.round(hsv.v * 100)\n\n\t\treturn color.a === 1\n\t\t\t? \"hsv(\" + h + \", \" + s + \"%, \" + v + \"%)\"\n\t\t\t: \"hsva(\" + h + \", \" + s + \"%, \" + v + \"%, \" + color.roundA + \")\"\n\t}\n\n\t/**\n\t * Formats a Color instance into {@link https://css-tricks.com/snippets/css/named-colors-and-hex-equivalents/ | CSS name}\n\t * or returns false if unspecified.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const green = Color(\"#8FBC8F\")\n\t *\n\t * Color.toName(green) // \"darkseagreen\"\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toName = (color: Color): string | false => {\n\t\tif (color.a === 0) {\n\t\t\treturn \"transparent\"\n\t\t}\n\t\tif (color.a < 1) {\n\t\t\treturn false\n\t\t}\n\t\tconst hex = rgbToHex(color.r, color.g, color.b, true)\n\n\t\tfor (const key of Object.keys(cssNames)) {\n\t\t\tconst value = cssNames[key]\n\t\t\tif (value === hex) {\n\t\t\t\treturn key\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t}\n\n\t/**\n\t * Formats a color into an HSL object.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toHsl(blue) // {h: 204, s: 1, l: 0.5, a: 1}\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toHsl = (color: Color): ColorHSLA => {\n\t\treturn {\n\t\t\th: Math.round(color.h),\n\t\t\ts: color.s,\n\t\t\tl: color.l,\n\t\t\ta: color.a,\n\t\t}\n\t}\n\n\t/**\n\t * Formats a color into an RGB object.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * Color.toRgb(blue) // {r: 40, g: 175, b: 250, a: 1}\n\t * ```\n\t *\n\t * @param color - The color to format\n\t */\n\tColor.toRgb = (color: Color): ColorRGBA => {\n\t\treturn {\n\t\t\tr: Math.round(color.r),\n\t\t\tg: Math.round(color.g),\n\t\t\tb: Math.round(color.b),\n\t\t\ta: color.a,\n\t\t}\n\t}\n\n\t/**\n\t * Returns a brightened color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t * const brightblue = Color.lighten(blue, 20)\n\t * ```\n\t *\n\t * @param color - The color to brighten\n\t * @param amount - A number, from 0 to 100. Set to 10 by default.\n\t */\n\tColor.brighten = (color: Color, amount: number = 10): Color => {\n\t\tconst rgb = Color.toRgb(color)\n\t\trgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))))\n\t\trgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))))\n\t\trgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))))\n\t\treturn Color(rgb)\n\t}\n\n\t/**\n\t * Add white and return a lightened color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t * const lightblue = Color.lighten(blue, 20)\n\t * ```\n\t *\n\t * @param color - The color to lighten\n\t * @param amount - A number, from 0 to 100. Set to 10 by default.\n\t */\n\tColor.lighten = (color: Color, amount: number = 10): Color => {\n\t\tconst hsl = Color.toHsl(color)\n\t\thsl.l += amount / 100\n\t\thsl.l = Math.min(1, Math.max(0, hsl.l))\n\t\treturn Color(hsl)\n\t}\n\n\t/**\n\t * Add black and return a darkened color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t * const darkblue = Color.darken(blue, 20)\n\t * ```\n\t * @param color - The color to darken.\n\t * @param amount - A number, from 0 to 100. Set to 10 by default.\n\t */\n\tColor.darken = (color: Color, amount: number = 10): Color => {\n\t\tconst hsl = Color.toHsl(color)\n\t\thsl.l -= amount / 100\n\t\thsl.l = Math.min(1, Math.max(0, hsl.l))\n\t\treturn Color(hsl)\n\t}\n\n\t/**\n\t * Increase the saturation of a color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t * const saturated = Color.saturate(blue, 100)\n\t * ```\n\t * @param color - The color to modify\n\t * @param amount - A number from 0 to 100. Set to 10 by default.\n\t */\n\tColor.saturate = (color: Color, amount: number = 10): Color => {\n\t\tconst hsl = Color.toHsl(color)\n\t\thsl.s += amount / 100\n\t\thsl.s = Math.min(1, Math.max(0, hsl.s))\n\t\treturn Color(hsl)\n\t}\n\n\t/**\n\t * Decrease the saturation of a color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t * const desaturated = Color.desaturate(blue, 100)\n\t * ```\n\t * @param color - The color to modify\n\t * @param amount - A number from 0 to 100. Set to 10 by default.\n\t */\n\tColor.desaturate = (color: Color, amount: number = 10): Color => {\n\t\tconst hsl = Color.toHsl(color)\n\t\thsl.s -= amount / 100\n\t\thsl.s = Math.min(1, Math.max(0, hsl.s))\n\t\treturn Color(hsl)\n\t}\n\n\t/**\n\t * Return a fully desaturated color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t * const gray = Color.grayscale(blue)\n\t * ```\n\t * @param color - The color to convert.\n\t */\n\tColor.grayscale = (color: Color): Color => {\n\t\treturn Color.desaturate(color, 100)\n\t}\n\n\t/**\n\t * Returns a new color for the rotated hue.\n\t * @param color - The color to manipulate\n\t * @param angle - The angle in degrees in which to rotate the hue.\n\t */\n\tColor.hueRotate = (color: Color, angle: number): Color => {\n\t\tconst hsl = Color.toHsl(color)\n\t\thsl.h += angle\n\t\thsl.h = hsl.h > 360 ? hsl.h - 360 : hsl.h\n\t\treturn Color(hsl)\n\t}\n\n\t/**\n\t * Set the alpha value, also known as opacity, of the color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * const transparent = Color.alpha(blue, 0.1)\n\t * ```\n\t * @param color - The original color to modify.\n\t * @param alpha - A number from 1 to 0. Set to 1 by default.\n\t */\n\tColor.alpha = (color: Color, a: number = 1): Color => {\n\t\treturn Color({\n\t\t\tr: color.r,\n\t\t\tg: color.g,\n\t\t\tb: color.b,\n\t\t\ta: a,\n\t\t})\n\t}\n\n\t/**\n\t * Set the alpha value, also known as opacity, of the color to zero.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t *\n\t * const transparent = Color.alpha(blue)\n\t * ```\n\t * @param color - The original color to modify.\n\t */\n\tColor.transparent = (color: Color): Color => {\n\t\treturn Color.alpha(color, 0)\n\t}\n\n\t/**\n\t * Change the alpha value, also know as opacity, by a multiplier.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const blue = Color(\"#0099FF\")\n\t * const transparent = Color.multiplyAlpha(blue, 0.5)\n\t * ```\n\t * @param color - The original color to modify.\n\t * @param alphaValue - A number between 1 and 0, defaults to 1,\n\t */\n\tColor.multiplyAlpha = (color: Color, alphaValue: number = 1): Color => {\n\t\treturn Color({\n\t\t\tr: color.r,\n\t\t\tg: color.g,\n\t\t\tb: color.b,\n\t\t\ta: color.a * alphaValue,\n\t\t})\n\t}\n\n\t/**\n\t * Alpha blends a top color over a bottom color and returns the resulting opaque color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const red = Color(\"red\")\n\t * const blue = Color(\"blue\")\n\t * const blended = Color.alphaComposite(Color.alpha(red, 0.5), blue)\n\t * ```\n\t *\n\t * @param top - The foreground color layered on top.\n\t * @param bottom - The background color behind it.\n\t */\n\tColor.alphaComposite = (top: Color, bottom: Color): Color => {\n\t\tif (top.a === 1) {\n\t\t\treturn top\n\t\t}\n\n\t\tif (bottom.a < 1) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Bottom color must be fully opaque for alpha blending, you should check and determine your own strategy for resolving alpha bottom layers, ie. `Color.alphaComposite(bottom, Color('white'))`\",\n\t\t\t)\n\t\t}\n\n\t\tif (top.a === 0) {\n\t\t\treturn bottom\n\t\t}\n\n\t\treturn Color({\n\t\t\tr: Math.round(top.r * top.a + bottom.r * (1 - top.a)),\n\t\t\tg: Math.round(top.g * top.a + bottom.g * (1 - top.a)),\n\t\t\tb: Math.round(top.b * top.a + bottom.b * (1 - top.a)),\n\t\t\ta: 1,\n\t\t})\n\t}\n\n\t/**\n\t * Returns a function that can be used to transition a color from one value\n\t * to another. By default this will use the RGB `mix` model. Useful for providing to animation tools.\n\t *\n\t * ```jsx\n\t * const blend = Color.interpolate(Color(\"red\"), Color(\"blue\"))\n\t *\n\t * blend(0)   // Initial state (red)\n\t * blend(0.5) // Mid state (purple)\n\t * blend(1)   // Final state (blue)\n\t * ```\n\t * @param colorA - The starting color\n\t * @param colorB - The final color\n\t * @param model  - The model to use for the mix. One of {@link ColorMixModelType}\n\t */\n\tColor.interpolate = (\n\t\tcolorA: Color,\n\t\tcolorB: Color,\n\t\tmodel: ColorMixModelType = ColorMixModelType.RGB,\n\t): ((progress: number) => Color) => {\n\t\tif (!Color.isColorObject(colorA) || !Color.isColorObject(colorB)) {\n\t\t\tthrow new TypeError(\"Both arguments for Color.interpolate must be Color objects\")\n\t\t}\n\t\treturn (progress: number): Color => {\n\t\t\tconst color = Color.mixAsColor(colorA, colorB, progress, false, model)\n\t\t\treturn color\n\t\t}\n\t}\n\n\t/**\n\t * Create a function that will mix two colors together and output the result as an rgb string.\n\t *\n\t * @param colorA - The starting color\n\t * @param colorB - The final color\n\t * @param options - Options for the color mixer\n\t *\n\t * - `model`: The model to use for the mix. One of {@link ColorMixModelType}\n\t *\n\t * @public\n\t */\n\tColor.mix = (from: Color, toColor: Color, { model = ColorMixModelType.RGB } = {}) => {\n\t\tconst fromColor = typeof from === \"string\" ? Color(from) : from\n\t\tconst mixer = Color.interpolate(fromColor, toColor, model)\n\n\t\treturn (p: number) => Color.toRgbString(mixer(p))\n\t}\n\n\t/**\n\t * Blend two colors together, optionally based on user input. The fraction defines the\n\t * distribution between the two colors, and is set to 0.5 by default.\n\t * The `limit` defines if the color can transition beyond its range.\n\t * @remarks\n\t * ```jsx\n\t * // Mix red with yellow\n\t * const orange = Color.mix(\"red\", \"yellow\", 0.5)\n\t * ```\n\t *\n\t * ```jsx\n\t * Color.mix(\"red\", \"yellow\", 0.5, true, \"husl\")\n\t * ```\n\t *\n\t * @param colorA   - A color, the first one.\n\t * @param colorB   - A color, the second one.\n\t * @param fraction - An optional number, from 0 to 1, set to 0.5 by default.\n\t * @param limit    - An optional boolean, set to false by default.\n\t * @param model    - The model to use for the mix. One of {@link ColorMixModelType}\n\t */\n\tColor.mixAsColor = (\n\t\tcolorA: Color,\n\t\tcolorB: Color,\n\t\tfraction = 0.5,\n\t\tlimit = false,\n\t\tmodel: ColorMixModelType = ColorMixModelType.RGB,\n\t): Color => {\n\t\tlet result: Color | null = null\n\n\t\tif (ColorMixModel.isRGB(model)) {\n\t\t\t// rgb model\n\t\t\tresult = Color({\n\t\t\t\tr: modulate(fraction, [0, 1], [colorA.r, colorB.r], limit),\n\t\t\t\tg: modulate(fraction, [0, 1], [colorA.g, colorB.g], limit),\n\t\t\t\tb: modulate(fraction, [0, 1], [colorA.b, colorB.b], limit),\n\t\t\t\ta: modulate(fraction, [0, 1], [colorA.a, colorB.a], limit),\n\t\t\t})\n\t\t} else {\n\t\t\tlet hslA, hslB\n\t\t\tif (ColorMixModel.isHSL(model)) {\n\t\t\t\t// hsl model\n\t\t\t\thslA = Color.toHsl(colorA)\n\t\t\t\thslB = Color.toHsl(colorB)\n\t\t\t} else {\n\t\t\t\t// husl model\n\t\t\t\thslA = Color.toHusl(colorA)\n\t\t\t\thslB = Color.toHusl(colorB)\n\t\t\t}\n\n\t\t\tif (hslA.s === 0) {\n\t\t\t\thslA.h = hslB.h\n\t\t\t} else if (hslB.s === 0) {\n\t\t\t\thslB.h = hslA.h\n\t\t\t}\n\n\t\t\tconst fromH = hslA.h\n\t\t\tconst toH = hslB.h\n\t\t\tlet deltaH = toH - fromH\n\n\t\t\tif (deltaH > 180) {\n\t\t\t\tdeltaH = toH - 360 - fromH\n\t\t\t} else if (deltaH < -180) {\n\t\t\t\tdeltaH = toH + 360 - fromH\n\t\t\t}\n\n\t\t\tconst tween = {\n\t\t\t\th: modulate(fraction, [0, 1], [fromH, fromH + deltaH], limit),\n\t\t\t\ts: modulate(fraction, [0, 1], [hslA.s, hslB.s], limit),\n\t\t\t\tl: modulate(fraction, [0, 1], [hslA.l, hslB.l], limit),\n\t\t\t\ta: modulate(fraction, [0, 1], [colorA.a, colorB.a], limit),\n\t\t\t}\n\n\t\t\tif (ColorMixModel.isHSL(model)) {\n\t\t\t\t// hsl model\n\t\t\t\tresult = Color(tween)\n\t\t\t} else {\n\t\t\t\t// husl model\n\t\t\t\tresult = Color(rgbaFromHusl(tween.h, tween.s, tween.l, tween.a))\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n\n\t/**\n\t * Returns a Color instance with a random color value set.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const random = Color.random()\n\t * ```\n\t *\n\t * @param alphaValue - An optional alpha value, set to 1 by default.\n\t */\n\tColor.random = (alphaValue = 1): Color => {\n\t\tfunction gen() {\n\t\t\treturn Math.floor(Math.random() * 255)\n\t\t}\n\t\treturn Color(\"rgba(\" + gen() + \", \" + gen() + \", \" + gen() + \", \" + alphaValue + \")\")\n\t}\n\n\t/**\n\t * Creates a greyscale color.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * const gray = Color.gray(0.5)\n\t * ```\n\t *\n\t * @param amount - A number from 0 to 1 representing the amount of white.\n\t * @param alphaValue  - A number from 0 to 1 representing the alpha. Set to 1 by default.\n\t */\n\tColor.grey = (amount: number = 0.5, alphaValue: number = 1) => {\n\t\tamount = Math.floor(amount * 255)\n\t\treturn Color(\"rgba(\" + amount + \", \" + amount + \", \" + amount + \", \" + alphaValue + \")\")\n\t}\n\n\t/**\n\t * @internal\n\t * Alias for {@link (Color:namespace).grey}\n\t */\n\tColor.gray = Color.grey\n\n\t/** @internal */\n\tColor.rgbToHsl = (r: number, g: number, b: number): ColorHSL => {\n\t\treturn rgbToHslConverter(r, g, b)\n\t}\n\n\t/** @internal */\n\tColor.isValidColorProperty = (name: string, value: string): boolean => {\n\t\tconst isColorKey = name.toLowerCase().slice(-5) === \"color\" || name === \"fill\" || name === \"stroke\"\n\t\tif (isColorKey && typeof value === \"string\" && Color.isColorString(value)) {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\n\t/**\n\t * Calculates the color difference using {@link https://en.wikipedia.org/wiki/Color_difference#Euclidean |\n\t * Euclidean distance fitting human perception}. Returns a value between 0 and 765\n\t * @param colorA - A first color.\n\t * @param colorB - A second color.\n\t */\n\tColor.difference = (colorA: Color, colorB: Color): number => {\n\t\tconst _r = (colorA.r + colorB.r) / 2\n\t\tconst deltaR = colorA.r - colorB.r\n\t\tconst deltaG = colorA.g - colorB.g\n\t\tconst deltaB = colorA.b - colorB.b\n\t\tconst deltaR2 = Math.pow(deltaR, 2)\n\t\tconst deltaG2 = Math.pow(deltaG, 2)\n\t\tconst deltaB2 = Math.pow(deltaB, 2)\n\t\treturn Math.sqrt(2 * deltaR2 + 4 * deltaG2 + 3 * deltaB2 + (_r * (deltaR2 - deltaB2)) / 256)\n\t}\n\n\t/**\n\t * Checks whether two Color objects are equal.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * Color.equal(Color(\"red\"), Color(\"red\"))  // true\n\t * Color.equal(Color(\"red\"), Color(\"blue\")) // false\n\t *\n\t * Color.equal(Color(\"#0099FF\"), Color(\"009AFF\"))    // false\n\t * Color.equal(Color(\"#0099FF\"), Color(\"009AFF\"), 2) // true\n\t * ```\n\t *\n\t * @param colorA    - The first color\n\t * @param colorB    - The second color\n\t * @param tolerance - A tolerance for the difference between rgba values. Set to 0.1 by default.\n\t */\n\tColor.equal = (colorA: Color, colorB: Color, tolerance = 0.1): boolean => {\n\t\tif (Math.abs(colorA.r - colorB.r) >= tolerance) {\n\t\t\treturn false\n\t\t}\n\t\tif (Math.abs(colorA.g - colorB.g) >= tolerance) {\n\t\t\treturn false\n\t\t}\n\t\tif (Math.abs(colorA.b - colorB.b) >= tolerance) {\n\t\t\treturn false\n\t\t}\n\t\tif (Math.abs(colorA.a - colorB.a) * 256 >= tolerance) {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\n\tconst channelToDecimal = interpolate([0, 255], [0, 1])\n\tfunction convertChannelToLinearRgb(channel: number) {\n\t\tchannel = channelToDecimal(channel)\n\t\tconst abs = Math.abs(channel)\n\t\tif (abs < 0.04045) return channel / 12.92\n\t\treturn (Math.sign(channel) || 1) * Math.pow((abs + 0.055) / 1.055, 2.4)\n\t}\n\n\t/*\n\t * WCAG luminance References:\n\t *\n\t * https://en.wikipedia.org/wiki/Relative_luminance\n\t * https://github.com/w3c/wcag/issues/236#issuecomment-379526596\n\t */\n\tColor.luminance = (color: Color): number => {\n\t\tconst { r, g, b } = Color.toRgb(color)\n\t\treturn (\n\t\t\t0.2126 * convertChannelToLinearRgb(r) +\n\t\t\t0.7152 * convertChannelToLinearRgb(g) +\n\t\t\t0.0722 * convertChannelToLinearRgb(b)\n\t\t)\n\t}\n\n\tColor.contrast = (a: Color, b: Color): number => {\n\t\tconst l1 = Color.luminance(a)\n\t\tconst l2 = Color.luminance(b)\n\t\treturn (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05)\n\t}\n\n\treturn Color\n})()\n\n// helpers\n\nfunction getCompleteColorStrategy(\n\tcolorOrR: IncomingColor | number,\n\tg?: number,\n\tb?: number,\n\ta: number = 1,\n): CompleteColor | undefined {\n\tlet completeColor: CompleteColor | undefined\n\t// RGB arguments have higher priority\n\tif (\n\t\ttypeof colorOrR === \"number\" &&\n\t\t!Number.isNaN(colorOrR) &&\n\t\ttypeof g === \"number\" &&\n\t\t!Number.isNaN(g) &&\n\t\ttypeof b === \"number\" &&\n\t\t!Number.isNaN(b)\n\t) {\n\t\t// color used as red - Color(255, 255, 255)\n\t\tconst _r = colorOrR\n\t\tconst _g = g\n\t\tconst _b = b\n\t\tconst _a = a\n\t\tcompleteColor = getCompleteColorFromRGB({ r: _r, g: _g, b: _b, a: _a })\n\t} else if (typeof colorOrR === \"string\") {\n\t\t// valid CSS color (including functions)\n\t\tcompleteColor = getCompleteColorFromString(colorOrR)\n\t} else if (typeof colorOrR === \"object\") {\n\t\t// biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>lint/suspicious/noPrototypeBuiltins: <explanation>\n\t\tif (colorOrR.hasOwnProperty(\"r\") && colorOrR.hasOwnProperty(\"g\") && colorOrR.hasOwnProperty(\"b\")) {\n\t\t\tcompleteColor = getCompleteColorFromRGB(colorOrR as ColorRGB)\n\t\t} else {\n\t\t\tcompleteColor = getCompleteColorFromHSL(colorOrR as ColorHSL)\n\t\t}\n\t}\n\n\treturn completeColor\n}\n\nfunction getCompleteColorFromString(color: string): CompleteColor | undefined {\n\tconst result = stringToObject(color)\n\tif (result) {\n\t\tif (result.format === ColorFormat.HSL) {\n\t\t\treturn getCompleteColorFromHSL(result as ColorHSLA)\n\t\t} else if (result.format === ColorFormat.HSV) {\n\t\t\treturn getCompleteColorFromHSV(result as ColorHSVA)\n\t\t} else {\n\t\t\treturn getCompleteColorFromRGB(result as ColorRGBA)\n\t\t}\n\t}\n}\n\nfunction getCompleteColorFromHSV(color: { h: number; s: number; v: number; a?: number }): CompleteColor | undefined {\n\tconst rgb: ColorRGB = hsvToRgb(color.h, color.s, color.v)\n\tconst hsl: ColorHSL = rgbToHslConverter(rgb.r, rgb.g, rgb.b)\n\treturn {\n\t\t...hsl,\n\t\t...rgb,\n\t\tformat: ColorFormat.RGB,\n\t\ta: color.a !== undefined ? correctAlpha(color.a) : 1,\n\t}\n}\n\nfunction getCompleteColorFromRGB(color: { r: number; g: number; b: number; a?: number }): CompleteColor | undefined {\n\tconst rgb: ColorRGB = rgbToRgb(color.r, color.g, color.b)\n\tconst hsl: ColorHSL = rgbToHslConverter(rgb.r, rgb.g, rgb.b)\n\treturn {\n\t\t...hsl,\n\t\t...rgb,\n\t\tformat: ColorFormat.RGB,\n\t\ta: color.a !== undefined ? correctAlpha(color.a) : 1,\n\t}\n}\n\nfunction getCompleteColorFromHSL(color: { h: number; s: number; l: number; a?: number }): CompleteColor {\n\tlet h: number\n\tlet s: number\n\tlet l: number\n\tlet rgb: ColorRGB = { r: 0, g: 0, b: 0 }\n\tlet hsl: ColorHSL = { h: 0, s: 0, l: 0 }\n\th = isNumeric(color.h) ? color.h : 0\n\th = (h + 360) % 360\n\ts = isNumeric(color.s) ? color.s : 1\n\tif (typeof color.s === \"string\") {\n\t\t// biome-ignore lint/style/noNonNullAssertion: should be defined.\n\t\ts = numberFromString(color.s as string)!\n\t}\n\tl = isNumeric(color.l) ? color.l : 0.5\n\tif (typeof color.l === \"string\") {\n\t\t// biome-ignore lint/style/noNonNullAssertion: should be defined.\n\t\tl = numberFromString(color.l as string)!\n\t}\n\trgb = hslToRgb(h, s, l)\n\thsl = {\n\t\th: h,\n\t\ts: s,\n\t\tl: l,\n\t}\n\n\treturn {\n\t\t...rgb,\n\t\t...hsl,\n\t\ta: color.a === undefined ? 1 : color.a,\n\t\tformat: ColorFormat.HSL,\n\t}\n}\nfunction correctAlpha(alphaValue: string | number) {\n\talphaValue = parseFloat(alphaValue as string)\n\tif (alphaValue < 0) {\n\t\talphaValue = 0\n\t}\n\tif (Number.isNaN(alphaValue) || alphaValue > 1) {\n\t\talphaValue = 1\n\t}\n\treturn alphaValue\n}\nfunction rgbToP3(color: ColorRGBA): string {\n\tthrow new Error(\"Function not implemented.\")\n}\n", "import { Color } from \"../render/types/Color/Color.ts\"\nimport type { IncomingColor } from \"../render/types/Color/types.ts\"\nimport { ColorMixModelType } from \"../render/types/Color/types.ts\"\nimport { Interpolation } from \"./Interpolation.ts\"\n\nexport const ColorInterpolation: (type?: ColorMixModelType) => Interpolation<Color> = (\n\ttype: ColorMixModelType = ColorMixModelType.HUSL,\n) => {\n\treturn {\n\t\tinterpolate(from: IncomingColor, to: IncomingColor): (progress: number) => Color {\n\t\t\t;[from, to] = Interpolation.handleUndefined(from, to)\n\t\t\treturn Color.interpolate(Color(from), Color(to), type)\n\t\t},\n\t\tdifference(from: IncomingColor, to: IncomingColor): number {\n\t\t\treturn Color.difference(Color(from), Color(to))\n\t\t},\n\t}\n}\n", "import { Interpolation } from \"./Interpolation.ts\"\n\nexport const NoInterpolation: Interpolation<any> = {\n\tinterpolate(from: any, to: any): (progress: number) => any {\n\t\t;[from, to] = Interpolation.handleUndefined(from, to)\n\t\treturn (progress: number): number => {\n\t\t\treturn progress < 0.5 ? from : to\n\t\t}\n\t},\n\tdifference(from: any, to: any): number {\n\t\treturn from === to ? 0 : 1\n\t},\n}\n", "import type { Interpolator } from \"./Interpolation.ts\"\nimport { Interpolation } from \"./Interpolation.ts\"\n\nexport const ObjectInterpolation = <Value>(\n\tvalueInterpolation: Interpolation<Value>,\n): Interpolation<{ [key: string]: Value }> => {\n\ttype Type<T> = Record<keyof T, Value>\n\n\treturn {\n\t\tinterpolate<T>(from: Type<T>, to: Type<T>): (progress: number) => Type<T> {\n\t\t\t;[from, to] = Interpolation.handleUndefined(from, to)\n\t\t\t// We can't use a spread operator here because TypeScript doesn't understand the types\n\t\t\tconst result: Type<T> = Object.assign({}, from)\n\t\t\tconst interpolations: { [Key in keyof Type<T>]: Interpolator<Value> } = {} as any\n\t\t\tconst keys = new Set()\n\t\t\tfor (const key in from) {\n\t\t\t\tinterpolations[key] = valueInterpolation.interpolate(from[key], to[key])\n\t\t\t\tkeys.add(key)\n\t\t\t}\n\n\t\t\tfor (const key in to) {\n\t\t\t\tif (!keys.has(key)) {\n\t\t\t\t\tinterpolations[key] = valueInterpolation.interpolate(from[key], to[key])\n\t\t\t\t\tkeys.add(key)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn (progress: number): Type<T> => {\n\t\t\t\tfor (const key in interpolations) {\n\t\t\t\t\tresult[key] = interpolations[key](progress)\n\t\t\t\t}\n\t\t\t\treturn result\n\t\t\t}\n\t\t},\n\t\tdifference<T>(from: Type<T>, to: Type<T>): number {\n\t\t\t// calculate Eucleadean distance\n\t\t\tlet sum = 0\n\t\t\tfor (const key in from) {\n\t\t\t\tconst difference = valueInterpolation.difference(from[key], to[key])\n\t\t\t\tsum += Math.pow(difference, 2)\n\t\t\t}\n\t\t\treturn Math.sqrt(sum)\n\t\t},\n\t}\n}\n", "import { Color } from \"../render/types/Color/Color.ts\"\nimport { ColorMixModelType } from \"../render/types/Color/types.ts\"\nimport { ColorInterpolation } from \"./ColorInterpolation.ts\"\nimport { Interpolation, isInterpolatable } from \"./Interpolation.ts\"\nimport { NoInterpolation } from \"./NoInterpolation.ts\"\nimport { NumberInterpolation } from \"./NumberInterpolation.ts\"\nimport { ObjectInterpolation } from \"./ObjectInterpolation.ts\"\n\nexport interface InterpolationOptions {\n\tcolorModel: ColorMixModelType\n}\n\nconst DefaultInterpolationOptions: InterpolationOptions = {\n\tcolorModel: ColorMixModelType.HUSL,\n}\n\n/**\n * @internal\n */\nexport class ValueInterpolation implements Interpolation {\n\tprivate options: InterpolationOptions\n\t/**\n\t * @internal\n\t */\n\tconstructor(options: Partial<InterpolationOptions> = DefaultInterpolationOptions) {\n\t\tthis.options = { ...DefaultInterpolationOptions, ...options }\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tprotected interPolationForValue(value: any): Interpolation {\n\t\tconst type = typeof value\n\t\tif (type === \"number\") {\n\t\t\treturn NumberInterpolation\n\t\t} else if (type === \"boolean\" || type === \"function\") {\n\t\t\treturn NoInterpolation\n\t\t} else if (Color.isColor(value)) {\n\t\t\treturn ColorInterpolation(this.options.colorModel)\n\t\t} else if (type === \"object\") {\n\t\t\tif (value === null) {\n\t\t\t\treturn NoInterpolation\n\t\t\t}\n\t\t\tconst constructor = value.constructor\n\t\t\tif (constructor && isInterpolatable(constructor)) {\n\t\t\t\tconst interpolation = constructor.interpolationFor(value, this)\n\t\t\t\tif (interpolation && interpolation !== this && interpolation.constructor !== ValueInterpolation) {\n\t\t\t\t\treturn interpolation\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ObjectInterpolation(this)\n\t\t}\n\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\tconsole.warn(`No interpolation defined for ${value}`)\n\t\treturn NoInterpolation\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tinterpolate = <T>(from: T, to: T): ((progress: number) => T) => {\n\t\t;[from, to] = Interpolation.handleUndefined(from, to)\n\t\treturn this.interPolationForValue(from).interpolate(from, to)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tdifference = <T>(from: T, to: T): number => {\n\t\tconst interpolation = this.interPolationForValue(from)\n\t\treturn interpolation.difference(from, to)\n\t}\n}\n\n/**\n * @internal\n */\nexport const AnyInterpolation = /* @__PURE__ */ new ValueInterpolation()\n", "import { MotionValue } from \"framer-motion\"\n\n/** @internal */\nexport const isMotionValue = (v: any): v is MotionValue => v instanceof MotionValue\n", "import { assert } from \"../../utils/assert.ts\"\nimport type { Animator } from \"./Animator.ts\"\n\nexport const Defaults = /* @__PURE__ */ (() => ({\n\tdelta: 1 / 60,\n\tmaxValues: 10000,\n}))()\n\nexport type PrecalculationOptions = typeof Defaults\n\nexport interface RequiredOptions<Value> {\n\tanimator: Animator<Value>\n}\n\nexport type Options<Value> = Partial<PrecalculationOptions> & RequiredOptions<Value>\n\n/**\n * @internal\n * @deprecated\n */\nexport class PrecalculatedAnimator<Value> implements Animator<Value, Options<Value>> {\n\tprivate animator: Animator<Value>\n\tvalues: Value[] | undefined\n\tprivate currentTime = 0\n\tprivate totalTime: number | undefined\n\tprivate options: PrecalculationOptions & RequiredOptions<Value>\n\tconstructor(options: Options<Value>) {\n\t\tthis.options = { ...Defaults, ...options }\n\t\tthis.animator = options.animator\n\t}\n\n\tprivate preCalculate() {\n\t\tif (!this.animator.isReady()) {\n\t\t\treturn\n\t\t}\n\t\tconst { delta } = this.options\n\t\tthis.values = []\n\t\twhile (!this.animator.isFinished() && this.values.length < this.options.maxValues) {\n\t\t\tlet value = this.animator.next(this.options.delta)\n\t\t\tif (typeof value === \"object\" && value) {\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated component\n\t\t\t\tconst object = value as any\n\t\t\t\tconst copy = { ...object }\n\t\t\t\tvalue = copy as Value\n\t\t\t}\n\t\t\tthis.values.push(value)\n\t\t}\n\t\tthis.totalTime = this.values.length * delta\n\t}\n\n\tprivate indexForTime(time: number): number {\n\t\tassert(this.values !== undefined, \"values must be set before calling indexForTime()\")\n\t\tassert(this.totalTime !== undefined, \"totalTime must be set before calling indexForTime()\")\n\t\treturn Math.max(0, Math.min(this.values.length - 1, Math.round(this.values.length * (time / this.totalTime)) - 1))\n\t}\n\n\tprivate valueForTime(time: number): Value {\n\t\tassert(this.values !== undefined, \"values must be set before calling valueForTime()\")\n\t\tconst index = this.indexForTime(time)\n\t\t// indexForTime ensures the next index stays in bound, so it is safe to\n\t\t// cast the return type here.\n\t\tconst value = this.values[index] as Value\n\t\treturn value\n\t}\n\n\tsetFrom(value: Value): void {\n\t\tthis.animator.setFrom(value)\n\t\tthis.preCalculate()\n\t}\n\n\tsetTo(end: Value): void {\n\t\tthis.animator.setTo(end)\n\t\tthis.preCalculate()\n\t}\n\n\tisReady(): boolean {\n\t\tassert(this.totalTime !== undefined, \"totalTime must be set before calling isReady()\")\n\t\treturn this.values !== undefined && this.values.length > 0 && this.totalTime > 0\n\t}\n\n\tnext(delta: number): Value {\n\t\tthis.currentTime += delta\n\t\treturn this.valueForTime(this.currentTime)\n\t}\n\n\tisFinished(): boolean {\n\t\tassert(this.totalTime !== undefined, \"totalTime must be set before calling isFinished()\")\n\t\treturn this.totalTime === 0 || this.currentTime >= this.totalTime\n\t}\n\n\tget endValue(): Value {\n\t\tthis.preCalculate()\n\t\tassert(this.totalTime !== undefined, \"expecting totalTime to be set after calling preCalculate()\")\n\t\tconst value = this.valueForTime(this.totalTime)\n\t\tassert(this.values !== undefined, \"expecting values to be set after calling preCalculate()\")\n\t\treturn this.values.length > 0 ? value : this.animator.next(0)\n\t}\n}\n", "export type ListenerFn = (...args: unknown[]) => void\n\n// Importing using `/* @__PURE__ */ require()` so that EventEmitter can be tree-shaken properly.\nconst EventEmitter3: typeof import(\"eventemitter3\").EventEmitter = /* @__PURE__ */ (() =>\n\trequire(\"eventemitter3\").EventEmitter)()\n\nexport class EventEmitter<EventName extends string> {\n\tprivate _emitter = new EventEmitter3<string>()\n\n\teventNames() {\n\t\treturn this._emitter.eventNames()\n\t}\n\n\teventListeners() {\n\t\tconst listeners: { [index: string]: ListenerFn[] } = {}\n\n\t\tfor (const eventName of this._emitter.eventNames()) {\n\t\t\tlisteners[eventName] = this._emitter.listeners(eventName)\n\t\t}\n\n\t\treturn listeners\n\t}\n\n\ton(eventName: EventName, fn: ListenerFn) {\n\t\tthis.addEventListener(eventName, fn, false, false, this)\n\t}\n\n\toff(eventName: EventName, fn: ListenerFn) {\n\t\tthis.removeEventListeners(eventName, fn)\n\t}\n\n\tonce(eventName: EventName, fn: ListenerFn) {\n\t\tthis.addEventListener(eventName, fn, true, false, this)\n\t}\n\n\tunique(eventName: EventName, fn: ListenerFn) {\n\t\tthis.addEventListener(eventName, fn, false, true, this)\n\t}\n\n\taddEventListener(eventName: EventName, fn: ListenerFn, once: boolean, unique: boolean, context: unknown) {\n\t\tif (unique) {\n\t\t\tfor (const name of this._emitter.eventNames()) {\n\t\t\t\tif (fn === (this._emitter.listeners(name) as unknown)) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (once === true) {\n\t\t\tthis._emitter.once(eventName, fn, context)\n\t\t} else {\n\t\t\tthis._emitter.addListener(eventName, fn, context)\n\t\t}\n\t}\n\n\tremoveEventListeners(eventName?: EventName, fn?: ListenerFn): void {\n\t\tif (eventName) {\n\t\t\tthis._emitter.removeListener(eventName, fn)\n\t\t} else {\n\t\t\tthis.removeAllEventListeners()\n\t\t}\n\t}\n\n\tremoveAllEventListeners() {\n\t\tthis._emitter.removeAllListeners()\n\t}\n\n\tcountEventListeners(eventName?: EventName): number {\n\t\tif (eventName) {\n\t\t\treturn this._emitter.listeners(eventName).length\n\t\t} else {\n\t\t\tlet count = 0\n\n\t\t\tfor (const name of this._emitter.eventNames()) {\n\t\t\t\tcount += this._emitter.listeners(name).length\n\t\t\t}\n\n\t\t\treturn count\n\t\t}\n\t}\n\n\temit(eventName: EventName, ...args: unknown[]) {\n\t\tthis._emitter.emit(eventName, ...args)\n\t}\n}\n", "import { safeWindow } from \"../utils/safeWindow.ts\"\n\n// const performance = safeWindow.performance || {\n//   offset: Date.now(),\n//   now: () => Date.now() - this.offset\n// };\n\nconst _raf = (f: FrameRequestCallback) => {\n\tsetTimeout(f, 1 / 60)\n}\nconst __raf = /* @__PURE__ */ (() => safeWindow[\"requestAnimationFrame\"] || _raf)()\n\nexport const raf = (f: Function) => __raf(f as FrameRequestCallback)\n", "import { EventEmitter } from \"./EventEmitter.ts\"\nimport * as time from \"./Time.ts\"\n\nexport type LoopEventNames = \"render\" | \"update\" | \"finish\"\nexport type LoopDeltaCallback = (this: Loop, frame: number) => void\n\nlet LoopTimeStep = /* @__PURE__ */ (() => 1 / 60)()\n\n/**\n * @public\n */\nexport class Loop extends EventEmitter<LoopEventNames> {\n\tprivate _started = false\n\tprivate _frame = 0\n\tprivate _frameTasks: Function[] = []\n\n\t/**\n\t * To add a task to be done at the end of a frame.\n\t * Tasks added from a task will be ignored. These will run after loop events have been processed.\n\t * @internal\n\t */\n\taddFrameTask(task: Function) {\n\t\tthis._frameTasks.push(task)\n\t}\n\n\tprivate _processFrameTasks() {\n\t\tconst postEventTasks = this._frameTasks\n\t\tconst length = postEventTasks.length\n\t\tif (length === 0) return\n\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\tpostEventTasks[i]?.()\n\t\t}\n\n\t\tpostEventTasks.length = 0\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tstatic set TimeStep(value: number) {\n\t\tLoopTimeStep = value\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tstatic get TimeStep() {\n\t\treturn LoopTimeStep\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tconstructor(start = false) {\n\t\tsuper()\n\t\tif (start) {\n\t\t\tthis.start()\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tstart(): this {\n\t\tif (this._started) return this\n\n\t\tthis._frame = 0\n\t\tthis._started = true\n\t\ttime.raf(this.tick)\n\t\treturn this\n\t}\n\n\t/**\n\t * @internal\n\t * @deprecated Don\u2019t use `stop` as you could be stopping the MainLoop for others.\n\t */\n\tstop(): this {\n\t\tthis._started = false\n\t\treturn this\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tget frame() {\n\t\treturn this._frame\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tget time() {\n\t\treturn this._frame * LoopTimeStep\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tprivate tick = () => {\n\t\tif (!this._started) return\n\n\t\ttime.raf(this.tick)\n\n\t\tthis.emit(\"update\", this._frame, LoopTimeStep)\n\t\tthis.emit(\"render\", this._frame, LoopTimeStep)\n\t\tthis._processFrameTasks()\n\n\t\tthis._frame++\n\t}\n}\n\n/**\n * @internal\n *\n * This call is safe to be tree-shaken away as long as `new Loop()` is called with `start` set to `false` (or unset).\n */\nexport const MainLoop = /* @__PURE__ */ new Loop()\n", "import { safeWindow } from \"../../utils/safeWindow.ts\"\n\nenum RenderTargetName {\n\tcanvas = \"CANVAS\",\n\texport = \"EXPORT\",\n\tthumbnail = \"THUMBNAIL\",\n\tpreview = \"PREVIEW\",\n}\n\n/**\n * @internal\n */\nexport interface RenderEnvironment {\n\ttarget: RenderTargetName\n\tzoom: number\n}\n\n/**\n * The screenshot lambda runs the project on this host to force an export target state.\n * RenderEnvironment can change at runtime, but this shouldn\u2019t.\n *\n * @internal\n */\nexport function isScreenshotFramerHost() {\n\treturn safeWindow.location.origin === \"https://screenshot.framer.invalid\"\n}\n\n/**\n * @internal\n */\nexport const RenderEnvironment: RenderEnvironment = {\n\ttarget:\n\t\t// Enable the static renderer for screenshot lambdas.\n\t\tisScreenshotFramerHost() ? RenderTargetName.export : RenderTargetName.preview,\n\tzoom: 1,\n}\n\n/**\n * This is used to temporarily execute a task in a different render environment (for example during export)\n * @internal\n */\nexport function executeInRenderEnvironment<T>(customEnvironment: Partial<RenderEnvironment>, task: () => T): T {\n\t// Copy currentEnvironment\n\tconst previousEnvironment = Object.assign({}, RenderEnvironment)\n\t// Set the customEnvironment to the current environment\n\tObject.assign(RenderEnvironment, customEnvironment)\n\tconst result = task()\n\t// Reset the previous environment back on the currentEnvironment\n\tObject.assign(RenderEnvironment, previousEnvironment)\n\treturn result\n}\n\n/**\n * This function sets the global render environment Framer Core uses to render.\n * Because it sets global state, there should be only one thing responsable for calling it in every react app (e.g. Vekter and Preview)\n * @internal\n */\nexport function setGlobalRenderEnvironment(environment: Partial<RenderEnvironment>) {\n\tObject.assign(RenderEnvironment, environment)\n}\n\n/**\n * @internal\n */\nexport function useRenderEnvironment(target: RenderTargetName, zoom: number) {\n\tlet willChangeElements = false\n\n\tif (RenderEnvironment.target !== target) {\n\t\tRenderEnvironment.target = target\n\t\twillChangeElements = true\n\t}\n\n\tif (RenderEnvironment.zoom !== zoom) {\n\t\tRenderEnvironment.zoom = zoom\n\t}\n\n\treturn { willChangeElements }\n}\n\n/**\n * The `RenderTarget` represents the current environment in which a component\n * is running. This is most commonly either the editor canvas in Framer or in\n * the generated preview window.\n *\n * @remarks\n * Code components can use the `RenderTarget.current()` method to check for\n * the environment within their components and vary rendering accordingly. The\n * most common case would be to improve performance while rendering in the\n * Framer canvas where components that take too long to render will be replaced\n * with a placeholder. The `RenderTarget.hasRestrictions()` method can be used\n * to check explicitly for this case.\n *\n * @privateRemarks\n * This is a read-only equivalent of RenderEnvironment.target that is exposed\n * to components for context-dependent rendering\n *\n * @public\n */\nexport type RenderTarget = RenderTargetName\n// \u2191 For backwards compatibility, re-export the RenderTargetName enum under the name RenderTarget. This allows the code like\n//   const renderTarget: RenderTarget\n// work as it worked when RenderTarget was defined as an enum AND a namespace, merged together.\n// Confused how two definitions with the same name work? See https://stackoverflow.com/a/67697999\n\nexport const RenderTarget = {\n\t/**\n\t * The component is to be rendered for the Framer canvas.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   if (RenderTarget.current() === RenderTarget.canvas) {\n\t *     return <CanvasComponent />\n\t *   }\n\t *   return <DefaultComponent />\n\t * }\n\t * ```\n\t */\n\tcanvas: RenderTargetName.canvas,\n\t/**\n\t * The component is to be rendered for export.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   if (RenderTarget.current() === RenderTarget.export) {\n\t *     return <ExportComponent />\n\t *   }\n\t *   return <DefaultComponent />\n\t * }\n\t * ```\n\t */\n\texport: RenderTargetName.export,\n\t/**\n\t * The component is to be rendered as a preview thumbnail, for example in the\n\t * component panel.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   if (RenderTarget.current() === RenderTarget.thumbnail) {\n\t *     return <Thumbnail />\n\t *   }\n\t *   return <DefaultComponent />\n\t * }\n\t * ```\n\t */\n\tthumbnail: RenderTargetName.thumbnail,\n\t/**\n\t * The component is being rendered in the preview window.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   React.useEffect(() => {\n\t *     if (RenderTarget.current() === RenderTarget.preview) {\n\t *       // Do something in preview.\n\t *     }\n\t *   })\n\t *   return <DefaultComponent />\n\t * }\n\t * ```\n\t */\n\tpreview: RenderTargetName.preview,\n\n\t/**\n\t * Returns the current `RenderTarget` allowing components to apply\n\t * different behaviors depending on the environment.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   if (RenderTarget.current() === RenderTarget.thumbnail) {\n\t *     return <PreviewIcon />\n\t *   }\n\t *   return <Frame>...</Frame>\n\t * }\n\t * ```\n\t */\n\tcurrent: (): RenderTargetName => RenderEnvironment.target,\n\n\t/**\n\t * Returns true if the current `RenderTarget` has performance restrictions.\n\t * Use this to avoid doing heavy work in these contexts because they may\n\t * bail on the rendering if the component takes too long.\n\t *\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   if (RenderTarget.hasRestrictions()) {\n\t *     return <SomePlaceholder />\n\t *   }\n\t *   return <RichPreviewContent />\n\t * }\n\t * ```\n\t */\n\thasRestrictions: (): boolean => {\n\t\tconst target = RenderEnvironment.target\n\t\tif (target === RenderTargetName.canvas) return true\n\t\tif (target === RenderTargetName.export) return true\n\t\treturn false\n\t},\n}\n", "import type { Animator as AnimatorInterface } from \"../Animators/Animator.ts\"\n\n/**\n * @internal\n */\n// biome-ignore lint/suspicious/noExplicitAny: deprecated\nexport interface DriverClass<AnimatorClass extends AnimatorInterface<Value, Options>, Value, Options = any> {\n\tnew (\n\t\tanimator: AnimatorClass,\n\t\tupdateCallback: (value: Value) => void,\n\t\tdoneCallback?: (isFinished: boolean) => void,\n\t): AnimationDriver<AnimatorClass, Value, Options>\n}\n\n/**\n * @public\n */\nexport interface AnimationInterface {\n\t/**\n\t * @internal\n\t */\n\tplay(): void\n\tcancel(): void\n\t/**\n\t * @internal\n\t */\n\tfinish(): void\n\tisFinished(): boolean\n}\n\n/**\n * @internal\n */\nexport abstract class AnimationDriver<\n\tAnimatorClass extends AnimatorInterface<Value, Options>,\n\tValue,\n\tOptions,\n> implements AnimationInterface {\n\tconstructor(\n\t\tpublic animator: AnimatorClass,\n\t\tprotected updateCallback: (value: Value) => void,\n\t\tprotected finishedCallback?: (isFinished: boolean) => void,\n\t) {\n\t\tif (!this.animator.isReady()) {\n\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\tconsole.warn(\"AnimationDriver initialized with animator that isn't ready\")\n\t\t}\n\t}\n\n\tabstract play(): void\n\n\tprotected update = (frame: number, elapsed: number) => {\n\t\tif (this.animator.isFinished()) {\n\t\t\tthis.finish()\n\t\t} else {\n\t\t\tconst value = this.animator.next(elapsed)\n\t\t\tthis.updateCallback(value)\n\t\t}\n\t}\n\n\tabstract cancel(): void\n\n\tfinish(): void {\n\t\tif (this.finishedCallback) {\n\t\t\tthis.finishedCallback(this.animator.isFinished())\n\t\t}\n\t}\n\n\tisFinished(): boolean {\n\t\treturn this.animator.isFinished()\n\t}\n}\n", "import { MainLoop } from \"../../core/Loop.ts\"\nimport { RenderEnvironment, RenderTarget } from \"../../render/types/RenderEnvironment.ts\"\nimport type { Animator as AnimatorInterface } from \"../Animators/Animator.ts\"\nimport { AnimationDriver } from \"./AnimationDriver.ts\"\n\n/**\n * @internal\n */\nexport class MainLoopAnimationDriver<\n\tAnimator extends AnimatorInterface<Value, Options>,\n\tValue,\n\tOptions,\n> extends AnimationDriver<Animator, Value, Options> {\n\tplay() {\n\t\tif (RenderEnvironment.target !== RenderTarget.preview) {\n\t\t\t// If we're not in preview mode, don't use the animator,\n\t\t\t// but just call the done callback directly\n\t\t\tthis.finishedCallback && this.finishedCallback(false)\n\t\t\treturn\n\t\t}\n\t\tMainLoop.on(\"update\", this.update)\n\t}\n\n\tcancel() {\n\t\tMainLoop.off(\"update\", this.update)\n\t}\n\n\toverride finish() {\n\t\tMainLoop.off(\"update\", this.update)\n\t\tsuper.finish()\n\t}\n}\n", "import type { Interpolation, InterpolationOptions } from \"../interpolation/index.ts\"\nimport { ValueInterpolation } from \"../interpolation/index.ts\"\nimport { ColorMixModelType } from \"../render/types/Color/types.ts\"\nimport { isMotionValue } from \"../render/utils/isMotionValue.ts\"\nimport type { DeprecatedAnimationTarget } from \"./Animatable/Animatable.ts\"\nimport { Animatable, isAnimatable } from \"./Animatable/Animatable.ts\"\nimport type { AnimatorClass, Animator as AnimatorInterface } from \"./Animators/Animator.ts\"\nimport { BezierAnimator } from \"./Animators/BezierAnimator.ts\"\nimport { PrecalculatedAnimator } from \"./Animators/PrecalculatedAnimator.ts\"\nimport type { AnimationDriver, DriverClass } from \"./Drivers/AnimationDriver.ts\"\nimport { MainLoopAnimationDriver } from \"./Drivers/MainLoopDriver.ts\"\n\ntype TargetObject<T> = { [K in keyof T]: T[K] | Animatable<T[K]> }\n\nexport type FramerAnimationState = \"idle\" | \"running\" | \"finished\"\n\n/**\n * @deprecated Use {@link FrameProps.transition} instead\n */\nexport interface DeprecatedAnimationOptions<Value> extends InterpolationOptions {\n\t/**\n\t * @internal\n\t */\n\tcustomInterpolation?: Interpolation<Value>\n\t/**\n\t * @internal\n\t */\n\tprecalculate: boolean\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: deprecated const\nconst DefaultDeprecatedAnimationOptions: DeprecatedAnimationOptions<any> = {\n\tprecalculate: false,\n\tcolorModel: ColorMixModelType.HUSL,\n}\n\n/**\n * The animation object returned by the {@link (animate:function)} functions\n * @remarks\n * Can be used to control a animation or wait for it to finish. You never create a FramerAnimation yourself, but store the return type from the animate function.\n * ```jsx\n * const animation = animate.ease(value, 100)\n * await animation.finished()\n * const animation = animate.spring(value, 200)\n * animation.cancel()\n * ```\n * @privateRemarks\n * This could be called just Animation, but it's type would clash with\n * javascript's native Animation: https://developer.mozilla.org/en-US/docs/Web/API/Animation\n * So if you forget the import, you would get weird errors.\n *\n * Also, this class follows the native Animation as much as possible.\n * @public\n * @deprecated Use the {@link useAnimation} hook instead\n */\nexport class FramerAnimation<Value, AnimatorOptions> {\n\t/**\n\t * @internal\n\t */\n\tprivate driver: AnimationDriver<AnimatorInterface<Value, AnimatorOptions>, Value, AnimatorOptions>\n\t/**\n\t * @internal\n\t */\n\tconstructor(\n\t\ttarget: DeprecatedAnimationTarget<Value>,\n\t\tfrom: Value,\n\t\tto: Value,\n\t\tanimatorClass?: AnimatorClass<Value, AnimatorOptions>,\n\t\toptions?: Partial<AnimatorOptions & DeprecatedAnimationOptions<Value>>,\n\t\tdriverClass: DriverClass<\n\t\t\tAnimatorInterface<Value, AnimatorOptions>,\n\t\t\tValue,\n\t\t\tAnimatorOptions\n\t\t> = MainLoopAnimationDriver,\n\t) {\n\t\tthis.resetFinishedPromise()\n\t\tconst deprecatedAnimationOptions: DeprecatedAnimationOptions<Value> = { ...DefaultDeprecatedAnimationOptions }\n\t\tconst animatorOptions: Partial<AnimatorOptions> = {}\n\t\tif (options) {\n\t\t\tObject.assign(deprecatedAnimationOptions, options)\n\t\t\tObject.assign(animatorOptions, options)\n\t\t}\n\t\tlet interpolation: Interpolation<Value>\n\t\tif (deprecatedAnimationOptions.customInterpolation) {\n\t\t\tinterpolation = deprecatedAnimationOptions.customInterpolation\n\t\t} else {\n\t\t\tinterpolation = new ValueInterpolation(options)\n\t\t}\n\t\tlet animator: AnimatorInterface<Value, AnimatorOptions>\n\t\tif (!animatorClass) {\n\t\t\tanimator = new BezierAnimator({}, interpolation)\n\t\t} else {\n\t\t\tanimator = new animatorClass(animatorOptions, interpolation)\n\t\t}\n\t\tif (deprecatedAnimationOptions.precalculate) {\n\t\t\tanimator = new PrecalculatedAnimator({ animator })\n\t\t}\n\t\tanimator.setFrom(from)\n\t\tanimator.setTo(to)\n\t\tconst updateCallback = (value: Value) => {\n\t\t\tFramerAnimation.driverCallbackHandler(target, value)\n\t\t}\n\n\t\tconst finishedCallback = (isFinished: boolean) => {\n\t\t\tif (isFinished) {\n\t\t\t\tFramerAnimation.driverCallbackHandler(target, to)\n\t\t\t\tif (this.playStateSource === \"running\") {\n\t\t\t\t\tthis.playStateValue = \"finished\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.driver = new driverClass(animator, updateCallback, finishedCallback)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tprivate static driverCallbackHandler<Value>(target: DeprecatedAnimationTarget<Value>, value: Value) {\n\t\tif (isAnimatable(target) || isMotionValue(target)) {\n\t\t\ttarget.set(value)\n\t\t} else {\n\t\t\tconst targetObject = target as TargetObject<Value>\n\t\t\tAnimatable.transaction(update => {\n\t\t\t\tfor (const key in targetObject) {\n\t\t\t\t\tconst targetValue = targetObject[key]\n\t\t\t\t\tif (isAnimatable(targetValue)) {\n\t\t\t\t\t\tupdate(targetValue, value[key])\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttargetObject[key] = value[key]\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 * @internal\n\t */\n\tprivate playStateSource: FramerAnimationState = \"idle\"\n\n\t/**\n\t * @internal\n\t */\n\tprivate get playStateValue(): FramerAnimationState {\n\t\treturn this.playStateSource\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tprivate set playStateValue(value: FramerAnimationState) {\n\t\tif (value !== this.playStateSource) {\n\t\t\tconst oldValue = value\n\t\t\tthis.playStateSource = value\n\t\t\tswitch (value) {\n\t\t\t\tcase \"idle\":\n\t\t\t\t\tif (oldValue === \"running\") {\n\t\t\t\t\t\tthis.oncancel && this.oncancel()\n\t\t\t\t\t}\n\t\t\t\t\tthis.readyResolve && this.readyResolve()\n\t\t\t\t\tthis.resetReadyPromise()\n\t\t\t\t\tbreak\n\t\t\t\tcase \"finished\":\n\t\t\t\t\tif (oldValue === \"idle\") {\n\t\t\t\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\t\t\t\tconsole.warn(\"Bad state transition\")\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tthis.onfinish && this.onfinish()\n\t\t\t\t\tthis.finishedResolve && this.finishedResolve()\n\t\t\t\t\tbreak\n\t\t\t\tcase \"running\":\n\t\t\t\t\tthis.resetReadyPromise()\n\t\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif (oldValue === \"finished\") {\n\t\t\t\tthis.resetFinishedPromise()\n\t\t\t}\n\n\t\t\tif (value === \"finished\") {\n\t\t\t\t// Jump to idle state:\n\t\t\t\tthis.playStateValue = \"idle\"\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tget playState(): FramerAnimationState {\n\t\treturn this.playStateValue\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tonfinish: undefined | (() => void)\n\t/**\n\t * @internal\n\t */\n\toncancel: undefined | (() => void)\n\n\t/**\n\t * @internal\n\t */\n\tprivate readyPromise: Promise<void> = Promise.resolve()\n\n\t/**\n\t * @internal\n\t */\n\tprivate readyResolve: null | (() => void) = null\n\n\t/**\n\t * @internal\n\t */\n\tprivate resetReadyPromise() {\n\t\tthis.readyResolve = null\n\t\tthis.readyPromise = new Promise((resolve, reject) => {\n\t\t\tthis.readyResolve = resolve\n\t\t})\n\t}\n\n\t/**\n     * Wait for the animation to be ready to play.\n     * @remarks\n     * ```jsx\n     * const animation = animate.ease(value, 100)\n     * animation.ready().then(() => {\n     *    // Animation is ready\n     * })\n\n     * // async/await syntax\n     * const animation = animate.ease(value, 100)\n     * await animation.ready()\n     * // Animation is ready\n     * ```\n     * @returns Promise that is resolved when the animation is ready to play\n     * @public\n     */\n\tget ready(): Promise<void> {\n\t\treturn this.readyPromise\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tprivate finishedPromise: Promise<void> = Promise.resolve()\n\t/**\n\t * @internal\n\t */\n\tprivate finishedResolve: null | (() => void) = null\n\t/**\n\t * @internal\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: deprecated\n\tprivate finishedReject: null | ((reason: any) => void) = null\n\t/**\n\t * @internal\n\t */\n\tprivate resetFinishedPromise() {\n\t\tthis.finishedResolve = null\n\t\tthis.finishedReject = null\n\t\tthis.finishedPromise = new Promise((resolve, reject) => {\n\t\t\tthis.finishedResolve = resolve\n\t\t\tthis.finishedReject = reject\n\t\t})\n\t\tthis.finishedPromise.catch(reason => {\n\t\t\t// Eat the exception that will occur when no 'reject' handler\n\t\t\t// is set.\n\t\t})\n\t}\n\n\t/**\n\t * Wait for the animation to be finished.\n\t * @remarks\n\t * ```jsx\n\t * // async/await syntax\n\t * const animation = animate.ease(value, 100)\n\t * await animation.finished()\n\t * // Animation is finished\n\t *\n\t *\n\t * const animation = animate.ease(value, 100)\n\t * animation.ready().then(() => {\n\t *    // Animation is finished\n\t * })\n\t * ```\n\t * @returns Promise that is resolved when the animation is ready to play\n\t * @public\n\t */\n\tget finished(): Promise<void> {\n\t\treturn this.finishedPromise\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tplay() {\n\t\tthis.playStateValue = \"running\"\n\t\tthis.driver.play()\n\t}\n\n\t/**\n\t * Cancels the animation if it is still running.\n\t * @remarks\n\t * ```jsx\n\t * const animation = animate.ease(value, 100, {duration: 3})\n\t * setTimeout(() => animation.cancel(), 500)\n\t * ```\n\t * @public\n\t */\n\tcancel() {\n\t\tif (this.playStateValue !== \"running\") {\n\t\t\treturn\n\t\t}\n\n\t\tthis.driver.cancel()\n\t\tif (this.playState !== \"idle\") {\n\t\t\tconst reason = \"AbortError\"\n\t\t\tthis.finishedReject && this.finishedReject(reason)\n\t\t}\n\t\tthis.playStateValue = \"idle\"\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tfinish() {\n\t\tif (this.playStateSource === \"running\") {\n\t\t\tthis.playStateValue = \"finished\"\n\t\t\tthis.driver.finish()\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tisFinished() {\n\t\treturn this.playStateValue === \"finished\"\n\t}\n}\n", "import type { AnyResolvedKeyframe, IProjectionNode } from \"framer-motion\"\n\nexport const correctBorderScale = (axis: \"x\" | \"y\") => ({\n\tcorrect: (latest: AnyResolvedKeyframe, { projectionDelta, treeScale }: IProjectionNode): AnyResolvedKeyframe => {\n\t\tif (typeof latest === \"string\") latest = parseFloat(latest)\n\t\tif (latest === 0) return \"0px\"\n\t\tlet corrected = latest\n\t\tif (projectionDelta && treeScale) {\n\t\t\tcorrected = Math.round(latest / projectionDelta[axis].scale / treeScale[axis])\n\t\t\tcorrected = Math.max(corrected, 1)\n\t\t}\n\t\treturn corrected + \"px\"\n\t},\n})\n", "import { addScaleCorrector } from \"framer-motion\"\nimport type { PropsWithChildren } from \"react\"\nimport { correctBorderScale } from \"./autoValueHandlers.ts\"\n\naddScaleCorrector({\n\tborderTopWidth: correctBorderScale(\"y\"),\n\tborderLeftWidth: correctBorderScale(\"x\"),\n\tborderRightWidth: correctBorderScale(\"x\"),\n\tborderBottomWidth: correctBorderScale(\"y\"),\n})\n\n/** @public */\nexport function MotionSetup({ children }: PropsWithChildren) {\n\treturn <>{children}</>\n}\n", "import { type AnyResolvedKeyframe, type Axis, type IProjectionNode, addScaleCorrector, px } from \"framer-motion\"\nimport { isUndefined } from \"../../utils/utils.ts\"\n\nexport function patchBorderRadiusScaleCorrector() {\n\tif (isPatched) return\n\tisPatched = true\n\taddScaleCorrector(borderRadiusCorrectors)\n}\n\nlet isPatched = false\n\nconst calcPrefix = \"calc(\"\nconst separator = \"*\"\n\n// https://github.com/motiondivision/motion/blob/78681bc6fe9c1297eacec6f634bd3f13328d64a7/packages/framer-motion/src/projection/styles/scale-border-radius.ts\nconst correctBorderRadius = {\n\tcorrect: (latest: AnyResolvedKeyframe, node: IProjectionNode): AnyResolvedKeyframe => {\n\t\tif (!node.target) return latest\n\n\t\tif (typeof latest === \"string\") {\n\t\t\tif (latest.startsWith(calcPrefix)) {\n\t\t\t\tconst [candidate, ...rest] = latest.slice(calcPrefix.length).split(separator)\n\t\t\t\tif (isUndefined(candidate) || !px.test(candidate.trim())) return latest\n\t\t\t\tconst pixels = parseFloat(candidate)\n\t\t\t\tconst x = pixelsToPercent(pixels, node.target.x)\n\t\t\t\tconst y = pixelsToPercent(pixels, node.target.y)\n\t\t\t\treturn `${reWrapInCalc(x, rest)} ${reWrapInCalc(y, rest)}`\n\t\t\t}\n\n\t\t\tif (px.test(latest)) {\n\t\t\t\tlatest = parseFloat(latest)\n\t\t\t} else {\n\t\t\t\treturn latest\n\t\t\t}\n\t\t}\n\n\t\tconst x = pixelsToPercent(latest, node.target.x)\n\t\tconst y = pixelsToPercent(latest, node.target.y)\n\n\t\treturn `${x}% ${y}%`\n\t},\n}\n\nconst borderRadiusCorrectors = /* @__PURE__ */ (() => ({\n\tborderRadius: {\n\t\t...correctBorderRadius,\n\t\tapplyTo: [\"borderTopLeftRadius\", \"borderTopRightRadius\", \"borderBottomLeftRadius\", \"borderBottomRightRadius\"],\n\t},\n\tborderTopLeftRadius: correctBorderRadius,\n\tborderTopRightRadius: correctBorderRadius,\n\tborderBottomLeftRadius: correctBorderRadius,\n\tborderBottomRightRadius: correctBorderRadius,\n}))()\n\nfunction pixelsToPercent(pixels: number, axis: Axis): number {\n\tif (axis.max === axis.min) return 0\n\treturn (pixels / (axis.max - axis.min)) * 100\n}\n\nfunction reWrapInCalc(percentage: number, rest: string[]): string {\n\treturn `${calcPrefix}${percentage}%${separator}${rest.join(separator)}`\n}\n", "import type { MotionValue, ValueAnimationTransition } from \"framer-motion\"\nimport { animate } from \"framer-motion\"\nimport { warnOnce } from \"../../utils/warnOnce.ts\"\n\n/**\n * @deprecated\n * @internal\n */\nexport function startAnimation<V extends string | number>(\n\t_key: string,\n\tvalue: MotionValue<V>,\n\ttarget: V | V[],\n\ttransition: ValueAnimationTransition<V> = {},\n) {\n\twarnOnce(\n\t\t`\"startAnimation\" is unsupported. Use \"animate\" instead: https://www.framer.com/api/motion/utilities/#animate`,\n\t)\n\n\treturn new Promise<void>(resolve => {\n\t\t// @TODO: Ignored for now, but should re-check later.\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tanimate(value, target, {\n\t\t\t...transition,\n\t\t\tonComplete: () => resolve(),\n\t\t} as ValueAnimationTransition<V>)\n\t})\n}\n", "import type { AnimationPlaybackControls, MotionValue, Spring, Transition, Tween } from \"framer-motion\"\nimport { animate as motionAnimate } from \"framer-motion\"\nimport { isMotionValue } from \"../render/utils/isMotionValue.ts\"\nimport { deprecationWarning } from \"../utils/deprecation.ts\"\nimport type { DeprecatedAnimationTarget } from \"./Animatable/Animatable.ts\"\nimport { Animatable, isAnimatable } from \"./Animatable/Animatable.ts\"\nimport type { AnimatorClass } from \"./Animators/Animator.ts\"\nimport type { BezierOptions, SpringOptions } from \"./Animators/index.ts\"\nimport { Bezier, BezierAnimator, SpringAnimator } from \"./Animators/index.ts\"\nimport type { DeprecatedAnimationOptions } from \"./FramerAnimation.ts\"\nimport { FramerAnimation } from \"./FramerAnimation.ts\"\n\n/**\n * Animate an {@link (Animatable:interface)} value to a new value.\n * @remarks\n * Recommended use is to use convenience functions from the `animate` namespace\n * instead of passing an animator. Only use this for low-level animation tweaking.\n *\n * ```jsx\n * const value = Animatable(0)\n * animate(value, 100)\n *\n * const value = Animatable({x: 0, y: 0})\n * animate(value, {x: 100, y: 100})\n * ```\n *\n * @param from - The animatable value or object to start from\n * @param to - Value to animate to\n * @param animator - Animator class to use.\n * @param options - Animation options\n * @returns Instance of {@link FramerAnimation} that can be used to control the animation\n * @public\n * @deprecated Use the {@link AnimationProps.animate} prop on {@link Frame} instead.\n */\nexport function deprecatedAnimate<Value, Options>(\n\tfrom: DeprecatedAnimationTarget<Value>,\n\tto: Value,\n\tanimator?: AnimatorClass<Value, Options>,\n\toptions?: Partial<Options & DeprecatedAnimationOptions<Value>>,\n): FramerAnimation<Value, Options> {\n\tdeprecationWarning(\"animate()\", \"2.0.0\", \"the new animation API (https://www.framer.com/api/animation/)\")\n\tconst target = from\n\tlet fromValue: Value\n\tif (isAnimatable(from) || isMotionValue(from)) {\n\t\tfromValue = from.get()\n\t} else {\n\t\tfromValue = Animatable.objectToValues(from)\n\t}\n\tconst animation = new FramerAnimation(target, fromValue, to, animator, options)\n\tanimation.play()\n\treturn animation\n}\n\ntype AnimationOptions<V> = (Tween | Spring) &\n\tAnimationPlaybackLifecycles<V> & { delay?: number; type?: \"tween\" | \"spring\" }\n\nexport type EaseOptions = Omit<BezierOptions, \"curve\">\n\ninterface AnimationPlaybackLifecycles<V> {\n\tonUpdate?: (latest: V) => void\n\tonPlay?: () => void\n\tonComplete?: () => void\n\tonRepeat?: () => void\n\tonStop?: () => void\n}\n\n/**\n * @public\n * @deprecated Use the {@link MotionProps.animate} prop on {@link Frame} instead.\n */\nexport const animate = /* @__PURE__ */ (() => {\n\t// TODO: When removing support for the deprecated API, simply delete this entire file as `framer-motion` is exported in its entirety.\n\t/**\n\t * Animate a single value or a `MotionValue`.\n\t *\n\t * The first argument is either a `MotionValue` to animate, or an initial animation value.\n\t *\n\t * The second is either a value to animate to, or an array of keyframes to animate through.\n\t *\n\t * The third argument can be either tween or spring options, and optional lifecycle methods: `onUpdate`, `onPlay`, `onComplete`, `onRepeat` and `onStop`.\n\t *\n\t * Returns `PlaybackControls`, currently just a `stop` method.\n\t *\n\t * ```javascript\n\t * const x = useMotionValue(0)\n\t *\n\t * useEffect(() => {\n\t *   const controls = animate(x, 100, {\n\t *     type: \"spring\",\n\t *     stiffness: 2000,\n\t *     onComplete: v => {}\n\t *   })\n\t *\n\t *   return controls.stop\n\t * })\n\t * ```\n\t *\n\t * @public\n\t *\n\t * @deprecated\n\t */\n\tfunction animate<Value, Options>(\n\t\tfrom: Animatable<Value>,\n\t\tto: Value,\n\t\tanimator?: AnimatorClass<Value, Options>,\n\t\toptions?: Partial<Options & DeprecatedAnimationOptions<Value>>,\n\t): FramerAnimation<Value, Options>\n\t/** @public */\n\tfunction animate<V>(\n\t\tfrom: MotionValue<V> | V,\n\t\tto: V | V[],\n\t\ttransition?: Transition & AnimationPlaybackLifecycles<V>,\n\t): AnimationPlaybackControls\n\t/** @public */\n\tfunction animate<V extends string | number, O>(\n\t\tfrom: Animatable<V> | MotionValue<V> | V,\n\t\tto: V | V[],\n\t\tanimatorOrTransition?: AnimatorClass<V, O> | (Transition & AnimationPlaybackLifecycles<V>),\n\t\toptions?: Partial<O & DeprecatedAnimationOptions<V>>,\n\t): FramerAnimation<V | V[], O> | AnimationPlaybackControls {\n\t\treturn isAnimatable(from)\n\t\t\t? deprecatedAnimate(from, to, animatorOrTransition as AnimatorClass<V | V[], O>, options)\n\t\t\t: motionAnimate(from, to, animatorOrTransition as AnimationOptions<V>)\n\t}\n\n\t/**\n\t * Animate value with a spring curve\n\t * @remarks\n\t * ```jsx\n\t * const value = Animatable(0)\n\t * animate.spring(value, 100, {tension: 100, friction: 100})\n\t *\n\t * animate.spring(value, 100, {dampingRatio: 0.5, duration: 1})\n\t * ```\n\t * @param from - Value to animate\n\t * @param to - Value to animate to\n\t * @param options - Options for the spring\n\t * These can be either `tension`, `friction`, `velocity` and `tolerance` _or_ `dampingRatio`, `duration`, `velocity` and `mass`\n\t * @returns Instance of {@link FramerAnimation} that can be used to control the animation\n\t * @deprecated Use {@link MotionProps.animate} on {@link Frame} instead.\n\t */\n\tanimate.spring = <Value>(\n\t\tfrom: Animatable<Value>,\n\t\tto: Value,\n\t\toptions?: Partial<SpringOptions & DeprecatedAnimationOptions<Value>>,\n\t): FramerAnimation<Value, SpringOptions> => {\n\t\treturn animate<Value, SpringOptions>(from, to, SpringAnimator, options)\n\t}\n\n\t/**\n\t * Animate value with a bezier curve\n\t * @remarks\n\t * ```jsx\n\t * const value = Animatable(0)\n\t * animate.bezier(value, 100, {duration: 1, curve: Bezier.EaseIn})\n\t *\n\t * animate.bezier(value, 100, {duration: 1, curve: [0.3, 0.1, 0.4, 1]})\n\t * ```\n\t * @param from - Value to animate\n\t * @param to - Value to animate to\n\t * @param options - Options for the bezier curve\n\t *\n\t * - `duration` Duration of the animation\n\t * - `curve` One of the `Bezier` enum values or an array with 4 control points\n\t *\n\t * @returns Instance of {@link FramerAnimation} that can be used to control the animation\n\t * @deprecated Use {@link MotionProps.animate} on {@link Frame} instead.\n\t */\n\tanimate.bezier = <Value>(\n\t\tfrom: Animatable<Value>,\n\t\tto: Value,\n\t\toptions?: Partial<BezierOptions & DeprecatedAnimationOptions<Value>>,\n\t): FramerAnimation<Value, BezierOptions> => {\n\t\treturn animate<Value, BezierOptions>(from, to, BezierAnimator, options)\n\t}\n\n\t/**\n\t * Animate value with a linear animation\n\t * @remarks\n\t * ```jsx\n\t * const value = Animatable(0)\n\t * animate.linear(value, 100)\n\t *\n\t * animate.linear(value, 100, {duration: 1})\n\t * ```\n\t * @param from  - Value to animate\n\t * @param to - Value to animate to\n\t * @param options - The options for the animation\n\t *\n\t * - `duration` - Duration of the animation\n\t *\n\t * @returns Instance of {@link FramerAnimation} that can be used to control the animation\n\t * @deprecated Use {@link MotionProps.animate} on {@link Frame} instead.\n\t */\n\tanimate.linear = <Value>(\n\t\tfrom: Animatable<Value>,\n\t\tto: Value,\n\t\toptions?: Partial<EaseOptions & DeprecatedAnimationOptions<Value>>,\n\t): FramerAnimation<Value, BezierOptions> => {\n\t\treturn animate.bezier(from, to, { ...options, curve: Bezier.Linear })\n\t}\n\n\t/**\n\t * Animate value with a ease animation\n\t * @remarks\n\t * ```jsx\n\t * const value = Animatable(0)\n\t * animate.ease(value, 100)\n\t *\n\t * animate.ease(value, 100, {duration: 1})\n\t * ```\n\t * @param from  - Value to animate\n\t * @param to - Value to animate to\n\t * @param options - The options for the animation\n\t *\n\t * - `duration` - Duration of the animation\n\t *\n\t * @returns Instance of {@link FramerAnimation} that can be used to control the animation\n\t * @deprecated Use {@link MotionProps.animate} on {@link Frame} instead.\n\t */\n\tanimate.ease = <Value>(\n\t\tfrom: Animatable<Value>,\n\t\tto: Value,\n\t\toptions?: Partial<EaseOptions & DeprecatedAnimationOptions<Value>>,\n\t): FramerAnimation<Value, BezierOptions> => {\n\t\treturn animate.bezier(from, to, { ...options, curve: Bezier.Ease })\n\t}\n\n\t/**\n\t * Animate value with a ease in animation\n\t * @remarks\n\t * ```jsx\n\t * const value = Animatable(0)\n\t * animate.easeIn(value, 100)\n\t *\n\t * animate.easeIn(value, 100, {duration: 1})\n\t * ```\n\t * @param from  - Value to animate\n\t * @param to - Value to animate to\n\t * @param options - The options for the animation\n\t *\n\t * - `duration` - Duration of the animation\n\t *\n\t * @returns Instance of {@link FramerAnimation} that can be used to control the animation\n\t * @deprecated Use {@link MotionProps.animate} on {@link Frame} instead.\n\t */\n\tanimate.easeIn = <Value>(\n\t\tfrom: Animatable<Value>,\n\t\tto: Value,\n\t\toptions?: Partial<EaseOptions & DeprecatedAnimationOptions<Value>>,\n\t): FramerAnimation<Value, BezierOptions> => {\n\t\treturn animate.bezier(from, to, { ...options, curve: Bezier.EaseIn })\n\t}\n\n\t/**\n\t * Animate value with a ease out animation\n\t * @remarks\n\t * ```jsx\n\t * const value = Animatable(0)\n\t * animate.easeOut(value, 100)\n\t *\n\t * animate.easeOUt(value, 100, {duration: 1})\n\t * ```\n\t * @param from  - Value to animate\n\t * @param to - Value to animate to\n\t * @param options - The options for the animation\n\t *\n\t * - `duration` - Duration of the animation\n\t *\n\t * @returns Instance of {@link FramerAnimation} that can be used to control the animation\n\t * @deprecated Use {@link MotionProps.animate} on {@link Frame} instead.\n\t */\n\tanimate.easeOut = <Value>(\n\t\tfrom: Animatable<Value>,\n\t\tto: Value,\n\t\toptions?: Partial<EaseOptions & DeprecatedAnimationOptions<Value>>,\n\t): FramerAnimation<Value, BezierOptions> => {\n\t\treturn animate.bezier(from, to, { ...options, curve: Bezier.EaseOut })\n\t}\n\n\t/**\n\t * Animate value with a ease in out animation\n\t * @remarks\n\t * ```jsx\n\t * const value = Animatable(0)\n\t * animate.easeInOut(value, 100)\n\t *\n\t * animate.easeInOut(value, 100, {duration: 1})\n\t * ```\n\t * @param from  - Value to animate\n\t * @param to - Value to animate to\n\t * @param options - The options for the animation\n\t *\n\t * - `duration` - Duration of the animation\n\t *\n\t * @returns Instance of {@link FramerAnimation} that can be used to control the animation\n\t * @deprecated Use {@link MotionProps.animate} on {@link Frame} instead.\n\t */\n\tanimate.easeInOut = <Value>(\n\t\tfrom: Animatable<Value>,\n\t\tto: Value,\n\t\toptions?: Partial<EaseOptions & DeprecatedAnimationOptions<Value>>,\n\t): FramerAnimation<Value, BezierOptions> => {\n\t\treturn animate.bezier(from, to, { ...options, curve: Bezier.EaseInOut })\n\t}\n\n\treturn animate\n})()\n", "import React, { useCallback, useContext, useMemo, useRef } from \"react\"\nimport { assert } from \"../../utils/assert.ts\"\n\n/**\n * @internal\n */\nexport interface GetLayoutId {\n\tid?: string\n\tname?: string\n\tduplicatedFrom?: string[]\n}\n\n/**\n * @internal\n */\nexport const LayoutIdContext = /* @__PURE__ */ React.createContext<{\n\tgetLayoutId: (args: GetLayoutId) => string | null\n\tpersistLayoutIdCache: () => void\n\t/**\n\t * Sometimes we overwrite getLayoutId to always return null, to prevent\n\t * layoutId generation for descendents. If we want to re-enable that\n\t * layoutId generation later in the tree, we need a reference to the\n\t * original function to restore.\n\t */\n\ttop: boolean\n\tenabled?: boolean\n}>({\n\tgetLayoutId: args => null,\n\tpersistLayoutIdCache: () => {},\n\ttop: false,\n\tenabled: true,\n})\n\ninterface Cache {\n\tbyId: Record<string, string>\n\tbyName: Record<string, string>\n\tbyLastId: Record<string, string>\n\tbyPossibleId: Record<string, string>\n\tbyLastName: Record<string, string>\n\tbyLayoutId: Record<string, string>\n\tcount: {\n\t\tbyId: Record<string, number>\n\t\tbyName: Record<string, number>\n\t}\n}\n\n/**\n * @internal\n */\nexport function LayoutIdProvider({ children }: { children: React.ReactNode }) {\n\tconst context = useContext(LayoutIdContext)\n\n\t// Since Code Components on the canvas can use Navigation, we need to ensure\n\t// that only the root LayoutIdContext is generating layoutIds so that the\n\t// cache is shared across all screens.\n\tif (context.top) return <>{children}</>\n\n\t// biome-ignore lint/correctness/useHookAtTopLevel: `context.top` is stable\n\tconst cache = useRef<Cache>({\n\t\t// When we provide a layoutId for a node based on it's first\n\t\t// duplicatedFrom id, we save it's layoutId mapped to it's actual id.\n\t\t// Future screen's nodes will check this cache first, to see if they've\n\t\t// previously been assigned a layoutId, or if any of there other\n\t\t// duplicatedFrom ids matched a node that was previously assigned a\n\t\t// layoutId.\n\t\tbyId: {},\n\t\tbyName: {},\n\t\t// When we navigate from screens that were duplicated from a future\n\t\t// screen, to that future screen, we want to do a reverse lookup on the\n\t\t// last duplicatedFrom id, rather than the id. We need to keep them\n\t\t// separate so they don't overlap.\n\t\tbyLastId: {},\n\t\tbyPossibleId: {},\n\t\tbyLastName: {},\n\t\tbyLayoutId: {},\n\t\t// When we don't have a cached layoutId for all duplicatedFrom ids, we\n\t\t// need to increment and save it so that we don't create clashing\n\t\t// layoutIds. We also need to reset name counts between screens, so we\n\t\t// record those separately.\n\t\tcount: {\n\t\t\tbyId: {},\n\t\t\tbyName: {},\n\t\t},\n\t})\n\n\t// biome-ignore lint/correctness/useHookAtTopLevel: `context.top` is stable\n\tconst screen = useRef<Omit<Cache, \"count\">>({\n\t\tbyId: {},\n\t\tbyName: {},\n\t\tbyLastId: {},\n\t\tbyPossibleId: {},\n\t\tbyLastName: {},\n\t\tbyLayoutId: {},\n\t})\n\n\t// Keep track of which layoutIds have been used on the current screen so\n\t// that we avoid reassigning them, and instead, use other methods to\n\t// generate a unique id.\n\t// biome-ignore lint/correctness/useHookAtTopLevel: `context.top` is stable\n\tconst usedIds = useRef(new Set<string>()).current\n\n\t// This function is quite abstract so I've done my best to annotate why\n\t// checks are happening. A lot of the complexity comes from handling named\n\t// and unnamed layers differently.\n\t// biome-ignore lint/correctness/useHookAtTopLevel: `context.top` is stable\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: has been like this for 4 years\n\tconst getLayoutId = useCallback(({ id, name, duplicatedFrom }: GetLayoutId) => {\n\t\t// Code components that use Frame's should not receive a layout id\n\t\t// from our context. However this will be bypassed if end-users add an\n\t\t// id to their Frame in code.\n\t\tif (!id) return null\n\t\tconst cacheKey = name ? \"byName\" : \"byId\"\n\n\t\t// If we've previously recorded an layout id for this node, reuse it\n\t\t// and return early.\n\t\tconst previousId = cache.current[cacheKey][id]\n\t\tif (previousId) return previousId\n\n\t\t// If the node is an original node (hasn't been duplicated from another\n\t\t// node), we use it's name or id, unless it's name or id was already\n\t\t// used on this screen, or used by a node that wasn't last duplicated\n\t\t// from this node on the previous screen (suggesting another node on\n\t\t// this screen will need to use this id in a future call).\n\t\tconst nodeIdentifier = name || id\n\t\tif (\n\t\t\t!duplicatedFrom &&\n\t\t\t!usedIds.has(nodeIdentifier) &&\n\t\t\t(!cache.current.byLayoutId[nodeIdentifier] || cache.current.byLayoutId[nodeIdentifier] === nodeIdentifier)\n\t\t) {\n\t\t\tif (cache.current.count[cacheKey][nodeIdentifier] === undefined) {\n\t\t\t\tcache.current.count[cacheKey][nodeIdentifier] = 0\n\t\t\t\tcache.current.byLayoutId[nodeIdentifier] = nodeIdentifier\n\t\t\t\tscreen.current[cacheKey][id] = nodeIdentifier\n\t\t\t}\n\n\t\t\tusedIds.add(nodeIdentifier)\n\t\t\treturn nodeIdentifier\n\t\t}\n\n\t\t// If a node is duplicated, check if an layout id was assigned to it\n\t\t// on the last screen. Use that layout id if it's not already been\n\t\t// used on this screen. This ensures that nodes duplicated from a\n\t\t// specific layer on one screen, preserve their connection even if they\n\t\t// are in a different hierarchical order on the current screen. This is\n\t\t// not relevant for design components since their layers are always in\n\t\t// the same order. We also check for matches against `byLastId`, but\n\t\t// only use them after we explicitly check `id`.\n\t\tlet possibleMatch: [string, string] | undefined = undefined\n\t\tif (duplicatedFrom?.length) {\n\t\t\tfor (let index = duplicatedFrom.length - 1; index >= 0; index--) {\n\t\t\t\tconst duplicatedId = duplicatedFrom[index]\n\t\t\t\tassert(!!duplicatedId, `duplicatedId must be defined`)\n\t\t\t\tconst match = cache.current[cacheKey][duplicatedId]\n\t\t\t\tconst byLastIdMatch = cache.current.byLastId[duplicatedId]\n\n\t\t\t\t// In the event that no match is found for the duplicatedFrom id\n\t\t\t\t// in the `byId` or `byName` cache, it's possible we will need\n\t\t\t\t// to loop through the duplicatedFrom ids again, to check if\n\t\t\t\t// there is a match against the `byLastId` cache. Rather than\n\t\t\t\t// performing that loop again, we can save the first successful\n\t\t\t\t// match here, and use it when it's the correct option later.\n\t\t\t\t// This is safe because we will only use this match if there is\n\t\t\t\t// no match against `byId` or `byName`, meaning we will always\n\t\t\t\t// have looped through all of the duplicatedFrom ids.\n\t\t\t\tif (byLastIdMatch && !possibleMatch) {\n\t\t\t\t\tconst matchedLayoutId = cache.current.byLayoutId[byLastIdMatch]\n\t\t\t\t\tconst shouldUseNamedLastIdMatch = !matchedLayoutId || matchedLayoutId === name\n\n\t\t\t\t\tif (byLastIdMatch && !usedIds.has(byLastIdMatch) && (name ? shouldUseNamedLastIdMatch : true)) {\n\t\t\t\t\t\tpossibleMatch = [byLastIdMatch, duplicatedId]\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If the match from the previous screen is a name match, ensure it is was assigned to the exact same name.\n\t\t\t\tconst previousLayoutId = match ? cache.current.byLayoutId[match] : undefined\n\t\t\t\tconst shouldUseNamedMatch = !previousLayoutId || previousLayoutId === name\n\n\t\t\t\tif (match && !usedIds.has(match) && (name ? shouldUseNamedMatch : true)) {\n\t\t\t\t\tscreen.current[cacheKey][id] = match\n\t\t\t\t\tscreen.current.byLastId[duplicatedId] = match\n\n\t\t\t\t\tusedIds.add(match)\n\t\t\t\t\treturn match\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// In cases where we're starting on a screen that uses frames duplicated\n\t\t// from a future screen, when we arrive on the future screen, we need to\n\t\t// make sure we preserve that connection. This handles direct\n\t\t// relationships. For example starting on a frame that was duplicated\n\t\t// directly from the previous frame, and transitioning to that previous\n\t\t// frame.\n\t\tconst last = cache.current.byLastId[id]\n\t\tif (last && !usedIds.has(last)) {\n\t\t\tusedIds.add(last)\n\t\t\tscreen.current.byId[id] = last\n\t\t\treturn last\n\t\t}\n\n\t\t// If we set a possible match by checking duplicatedFrom ids against\n\t\t// `byLastId`, and we weren't able to find a match against the `byId` or\n\t\t// `byName`, or by directly looking up the node's id against `byLastId`,\n\t\t// use a possible match if it was set.\n\t\tif (possibleMatch) {\n\t\t\tconst [match, duplicatedId] = possibleMatch\n\n\t\t\tscreen.current[cacheKey][id] = match\n\t\t\tscreen.current.byLastId[duplicatedId] = match\n\n\t\t\tusedIds.add(match)\n\t\t\treturn match\n\t\t}\n\n\t\t// In cases where we're starting on a screen that uses frames duplicated\n\t\t// from a future screen, when we arrive on the future screen, we need to\n\t\t// make sure we preserve that connection. This handles indirect\n\t\t// relationships. For example starting on the last frame duplicated many\n\t\t// times from an initial frame, and transitioning directly to that\n\t\t// initial frame.\n\t\tconst possible = cache.current.byPossibleId[id]\n\t\tif (possible && !usedIds.has(possible)) {\n\t\t\tusedIds.add(possible)\n\t\t\tscreen.current.byId[id] = possible\n\t\t\treturn possible\n\t\t}\n\n\t\tconst rootDuplicatedId = duplicatedFrom?.[0]\n\n\t\t// If a node hasn't been assigned a layout id on a previous screen,\n\t\t// or if that layout id has already been used, or if this is the\n\t\t// first screen, generate a unique layout id by incrementing a\n\t\t// counter for that name or duplicatedId.\n\t\tconst identifier = name || rootDuplicatedId || id\n\t\tconst value = (cache.current.count[cacheKey][identifier] ?? -1) + 1\n\n\t\tconst { layoutId, value: nextValue } = nextLayoutId(identifier, value, usedIds)\n\n\t\tcache.current.count[cacheKey][identifier] = nextValue\n\t\tscreen.current[cacheKey][id] = layoutId\n\n\t\tif (duplicatedFrom?.length) {\n\t\t\t// TODO: Should name use it's own map?\n\t\t\tif (!name) {\n\t\t\t\tconst lastId = duplicatedFrom[duplicatedFrom.length - 1]\n\t\t\t\tif (lastId) {\n\t\t\t\t\tscreen.current.byLastId[lastId] = layoutId\n\t\t\t\t}\n\n\t\t\t\tif (duplicatedFrom.length > 1) {\n\t\t\t\t\t// Skipping the most recent duplicatedFrom, and only setting\n\t\t\t\t\t// it if there isn't already one set. This isn't a perfect\n\t\t\t\t\t// heuristic since it allows layout hierarchy to influence\n\t\t\t\t\t// matches, since we have to assign on a\n\t\t\t\t\t// first-come-first-serve basis.\n\t\t\t\t\tfor (let index = 0; index < duplicatedFrom.length - 1; index++) {\n\t\t\t\t\t\tconst possibleId = duplicatedFrom[index]\n\t\t\t\t\t\tif (possibleId === undefined) continue\n\t\t\t\t\t\tif (!screen.current.byPossibleId[possibleId]) {\n\t\t\t\t\t\t\tscreen.current.byPossibleId[possibleId] = layoutId\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\tscreen.current.byLayoutId[layoutId] = nodeIdentifier\n\n\t\tusedIds.add(layoutId)\n\n\t\treturn layoutId\n\t}, [])\n\n\t// biome-ignore lint/correctness/useHookAtTopLevel: `context.top` is stable\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: has been like this for 4 years\n\tconst persistLayoutIdCache = useCallback(() => {\n\t\tcache.current = {\n\t\t\tbyId: {\n\t\t\t\t...cache.current.byId,\n\t\t\t\t...screen.current.byId,\n\t\t\t},\n\t\t\tbyLastId: {\n\t\t\t\t...cache.current.byLastId,\n\t\t\t\t...screen.current.byLastId,\n\t\t\t},\n\t\t\tbyPossibleId: {\n\t\t\t\t...cache.current.byPossibleId,\n\t\t\t\t...screen.current.byPossibleId,\n\t\t\t},\n\t\t\tbyName: {\n\t\t\t\t...cache.current.byName,\n\t\t\t\t...screen.current.byName,\n\t\t\t},\n\t\t\tbyLastName: { ...cache.current.byLastName, ...screen.current.byLastName },\n\t\t\tbyLayoutId: { ...cache.current.byLayoutId, ...screen.current.byLayoutId },\n\n\t\t\t// Unlike the count.byId, we need to reset the count.byName because\n\t\t\t// named layers might not have duplicatedFrom ids (e.g. imported\n\t\t\t// from Figma). When we can use duplicatedFrom ids to check if an id\n\t\t\t// was assigned on a previous screen, we don't increment the count,\n\t\t\t// which means that the count only increments for new items, and\n\t\t\t// only increments on a new screen if the node is new. Since named\n\t\t\t// layers need to always match in some way between screens, we reset\n\t\t\t// the count so that the second named layer on a second screen is\n\t\t\t// always name-1 if it doesn't have any duplicatedFrom ids.\n\t\t\tcount: {\n\t\t\t\t...cache.current.count,\n\t\t\t\tbyName: {},\n\t\t\t},\n\t\t}\n\n\t\tscreen.current = {\n\t\t\tbyId: {},\n\t\t\tbyName: {},\n\t\t\tbyLastId: {},\n\t\t\tbyPossibleId: {},\n\t\t\tbyLastName: {},\n\t\t\tbyLayoutId: {},\n\t\t}\n\n\t\tusedIds.clear()\n\t}, [])\n\n\t// Bind the context value to a ref so that it doesn't change between\n\t// renders, which cases all subscribed descendants to update.\n\t// biome-ignore lint/correctness/useHookAtTopLevel: `context.top` is stable\n\tconst contextValue = useRef({\n\t\tgetLayoutId,\n\t\tpersistLayoutIdCache,\n\t\ttop: true,\n\t\tenabled: true,\n\t}).current\n\n\treturn <LayoutIdContext.Provider value={contextValue}>{children}</LayoutIdContext.Provider>\n}\n\nfunction nextLayoutId(identifier: string, initialValue: number, usedIds: Set<string>) {\n\tlet value = initialValue\n\t// We expect 0 to be falsy here so that generated ids match with\n\t// original ids.\n\tlet layoutId = value ? `${identifier}-${value}` : identifier\n\twhile (usedIds.has(layoutId)) {\n\t\tvalue++\n\t\tlayoutId = `${identifier}-${value}`\n\t}\n\n\treturn { layoutId, value }\n}\n\n/**\n * Enable or disable the automatic generation of layout ids for canvas layers.\n * By default layout ids are generated for all layers created on the Framer\n * canvas. However, layout ids are not generated for any layer that is a\n * descendant of a code component. Sometimes you will want to enable layout id\n * generation for descendants of your code components when they use children,\n * slots, or import design components, and you want those layers to animate with\n * magic motion transitions.\n *\n * You can enable that behavior by wrapping your code component like this\n * ```typescript\n * <AutomaticLayoutIds enabled>\n *  <YourComponent/>\n * </AutomaticLayoutIds>\n * ```\n * @public\n */\nexport function AutomaticLayoutIds({ enabled = true, ...props }: React.PropsWithChildren<{ enabled?: boolean }>) {\n\tconst context = useContext(LayoutIdContext)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: has been like this for 4 years\n\tconst contextValue = useMemo(() => {\n\t\treturn {\n\t\t\t...context,\n\t\t\tenabled,\n\t\t}\n\t}, [enabled])\n\n\treturn <LayoutIdContext.Provider {...props} value={contextValue} />\n}\n", "import { MotionConfig } from \"framer-motion\"\nimport type { CSSProperties } from \"react\"\nimport React, { Component } from \"react\"\nimport { useConstant } from \"../../components/utils/useConstant.ts\"\nimport type { Point } from \"../../render/types/Point.ts\"\nimport { safeWindow } from \"../../utils/safeWindow.ts\"\nimport { ErrorPlaceholder } from \"./ErrorPlaceholder.tsx\"\n\n// This is the \"plain\" component part of the Device Component.\n\n/**\n * @internal\n */\nexport interface DeviceOptions {\n\tdeviceWidth: number\n\tdeviceHeight: number\n\tscreenMaxHeight?: string | number\n\tnoPadding?: boolean\n\tappearance:\n\t\t| {\n\t\t\t\ttype: \"clay\"\n\t\t\t\tbezelRadius?: string\n\t\t\t\tbezelColor?: string\n\t\t\t\tbezelShadeColor?: string\n\t\t  }\n\t\t| {\n\t\t\t\ttype: \"realistic\"\n\t\t\t\timageUrl: string\n\t\t\t\timageWidth: number\n\t\t\t\timageHeight: number\n\t\t\t\trotateImage?: boolean\n\t\t  }\n\t\t| {\n\t\t\t\ttype: \"external-clay\"\n\t\t\t\timageUrl: string\n\t\t\t\timageWidth: number\n\t\t\t\timageHeight: number\n\t\t\t\trotateImage?: boolean\n\t\t  }\n\t\t| { type: \"none\" }\n\tscreenWidth: number\n\tscreenHeight: number\n\tscreenOffsetTop?: number\n\tscreenOffsetLeft?: number\n\tscreenRadius?: string\n\tscreenMaskImage?: string\n\tscreenColor?: string\n\tshadow?: string\n\thand?: {\n\t\timageUrl: string\n\t\toffsetLeft?: number\n\t\toffsetRight?: number\n\t\toffsetBottom?: number\n\t}\n\tbackground?: string\n\ttransparentBackground?: boolean\n\ttheme?: \"dark\" | \"light\"\n\n\t// FIXME: This doesn't really belong here, as the colorId is already baked\n\t// into the realistic imageUrl. We should consider refactoring the code that\n\t// uses this property, and then removing it.\n\tcolorId?: string\n}\n\ninterface ResizeObserver {\n\tobserve(target: Element): void\n\tunobserve(target: Element): void\n\tdisconnect(): void\n}\n\ninterface ScaleData {\n\tscale: number\n\tscreenScalePixelFix: number\n\tscaledComponentWidth: number\n\tscaledComponentHeight: number\n\tscaledDeviceWidth: number\n\tscaledDeviceHeight: number\n}\n\n/**\n * @internal\n */\nexport interface DeviceProps {\n\toverrideTheme?: \"dark\" | \"light\"\n\tcanResize?: boolean\n\tchildren?: React.ReactNode\n\tdeviceOptions?: DeviceOptions\n\t/**\n\t * - setting width + height will scale the component to that size\n\t * - \"dynamic\" will scale the component to the size of its container\n\t * - leaving this undefined will render the component at its intrinsic size\n\t */\n\tscaleTo?: { width: number; height: number } | \"dynamic\"\n\tResizeObserver?: {\n\t\tprototype: ResizeObserver\n\t\tnew (callback: () => void): ResizeObserver\n\t}\n}\n\nfunction getScaleData(deviceOptions: DeviceOptions, containerSize: { width: number; height: number }): ScaleData {\n\tconst { componentWidth, componentHeight } = getComponentSize(deviceOptions)\n\tconst scaleX = containerSize.width / componentWidth\n\tconst scaleY = containerSize.height / componentHeight\n\tconst scale = Math.min(scaleX, scaleY, 1)\n\n\t// temp fix for leaking pixel, see more https://github.com/framer/company/issues/20377\n\tlet screenScalePixelFix = 1\n\tif (scale < 1) {\n\t\tconst actualScreenWidth = deviceOptions.screenWidth * scale\n\t\tconst desiredScreenWidth = actualScreenWidth + 1\n\t\tconst screenScaleX = desiredScreenWidth / actualScreenWidth\n\t\tconst actualScreenHeight = deviceOptions.screenHeight * scale\n\t\tconst desiredScreenHeight = actualScreenHeight + 1\n\t\tconst screenScaleY = desiredScreenHeight / actualScreenHeight\n\t\tconst screenScale = Math.max(screenScaleX, screenScaleY)\n\t\tscreenScalePixelFix = screenScale\n\t}\n\n\treturn {\n\t\tscale,\n\t\tscreenScalePixelFix,\n\t\tscaledComponentWidth: componentWidth * scale,\n\t\tscaledComponentHeight: componentHeight * scale,\n\t\tscaledDeviceWidth: deviceOptions.deviceWidth * scale,\n\t\tscaledDeviceHeight: deviceOptions.deviceHeight * scale,\n\t}\n}\nexport function getColorsFromTheme(theme?: \"dark\" | \"light\", type?: DeviceOptions[\"appearance\"][\"type\"]) {\n\tif (type === \"none\") return {}\n\tif (!theme) return {}\n\tconst isDarkTheme = theme === \"dark\"\n\treturn {\n\t\tshadowColor: isDarkTheme ? \"rgba(0, 0, 0, 0.55)\" : \"rgba(0, 0, 0, 0.15)\",\n\t\tbezelColor: isDarkTheme ? \"#222\" : \"#fff\",\n\t\tbezelShadeColor: isDarkTheme ? \"#000\" : \"rgba(0, 0, 0, 0.2)\",\n\t\tscreenColor: isDarkTheme ? \"#333\" : \"#eee\",\n\t}\n}\n\ninterface State {\n\tlastError?: {\n\t\tcomponentStack: string[] | undefined\n\t\terror: Error\n\t}\n}\n\nexport class ErrorBoundary extends Component<{ children?: React.ReactNode }, State> {\n\toverride state: State = {}\n\toverride componentDidCatch(error: Error, info: React.ErrorInfo) {\n\t\tlet stack = info.componentStack?.split(\"\\n\").filter(line => line.length !== 0)\n\t\tlet currentIndex = 0\n\t\tif (stack) {\n\t\t\tfor (const line of stack) {\n\t\t\t\tif (line.startsWith(`    in ${this.constructor.name}`)) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcurrentIndex++\n\t\t\t}\n\t\t\tstack = stack.slice(0, currentIndex)\n\t\t}\n\n\t\tthis.setState({\n\t\t\tlastError: {\n\t\t\t\terror,\n\t\t\t\tcomponentStack: stack,\n\t\t\t},\n\t\t})\n\t}\n\n\toverride componentDidUpdate(_: unknown, prevState: State) {\n\t\tif (this.state.lastError === undefined) return\n\t\t// If `state.lastError` didn't change since the last render it means\n\t\t// that the the component was rendered due to a parent render or\n\t\t// change of props. In both these cases we want to let the wrapped\n\t\t// component try to render itself again and possibly fix the error,\n\t\t// so we clear `state.lastError`.\n\t\tif (prevState.lastError === this.state.lastError) this.setState({ lastError: undefined })\n\t}\n\toverride render() {\n\t\t// If there is an error caught by componentDidCatch, render an error\n\t\t// placeholder to prevent the error from being rethrown and crashing\n\t\t// the entire sandbox. Errors will be dismissed by\n\t\t// componentDidUpdate when the component ceases crashing as the\n\t\t// result of the file or props being updated.\n\t\tif (this.state.lastError) {\n\t\t\treturn <ErrorPlaceholder error={this.state.lastError.error.message} file=\"Prototype\" />\n\t\t}\n\n\t\treturn this.props.children\n\t}\n}\n\n/**\n * @internal\n */\nexport function Device({\n\tcanResize = false,\n\tchildren,\n\tResizeObserver = safeWindow.ResizeObserver,\n\t...options\n}: DeviceProps) {\n\t// Store options in a ref so that we can access the latest values without\n\t// invalidating our memoized resize observer callback.\n\tconst optionsRef = React.useRef<Partial<DeviceProps> | undefined>(undefined)\n\tif (optionsRef.current === undefined) optionsRef.current = options\n\n\tconst deviceAppearance = options.deviceOptions?.appearance.type\n\n\t// Scale data must be kept on a ref so that we can access it in\n\t// `invertScale` without updating state.\n\tconst scaleDataRef = React.useRef<ScaleData>()\n\tconst containerRef = React.useRef<HTMLDivElement | null>(null)\n\tconst deviceRef = React.useRef<HTMLDivElement>(null)\n\tconst screenRef = React.useRef<HTMLDivElement>(null)\n\n\tconst updateImperativeScale = React.useCallback(({ scale, screenScalePixelFix }: ScaleData) => {\n\t\tif (!scaleDataRef.current || !deviceRef.current || !screenRef.current) return\n\n\t\tdeviceRef.current.style.transform = `scale(${scale})`\n\t\tscreenRef.current.style.transform = `scale(${screenScalePixelFix})`\n\t}, [])\n\n\tif (scaleDataRef.current === undefined && options.deviceOptions && options.scaleTo && options.scaleTo !== \"dynamic\") {\n\t\tconst scale = (scaleDataRef.current = getScaleData(options.deviceOptions, options.scaleTo))\n\t\tupdateImperativeScale(scale)\n\t}\n\n\t// To ensure magic motion transitions in descendants of the Device are properly\n\t// transformed, we must communicate the scale applied to the device\n\t// component when performing calculations.\n\tconst invertScale = React.useCallback((point: Point) => {\n\t\tif (!scaleDataRef.current) return point\n\t\tconst { scale = 1 } = scaleDataRef.current\n\t\treturn { x: point.x / scale, y: point.y / scale }\n\t}, [])\n\n\tconst updateScale = React.useCallback(() => {\n\t\tconst { deviceOptions, scaleTo } = optionsRef.current ?? {}\n\t\tif (!deviceOptions || !scaleTo || scaleTo !== \"dynamic\" || !containerRef.current) return\n\t\tif (containerRef.current.offsetWidth === 0 || containerRef.current.offsetHeight === 0) return\n\n\t\tconst scaleData = (scaleDataRef.current = getScaleData(deviceOptions, {\n\t\t\twidth: containerRef.current.offsetWidth,\n\t\t\theight: containerRef.current.offsetHeight,\n\t\t}))\n\n\t\tupdateImperativeScale(scaleData)\n\t}, [updateImperativeScale])\n\n\t// Create an observer. The callback will be a noop if `scaleTo` is not set\n\t// to \"dynamic\".\n\tconst observer: ResizeObserver | undefined = useConstant(() => {\n\t\tif (!ResizeObserver) {\n\t\t\treturn\n\t\t}\n\t\treturn new ResizeObserver(() => updateScale())\n\t})\n\n\t// Keep the options ref up to date so that the an event from the observer,\n\t// and updateScale, always use the latest prop values.\n\tReact.useLayoutEffect(() => {\n\t\toptionsRef.current = {\n\t\t\tdeviceOptions: options.deviceOptions,\n\t\t\toverrideTheme: options.overrideTheme,\n\t\t\tscaleTo: options.scaleTo,\n\t\t}\n\t}, [options.deviceOptions, options.overrideTheme, options.scaleTo])\n\n\t// Before paint, calculate the scale and imperatively set it on the element\n\t// if `scaleTo` is \"dynamic\".\n\tReact.useLayoutEffect(() => {\n\t\tupdateScale()\n\t}, [updateScale])\n\n\t// After mount, connect the observer to the container. On unmount,\n\t// disconnect the observer.\n\tReact.useEffect(() => {\n\t\tif (!observer || !containerRef.current) return\n\n\t\tobserver.observe(containerRef.current)\n\n\t\treturn () => observer.disconnect()\n\t}, [])\n\n\tconst { containerStyle, handStyle, deviceStyle, deviceImageStyle, screenStyle } = getDeviceStyle(options)\n\tconst resizeStyles = canResize\n\t\t? {\n\t\t\t\tdisplay: \"flex\",\n\t\t\t\tjustifyContent: \"center\",\n\t\t\t\talignItems: \"center\",\n\t\t\t\theight: \"100%\",\n\t\t\t}\n\t\t: {}\n\n\tconst screenBackground = options.deviceOptions?.transparentBackground ? \"transparent\" : \"white\"\n\treturn (\n\t\t<div style={{ ...containerStyle, ...resizeStyles }} ref={containerRef}>\n\t\t\t<div style={{ ...deviceStyle }} ref={deviceRef}>\n\t\t\t\t{handStyle && <div style={handStyle} />}\n\t\t\t\t{deviceAppearance === \"external-clay\" && deviceImageStyle && <div style={deviceImageStyle} />}\n\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\t...screenStyle,\n\t\t\t\t\t\tpointerEvents: undefined,\n\t\t\t\t\t\tbackgroundColor: children ? screenBackground : screenStyle.backgroundColor,\n\t\t\t\t\t}}\n\t\t\t\t\tref={screenRef}\n\t\t\t\t>\n\t\t\t\t\t<MotionConfig transformPagePoint={invertScale}>\n\t\t\t\t\t\t<ErrorBoundary>{children}</ErrorBoundary>\n\t\t\t\t\t</MotionConfig>\n\t\t\t\t</div>\n\t\t\t\t{deviceAppearance === \"realistic\" && deviceImageStyle && <div style={deviceImageStyle} />}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\nconst DEVICE_PADDING = 45\n\nconst HAND_IMG_WIDTH = 2400\nconst HAND_IMG_HEIGHT = 3740\nconst HAND_IMG_GAP_WIDTH = 859\nconst HAND_IMG_GAP_LEFT = 772\n// 992 is the actual measurement, but we subtract some buffer, determined empirically\nconst HAND_IMG_GAP_BOTTOM = /* @__PURE__ */ (() => 992 - 5)()\n\nconst noDeviceSize = { componentWidth: 500, componentHeight: 500 }\n/**\n * @internal\n */\nexport function getComponentSize(options?: Pick<DeviceOptions, \"deviceWidth\" | \"deviceHeight\" | \"noPadding\">): {\n\tcomponentWidth: number\n\tcomponentHeight: number\n} {\n\tif (!options) return noDeviceSize\n\tconst { deviceWidth, deviceHeight, noPadding } = options\n\tconst padding = noPadding ? 0 : DEVICE_PADDING * 2\n\treturn {\n\t\tcomponentWidth: deviceWidth + padding,\n\t\tcomponentHeight: deviceHeight + padding,\n\t}\n}\n\ninterface DeviceStyle {\n\tcontainerStyle: CSSProperties\n\thandStyle?: CSSProperties\n\tdeviceStyle: CSSProperties\n\tdeviceImageStyle?: CSSProperties\n\tscreenStyle: CSSProperties\n}\n\nfunction getDeviceStyle({ scaleTo, deviceOptions, overrideTheme }: Partial<DeviceProps> = {}): DeviceStyle {\n\tconst noDeviceStyle: DeviceStyle = { containerStyle: {}, deviceStyle: {}, screenStyle: {} }\n\tif (!deviceOptions) return noDeviceStyle\n\n\tconst { componentWidth, componentHeight } = getComponentSize(deviceOptions)\n\tconst overriddenColors = getColorsFromTheme(overrideTheme, deviceOptions.appearance.type)\n\tconst {\n\t\tdeviceWidth,\n\t\tdeviceHeight,\n\t\tappearance,\n\t\tscreenWidth,\n\t\tscreenHeight,\n\t\tscreenMaxHeight,\n\t\tscreenOffsetTop,\n\t\tscreenOffsetLeft,\n\t\tscreenRadius,\n\t\tscreenMaskImage,\n\t\tscreenColor,\n\t\tshadow,\n\t\tbackground,\n\t\thand,\n\t} = deviceOptions\n\n\tconst boxShadows: string[] = []\n\t// At this time, we only support shadow for clay devices.\n\tif (appearance.type === \"clay\" && shadow) {\n\t\tboxShadows.push(shadow)\n\t}\n\n\tlet bezelStyle: CSSProperties | undefined = undefined\n\tif (appearance.type === \"clay\") {\n\t\tbezelStyle = {\n\t\t\tborderRadius: appearance.bezelRadius,\n\t\t\tbackgroundColor: overriddenColors.bezelColor || appearance.bezelColor,\n\t\t}\n\t\tif (overriddenColors.bezelShadeColor || appearance.bezelShadeColor) {\n\t\t\tboxShadows.push(`inset 0 0 15px ${overriddenColors.bezelShadeColor || appearance.bezelShadeColor}`)\n\t\t}\n\t}\n\n\tconst handOffsetLeft = hand?.offsetLeft ?? 0\n\tconst handOffsetRight = hand?.offsetRight ?? 0\n\tconst handOffsetBottom = hand?.offsetBottom ?? 0\n\tconst handScale = (deviceWidth - handOffsetLeft - handOffsetRight) / HAND_IMG_GAP_WIDTH\n\n\treturn {\n\t\tcontainerStyle: {\n\t\t\twidth: scaleTo ? \"100%\" : componentWidth,\n\t\t\theight: scaleTo ? \"100%\" : componentHeight,\n\t\t\tflex: \"1 1 0\",\n\t\t\tdisplay: \"flex\",\n\t\t\talignItems: \"center\",\n\t\t\tjustifyContent: \"center\",\n\t\t\toverflow: \"hidden\",\n\t\t\tbackground,\n\t\t},\n\t\thandStyle: hand && {\n\t\t\twidth: HAND_IMG_WIDTH * handScale,\n\t\t\theight: HAND_IMG_HEIGHT * handScale,\n\t\t\tposition: \"absolute\",\n\t\t\tpointerEvents: \"none\",\n\t\t\tbackgroundImage: `url(\"${hand.imageUrl}\")`,\n\t\t\tbackgroundSize: \"contain\",\n\t\t\tbackgroundRepeat: \"no-repeat\",\n\t\t\tleft: -HAND_IMG_GAP_LEFT * handScale + handOffsetLeft,\n\t\t\tbottom: -HAND_IMG_GAP_BOTTOM * handScale + handOffsetBottom,\n\t\t},\n\t\tdeviceStyle: {\n\t\t\twidth: deviceWidth,\n\t\t\theight: deviceHeight,\n\t\t\tflexShrink: 0,\n\t\t\tposition: \"absolute\",\n\t\t\tboxShadow: boxShadows.join(\",\"),\n\t\t\t...bezelStyle,\n\t\t},\n\t\tdeviceImageStyle:\n\t\t\tappearance.type === \"realistic\" || appearance.type === \"external-clay\"\n\t\t\t\t? {\n\t\t\t\t\t\twidth: appearance.imageWidth,\n\t\t\t\t\t\theight: appearance.imageHeight,\n\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\tpointerEvents: \"none\",\n\t\t\t\t\t\toverflow: \"hidden\",\n\t\t\t\t\t\tbackgroundImage: `url(\"${appearance.imageUrl}\")`,\n\t\t\t\t\t\tbackgroundPosition: \"top left\",\n\t\t\t\t\t\tbackgroundRepeat: \"no-repeat\",\n\t\t\t\t\t\tbackgroundSize: `${appearance.imageWidth}px ${appearance.imageHeight}px`,\n\t\t\t\t\t\t// Rotate 90 degrees counter-clockwise around (0,0), then move the\n\t\t\t\t\t\t// result down into the viewport (rightmost transform is applied first).\n\t\t\t\t\t\ttransformOrigin: \"top left\",\n\t\t\t\t\t\ttransform: appearance.rotateImage ? `translateY(${appearance.imageWidth}px) rotate(-90deg)` : undefined,\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\tscreenStyle: {\n\t\t\twidth: screenWidth,\n\t\t\theight: screenHeight,\n\t\t\tmaxHeight: screenMaxHeight,\n\t\t\tposition: \"absolute\",\n\t\t\ttop: screenOffsetTop,\n\t\t\tleft: screenOffsetLeft,\n\t\t\tdisplay: \"flex\",\n\t\t\talignItems: \"center\",\n\t\t\tjustifyContent: \"center\",\n\t\t\toverflow: \"hidden\",\n\t\t\tborderRadius: screenRadius,\n\t\t\tbackgroundColor: overriddenColors.screenColor || screenColor,\n\t\t\t...(screenMaskImage && {\n\t\t\t\tmaskImage: screenMaskImage,\n\t\t\t\tWebkitMaskImage: screenMaskImage,\n\t\t\t\tmaskSize: \"contain\",\n\t\t\t\tWebkitMaskSize: \"contain\",\n\t\t\t}),\n\t\t},\n\t}\n}\n", "import { useRef } from \"react\"\n\n// Only init the constant once\nexport function useConstant<T>(init: () => T): T {\n\tconst ref = useRef<T | null>(null)\n\n\tif (ref.current === null) {\n\t\tref.current = init()\n\t}\n\n\treturn ref.current\n}\n", "import type React from \"react\"\n\nenum PlaceholderType {\n\tLoading,\n\tError,\n}\n\nconst baseStyle: React.CSSProperties = {\n\tbackground: undefined,\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\tjustifyContent: \"center\",\n\talignItems: \"center\",\n\tlineHeight: \"1.4em\",\n\ttextOverflow: \"ellipsis\",\n\toverflow: \"hidden\",\n\tminHeight: 0,\n\twidth: \"100%\",\n\theight: \"100%\",\n}\n\nconst errorStyle: React.CSSProperties = /* @__PURE__ */ (() => ({\n\t...baseStyle,\n\tborder: \"1px solid rgba(149, 149, 149, 0.15)\",\n\tborderRadius: 6,\n\tfontSize: \"12px\",\n\tbackgroundColor: \"rgba(149, 149, 149, 0.1)\",\n\tcolor: \"#a5a5a5\",\n}))()\n\nconst textStyle: React.CSSProperties = {\n\toverflow: \"hidden\",\n\twhiteSpace: \"nowrap\",\n\ttextOverflow: \"ellipsis\",\n\tmaxWidth: \"100%\",\n\tflexShrink: 0,\n\tpadding: `0 10px`,\n}\n\nconst titleStyle: React.CSSProperties = /* @__PURE__ */ (() => ({\n\t...textStyle,\n\t// TODO: Use Fresco tokens for this.\n\tfontWeight: 500,\n}))()\n\nconst messageStyle: React.CSSProperties = /* @__PURE__ */ (() => ({\n\t...textStyle,\n\twhiteSpace: \"pre\",\n\tmaxHeight: \"calc(50% - calc(20px * var(--framerInternalCanvas-canvasPlaceholderContentScaleFactor, 1)))\",\n\tWebkitMaskImage: \"linear-gradient(to bottom, black 80%, transparent 100%)\",\n}))()\n\n// This is a stripped down version of `RenderPlaceholder` from\n// `src/app/runtime/src/components/RenderPlaceholder.tsx`. We may want to keep\n// styles in sync.\n/** @internal */\nexport function ErrorPlaceholder(props: { error: unknown; file?: string }) {\n\tconst { error, file } = props\n\tconst title = file ? `Error in ${stripSlash(file)}` : \"Error\"\n\tconst message = error instanceof Error ? error.message : \"\" + error\n\n\treturn (\n\t\t<div style={errorStyle}>\n\t\t\t<div className=\"text\" style={titleStyle}>\n\t\t\t\t{title}\n\t\t\t</div>\n\t\t\t{message && (\n\t\t\t\t<div className=\"text\" style={messageStyle}>\n\t\t\t\t\t{message}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\nfunction stripSlash(title: string) {\n\tif (title.startsWith(\"./\")) {\n\t\treturn title.replace(\"./\", \"\")\n\t}\n\treturn title\n}\n", "import React from \"react\"\nimport { ParentSizeState, ProvideParentSize } from \"../../render/types/NewConstraints.tsx\"\nimport { ControlType } from \"../../render/types/PropertyControls.ts\"\nimport type { Size } from \"../../render/types/Size.ts\"\nimport { withLibraryCSS } from \"../../render/utils/injectComponentCSSRules.ts\"\nimport { addPropertyControls } from \"../../utils/addPropertyControls.ts\"\nimport { Device, getComponentSize } from \"./Device.tsx\"\nimport type { DeviceCodeComponentProps } from \"./DeviceCodeComponentProps.ts\"\nimport {\n\tcolorIdForTheme,\n\tconvertPropsToDeviceOptions,\n\tdefaultDeviceProps,\n\tsupportsHand,\n} from \"./DeviceCodeComponentProps.ts\"\nimport type { DevicePresetID } from \"./presets.ts\"\nimport { deviceCodeComponentPresetIds, devicePresets, getDevicePreset } from \"./presets.ts\"\nimport { usePrototypingMetaTags } from \"./usePrototypingMetaTags.ts\"\n\n// This is the \"code component\" part of the Device Component, i.e., the one that\n// we register with the component loader, and expose its props to the public as\n// property controls. Because of the latter, we need to be a bit more careful\n// about changing its props.\n//\n// Note that this module depends on the library, while the \"plain\" one doesn't.\n\n/**\n * @internal\n */\nconst DeviceCodeComponentInner: React.FunctionComponent<DeviceCodeComponentProps & Partial<Size>> =\n\t/* #__PURE__ */ withLibraryCSS(({ children, ...props }) => {\n\t\tusePrototypingMetaTags()\n\n\t\tconst deviceOptions = convertPropsToDeviceOptions(props, { forceOldClay: true })\n\n\t\tif (!deviceOptions) {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tdata-framer-component-type=\"DeviceComponent\"\n\t\t\t\t\tclassName=\"no-device\"\n\t\t\t\t\tstyle={{ width: \"100%\", height: \"100%\" }}\n\t\t\t\t>\n\t\t\t\t\t<ProvideParentSize parentSize={ParentSizeState.Disabled}>{children}</ProvideParentSize>\n\t\t\t\t</div>\n\t\t\t)\n\t\t}\n\n\t\tconst child = Array.isArray(children) ? children[0] : children\n\t\tconst resizedChild =\n\t\t\tchild && React.isValidElement(child)\n\t\t\t\t? React.cloneElement(child as React.ReactElement<Size>, {\n\t\t\t\t\t\twidth: deviceOptions.screenWidth,\n\t\t\t\t\t\theight: deviceOptions.screenHeight,\n\t\t\t\t\t})\n\t\t\t\t: null\n\n\t\treturn (\n\t\t\t<Device scaleTo=\"dynamic\" deviceOptions={deviceOptions}>\n\t\t\t\t{resizedChild}\n\t\t\t</Device>\n\t\t)\n\t})\n\nexport const DeviceCodeComponent = /* @__PURE__ */ (() => {\n\tconst { componentWidth: defaultWidth, componentHeight: defaultHeight } = getComponentSize(\n\t\tconvertPropsToDeviceOptions(defaultDeviceProps, { forceOldClay: true }),\n\t)\n\tDeviceCodeComponentInner.defaultProps = {\n\t\twidth: defaultWidth,\n\t\theight: defaultHeight,\n\t\t...defaultDeviceProps,\n\t}\n\n\tconst deviceCodeComponentPresets = devicePresets.filter(preset => deviceCodeComponentPresetIds.includes(preset.id))\n\n\taddPropertyControls(DeviceCodeComponentInner, {\n\t\tchildren: {\n\t\t\ttitle: \"Content\",\n\t\t\ttype: ControlType.Slot,\n\t\t\tmaxCount: 1,\n\t\t},\n\t\tpreset: {\n\t\t\ttype: ControlType.Enum,\n\t\t\toptions: [\"no-device\", \"custom\"].concat(deviceCodeComponentPresets.map(preset => preset.id)),\n\t\t\toptionTitles: [\"No Device\", \"Custom\"].concat(deviceCodeComponentPresets.map(preset => preset.title)),\n\t\t},\n\t\tcustomWidth: {\n\t\t\ttitle: \"Width\",\n\t\t\ttype: ControlType.Number,\n\t\t\tmin: 0,\n\t\t\tdisplayStepper: true,\n\t\t\thidden: props => props.preset !== \"custom\",\n\t\t},\n\t\tcustomHeight: {\n\t\t\ttitle: \"Height\",\n\t\t\ttype: ControlType.Number,\n\t\t\tmin: 0,\n\t\t\tdisplayStepper: true,\n\t\t\thidden: props => props.preset !== \"custom\",\n\t\t},\n\t\tcustomBezel: {\n\t\t\ttitle: \"Bezel\",\n\t\t\ttype: ControlType.FusedNumber,\n\t\t\tmin: 0,\n\t\t\ttoggleKey: \"isMixedBezel\",\n\t\t\ttoggleTitles: [\"a\", \"b\"],\n\t\t\tvalueKeys: [\"bezelTop\", \"bezelRight\", \"bezelBottom\", \"bezelLeft\"],\n\t\t\tvalueLabels: [\"T\", \"R\", \"B\", \"L\"],\n\t\t\thidden: props => props.preset !== \"custom\",\n\t\t},\n\t\tcustomBezelRadius: {\n\t\t\ttitle: \"Bezel Radius\",\n\t\t\ttype: ControlType.Number,\n\t\t\tmin: 0,\n\t\t\tdisplayStepper: true,\n\t\t\thidden: props => props.preset !== \"custom\",\n\t\t},\n\t\tcustomScreenRadius: {\n\t\t\ttitle: \"Screen Radius\",\n\t\t\ttype: ControlType.Number,\n\t\t\tmin: 0,\n\t\t\tdisplayStepper: true,\n\t\t\thidden: props => props.preset !== \"custom\",\n\t\t},\n\t\torientation: {\n\t\t\ttype: ControlType.Enum,\n\t\t\tdisplaySegmentedControl: true,\n\t\t\toptions: [\"portrait\", \"landscape\"],\n\t\t\toptionTitles: [\"Portrait\", \"Landscape\"],\n\t\t\toptionIcons: [\"orientation-portrait\", \"orientation-landscape\"],\n\t\t\thidden: props => !!props.preset && !supportsOrientation(props.preset),\n\t\t},\n\t\tskin: {\n\t\t\ttitle: \"Device\",\n\t\t\ttype: ControlType.Enum,\n\t\t\tdisplaySegmentedControl: true,\n\t\t\toptions: [\"realistic\", \"clay\"],\n\t\t\toptionTitles: [\"Realistic\", \"Clay\"],\n\t\t\tdefaultValue: \"clay\",\n\t\t\thidden: props => !!props.preset && !supportsRealisticSkin(props.preset),\n\t\t},\n\t\ttheme: {\n\t\t\ttype: ControlType.Enum,\n\t\t\tdisplaySegmentedControl: true,\n\t\t\toptions: [\"light\", \"dark\"],\n\t\t\toptionTitles: [\"Light\", \"Dark\"],\n\t\t\thidden: props => !!props.preset && !supportsThemes(props.preset, props.skin),\n\t\t},\n\t\tshadow: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tenabledTitle: \"On\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\thidden: ({ skin, preset }) => (preset !== \"custom\" && skin === \"realistic\") || preset === \"no-device\",\n\t\t},\n\t\thand: {\n\t\t\ttype: ControlType.Enum,\n\t\t\toptions: [null, \"hand-1\", \"hand-2\"],\n\t\t\toptionTitles: [\"None\", \"Model 1\", \"Model 2\"],\n\t\t\thidden: props => !supportsHand(props),\n\t\t},\n\t\tbackgroundColor: {\n\t\t\ttype: ControlType.Color,\n\t\t\ttitle: \"Background\",\n\t\t\toptional: true,\n\t\t\thidden: ({ preset }) => preset === \"no-device\",\n\t\t},\n\t})\n\n\treturn DeviceCodeComponentInner\n})()\n\nfunction supportsOrientation(presetId: DevicePresetID | \"custom\" | \"no-device\"): boolean {\n\tif (presetId === \"no-device\") return false\n\tif (presetId === \"custom\") return true\n\n\tconst preset = getDevicePreset(presetId)\n\treturn !preset.disableRotation\n}\n\nfunction supportsRealisticSkin(presetId: DevicePresetID | \"custom\" | \"no-device\"): boolean {\n\tif (presetId === \"custom\" || presetId === \"no-device\") return false\n\n\tconst preset = getDevicePreset(presetId)\n\treturn !!preset.realisticImage\n}\n\nfunction supportsThemes(\n\tpresetId: DevicePresetID | \"custom\" | \"no-device\",\n\tskin: \"realistic\" | \"clay\" | undefined,\n): boolean {\n\tif (presetId === \"no-device\") return false\n\tif (presetId === \"custom\" || skin !== \"realistic\") return true\n\n\tconst preset = getDevicePreset(presetId)\n\tconst realisticImage = preset.realisticImage\n\tif (realisticImage === undefined) {\n\t\t// Note: if there's no realistic image, Device Component will fall back to\n\t\t// the clay appearance, which supports themes.\n\t\treturn true\n\t}\n\tif (colorIdForTheme(\"dark\", realisticImage.availableColors) !== undefined) {\n\t\t// We assume here that every \"dark\" theme also supports a light theme (which is currently the case)\n\t\treturn true\n\t}\n\treturn false\n}\n", "import type { MotionValue } from \"framer-motion\"\nimport React from \"react\"\nimport { isFiniteNumber } from \"../utils/isFiniteNumber.ts\"\nimport type { SizeConstraints, UserConstraintValues } from \"./Constraints.ts\"\nimport { ConstraintMask, ConstraintValues, DimensionType, valueToDimensionType } from \"./Constraints.ts\"\nimport type { Rect } from \"./Rect.ts\"\nimport type { Size } from \"./Size.ts\"\n\n// Constraint system that can switch between DOM and Constraint layout\n\nexport interface PositionProperties {\n\ttop: number | string\n\tright: number | string\n\tbottom: number | string\n\tleft: number | string\n\tcenter: \"x\" | \"y\" | boolean\n}\n\n/** @internal */\nexport interface SizeProperties extends SizeConstraints {\n\twidth: number | string\n\theight: number | string\n\tsize: number | string\n}\n\n/** @public */\nexport interface PositionStickyProperties {\n\t/** @internal */\n\tpositionSticky?: boolean\n\t/** @internal */\n\tpositionStickyTop?: number\n\t/** @internal */\n\tpositionStickyRight?: number\n\t/** @internal */\n\tpositionStickyBottom?: number\n\t/** @internal */\n\tpositionStickyLeft?: number\n}\n\nexport interface PositionFixedProperties {\n\t/** @internal */\n\tpositionFixed?: boolean\n}\n\nexport interface PositionAbsoluteProperties {\n\t/** @internal */\n\tpositionAbsolute?: boolean\n}\n\nexport interface LayoutProperties\n\textends\n\t\tPositionProperties,\n\t\tPositionStickyProperties,\n\t\tPositionFixedProperties,\n\t\tPositionAbsoluteProperties,\n\t\tSizeProperties {\n\t/** @internal */\n\twidthType?: DimensionType\n\t/** @internal */\n\theightType?: DimensionType\n}\n\nexport interface CustomConstraintProperties {\n\t/**\n\t * Aspect Ratio to keep when resizing\n\t * @public\n\t */\n\taspectRatio?: number | null\n\n\t/**\n\t * Used for Text and Graphics containers\n\t * @public\n\t */\n\tautoSize?: boolean\n\n\t/**\n\t * Use Vekter constraint layout system, disable DOM layout\n\t * @public\n\t */\n\tenabled: boolean\n\n\tintrinsicWidth?: number\n\tintrinsicHeight?: number\n}\n\nexport interface ConstraintConfiguration {\n\t/** @internal */\n\t_constraints: CustomConstraintProperties\n}\n\n/** @internal */\nexport interface NewConstraintProperties extends Partial<LayoutProperties>, ConstraintConfiguration {}\n\n// The old constraint system does not allow for strings, so this function checks if the layout props contain string values\n// In certain centering cases we can convert the strings to the old constraint system, so that logic is captured here\nfunction containsInvalidStringValues(props: Partial<NewConstraintProperties>): boolean {\n\t// We never allow right or bottom to be strings\n\tif (typeof props.right === \"string\") return true\n\tif (typeof props.bottom === \"string\") return true\n\n\t// Only allow a string for left, if it is part of the centering logic\n\tif (typeof props.left === \"string\" && (!props.center || props.center === \"y\")) {\n\t\t// We are not centering or only centering in the opposite direction\n\t\treturn true\n\t}\n\n\t// Only allow a string for top, if it is part of the centering logic\n\tif (typeof props.top === \"string\" && (!props.center || props.center === \"x\")) {\n\t\t// We are not centering or only centering in the opposite direction\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/** @internal */\nexport function constraintsEnabled(props: Partial<NewConstraintProperties>): props is NewConstraintProperties {\n\tif (!props._constraints) return false\n\tif (containsInvalidStringValues(props)) return false\n\treturn props._constraints.enabled\n}\n\nfunction sizeFromFiniteNumberProps(props: Partial<NewConstraintProperties>): Size | null {\n\tconst { size } = props\n\tlet { width, height } = props\n\tif (isFiniteNumber(size)) {\n\t\tif (width === undefined) {\n\t\t\twidth = size\n\t\t}\n\t\tif (height === undefined) {\n\t\t\theight = size\n\t\t}\n\t}\n\tif (isFiniteNumber(width) && isFiniteNumber(height)) {\n\t\treturn {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t}\n\t}\n\treturn null\n}\n\nfunction rectFromFiniteNumberProps(props: Partial<NewConstraintProperties>): Rect | null {\n\tconst size = sizeFromFiniteNumberProps(props)\n\tif (size === null) {\n\t\treturn null\n\t}\n\tconst { left, top } = props\n\tif (isFiniteNumber(left) && isFiniteNumber(top)) {\n\t\treturn {\n\t\t\tx: left,\n\t\t\ty: top,\n\t\t\t...size,\n\t\t}\n\t}\n\treturn null\n}\n\n/** @internal */\nexport function calculateRect(\n\tprops: Partial<NewConstraintProperties & Partial<{ size: number | string }>>,\n\tparentSize: ParentSize,\n\tpixelAlign: boolean = true,\n): Rect | null {\n\tif (props.positionFixed || props.positionAbsolute) return null\n\n\tconst parentSizeDisabled =\n\t\tparentSize === ParentSizeState.Disabled || parentSize === ParentSizeState.DisabledForCurrentLevel\n\n\tif (!constraintsEnabled(props) || parentSizeDisabled) {\n\t\treturn rectFromFiniteNumberProps(props)\n\t}\n\n\tconst constraintValues = getConstraintValues(props)\n\tconst enabledParentSize = deprecatedParentSize(parentSize)\n\t// We convert viewport sizing to fixed sizing when rendering with library components, so parentSizeForSizing and\n\t// parentSizeForPositioning are the same. Same for viewport, we convert vh min/max to fixed values when rendering\n\t// with library components.\n\tconst parentSizeInfo = enabledParentSize\n\t\t? { sizing: enabledParentSize, positioning: enabledParentSize, viewport: null }\n\t\t: null\n\treturn ConstraintValues.toRect(constraintValues, parentSizeInfo, null, pixelAlign, null)\n}\n\n/** @internal */\nexport function getConstraintValues(props: NewConstraintProperties): UserConstraintValues {\n\tconst { left, right, top, bottom, center, _constraints, size } = props\n\tlet { width, height } = props\n\tif (width === undefined) {\n\t\twidth = size\n\t}\n\tif (height === undefined) {\n\t\theight = size\n\t}\n\tconst { aspectRatio, autoSize } = _constraints\n\tconst constraintMask = ConstraintMask.quickfix({\n\t\tleft: isFiniteNumber(left),\n\t\tright: isFiniteNumber(right),\n\t\ttop: isFiniteNumber(top),\n\t\tbottom: isFiniteNumber(bottom),\n\t\twidthType: valueToDimensionType(width),\n\t\theightType: valueToDimensionType(height),\n\t\taspectRatio: aspectRatio || null,\n\t\tfixedSize: autoSize === true,\n\t})\n\n\tlet widthValue: number | null = null\n\tlet heightValue: number | null = null\n\n\tlet widthType = DimensionType.FixedNumber\n\tlet heightType = DimensionType.FixedNumber\n\n\tif (constraintMask.widthType !== DimensionType.FixedNumber && typeof width === \"string\") {\n\t\tconst parsedWidth = parseFloat(width)\n\n\t\tif (width.endsWith(\"fr\")) {\n\t\t\twidthType = DimensionType.FractionOfFreeSpace\n\t\t\twidthValue = parsedWidth\n\t\t} else if (width === \"auto\") {\n\t\t\twidthType = DimensionType.Auto\n\t\t} else {\n\t\t\t// Percentage\n\t\t\twidthType = DimensionType.Percentage\n\t\t\twidthValue = parsedWidth / 100\n\t\t}\n\t} else if (width !== undefined && typeof width !== \"string\") {\n\t\twidthValue = width\n\t}\n\n\tif (constraintMask.heightType !== DimensionType.FixedNumber && typeof height === \"string\") {\n\t\tconst parsedHeight = parseFloat(height)\n\n\t\tif (height.endsWith(\"fr\")) {\n\t\t\theightType = DimensionType.FractionOfFreeSpace\n\t\t\theightValue = parsedHeight\n\t\t} else if (height === \"auto\") {\n\t\t\theightType = DimensionType.Auto\n\t\t} else {\n\t\t\t// Percentage\n\t\t\theightType = DimensionType.Percentage\n\t\t\theightValue = parseFloat(height) / 100\n\t\t}\n\t} else if (height !== undefined && typeof height !== \"string\") {\n\t\theightValue = height\n\t}\n\n\tlet centerAnchorX = 0.5\n\tlet centerAnchorY = 0.5\n\t// XXX: is this\n\tif (center === true || center === \"x\") {\n\t\tconstraintMask.left = false\n\t\tif (typeof left === \"string\") {\n\t\t\tcenterAnchorX = parseFloat(left) / 100\n\t\t}\n\t}\n\tif (center === true || center === \"y\") {\n\t\tconstraintMask.top = false\n\t\tif (typeof top === \"string\") {\n\t\t\tcenterAnchorY = parseFloat(top) / 100\n\t\t}\n\t}\n\n\treturn {\n\t\t// Because we check isFiniteNumber when creating the masks,\n\t\t// We know that left, right, top and bottom are numbers if the mask is true for the corresponding value\n\t\t// We need to cast this because typescript does not understand that\n\t\tleft: constraintMask.left ? (left as number) : null,\n\t\tright: constraintMask.right ? (right as number) : null,\n\t\ttop: constraintMask.top ? (top as number) : null,\n\t\tbottom: constraintMask.bottom ? (bottom as number) : null,\n\t\twidthType,\n\t\theightType,\n\t\twidth: widthValue,\n\t\theight: heightValue,\n\t\taspectRatio: constraintMask.aspectRatio || null,\n\t\tcenterAnchorX: centerAnchorX,\n\t\tcenterAnchorY: centerAnchorY,\n\t\tminHeight: props.minHeight,\n\t\tmaxHeight: props.maxHeight,\n\t\tminWidth: props.minWidth,\n\t\tmaxWidth: props.maxWidth,\n\t}\n}\n\nexport enum ParentSizeState {\n\tUnknown, // There is no known ParentSize\n\tDisabled, // ParentSize should not be used for layout in the entire subtree\n\tDisabledForCurrentLevel, // ParentSize should not be used for layout in the current level of the hierarchy\n}\nexport type ParentSize = Size | ParentSizeState\n\n// Only exported for use in class components, otherwise use one of the hooks below\nexport const ConstraintsContext = /* @__PURE__ */ React.createContext<{\n\tparentSize: ParentSize\n}>({\n\tparentSize: ParentSizeState.Unknown,\n})\n\nexport function deprecatedParentSize(parentSize: ParentSize): Size | null {\n\tif (\n\t\tparentSize === ParentSizeState.Unknown ||\n\t\tparentSize === ParentSizeState.Disabled ||\n\t\tparentSize === ParentSizeState.DisabledForCurrentLevel\n\t) {\n\t\treturn null\n\t}\n\treturn parentSize\n}\n\n/** @internal */\nexport function useParentSize(): ParentSize {\n\treturn React.useContext(ConstraintsContext).parentSize\n}\n\nexport function isSize(o: ParentSize): o is Size {\n\treturn typeof o === \"object\"\n}\n\n/** @internal */\nexport const ProvideParentSize: React.FunctionComponent<{\n\tchildren?: React.ReactNode\n\tparentSize: ParentSize\n}> = props => {\n\tconst currentParentSize = useParentSize()\n\tconst { parentSize, children } = props\n\n\t// We are generating the memoKeys in runtime and react doesn't like it,\n\t// but it should be safe to ignore.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: see above\n\tconst value = React.useMemo(\n\t\t() => ({ parentSize }),\n\n\t\t[getParentWidth(parentSize), getParentHeight(parentSize)],\n\t)\n\n\tif (currentParentSize === ParentSizeState.Disabled) {\n\t\treturn children ? <>{children}</> : null\n\t}\n\n\treturn <ConstraintsContext.Provider value={value}>{children}</ConstraintsContext.Provider>\n}\n\nfunction getParentWidth(parentSize: ParentSize): ParentSizeState | number {\n\treturn isSize(parentSize) ? parentSize.width : parentSize\n}\n\nfunction getParentHeight(parentSize: ParentSize): ParentSizeState | number {\n\treturn isSize(parentSize) ? parentSize.height : parentSize\n}\n\nexport const ConsumeParentSize = /* @__PURE__ */ (() => ConstraintsContext.Consumer)()\n\nexport function useProvideParentSize(node: React.ReactNode, parentSize: ParentSize): React.ReactNode {\n\treturn <ProvideParentSize parentSize={parentSize}>{node}</ProvideParentSize>\n}\n\nexport function useConstraints(props: Partial<NewConstraintProperties>): Rect | null {\n\tconst parentSize = useParentSize()\n\tconst calculatedRect = calculateRect(props, parentSize, true)\n\treturn calculatedRect\n}\n\nexport function isAutoSized({\n\twidth,\n\theight,\n}: {\n\twidth?: string | number | MotionValue\n\theight?: string | number | MotionValue\n}) {\n\treturn width === \"auto\" || width === \"min-content\" || height === \"auto\" || height === \"min-content\"\n}\n", "/** @internal */\nexport function isFiniteNumber(value: any): value is number {\n\treturn Number.isFinite(value)\n}\n\n/** @internal */\nexport function finiteNumber(value: any): number | undefined {\n\treturn isFiniteNumber(value) ? value : undefined\n}\n", "import type React from \"react\"\n\nexport type ReactElementType = string | React.JSXElementConstructor<any>\n\nfunction isEmpty(obj: any): boolean {\n\treturn !obj || (!Object.keys(obj).length && obj.constructor === Object)\n}\n\nexport function isReactElement<P, T extends ReactElementType = ReactElementType>(\n\ttest: React.ReactChild,\n): test is React.ReactElement<P, T> {\n\treturn typeof test !== \"string\" && typeof test !== \"number\"\n}\n\nexport function isReactChild(test: React.ReactNode): test is React.ReactChild {\n\treturn test !== null && typeof test !== \"undefined\" && typeof test !== \"boolean\" && !isEmpty(test)\n}\n", "/** @internal */\nexport function degreesToRadians(degrees: number): number {\n\treturn degrees * (Math.PI / 180)\n}\n", "import { degreesToRadians } from \"../utils/degreesToRadians.ts\"\nimport { Point } from \"./Point.ts\"\n\n/**\n * @internal\n */\nexport interface Line {\n\ta: Point\n\tb: Point\n}\n\n/**\n * @internal\n */\nexport const Line = /* @__PURE__ */ (() => {\n\t/**\n\t * @internal\n\t */\n\tfunction Line(a: Point, b: Point): Line {\n\t\treturn { a, b }\n\t}\n\n\tLine.offset = (line: Line, offset: number) => {\n\t\tconst angle = Point.angleFromX(line.a, line.b)\n\t\tconst rad = degreesToRadians(angle)\n\t\tconst x = offset * Math.sin(rad)\n\t\tconst y = offset * Math.cos(rad)\n\t\treturn Line(\n\t\t\t{ x: line.a.x + x, y: line.a.y - y },\n\t\t\t{\n\t\t\t\tx: line.b.x + x,\n\t\t\t\ty: line.b.y - y,\n\t\t\t},\n\t\t)\n\t}\n\n\tLine.intersection = (lineA: Line, lineB: Line, segments?: boolean): Point | null => {\n\t\tconst x1 = lineA.a.x\n\t\tconst y1 = lineA.a.y\n\t\tconst x2 = lineA.b.x\n\t\tconst y2 = lineA.b.y\n\t\tconst x3 = lineB.a.x\n\t\tconst y3 = lineB.a.y\n\t\tconst x4 = lineB.b.x\n\t\tconst y4 = lineB.b.y\n\n\t\tconst a1 = (x4 - x3) * (y3 - y1) - (y4 - y3) * (x3 - x1)\n\t\tconst b1 = (x4 - x3) * (y2 - y1) - (y4 - y3) * (x2 - x1)\n\t\tconst c1 = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)\n\n\t\t// Line segments are colinear\n\t\tif (a1 === 0 && b1 === 0) return null\n\t\t// Lines are parallel and non-intersecting.\n\t\tif (b1 === 0) return null\n\n\t\tconst alpha = a1 / b1\n\t\tconst beta = c1 / b1\n\n\t\t// If we are testing line segments (lines that are not extended\n\t\t// infinitely), return null if the line segments are not parallel but don't intersect.\n\t\tif (segments && (alpha < 0 || alpha > 1 || beta < 0 || beta > 1)) return null\n\n\t\treturn {\n\t\t\tx: x1 + alpha * (x2 - x1),\n\t\t\ty: y1 + alpha * (y2 - y1),\n\t\t}\n\t}\n\n\tLine.intersectionAngle = (lineA: Line, lineB: Line): number => {\n\t\tconst deltaAX = lineA.b.x - lineA.a.x\n\t\tconst deltaAY = lineA.b.y - lineA.a.y\n\t\tconst deltaBX = lineB.b.x - lineB.a.x\n\t\tconst deltaBY = lineB.b.y - lineB.a.y\n\t\tconst angle = Math.atan2(deltaAX * deltaBY - deltaAY * deltaBX, deltaAX * deltaBX + deltaAY * deltaBY)\n\t\treturn angle * (180 / Math.PI)\n\t}\n\n\tLine.isOrthogonal = (line: Line) => {\n\t\treturn line.a.x === line.b.x || line.a.y === line.b.y\n\t}\n\n\tLine.perpendicular = (line: Line, pointOnLine: Point) => {\n\t\tconst deltaX = line.a.x - line.b.x\n\t\tconst deltaY = line.a.y - line.b.y\n\t\tconst pointB = Point(pointOnLine.x - deltaY, pointOnLine.y + deltaX)\n\t\treturn Line(pointB, pointOnLine)\n\t}\n\n\tLine.projectPoint = (line: Line, point: Point) => {\n\t\tconst perp = Line.perpendicular(line, point)\n\t\treturn Line.intersection(line, perp)\n\t}\n\n\tLine.pointAtPercentDistance = (line: Line, distance: number): Point => {\n\t\tconst hypotenuse = Line.distance(line)\n\t\tconst r = (distance * hypotenuse) / hypotenuse\n\n\t\treturn {\n\t\t\tx: r * line.b.x + (1 - r) * line.a.x,\n\t\t\ty: r * line.b.y + (1 - r) * line.a.y,\n\t\t}\n\t}\n\n\tLine.distance = (line: Line): number => {\n\t\treturn Point.distance(line.a, line.b)\n\t}\n\n\treturn Line\n})()\n", "import { assert, assertNever } from \"../../utils/assert.ts\"\nimport { roundedNumber } from \"../utils/roundedNumber.ts\"\nimport { Line } from \"./Line.ts\"\nimport { Point } from \"./Point.ts\"\nimport type { Size } from \"./Size.ts\"\n\n/**\n * @public\n */\nexport interface Rect extends Point, Size {}\n\n/**\n * @public\n */\nexport const Rect = {\n\t/**\n\t *\n\t * @param rect -\n\t * @param other -\n\t * @returns if the input rectangles are equal in size and position\n\t * @public\n\t */\n\tequals: function (rect: Rect | null, other: Rect | null): boolean {\n\t\tif (rect === other) return true\n\t\tif (!rect || !other) return false\n\t\treturn rect.x === other.x && rect.y === other.y && rect.width === other.width && rect.height === other.height\n\t},\n\n\t/** @internal */\n\tfrom: (rect: Rect): Rect => {\n\t\treturn {\n\t\t\tx: rect.x,\n\t\t\ty: rect.y,\n\t\t\twidth: rect.width,\n\t\t\theight: rect.height,\n\t\t}\n\t},\n\n\t/** @internal */\n\tatOrigin: (size: Size): Rect => {\n\t\treturn {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\twidth: size.width,\n\t\t\theight: size.height,\n\t\t}\n\t},\n\n\t/** @internal */\n\tfromTwoPoints: (a: Point, b: Point): Rect => {\n\t\treturn {\n\t\t\tx: Math.min(a.x, b.x),\n\t\t\ty: Math.min(a.y, b.y),\n\t\t\twidth: Math.abs(a.x - b.x),\n\t\t\theight: Math.abs(a.y - b.y),\n\t\t}\n\t},\n\n\t/** @internal */\n\tfromRect: (rect: ClientRect): Rect => {\n\t\treturn {\n\t\t\tx: rect.left,\n\t\t\ty: rect.top,\n\t\t\twidth: rect.right - rect.left,\n\t\t\theight: rect.bottom - rect.top,\n\t\t}\n\t},\n\n\t/** @internal */\n\tmultiply: (rect: Rect, n: number): Rect => {\n\t\treturn {\n\t\t\tx: rect.x * n,\n\t\t\ty: rect.y * n,\n\t\t\twidth: rect.width * n,\n\t\t\theight: rect.height * n,\n\t\t}\n\t},\n\n\t/** @internal */\n\tdivide: (rect: Rect, n: number): Rect => {\n\t\treturn Rect.multiply(rect, 1 / n)\n\t},\n\n\t/** @internal */\n\toffset: (rect: Rect, delta: Partial<Point>): Rect => {\n\t\tconst xOffset = typeof delta.x === \"number\" ? delta.x : 0\n\t\tconst yOffset = typeof delta.y === \"number\" ? delta.y : 0\n\t\treturn {\n\t\t\t...rect,\n\t\t\tx: rect.x + xOffset,\n\t\t\ty: rect.y + yOffset,\n\t\t}\n\t},\n\n\t/** @internal */\n\tinflate: (rect: Rect, value: number) => {\n\t\tif (value === 0) return rect\n\t\tconst doubleValue = 2 * value\n\t\treturn {\n\t\t\tx: rect.x - value,\n\t\t\ty: rect.y - value,\n\t\t\twidth: rect.width + doubleValue,\n\t\t\theight: rect.height + doubleValue,\n\t\t}\n\t},\n\n\t/** @internal */\n\tpixelAligned: (rect: Rect): Rect => {\n\t\tconst x = Math.round(rect.x)\n\t\tconst y = Math.round(rect.y)\n\t\tconst rectMaxX = Math.round(rect.x + rect.width)\n\t\tconst rectMaxY = Math.round(rect.y + rect.height)\n\t\tconst width = Math.max(rectMaxX - x, 0)\n\t\tconst height = Math.max(rectMaxY - y, 0)\n\t\treturn { x, y, width, height }\n\t},\n\n\t/** @internal */\n\thalfPixelAligned: (rect: Rect): Rect => {\n\t\tconst x = Math.round(rect.x * 2) / 2\n\t\tconst y = Math.round(rect.y * 2) / 2\n\t\tconst rectMaxX = Math.round((rect.x + rect.width) * 2) / 2\n\t\tconst rectMaxY = Math.round((rect.y + rect.height) * 2) / 2\n\t\tconst width = Math.max(rectMaxX - x, 1)\n\t\tconst height = Math.max(rectMaxY - y, 1)\n\t\treturn { x, y, width, height }\n\t},\n\n\t/** @internal */\n\tround: (rect: Rect, decimals = 0): Rect => {\n\t\tconst x = roundedNumber(rect.x, decimals)\n\t\tconst y = roundedNumber(rect.y, decimals)\n\t\tconst width = roundedNumber(rect.width, decimals)\n\t\tconst height = roundedNumber(rect.height, decimals)\n\t\treturn { x, y, width, height }\n\t},\n\n\t/** @internal */\n\troundToOutside: (rect: Rect): Rect => {\n\t\tconst x = Math.floor(rect.x)\n\t\tconst y = Math.floor(rect.y)\n\t\tconst rectMaxX = Math.ceil(rect.x + rect.width)\n\t\tconst rectMaxY = Math.ceil(rect.y + rect.height)\n\t\tconst width = Math.max(rectMaxX - x, 0)\n\t\tconst height = Math.max(rectMaxY - y, 0)\n\t\treturn { x, y, width, height }\n\t},\n\n\t/**\n\t * @param rect -\n\t * @internal\n\t */\n\tminX: (rect: Rect) => {\n\t\treturn rect.x\n\t},\n\n\t/**\n\t * @param rect -\n\t * @internal\n\t */\n\tmaxX: (rect: Rect) => {\n\t\treturn rect.x + rect.width\n\t},\n\n\t/**\n\t * @param rect -\n\t * @internal\n\t */\n\tminY: (rect: Rect) => {\n\t\treturn rect.y\n\t},\n\n\t/**\n\t * @param rect -\n\t * @internal\n\t */\n\tmaxY: (rect: Rect) => {\n\t\treturn rect.y + rect.height\n\t},\n\n\t/** @internal */\n\tpositions: (rect: Rect) => {\n\t\treturn {\n\t\t\tminX: rect.x,\n\t\t\tmidX: rect.x + rect.width / 2,\n\t\t\tmaxX: Rect.maxX(rect),\n\t\t\tminY: rect.y,\n\t\t\tmidY: rect.y + rect.height / 2,\n\t\t\tmaxY: Rect.maxY(rect),\n\t\t}\n\t},\n\n\t/**\n\t *\n\t * @param rect -\n\t * @internal\n\t */\n\tcenter: (rect: Rect) => {\n\t\treturn {\n\t\t\tx: rect.x + rect.width / 2,\n\t\t\ty: rect.y + rect.height / 2,\n\t\t}\n\t},\n\n\t/** @internal */\n\tboundingRectFromPoints: (points: Point[]) => {\n\t\tlet minX = Infinity\n\t\tlet maxX = -Infinity\n\t\tlet minY = Infinity\n\t\tlet maxY = -Infinity\n\n\t\tfor (let i = 0; i < points.length; i++) {\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: Performance.\n\t\t\tconst point = points[i]!\n\n\t\t\tminX = Math.min(minX, point.x)\n\t\t\tmaxX = Math.max(maxX, point.x)\n\n\t\t\tminY = Math.min(minY, point.y)\n\t\t\tmaxY = Math.max(maxY, point.y)\n\t\t}\n\n\t\treturn { x: minX, y: minY, width: maxX - minX, height: maxY - minY }\n\t},\n\n\t/**\n\t * Returns the precise box defined by the given points, starting from the top-left point. This produces the same\n\t * Rect as Rect.boundingRectFromPoints *only* when the rect described by the points is not rotated.\n\t *\n\t * @internal\n\t */\n\tfromPoints: (ps: [Point, Point, Point, Point]) => {\n\t\tconst [tl, tr, _, bl] = ps\n\t\tconst { x, y } = tl\n\t\tconst width = Point.distance(tl, tr)\n\t\tconst height = Point.distance(tl, bl)\n\t\treturn { x, y, width, height }\n\t},\n\n\t/**\n\t * Returns a rect containing all input rects\n\t * @param rect - a list of rectangles\n\t * @returns A rectangle that fits exactly around the input rects\n\t * @internal\n\t */\n\tmerge: (...rect: Rect[]): Rect => {\n\t\tconst min = {\n\t\t\tx: Math.min(...rect.map(Rect.minX)),\n\t\t\ty: Math.min(...rect.map(Rect.minY)),\n\t\t}\n\n\t\tconst max = {\n\t\t\tx: Math.max(...rect.map(Rect.maxX)),\n\t\t\ty: Math.max(...rect.map(Rect.maxY)),\n\t\t}\n\n\t\treturn Rect.fromTwoPoints(min, max)\n\t},\n\n\t/** @internal */\n\tintersection: (rect1: Rect, rect2: Rect): Rect => {\n\t\tconst x = Math.max(rect1.x, rect2.x)\n\t\tconst x2 = Math.min(rect1.x + rect1.width, rect2.x + rect2.width)\n\t\tconst y = Math.max(rect1.y, rect2.y)\n\t\tconst y2 = Math.min(rect1.y + rect1.height, rect2.y + rect2.height)\n\t\treturn { x, y, width: x2 - x, height: y2 - y }\n\t},\n\n\t/**\n\t * Returns all the corner points for a rect\n\t * @param rect -\n\t * @internal\n\t */\n\tpoints: (rect: Rect): [Point, Point, Point, Point] => {\n\t\treturn [\n\t\t\t{ x: Rect.minX(rect), y: Rect.minY(rect) },\n\t\t\t{ x: Rect.minX(rect), y: Rect.maxY(rect) },\n\t\t\t{ x: Rect.maxX(rect), y: Rect.minY(rect) },\n\t\t\t{ x: Rect.maxX(rect), y: Rect.maxY(rect) },\n\t\t]\n\t},\n\n\t/**\n\t * Returns all the corner points for a rect at the origin.\n\t * @internal\n\t */\n\tpointsAtOrigin: (rect: Pick<Rect, \"height\" | \"width\">): [Point, Point, Point, Point] => {\n\t\treturn [\n\t\t\t{ x: 0, y: 0 },\n\t\t\t{ x: rect.width, y: 0 },\n\t\t\t{ x: rect.width, y: rect.height },\n\t\t\t{ x: 0, y: rect.height },\n\t\t]\n\t},\n\n\t/** Takes a rect and transforms it by a matrix, resulting in the bounding rectangle of the\n\t * rotated and/or translated original.\n\t * @param rect - rectangle to transform\n\t * @param matrix - matrix to transform by\n\t * @returns The bounding rectangle of the rotated and/or translated rect.\n\t */\n\ttransform: (rect: Rect, matrix: DOMMatrixReadOnly): Rect => {\n\t\tconst { x: x1, y: y1 } = matrix.transformPoint({ x: rect.x, y: rect.y })\n\t\tconst { x: x2, y: y2 } = matrix.transformPoint({ x: rect.x + rect.width, y: rect.y })\n\t\tconst { x: x3, y: y3 } = matrix.transformPoint({ x: rect.x + rect.width, y: rect.y + rect.height })\n\t\tconst { x: x4, y: y4 } = matrix.transformPoint({ x: rect.x, y: rect.y + rect.height })\n\t\tconst x = Math.min(x1, x2, x3, x4)\n\t\tconst width = Math.max(x1, x2, x3, x4) - x\n\t\tconst y = Math.min(y1, y2, y3, y4)\n\t\tconst height = Math.max(y1, y2, y3, y4) - y\n\t\treturn { x, y, width, height }\n\t},\n\n\t/**\n\t * Checks if a rectangle contains a point\n\t * @param rect - The rectangle to check\n\t * @param point - The point to check\n\t * @returns true if the provided rectangle contains the provided point\n\t * @internal\n\t */\n\tcontainsPoint: (rect: Rect, point: Point) => {\n\t\tif (point.x < Rect.minX(rect)) {\n\t\t\treturn false\n\t\t}\n\t\tif (point.x > Rect.maxX(rect)) {\n\t\t\treturn false\n\t\t}\n\t\tif (point.y < Rect.minY(rect)) {\n\t\t\treturn false\n\t\t}\n\t\tif (point.y > Rect.maxY(rect)) {\n\t\t\treturn false\n\t\t}\n\t\tif (Number.isNaN(rect.x)) {\n\t\t\treturn false\n\t\t}\n\t\tif (Number.isNaN(rect.y)) {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t},\n\n\t/**\n\t * Returns wether a rect contains another rect entirely\n\t * @param rectA -\n\t * @param rectB -\n\t * @returns true if rectA contains rectB\n\t */\n\tcontainsRect: (rectA: Rect, rectB: Rect) => {\n\t\tfor (const point of Rect.points(rectB)) {\n\t\t\tif (!Rect.containsPoint(rectA, point)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\t},\n\n\t/** @internal */\n\ttoCSS: (rect: Rect) => {\n\t\treturn {\n\t\t\tdisplay: \"block\",\n\t\t\ttransform: `translate(${rect.x}px, ${rect.y}px)`,\n\t\t\twidth: `${rect.width}px`,\n\t\t\theight: `${rect.height}px`,\n\t\t}\n\t},\n\n\t/** @internal */\n\tinset: (rect: Rect, n: number) => {\n\t\treturn {\n\t\t\tx: rect.x + n,\n\t\t\ty: rect.y + n,\n\t\t\twidth: Math.max(0, rect.width - 2 * n),\n\t\t\theight: Math.max(0, rect.height - 2 * n),\n\t\t}\n\t},\n\n\t/** @internal */\n\tintersects: (rectA: Rect, rectB: Rect): boolean => {\n\t\treturn !(\n\t\t\trectB.x >= Rect.maxX(rectA) ||\n\t\t\tRect.maxX(rectB) <= rectA.x ||\n\t\t\trectB.y >= Rect.maxY(rectA) ||\n\t\t\tRect.maxY(rectB) <= rectA.y\n\t\t)\n\t},\n\n\t/** @internal */\n\toverlapHorizontally: (rectA: Rect, rectB: Rect): boolean => {\n\t\tconst aMax = Rect.maxX(rectA)\n\t\tconst bMax = Rect.maxX(rectB)\n\t\treturn aMax > rectB.x && bMax > rectA.x\n\t},\n\n\t/** @internal */\n\toverlapVertically: (rectA: Rect, rectB: Rect): boolean => {\n\t\tconst aMax = Rect.maxY(rectA)\n\t\tconst bMax = Rect.maxY(rectB)\n\t\treturn aMax > rectB.y && bMax > rectA.y\n\t},\n\n\t/** @internal */\n\tdoesNotIntersect: (rect: Rect, rects: Rect[]): boolean => {\n\t\treturn (\n\t\t\trects.find(comparingRect => {\n\t\t\t\treturn Rect.intersects(comparingRect, rect)\n\t\t\t}) === undefined\n\t\t)\n\t},\n\n\t/**\n\t *\n\t * @param rectA -\n\t * @param rectB -\n\t * @returns if the input rectangles are equal in size and position\n\t * @public\n\t * @deprecated: please use Rect.equals instead\n\t */\n\tisEqual: (rectA: Rect | null, rectB: Rect | null) => {\n\t\treturn Rect.equals(rectA, rectB)\n\t},\n\n\t// @TODO: duplicate of points()\n\t/**\n\t * @returns [tl, tr, br, bl]\n\t * @internal\n\t */\n\tcornerPoints: (rect: Rect): [Point, Point, Point, Point] => {\n\t\tconst rectMinX = rect.x\n\t\tconst rectMaxX = rect.x + rect.width\n\t\tconst rectMinY = rect.y\n\t\tconst rectMaxY = rect.y + rect.height\n\t\tconst corner1 = { x: rectMinX, y: rectMinY }\n\t\tconst corner2 = { x: rectMaxX, y: rectMinY }\n\t\tconst corner3 = { x: rectMaxX, y: rectMaxY }\n\t\tconst corner4 = { x: rectMinX, y: rectMaxY }\n\t\treturn [corner1, corner2, corner3, corner4]\n\t},\n\n\t/** @internal */\n\tmidPoints: (rect: Rect): [Point, Point, Point, Point] => {\n\t\tconst rectMinX = rect.x\n\t\tconst rectMidX = rect.x + rect.width / 2\n\t\tconst rectMaxX = rect.x + rect.width\n\t\tconst rectMinY = rect.y\n\t\tconst rectMidY = rect.y + rect.height / 2\n\t\tconst rectMaxY = rect.y + rect.height\n\t\tconst top = { x: rectMidX, y: rectMinY }\n\t\tconst right = { x: rectMaxX, y: rectMidY }\n\t\tconst bottom = { x: rectMidX, y: rectMaxY }\n\t\tconst left = { x: rectMinX, y: rectMidY }\n\t\treturn [top, right, bottom, left]\n\t},\n\n\t/** @internal */\n\tpointDistance: (rect: Rect, point: Point) => {\n\t\tlet x = 0\n\t\tlet y = 0\n\t\tif (point.x < rect.x) {\n\t\t\tx = rect.x - point.x\n\t\t} else if (point.x > Rect.maxX(rect)) {\n\t\t\tx = point.x - Rect.maxX(rect)\n\t\t}\n\t\tif (point.y < rect.y) {\n\t\t\ty = rect.y - point.y\n\t\t} else if (point.y > Rect.maxY(rect)) {\n\t\t\ty = point.y - Rect.maxY(rect)\n\t\t}\n\t\treturn Point.distance({ x, y }, { x: 0, y: 0 })\n\t},\n\n\tdelta: (a: Rect, b: Rect): Point => {\n\t\tconst pointA = { x: Rect.minX(a), y: Rect.minY(a) }\n\t\tconst pointB = { x: Rect.minX(b), y: Rect.minY(b) }\n\t\treturn {\n\t\t\tx: pointA.x - pointB.x,\n\t\t\ty: pointA.y - pointB.y,\n\t\t}\n\t},\n\n\t/** @internal */\n\twithMinSize: (rect: Rect, minSize: Size): Rect => {\n\t\tconst { width: minWidth, height: minHeight } = minSize\n\t\tconst diffX = rect.width - minWidth\n\t\tconst diffY = rect.height - minHeight\n\t\treturn {\n\t\t\twidth: Math.max(rect.width, minWidth),\n\t\t\theight: Math.max(rect.height, minHeight),\n\t\t\tx: rect.width < minWidth ? rect.x + diffX / 2 : rect.x,\n\t\t\ty: rect.height < minHeight ? rect.y + diffY / 2 : rect.y,\n\t\t}\n\t},\n\n\t/**\n\t * Return false if any point is not inside or on the provided rect.\n\t * @internal\n\t */\n\tanyPointsOutsideRect: (rect: Rect, ps: Point[]): boolean => {\n\t\tconst rectMinX = Rect.minX(rect)\n\t\tconst rectMinY = Rect.minY(rect)\n\t\tconst rectMaxX = Rect.maxX(rect)\n\t\tconst rectMaxY = Rect.maxY(rect)\n\n\t\tfor (const point of ps) {\n\t\t\tif (point.x < rectMinX || point.x > rectMaxX) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (point.y < rectMinY || point.y > rectMaxY) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t},\n\n\t/**\n\t * Returns the four edges of a rect as lines in the order of top, right, bottom, left.\n\t * @internal\n\t */\n\tedges: (rect: Rect): [Line, Line, Line, Line] => {\n\t\tconst [tl, tr, br, bl] = Rect.cornerPoints(rect)\n\t\treturn [Line(tl, tr), Line(tr, br), Line(br, bl), Line(bl, tl)]\n\t},\n\n\t/**\n\t * Return a new rect projected into a new position based on the anchor rect and the given direction/alignment.\n\t * @internal\n\t */\n\trebaseRectOnto: (\n\t\trect: Rect,\n\t\tanchorRect: Rect,\n\t\tdirection: \"top\" | \"right\" | \"bottom\" | \"left\",\n\t\talignment: \"start\" | \"center\" | \"end\",\n\t) => {\n\t\tconst rebasedRect = { ...rect }\n\n\t\t// rebase X axis\n\t\tswitch (direction) {\n\t\t\tcase \"bottom\":\n\t\t\tcase \"top\":\n\t\t\t\tswitch (alignment) {\n\t\t\t\t\tcase \"start\":\n\t\t\t\t\t\trebasedRect.x = anchorRect.x\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"center\":\n\t\t\t\t\t\trebasedRect.x = anchorRect.x + anchorRect.width / 2 - rect.width / 2\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"end\":\n\t\t\t\t\t\trebasedRect.x = anchorRect.x + anchorRect.width - rect.width\n\t\t\t\t\t\tbreak\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\tcase \"left\":\n\t\t\t\trebasedRect.x = anchorRect.x - rect.width\n\t\t\t\tbreak\n\t\t\tcase \"right\":\n\t\t\t\trebasedRect.x = anchorRect.x + anchorRect.width\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tassertNever(direction)\n\t\t}\n\n\t\t// rebase Y axis\n\t\tswitch (direction) {\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\trebasedRect.y = anchorRect.y\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"center\":\n\t\t\t\t\t\trebasedRect.y = anchorRect.y + anchorRect.height / 2 - rect.height / 2\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"end\":\n\t\t\t\t\t\trebasedRect.y = anchorRect.y + anchorRect.height - rect.height\n\t\t\t\t\t\tbreak\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\tcase \"top\":\n\t\t\t\trebasedRect.y = anchorRect.y - rect.height\n\t\t\t\tbreak\n\t\t\tcase \"bottom\":\n\t\t\t\trebasedRect.y = anchorRect.y + anchorRect.height\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tassertNever(direction)\n\t\t}\n\n\t\treturn rebasedRect\n\t},\n\n\t/**\n\t * Constrain a rect to a bound, offsetting its position to make the rect fit within the bound.\n\t * @internal\n\t */\n\tconstrain: (rect: Rect, bound?: Rect) => {\n\t\tif (!bound) return rect\n\n\t\t// check top\n\t\tlet y = Math.max(rect.y, bound.y)\n\t\t// check bottom\n\t\ty = Math.min(y, bound.y + bound.height - rect.height)\n\t\t// check left\n\t\tlet x = Math.max(rect.x, bound.x)\n\t\t// check right\n\t\tx = Math.min(x, bound.x + bound.width - rect.width)\n\n\t\treturn {\n\t\t\tx,\n\t\t\ty,\n\t\t\twidth: rect.width,\n\t\t\theight: rect.height,\n\t\t}\n\t},\n\n\t/**\n\t * Finds the closest edge of a rect to a point. Note that this does not check perpendicular\n\t * distances, so it might not be the technically closest edge, but rather a close approximation\n\t * or the visually closest edge. It achieves this by drawing a line from the center of the rect\n\t * to the point and checking if it intersects with any of the edges. Returns undefined if no\n\t * edge is intersected (e.g., if the point is inside the rect).\n\t * @internal\n\t */\n\tclosestEdge: (rect: Rect, point: Point): { edge: Line; name: \"top\" | \"right\" | \"bottom\" | \"left\" } | undefined => {\n\t\tconst center = Rect.center(rect)\n\t\tconst pointToCenterLine = Line(point, center)\n\t\tconst edges = Rect.edges(rect)\n\n\t\tfor (let i = 0; i < edges.length; i++) {\n\t\t\tconst edge = edges[i]\n\t\t\tif (!edge) continue\n\n\t\t\tif (Line.intersection(pointToCenterLine, edge, true)) {\n\t\t\t\tconst name = edgesInOrder[i]\n\t\t\t\tassert(name, \"Invalid edge name\", edgesInOrder)\n\t\t\t\treturn { edge, name }\n\t\t\t}\n\t\t}\n\t},\n\n\t/** @internal */\n\tclosestRect: (rects: Rect[], point: Point): { rect: Rect; index: number } => {\n\t\tlet index = 0\n\t\tlet rect = rects[0]\n\t\tassert(rect, \"Rect array is empty\")\n\t\tlet distance = Rect.pointDistance(rect, point)\n\n\t\tfor (let candidateIndex = 1; candidateIndex < rects.length; candidateIndex += 1) {\n\t\t\tconst candidateRect = rects[candidateIndex]\n\t\t\tassert(candidateRect)\n\t\t\tconst candidateDistance = Rect.pointDistance(candidateRect, point)\n\n\t\t\tif (candidateDistance < distance) {\n\t\t\t\tindex = candidateIndex\n\t\t\t\trect = candidateRect\n\t\t\t\tdistance = candidateDistance\n\t\t\t}\n\n\t\t\tif (distance === 0) break\n\t\t}\n\n\t\treturn { rect, index }\n\t},\n}\n\nconst edgesInOrder = /* @__PURE__ */ [\"top\", \"right\", \"bottom\", \"left\"] as const\n", "import type React from \"react\"\nimport type { AnimatableObject } from \"../../animation/Animatable/Animatable.ts\"\nimport { Animatable, isAnimatable } from \"../../animation/Animatable/Animatable.ts\"\nimport { assertNever } from \"../../utils/assert.ts\"\nimport { isReactChild, isReactElement } from \"../../utils/type-guards.ts\"\nimport { isUndefined } from \"../../utils/utils.ts\"\nimport type { WithFractionOfFreeSpace } from \"../traits/FreeSpace.ts\"\nimport { isFiniteNumber } from \"../utils/isFiniteNumber.ts\"\nimport { Rect } from \"./Rect.ts\"\nimport type { Size } from \"./Size.ts\"\n\n/** @internal */\ninterface ParentSizeInfo {\n\tsizing: Size | AnimatableObject<Size> | null\n\tpositioning: Size | AnimatableObject<Size> | null\n\t/* used for vh constraints */\n\tviewport: Size | null\n}\n\n/** @internal */\nexport interface DefaultProps {\n\tparentSize: AnimatableObject<Size> // Should always be mirrored with the parentSize in ConstraintProperties\n}\n\n/**\n * These properties are used to layout elements within Framer\u2019s constraint system.\n * @privateRemarks Represents model property values for layout constraints. These may be internally inconsistent. Mask and Values are generated from these.\n * @public\n * */\nexport interface ConstraintProperties extends Partial<WithFractionOfFreeSpace> {\n\t/**\n\t * //TODO Should it be internal?\n\t * @internal\n\t */\n\tparentSize: Size | null\n\n\t/**\n\t * Pinned position from left\n\t * @public\n\t */\n\tleft: Animatable<number> | number | null\n\n\t/**\n\t * Pinned position from right\n\t * @public\n\t */\n\tright: Animatable<number> | number | null\n\n\t/**\n\t * Pinned position from top\n\t * @public\n\t */\n\ttop: Animatable<number> | number | null\n\n\t/**\n\t * Pinned position from bottom\n\t * @public\n\t */\n\tbottom: Animatable<number> | number | null\n\n\t/**\n\t * Center of horizontal position (X axis)\n\t * @public\n\t */\n\tcenterX: ConstraintPercentage\n\n\t/**\n\t * Center of vertical position (Y axis)\n\t * @public\n\t */\n\tcenterY: ConstraintPercentage\n\n\t/**\n\t * Element width\n\t * @public\n\t */\n\twidth: ConstraintDimension\n\n\t/**\n\t * Element height\n\t * @public\n\t */\n\theight: ConstraintDimension\n\n\t/**\n\t * Aspect Ratio to keep when resizing\n\t * @public\n\t */\n\taspectRatio: number | null\n\n\t/**\n\t * //TODO What is autoSize for? Internal?\n\t * @public\n\t */\n\tautoSize?: boolean\n}\n\nexport const constraintDefaults: ConstraintProperties = {\n\tleft: null,\n\tright: null,\n\ttop: null,\n\tbottom: null,\n\tcenterX: \"50%\",\n\tcenterY: \"50%\",\n\taspectRatio: null,\n\tparentSize: null,\n\twidth: 100,\n\theight: 100,\n}\n\n// Some property values can be defined using parent-relative percentages. Note: this used to be indicated using React.CSSPercentage.\n/** @public */\nexport type ConstraintPercentage = string\nexport type ConstraintAuto = \"auto\"\nexport type ConstraintFreespaceFraction = string\n\n/**\n * Dimensions can be numbers or strings: percentages, fractions of free space (fr), or auto\n * @public\n */\nexport type ConstraintDimension =\n\t| Animatable<number>\n\t| number\n\t| ConstraintPercentage\n\t| ConstraintAuto\n\t| ConstraintFreespaceFraction\n\n/** @internal */\nexport enum DimensionType {\n\tFixedNumber = 0,\n\tPercentage = 1,\n\t/** @internal */ Auto = 2,\n\tFractionOfFreeSpace = 3,\n\tViewport = 4,\n\t/** @internal */\n\tFitImage = 5,\n}\n\n/** @internal */\nexport type SizeConstraints = Partial<{\n\tminWidth: string | number\n\tmaxWidth: string | number\n\tminHeight: string | number\n\tmaxHeight: string | number\n}>\n\n// Represents a set of active layout constraints. In a better world, this would be an enum / option set.\n/** @internal */\nexport interface ConstraintMask extends SizeConstraints {\n\tleft: boolean\n\tright: boolean\n\ttop: boolean\n\tbottom: boolean\n\n\twidthType: DimensionType\n\theightType: DimensionType\n\n\taspectRatio: number | null\n\tfixedSize: boolean // usesIntrinsicSize?\n}\n\nexport function isAutoDimensionType(dimensionType: DimensionType | undefined) {\n\tif (isUndefined(dimensionType)) return false\n\treturn dimensionType === DimensionType.Auto || dimensionType === DimensionType.FitImage\n}\nexport function isConstraintSupportingChild<T extends { constraints: Partial<ConstraintProperties> }>(\n\tchild: React.ReactChild,\n): child is React.ReactElement<T> {\n\tif (!isReactChild(child) || !isReactElement(child)) {\n\t\treturn false\n\t}\n\t// Assume for now that all children support constraints (so they get passed parentSize)\n\treturn true\n}\n\n/** @internal */\nexport const ConstraintMask = {\n\t// Modifies the constraint mask to remove invalid (mutually exclusive) options and returns the original.\n\t// TODO: this removes major inconsistencies but probably needs to be merged with ConstraintSolver.\n\tquickfix: (constraints: ConstraintMask): ConstraintMask => {\n\t\tif (isAutoDimensionType(constraints.widthType) || isAutoDimensionType(constraints.heightType)) {\n\t\t\tconstraints.aspectRatio = null\n\t\t}\n\n\t\tif (isFiniteNumber(constraints.aspectRatio)) {\n\t\t\tif (constraints.left && constraints.right) {\n\t\t\t\tconstraints.widthType = DimensionType.FixedNumber\n\t\t\t}\n\t\t\tif (constraints.top && constraints.bottom) {\n\t\t\t\tconstraints.heightType = DimensionType.FixedNumber\n\t\t\t}\n\t\t\tif (constraints.left && constraints.right && constraints.top && constraints.bottom) {\n\t\t\t\tconstraints.bottom = false\n\t\t\t}\n\t\t\tif (constraints.widthType !== DimensionType.FixedNumber && constraints.heightType !== DimensionType.FixedNumber) {\n\t\t\t\tconstraints.heightType = DimensionType.FixedNumber\n\t\t\t}\n\t\t}\n\n\t\tif (constraints.left && constraints.right) {\n\t\t\tif (constraints.fixedSize || isAutoDimensionType(constraints.widthType) || isFiniteNumber(constraints.maxWidth)) {\n\t\t\t\tconstraints.right = false\n\t\t\t}\n\n\t\t\tconstraints.widthType = DimensionType.FixedNumber\n\t\t}\n\t\tif (constraints.top && constraints.bottom) {\n\t\t\tif (\n\t\t\t\tconstraints.fixedSize ||\n\t\t\t\tisAutoDimensionType(constraints.heightType) ||\n\t\t\t\tisFiniteNumber(constraints.maxHeight)\n\t\t\t) {\n\t\t\t\tconstraints.bottom = false\n\t\t\t}\n\n\t\t\tconstraints.heightType = DimensionType.FixedNumber\n\t\t}\n\n\t\treturn constraints\n\t},\n}\n\n// Represents concrete snapshot values for constraints. Constraints that aren't active in the corresponding ConstraintsMask should be assumed to contain garbage.\n/** @internal */\nexport interface ConstraintValuesBase {\n\tleft: number | null\n\tright: number | null\n\ttop: number | null\n\tbottom: number | null\n\tcenterAnchorX: number // [0...1]\n\tcenterAnchorY: number // [0...1]\n\twidthType: DimensionType\n\theightType: DimensionType\n\taspectRatio: number | null\n}\n\n/** @internal */\nexport interface ConstraintValues extends ConstraintValuesBase, SizeConstraints {\n\twidth: number\n\theight: number\n}\n\n/**\n * @internal\n */\nexport interface UserConstraintValues extends ConstraintValuesBase, SizeConstraints {\n\twidth: number | null\n\theight: number | null\n}\n\n/** @internal */\nexport function valueToDimensionType(value: string | number | Animatable<number> | undefined) {\n\tif (typeof value === \"string\") {\n\t\tconst trimmedValue = value.trim()\n\t\tif (trimmedValue === \"auto\") return DimensionType.Auto\n\t\tif (trimmedValue.endsWith(\"fr\")) return DimensionType.FractionOfFreeSpace\n\t\tif (trimmedValue.endsWith(\"%\")) return DimensionType.Percentage\n\t\tif (trimmedValue.endsWith(\"vw\") || trimmedValue.endsWith(\"vh\")) return DimensionType.Viewport\n\t}\n\treturn DimensionType.FixedNumber\n}\n\n/**\n * @internal\n */\nexport const ConstraintValues = {\n\t// Returns concrete current values given some ConstraintProperties.\n\tfromProperties: (props: Partial<ConstraintProperties> & { autoSize?: boolean }): UserConstraintValues => {\n\t\tconst { left, right, top, bottom, width, height, centerX, centerY, aspectRatio, autoSize } = props\n\t\tconst constraints = ConstraintMask.quickfix({\n\t\t\tleft: isFiniteNumber(left) || isAnimatable(left),\n\t\t\tright: isFiniteNumber(right) || isAnimatable(right),\n\t\t\ttop: isFiniteNumber(top) || isAnimatable(top),\n\t\t\tbottom: isFiniteNumber(bottom) || isAnimatable(bottom),\n\t\t\twidthType: valueToDimensionType(width),\n\t\t\theightType: valueToDimensionType(height),\n\t\t\taspectRatio: aspectRatio || null,\n\t\t\tfixedSize: autoSize === true,\n\t\t})\n\n\t\tlet widthValue: number | null = null\n\t\tlet heightValue: number | null = null\n\n\t\tlet widthType = DimensionType.FixedNumber\n\t\tlet heightType = DimensionType.FixedNumber\n\n\t\tif (constraints.widthType !== DimensionType.FixedNumber && typeof width === \"string\") {\n\t\t\tconst parsedWidth = parseFloat(width)\n\n\t\t\tif (width.endsWith(\"fr\")) {\n\t\t\t\twidthType = DimensionType.FractionOfFreeSpace\n\t\t\t\twidthValue = parsedWidth\n\t\t\t} else if (width === \"auto\") {\n\t\t\t\twidthType = DimensionType.Auto\n\t\t\t} else {\n\t\t\t\t// Percentage\n\t\t\t\twidthType = DimensionType.Percentage\n\t\t\t\twidthValue = parsedWidth / 100\n\t\t\t}\n\t\t} else if (width !== undefined && typeof width !== \"string\") {\n\t\t\twidthValue = Animatable.getNumber(width)\n\t\t}\n\n\t\tif (constraints.heightType !== DimensionType.FixedNumber && typeof height === \"string\") {\n\t\t\tconst parsedHeight = parseFloat(height)\n\n\t\t\tif (height.endsWith(\"fr\")) {\n\t\t\t\theightType = DimensionType.FractionOfFreeSpace\n\t\t\t\theightValue = parsedHeight\n\t\t\t} else if (height === \"auto\") {\n\t\t\t\theightType = DimensionType.Auto\n\t\t\t} else {\n\t\t\t\t// Percentage\n\t\t\t\theightType = DimensionType.Percentage\n\t\t\t\theightValue = parseFloat(height) / 100\n\t\t\t}\n\t\t} else if (height !== undefined && typeof height !== \"string\") {\n\t\t\theightValue = Animatable.getNumber(height)\n\t\t}\n\n\t\tlet centerAnchorX = 0.5\n\t\tlet centerAnchorY = 0.5\n\t\tif (centerX) {\n\t\t\tcenterAnchorX = parseFloat(centerX) / 100\n\t\t}\n\t\tif (centerY) {\n\t\t\tcenterAnchorY = parseFloat(centerY) / 100\n\t\t}\n\n\t\treturn {\n\t\t\tleft: constraints.left ? Animatable.getNumber(left) : null,\n\t\t\tright: constraints.right ? Animatable.getNumber(right) : null,\n\t\t\ttop: constraints.top ? Animatable.getNumber(top) : null,\n\t\t\tbottom: constraints.bottom ? Animatable.getNumber(bottom) : null,\n\t\t\twidthType,\n\t\t\theightType,\n\t\t\twidth: widthValue,\n\t\t\theight: heightValue,\n\t\t\taspectRatio: constraints.aspectRatio || null,\n\t\t\tcenterAnchorX: centerAnchorX,\n\t\t\tcenterAnchorY: centerAnchorY,\n\t\t}\n\t},\n\n\ttoSize: (\n\t\tvalues: UserConstraintValues,\n\t\tparentSizeInfo: ParentSizeInfo | null,\n\t\tautoSize: Size | null,\n\t\tfreeSpace: WithFractionOfFreeSpace | null,\n\t): Size => {\n\t\tlet width: number | null = null\n\t\tlet height: number | null = null\n\n\t\tconst parentWidth = parentSizeInfo?.sizing ? Animatable.getNumber(parentSizeInfo?.sizing.width) : null\n\t\tconst parentHeight = parentSizeInfo?.sizing ? Animatable.getNumber(parentSizeInfo?.sizing.height) : null\n\n\t\tconst hOpposingPinsOffset = pinnedOffset(values.left, values.right)\n\n\t\tif (parentWidth && isFiniteNumber(hOpposingPinsOffset)) {\n\t\t\twidth = parentWidth - hOpposingPinsOffset\n\t\t} else if (autoSize && isAutoDimensionType(values.widthType)) {\n\t\t\twidth = autoSize.width\n\t\t} else if (isFiniteNumber(values.width)) {\n\t\t\tswitch (values.widthType) {\n\t\t\t\tcase DimensionType.FixedNumber:\n\t\t\t\t\twidth = values.width\n\t\t\t\t\tbreak\n\t\t\t\tcase DimensionType.FractionOfFreeSpace:\n\t\t\t\t\t// set width/height to null if freeSpace is not available, so we would fallback to the default value\n\t\t\t\t\t// see: https://github.com/framer/FramerStudio/pull/3345\n\t\t\t\t\twidth = freeSpace\n\t\t\t\t\t\t? (freeSpace.freeSpaceInParent.width / freeSpace.freeSpaceUnitDivisor.width) * values.width\n\t\t\t\t\t\t: null\n\t\t\t\t\tbreak\n\t\t\t\tcase DimensionType.Percentage:\n\t\t\t\tcase DimensionType.Viewport:\n\t\t\t\t\tif (parentWidth) {\n\t\t\t\t\t\twidth = parentWidth * values.width\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase DimensionType.Auto:\n\t\t\t\tcase DimensionType.FitImage:\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(values.widthType)\n\t\t\t}\n\t\t}\n\n\t\tconst vOpposingPinsOffset = pinnedOffset(values.top, values.bottom)\n\n\t\tif (parentHeight && isFiniteNumber(vOpposingPinsOffset)) {\n\t\t\theight = parentHeight - vOpposingPinsOffset\n\t\t} else if (autoSize && isAutoDimensionType(values.heightType)) {\n\t\t\theight = autoSize.height\n\t\t} else if (isFiniteNumber(values.height)) {\n\t\t\tswitch (values.heightType) {\n\t\t\t\tcase DimensionType.FixedNumber:\n\t\t\t\t\theight = values.height\n\t\t\t\t\tbreak\n\t\t\t\tcase DimensionType.FractionOfFreeSpace:\n\t\t\t\t\t// set width/height to null if freeSpace is not available, so we would fallback to the default value\n\t\t\t\t\t// see: https://github.com/framer/FramerStudio/pull/3345\n\t\t\t\t\theight = freeSpace\n\t\t\t\t\t\t? (freeSpace.freeSpaceInParent.height / freeSpace.freeSpaceUnitDivisor.height) * values.height\n\t\t\t\t\t\t: null\n\t\t\t\t\tbreak\n\t\t\t\tcase DimensionType.Percentage:\n\t\t\t\tcase DimensionType.Viewport:\n\t\t\t\t\tif (parentHeight) {\n\t\t\t\t\t\theight = parentHeight * values.height\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\tcase DimensionType.Auto:\n\t\t\t\tcase DimensionType.FitImage:\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(values.heightType)\n\t\t\t}\n\t\t}\n\n\t\treturn sizeAfterApplyingConstraintsAndAspectRatio(\n\t\t\twidth,\n\t\t\theight,\n\t\t\tvalues,\n\t\t\t{\n\t\t\t\theight: parentHeight ?? 0,\n\t\t\t\twidth: parentWidth ?? 0,\n\t\t\t},\n\t\t\tparentSizeInfo?.viewport,\n\t\t)\n\t},\n\n\t// Returns a parent-relative rect given concrete ConstraintValues.\n\ttoRect: (\n\t\tvalues: UserConstraintValues,\n\t\t// Normally we would use the same parentSize to calculate the node's size (width/height) and postiion (x/y), but\n\t\t// for non-position-fixed nodes using vw/vh, the size is based on the viewport size, while its position should\n\t\t// still be calculated via its parent's size.\n\t\tparentSizeInfo: ParentSizeInfo | null = null,\n\t\tautoSize: Size | null = null,\n\t\tpixelAlign: boolean = false,\n\t\t// This argument is actually never used, because fractional sizes are\n\t\t// always calculated by it's parent to static sizes\n\t\tfreeSpace: WithFractionOfFreeSpace | null = null,\n\t): Rect => {\n\t\tlet x = values.left || 0\n\t\tlet y = values.top || 0\n\n\t\tconst { width, height } = ConstraintValues.toSize(values, parentSizeInfo, autoSize, freeSpace)\n\n\t\tconst parentSizeForPositioning = parentSizeInfo?.positioning ?? null\n\t\tconst positioningParentWidth = parentSizeForPositioning\n\t\t\t? Animatable.getNumber(parentSizeForPositioning.width)\n\t\t\t: null\n\t\tconst positioningParentHeight = parentSizeForPositioning\n\t\t\t? Animatable.getNumber(parentSizeForPositioning.height)\n\t\t\t: null\n\n\t\tif (values.left !== null) {\n\t\t\tx = values.left\n\t\t} else if (positioningParentWidth && values.right !== null) {\n\t\t\tx = positioningParentWidth - values.right - width\n\t\t} else if (positioningParentWidth) {\n\t\t\tx = values.centerAnchorX * positioningParentWidth - width / 2\n\t\t}\n\n\t\tif (values.top !== null) {\n\t\t\ty = values.top\n\t\t} else if (positioningParentHeight && values.bottom !== null) {\n\t\t\ty = positioningParentHeight - values.bottom - height\n\t\t} else if (positioningParentHeight) {\n\t\t\ty = values.centerAnchorY * positioningParentHeight - height / 2\n\t\t}\n\n\t\tconst f: Rect = { x, y, width, height }\n\t\tif (pixelAlign) {\n\t\t\treturn Rect.pixelAligned(f)\n\t\t}\n\t\treturn f\n\t},\n}\n\nconst defaultWidth = 200\nconst defaultHeight = 200\n\nfunction getConstraintValue(\n\tconstraint: keyof SizeConstraints,\n\tvalue: string | number,\n\tparentSize: Size | null | undefined,\n\tviewport: Size | null | undefined,\n): number {\n\tif (typeof value === \"string\") {\n\t\tif (value.endsWith(\"%\") && parentSize) {\n\t\t\tswitch (constraint) {\n\t\t\t\tcase \"maxWidth\":\n\t\t\t\tcase \"minWidth\":\n\t\t\t\t\treturn (parseFloat(value) / 100) * parentSize.width\n\t\t\t\tcase \"maxHeight\":\n\t\t\t\tcase \"minHeight\":\n\t\t\t\t\treturn (parseFloat(value) / 100) * parentSize.height\n\n\t\t\t\tdefault:\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif (value.endsWith(\"vh\")) {\n\t\t\tif (!viewport) return constraintValueForUncalculatedViewport(constraint)\n\t\t\tswitch (constraint) {\n\t\t\t\tcase \"maxWidth\":\n\t\t\t\tcase \"minWidth\":\n\t\t\t\t\treturn (parseFloat(value) / 100) * viewport.width\n\t\t\t\tcase \"maxHeight\":\n\t\t\t\tcase \"minHeight\":\n\t\t\t\t\treturn (parseFloat(value) / 100) * viewport.height\n\n\t\t\t\tdefault:\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\treturn parseFloat(value)\n\t}\n\n\treturn value\n}\n\nfunction constraintValueForUncalculatedViewport(constraint: keyof SizeConstraints): number {\n\t// Unexpected, but we should not just parse the vh value to px value. If we can't calculated the vh\n\t// value, return Infinity so the constraint doesn't have an impact on the constrained rect.\n\tswitch (constraint) {\n\t\tcase \"minWidth\":\n\t\tcase \"minHeight\":\n\t\t\treturn Number.NEGATIVE_INFINITY\n\t\tcase \"maxWidth\":\n\t\tcase \"maxHeight\":\n\t\t\treturn Number.POSITIVE_INFINITY\n\t\tdefault:\n\t\t\tassertNever(constraint, \"unknown constraint key\")\n\t}\n}\n\nfunction constrainHeight(\n\theight: number,\n\tvalues: UserConstraintValues,\n\tparentSize: Size | undefined | null,\n\tviewport: Size | undefined | null,\n) {\n\tif (values.minHeight) {\n\t\theight = Math.max(getConstraintValue(\"minHeight\", values.minHeight, parentSize, viewport), height)\n\t}\n\tif (values.maxHeight) {\n\t\theight = Math.min(getConstraintValue(\"maxHeight\", values.maxHeight, parentSize, viewport), height)\n\t}\n\n\treturn height\n}\n\nfunction constrainWidth(\n\twidth: number,\n\tvalues: UserConstraintValues,\n\tparentSize: Size | undefined | null,\n\tviewport: Size | undefined | null,\n) {\n\tif (values.minWidth) {\n\t\twidth = Math.max(getConstraintValue(\"minWidth\", values.minWidth, parentSize, viewport), width)\n\t}\n\tif (values.maxWidth) {\n\t\twidth = Math.min(getConstraintValue(\"maxWidth\", values.maxWidth, parentSize, viewport), width)\n\t}\n\n\treturn width\n}\n\nfunction sizeAfterApplyingConstraintsAndAspectRatio(\n\twidth: number | null,\n\theight: number | null,\n\tvalues: UserConstraintValues,\n\tparentSize: Size | null | undefined,\n\tviewport: Size | null | undefined,\n): Size {\n\tlet w = constrainWidth(isFiniteNumber(width) ? width : defaultWidth, values, parentSize, viewport)\n\tlet h = constrainHeight(isFiniteNumber(height) ? height : defaultHeight, values, parentSize, viewport)\n\n\tif (isFiniteNumber(values.aspectRatio) && values.aspectRatio > 0) {\n\t\tif (isFiniteNumber(values.left) && isFiniteNumber(values.right)) {\n\t\t\th = w / values.aspectRatio\n\t\t} else if (isFiniteNumber(values.top) && isFiniteNumber(values.bottom)) {\n\t\t\tw = h * values.aspectRatio\n\t\t} else if (values.widthType !== DimensionType.FixedNumber) {\n\t\t\th = w / values.aspectRatio\n\t\t} else {\n\t\t\tw = h * values.aspectRatio\n\t\t}\n\t}\n\n\treturn {\n\t\twidth: w,\n\t\theight: h,\n\t}\n}\n\nfunction pinnedOffset(start: number | null, end: number | null) {\n\tif (!isFiniteNumber(start) || !isFiniteNumber(end)) return null\n\treturn start + end\n}\n", "import type { Transition } from \"framer-motion\"\nimport type { FramerFontVariant } from \"../../render/fonts/FramerFontSource.ts\"\nimport type { BorderStyle } from \"../style/BorderComponent.tsx\"\nimport type { BoxShadow } from \"./Shadow.ts\"\nimport type { SupportedLinkRelValue } from \"./SupportedRelValue.ts\"\n\n/** @public */\nexport type PropertyControls<ComponentProps = any, ArrayTypes = any> = {\n\t[K in keyof ComponentProps]?: ControlDescription<Partial<ComponentProps>>\n}\n\n/**\n * Object sub type (public types only)\n * Currently not supported: component instance, and event handler.\n * @public\n */\nexport type ObjectPropertyControlDescription<P = any> =\n\t| NumberControlDescription<P>\n\t| EnumControlDescription<P>\n\t| BooleanControlDescription<P>\n\t| StringControlDescription<P>\n\t| ColorControlDescription<P>\n\t| SegmentedEnumControlDescription<P>\n\t| ImageControlDescription<P>\n\t| ResponsiveImageControlDescription<P>\n\t| FileControlDescription<P>\n\t| TransitionControlDescription<P>\n\t| BoxShadowControlDescription<P>\n\t| LinkControlDescription<P>\n\t| DateControlDescription<P>\n\t| ArrayControlDescription<P>\n\t| ObjectControlDescription<P>\n\t| FusedNumberControlDescription<P>\n\t| FontControlDescription<P>\n\t| BorderControlDescription<P>\n\t| CursorControlDescription<P>\n\t| PaddingControlDescription<P>\n\t| BorderRadiusControlDescription<P>\n\t| GapControlDescription<P>\n\t| TrackingIdControlDescription<P>\n\t/** @internalunionmember */\n\t| RichTextControlDescription<P>\n\t/** @internalunionmember */\n\t| PageScopeControlDescription<P>\n\t/** @internalunionmember */\n\t| ScrollSectionRefControlDescription<P>\n\t/** @internalunionmember */\n\t| CustomCursorControlDescription<P>\n\t/** @internalunionmember */\n\t| CollectionReferenceControlDescription<P>\n\t/** @internalunionmember */\n\t| MultiCollectionReferenceControlDescription<P>\n\t/** @internalunionmember */\n\t| LocationControlDescription<P>\n\n/**\n * Array sub type (public types only)\n * @public\n */\nexport type ArrayItemControlDescription<P = any> =\n\t| Omit<NumberControlDescription<P>, \"hidden\" | \"description\" | \"optional\" | \"section\">\n\t| Omit<EnumControlDescription<P>, \"hidden\" | \"description\" | \"optional\" | \"section\">\n\t| Omit<BooleanControlDescription<P>, \"hidden\" | \"description\" | \"optional\" | \"section\">\n\t| Omit<StringControlDescription<P>, \"hidden\" | \"description\" | \"optional\" | \"section\">\n\t| Omit<ColorControlDescription<P>, \"hidden\" | \"description\" | \"optional\" | \"section\">\n\t| Omit<SegmentedEnumControlDescription<P>, \"hidden\" | \"description\" | \"section\">\n\t| Omit<ImageControlDescription<P>, \"hidden\" | \"description\" | \"section\">\n\t| Omit<ResponsiveImageControlDescription<P>, \"hidden\" | \"description\" | \"section\">\n\t| Omit<FileControlDescription<P>, \"hidden\" | \"description\" | \"section\">\n\t| Omit<ComponentInstanceDescription<P>, \"hidden\" | \"description\" | \"section\">\n\t| Omit<TransitionControlDescription<P>, \"hidden\" | \"description\" | \"section\">\n\t| Omit<LinkControlDescription<P>, \"hidden\" | \"description\" | \"section\">\n\t| Omit<DateControlDescription<P>, \"hidden\" | \"description\" | \"section\">\n\t| Omit<ObjectControlDescription<P>, \"hidden\" | \"description\" | \"optional\" | \"section\">\n\t| Omit<BorderControlDescription<P>, \"hidden\" | \"description\" | \"optional\" | \"section\">\n\t| Omit<CursorControlDescription<P>, \"hidden\" | \"description\" | \"section\">\n\t/** @internalunionmember */\n\t| Omit<RichTextControlDescription<P>, \"hidden\" | \"description\" | \"section\">\n\t/** @internalunionmember */\n\t| Omit<ScrollSectionRefControlDescription<P>, \"hidden\" | \"description\" | \"section\">\n\t/** @internalunionmember */\n\t| Omit<CustomCursorControlDescription<P>, \"hidden\" | \"description\" | \"section\">\n\t/** @internalunionmember */\n\t| Omit<LocationControlDescription<P>, \"hidden\" | \"description\" | \"optional\" | \"section\">\n\n/** @public */\nexport type ControlDescription<P = any> =\n\t| NumberControlDescription<P>\n\t| EnumControlDescription<P>\n\t| BooleanControlDescription<P>\n\t| StringControlDescription<P>\n\t| ColorControlDescription<P>\n\t| FusedNumberControlDescription<P>\n\t| SegmentedEnumControlDescription<P>\n\t| ImageControlDescription<P>\n\t| ResponsiveImageControlDescription<P>\n\t| FileControlDescription<P>\n\t| ComponentInstanceDescription<P>\n\t| ArrayControlDescription<P>\n\t| EventHandlerControlDescription<P>\n\t/** @internalunionmember */\n\t| ChangeHandlerControlDescription<P>\n\t| TransitionControlDescription<P>\n\t| BoxShadowControlDescription<P>\n\t| LinkControlDescription<P>\n\t| DateControlDescription<P>\n\t| ObjectControlDescription<P>\n\t| FontControlDescription<P>\n\t| BorderControlDescription<P>\n\t| CursorControlDescription<P>\n\t| PaddingControlDescription<P>\n\t| BorderRadiusControlDescription<P>\n\t| GapControlDescription<P>\n\t| TrackingIdControlDescription<P>\n\t| SlotControlDescription<P>\n\t/** @internalunionmember */\n\t| RichTextControlDescription<P>\n\t/** @internalunionmember */\n\t| LinkRelValuesControlDescription<P>\n\t/** @internalunionmember */\n\t| PageScopeControlDescription<P>\n\t/** @internalunionmember */\n\t| ScrollSectionRefControlDescription<P>\n\t/** @internalunionmember */\n\t| CustomCursorControlDescription<P>\n\t/** @internalunionmember */\n\t| CollectionReferenceControlDescription<P>\n\t/** @internalunionmember */\n\t| MultiCollectionReferenceControlDescription<P>\n\t/** @internalunionmember */\n\t| VectorSetItemControlDescription<P>\n\t/** @internalunionmember */\n\t| LocationControlDescription<P>\n\n/**\n * Used by the {@link PropertyControls} and specifies the type of user interface for receiving\n * input. Each field has a distinct set of properties though they all accept `title` and `hidden`\n * properties.\n *\n * @remarks\n * ```javascript\n * export function MyComponent({ title }) {\n *   return <div>{title}</div>\n * }\n *\n * addPropertyControls(MyComponent, {\n *   title: {\n *     type: ControlType.String,\n *     title: \"Title\",\n *     hidden: (props) => true\n *   },\n * }\n * ```\n * @public\n */\nexport enum ControlType {\n\t/**\n\t * A control that displays an on / off checkbox. The associated property will be `true` or `false`,\n\t * depending on the state of the checkbox. Includes an optional `defaultValue`, which is set to `true` by default. You can also customize the labels displayed in the property panel with the `enabledTitle` and `disabledTitle` properties.\n\t *\n\t * @remarks\n\t * ```javascript\n\t * export function MyComponent(props) {\n\t *   return <div>{props.showText ? \"Hello World\" : null}</div>\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   showText: {\n\t *     type: ControlType.Boolean,\n\t *     title: \"Show Text\",\n\t *     defaultValue: true,\n\t *     enabledTitle: \"On\",\n\t *     disabledTitle: \"Off\",\n\t *   },\n\t * })\n\t * ```\n\t */\n\tBoolean = \"boolean\",\n\t/**\n\t * A control that accepts any numeric value. This will be provided directly as a property.\n\t * Will display an input field with a range slider by default. The\n\t * `displayStepper` option can be enabled to include a stepper control instead.\n\t *\n\t * @remarks\n\t * ```javascript\n\t * export function MyComponent(props) {\n\t *   return <motion.div style={{ rotate: props.rotation }}>{props.rotation}</motion.div>\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   rotation: {\n\t *     type: ControlType.Number,\n\t *     defaultValue: 0,\n\t *     min: 0,\n\t *     max: 360,\n\t *     unit: \"deg\",\n\t *     step: 0.1,\n\t *     displayStepper: true,\n\t *   },\n\t * })\n\t * ```\n\t */\n\tNumber = \"number\",\n\t/**\n\t * A control that accepts plain text values. This will be provided directly as a property.\n\t * Will display an input field with an optional placeholder value.\n\t * If `obscured` attribute is set to true a password input field will be used instead of a regular text input\n\t * so that the value in the input will be visually obscured, yet still be available as plain text inside the component.\n\t * `displayTextArea` can be enabled to display a multi-line input area instead.\n\t *\n\t * @remarks\n\t * ```javascript\n\t * export function MyComponent(props) {\n\t *   return <div>{props.title} \u2014 {props.body}</div>\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   title: {\n\t *     type: ControlType.String,\n\t *     defaultValue: \"Framer\",\n\t *     placeholder: \"Type something\u2026\",\n\t *   },\n\t *   body: {\n\t *     type: ControlType.String,\n\t *     defaultValue: \"Lorem ipsum dolor sit amet.\",\n\t *     placeholder: \"Type something\u2026\",\n\t *     displayTextArea: true,\n\t *   },\n\t * })\n\t * ```\n\t */\n\tString = \"string\",\n\t/**\n\t * @internal\n\t * This is used by framer internally. Use at your own risk. Will contain a string with html\n\t * markup containing h1, h2, etc., paragraphs, and inline styles.\n\t */\n\tRichText = \"richtext\",\n\t/**\n\t * Deprecated, please use ControlType.Padding and ControlType.BorderRadius. You should be able\n\t * to switch to the new control type without data loss. Be aware that these new controls only\n\t * have a single value (e.g. `10px` or `10px 20px 30px 40px`).\n\t *\n\t * A control that can be used to take a single number or four distinct numeric input fields. The\n\t * typical use case for this control is for visual properties like border, padding or margin. It\n\t * will display an input field to accept a single value, alongside a segmented control allowing\n\t * four distinct values to be provided.\n\t *\n\t * You can also set the default value for each valueKey as well as the toggleKey by setting\n\t * their values on `defaultProps`.\n\t *\n\t * @deprecated Please use {@link ControlType.Padding} and ${@link ControlType.BorderRadius}. You\n\t * should be able to switch to the new control type without data loss. Be aware that these new controls only\n\t * have a single value (e.g. `10px` or `10px 20px 30px 40px`).\n\t * @remarks\n\t * ```javascript\n\t * export function MyComponent({\n\t *   radius = 50,\n\t *   topLeft,\n\t *   topRight,\n\t *   bottomRight,\n\t *   bottomLeft,\n\t *   isMixed = false,\n\t * }) {\n\t *   const borderRadius = isMixed\n\t *     ? `${topLeft}px ${topRight}px ${bottomRight}px ${bottomLeft}px`\n\t *     : `${radius}px`\n\t *   return <div style={{ background: \"red\", borderRadius }}></div>\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   radius: {\n\t *     type: ControlType.FusedNumber,\n\t *     title: \"Radius\",\n\t *     defaultValue: 50,\n\t *     toggleKey: \"isMixed\",\n\t *     toggleTitles: [\"All\", \"Individual\"],\n\t *     valueKeys: [\"topLeft\", \"topRight\", \"bottomRight\", \"bottomLeft\"],\n\t *     valueLabels: [\"NW\", \"NE\", \"SE\", \"SW\"],\n\t *     min: 0,\n\t *   },\n\t * })\n\t *\n\t * // Set the default value for each valueKey as well as the toggleKey by setting their values on `defaultProps`:\n\t * MyComponent.defaultProps = {\n\t *     radius: 10,\n\t *     isMixed: true,\n\t *     topLeft: 5,\n\t *     topRight: 15,\n\t *     bottomRight: 5,\n\t *     bottomLeft: 15,\n\t * }\n\t * ```\n\t */\n\tFusedNumber = \"fusednumber\",\n\t/**\n\t * A property control that represents a list of options. The list contains primitive values and each\n\t * value has to be unique. The selected option will be provided as a property. This control is displayed\n\t * as a dropdown menu in which a user can select one of the items.\n\t * `displaySegmentedControl` can be enabled to display a segmented control instead.\n\t *\n\t * ```javascript\n\t * export function MyComponent(props) {\n\t *   const value = props.value || \"a\"\n\t *   const colors = { a: \"red\", b: \"green\", c: \"blue\" }\n\t *   return <div style={{ background: colors[value] }}>{value}</div>\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   value: {\n\t *     type: ControlType.Enum,\n\t *     defaultValue: \"a\",\n\t *     options: [\"a\", \"b\", \"c\"],\n\t *     optionTitles: [\"Option A\", \"Option B\", \"Option C\"],\n\t *   },\n\t * })\n\t * ```\n\t */\n\tEnum = \"enum\",\n\t/**\n\t * Deprecated, please use {@link ControlType.Enum} and enable displaySegmentedControl.\n\t *\n\t * @deprecated Please use {@link ControlType.Enum} and enable displaySegmentedControl.\n\t * @remarks\n\t * ```javascript\n\t * export function MyComponent(props) {\n\t *   const value = props.value || \"a\"\n\t *   const colors = { a: \"red\", b: \"green\", c: \"blue\" }\n\t *   return <div style={{ background: colors[value] }}>{value}</div>\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   value: {\n\t *     type: ControlType.SegmentedEnum,\n\t *     defaultValue: \"a\",\n\t *     options: [\"a\", \"b\", \"c\"],\n\t *     optionTitles: [\"A\", \"B\", \"C\"],\n\t *   },\n\t * })\n\t * ```\n\t */\n\tSegmentedEnum = \"segmentedenum\",\n\t/**\n\t * A control that represents a color value. It will be included in the component props as a string.\n\t * This control is displayed as a color field and will provide the selected color in either\n\t * HEX (`\"#fff\"`) or HSL (`hsla(203, 87%, 50%, 0.5)`) notation, depending on\n\t * whether there is an alpha channel.\n\t *\n\t * @remarks\n\t * ```javascript\n\t * function MyComponent(props) {\n\t *   return <div style={{ background: props.background }} />\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   background: {\n\t *     type: ControlType.Color,\n\t *     defaultValue: \"#fff\",\n\t *   },\n\t * })\n\t * ```\n\t */\n\tColor = \"color\",\n\t/**\n\t * @deprecated Please use {@link ControlType.ResponsiveImage}\u2019s `src` field instead.\n\t */\n\tImage = \"image\",\n\t/**\n\t * A control that allows the user to pick an image resource. Displayed as an image picker\n\t * with associated file picker.\n\t *\n\t * The chosen image will be provided in the component props as an object with `src` and `srcSet` properties:\n\t * - `src`: a string containing the URL of a full resolution image\n\t * - `srcSet`: an optional string with scaled down image variants. This is typically passed into [`<img srcSet>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset)\n\t *   and helps the browser to load a smaller image when a full-size one isn\u2019t necessary.\n\t * - `alt`: an optional description of the image.\n\t *\n\t * @remarks\n\t * ```javascript\n\t * function MyComponent(props) {\n\t *   return <img src={props.image.src} srcSet={props.image.srcSet} alt={props.image.alt} />\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   image: {\n\t *     type: ControlType.ResponsiveImage,\n\t *   }\n\t * })\n\t * ```\n\t */\n\tResponsiveImage = \"responsiveimage\",\n\t/**\n\t * A control that allows the user to pick a file resource. It will be\n\t * included in the component props as an URL string.\n\t * Displayed as an file picker that will open a native file browser. The\n\t * selected file will be provided as a fully qualified URL. The\n\t * `allowedFileTypes` property must be provided to specify acceptable file\n\t * types.\n\t *\n\t * @remarks\n\t * ```javascript\n\t * export function MyComponent(props) {\n\t *   return (\n\t *     <div>\n\t *       <video\n\t *         style={{ objectFit: \"contain\", props.width, props.height }}\n\t *         src={props.filepath}\n\t *         controls\n\t *       />\n\t *     </div>\n\t *   )\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   filepath: {\n\t *     type: ControlType.File,\n\t *     allowedFileTypes: [\"mov\"],\n\t *   },\n\t * })\n\t * ```\n\t */\n\tFile = \"file\",\n\t/**\n\t * Deprecated, please use {@link ControlType.Slot} instead. The new slot type doesn't need to be\n\t * nested within an array control if you want to allow for multiple slot items to be connected.\n\t * By default the new slot type allows for an infinite amount of items. You can limit the amount\n\t * of items by setting the `maxCount` property.\n\t *\n\t * @deprecated Please use {@link ControlType.Slot} instead.\n\t */\n\tComponentInstance = \"componentinstance\",\n\t/**\n\t * A control that references 1 to many other components on the canvas, included in the component\n\t * props as a React node. This control by default allows any number of components to be linked,\n\t * but this can be limited by setting the `maxCount` property.\n\t *\n\t * ```javascript\n\t * export function MyComponent(props) {\n\t *   return <div>{props.children}</div>\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   children: {\n\t *     type: ControlType.Slot,\n\t *     maxCount: 5,\n\t *   },\n\t * })\n\t * ```\n\t */\n\tSlot = \"slot\",\n\t/**\n\t * A control that allows multiple values per `ControlType`, provided as an\n\t * array via properties. For most control types this will be displayed as an\n\t * additional section in the properties panel allowing as many fields to be\n\t * provided as required.\n\t *\n\t * For a {@link ControlType.ComponentInstance} the Frame will also gain an\n\t * additional outlet control on the Canvas that allows links to be created\n\t * between frames.\n\t *\n\t * Group properties together by using an object control.\n\t *\n\t * For multiple {@link ControlType.FusedNumber} values, you can pass in an\n\t * array of single values as the React default prop.\n\t *\n\t * ```javascript\n\t * export function MyComponent(props) {\n\t *   const frames = props.images.map(image => <img src={image.src} style={{ width: \"100%\", height: \"100%\" }} />)\n\t *   return <div>{frames}</div>\n\t * }\n\t *\n\t * // Add a repeatable image property control\n\t * addPropertyControls(MyComponent, {\n\t *   images: {\n\t *     type: ControlType.Array,\n\t *     control: {\n\t *       type: ControlType.ResponsiveImage\n\t *     }\n\t *   },\n\t *   // Allow up to five items\n\t *   maxCount: 5,\n\t * })\n\t *\n\t * // Add a multi-connector to your component to connect components on the canvas\n\t * addPropertyControls(MyComponent, {\n\t *   children: {\n\t *     type: ControlType.Array,\n\t *     control: {\n\t *       type: ControlType.ComponentInstance\n\t *     },\n\t *     maxCount: 5,\n\t *   },\n\t * })\n\t *\n\t * // Add a list of objects\n\t * addPropertyControls(MyComponent, {\n\t *   myArray: {\n\t *     type: ControlType.Array,\n\t *     control: {\n\t *       type: ControlType.Object,\n\t *       controls: {\n\t *         title: { type: ControlType.String, defaultValue: \"Employee\" },\n\t *         avatar: { type: ControlType.ResponsiveImage },\n\t *       },\n\t *     },\n\t *     defaultValue: [\n\t *       { title: \"Jorn\" },\n\t *       { title: \"Koen\" },\n\t *     ],\n\t *   },\n\t * })\n\t *\n\t * // For multiple values, you can pass in an array of single values as the React default prop.\n\t * MyComponent.defaultProps = {\n\t *    paddings: [5, 10, 15],\n\t * }\n\t * ```\n\t *\n\t */\n\tArray = \"array\",\n\t/**\n\t * A control that exposes events in the prototyping panel within the Framer UI. When choosing an event from the prototyping panel, you can select from a list of actions to trigger.\n\t *\n\t * ```javascript\n\t * export function MyComponent(props) {\n\t *   return <motion.div onTap={props.onTap} />\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   onTap: {\n\t *     type: ControlType.EventHandler,\n\t *   },\n\t * })\n\t * ```\n\t */\n\tEventHandler = \"eventhandler\",\n\t/**\n\t * @internal\n\t * A control used by Framer internally to associate an implicit change handler with another\n\t * control.\n\t */\n\tChangeHandler = \"changehandler\",\n\t/**\n\t * A control that allows for editing Framer Motion transition options within the Framer UI.\n\t *\n\t * ```javascript\n\t * export function MyComponent(props) {\n\t *   return (\n\t *       <motion.div\n\t *          animate={{ scale: 2 }}\n\t *          transition={props.transition}\n\t *       />\n\t *   )\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   transition: {\n\t *       type: ControlType.Transition,\n\t *   },\n\t * })\n\t * ```\n\t */\n\tTransition = \"transition\",\n\t/**\n\t * A control that allows for exposing shadows. The value will be provided as\n\t * a string with valid CSS box-shadow values.\n\t *\n\t * ```javascript\n\t * export function MyComponent(props) {\n\t *  return <motion.div style={{boxShadow: props.shadow}} />\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *  shadow: {\n\t *      type: ControlType.BoxShadow,\n\t *  }\n\t * })\n\t */\n\tBoxShadow = \"boxshadow\",\n\t/**\n\t * A control that allows for exposing web links.\n\t *\n\t * ```javascript\n\t * export function MyComponent(props) {\n\t *   return <a href={props.link}>My Link</a>\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   link: {\n\t *     type: ControlType.Link,\n\t *   }\n\t * })\n\t * ```\n\t */\n\tLink = \"link\",\n\t/**\n\t * A control that allows for exposing dates. The value will be provided in toJSON() string format.\n\t *\n\t * ```javascript\n\t * export function MyComponent(props) {\n\t *   const formattedDate = React.useMemo(() => {\n\t *     return new Date(props.date).toLocaleDateString()\n\t *   }, [props.date])\n\t *   return <div>{formattedDate}</div>\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   date: {\n\t *     type: ControlType.Date,\n\t *     displayTime: true\n\t *   }\n\t * })\n\t * ```\n\t */\n\tDate = \"date\",\n\t/**\n\t * A control that allows for grouping multiple properties as an object.\n\t *\n\t * ```javascript\n\t * export function MyComponent(props) {\n\t *   return <div style={{ opacity: props.myObject.opacity, background: props.myObject.tint }} />\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   myObject: {\n\t *     type: ControlType.Object,\n\t *     controls: {\n\t *       opacity: { type: ControlType.Number },\n\t *       tint: { type: ControlType.Color },\n\t *     }\n\t *   }\n\t * })\n\t * ```\n\t */\n\tObject = \"object\",\n\t/**\n\t * A control that allows for selecting a font to be used in the component.\n\t *\n\t * ```javascript\n\t * export function MyComponent(props) {\n\t *   return <div style={props.customFont} />\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   customFont: {\n\t *     type: ControlType.Font,\n\t *     title: \"Custom Font\",\n\t *     defaultValue: {\n\t *       textAlign: \"left\", // or \"right\", or \"center\", or \"justify\"\n\t *       fontSize: 16, // or \"16px\", or \"16rem\"\n\t *       letterSpacing: 0.1, // or \"0.1em\", or \"1px\"\n\t *       lineHeight: 1.5, // or \"1.5em\", or \"20px\", or \"150%\"\n\t *     },\n\t *     defaultFontType: \"sans-serif\", // or \"serif\", or \"monospace\"\n\t *     defaultFontSize: \"16px\", // or \"16rem\", or \"16pt\"\n\t *     displayTextAlignment: true,\n\t *     displayFontSize: true,\n\t *     controls: \"basic\", // or \"extended\", to show more options\n\t *   }\n\t * })\n\t * ```\n\t */\n\tFont = \"font\",\n\t/**\n\t * @internal\n\t * A control that allows for selecting a page, a path to that page will be provided during\n\t * rendering.\n\t *\n\t * ```javascript\n\t * export function MyComponent(props) {\n\t *   return <div />\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   scope: {\n\t *     type: ControlType.PageScope,\n\t *   }\n\t * })\n\t * ```\n\t */\n\tPageScope = \"pagescope\",\n\t/**\n\t * @internal\n\t * A control that allows specifying a scroll section on the current web page\n\t * which will be provided as a React ref.\n\t */\n\tScrollSectionRef = \"scrollsectionref\",\n\t/**\n\t * @internal\n\t * A control that allows specifying a custom cursor that should be shown\n\t * when mousing over the element assigned.\n\t */\n\tCustomCursor = \"customcursor\",\n\t/**\n\t * @public\n\t * A control that represents a border.\n\t *\n\t * @remarks\n\t * ```javascript\n\t * function MyComponent(props) {\n\t *   return <div style={props.border} />\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   border: {\n\t *     type: ControlType.Border,\n\t *     defaultValue: {\n\t *       borderWidth: 1,\n\t *       borderStyle: \"solid\",\n\t *       borderColor: \"rgba(0, 0, 0, 0.5)\",\n\t *     },\n\t *   }\n\t * })\n\t * ```\n\t */\n\tBorder = \"border\",\n\t/**\n\t * @public\n\t * A control that allows specifying a web cursor that should be shown\n\t * when mousing over the element assigned.\n\t */\n\tCursor = \"cursor\",\n\t/**\n\t * @public\n\t * A control that represents CSS padding.\n\t *\n\t * @remarks\n\t * ```javascript\n\t * function MyComponent({ padding }) {\n\t *   return <div style={{ padding }} />\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   padding: {\n\t *     type: ControlType.Padding,\n\t *     defaultValue: \"8px\",\n\t *   }\n\t * })\n\t */\n\tPadding = \"padding\",\n\t/**\n\t * @public\n\t * A control that represents CSS border radius.\n\t *\n\t * @remarks\n\t * ```javascript\n\t * function MyComponent({ borderRadius }) {\n\t *   return <div style={{ borderRadius }} />\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   borderRadius: {\n\t *     type: ControlType.BorderRadius,\n\t *     defaultValue: \"16px\",\n\t *     title: \"Radius\",\n\t *   }\n\t * })\n\t */\n\tBorderRadius = \"borderradius\",\n\t/**\n\t * A control that represents CSS gap.\n\t *\n\t * @remarks\n\t * ```javascript\n\t * function MyComponent({ gap }) {\n\t *   return <div style={{ gap, display: \"grid\" }} />\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   gap: {\n\t *     type: ControlType.Gap,\n\t *     defaultValue: \"8px\",\n\t *   }\n\t * })\n\t */\n\tGap = \"gap\",\n\t/**\n\t * @internal\n\t * A control that represents the id of a single collection item.\n\t */\n\tCollectionReference = \"collectionreference\",\n\t/**\n\t * @internal\n\t * A control that represents the ids of multiple collection items.\n\t */\n\tMultiCollectionReference = \"multicollectionreference\",\n\t/**\n\t * @public\n\t * A control that represents an id of a tracking event:\n\t * - Lowercase letters (a-z) and numbers (0-9) only\n\t * - Hyphens (-) as separators (no leading/trailing or consecutive hyphens)\n\t * - Valid: \"button-click\", \"form-submit\", \"video-play\", \"nav-item-1\"\n\t * - Invalid: \"Button-Click\", \"form--submit\", \"-button-click\", \"button_utils\"\n\t *\n\t */\n\tTrackingId = \"trackingid\",\n\t/**\n\t * @internal\n\t * A control that provides a React.ComponentInstance of a Vector from a predetermined Vector\n\t * Set.\n\t *\n\t * Not intended to be configurable in user code as it requires knowing global module ids to\n\t * support external vector sets.\n\t *\n\t * @remarks\n\t * ```javascript\n\t * function MyComponent({ Icon }) {\n\t *   return <Icon color=\"red\" />\n\t * }\n\t *\n\t * addPropertyControls(MyComponent, {\n\t *   Icon: {\n\t *     type: ControlType.VectorSetItem,\n\t *     setModuleId: \"yyy\", // Global module id of the Vector Set.\n\t *     defaultValue: {\n\t *       identifier: \"local-module:xxx/yyy:zzz\",\n\t *       moduleId: \"xxx\", // Global module id of the Vector.\n\t *     },\n\t *     title: \"Phosphor\",\n\t *   }\n\t * })\n\t */\n\tVectorSetItem = \"vectorsetitem\",\n\t/**\n\t * @internal\n\t * A control that allows for selecting one or more link rel values.\n\t */\n\tLinkRelValues = \"linkrelvalues\",\n\t/**\n\t * @internal\n\t * A control that stores a geographic location with coordinate, optional place name and address.\n\t */\n\tLocation = \"location\",\n}\n\n/** @public */\nexport interface BaseControlDescription<P = any> {\n\ttitle?: string\n\tdescription?: string\n\t/** @internal */\n\tsection?: string\n\n\thidden?: ((props: P, rootProps: any) => boolean) | boolean\n}\n\n/** @public */\nexport interface WithOptional {\n\toptional?: boolean\n}\n\n/** @public */\nexport interface WithHiddenWhenUnset {\n\thiddenWhenUnset?: boolean\n}\n\n/** @public */\nexport interface BooleanControlDescription<P = any>\n\textends BaseControlDescription<P>, WithOptional, WithHiddenWhenUnset {\n\ttype: ControlType.Boolean\n\tdefaultValue?: boolean\n\t/**\n\t * @deprecated No longer recommended because it should be clear what happens when assigning a\n\t * boolean variable.\n\t */\n\tdisabledTitle?: string\n\t/**\n\t * @deprecated No longer recommended because it should be clear what happens when assigning a\n\t * boolean variable.\n\t */\n\tenabledTitle?: string\n}\n\n/** @public */\nexport interface NumberControlDescription<P = any>\n\textends BaseControlDescription<P>, WithOptional, WithHiddenWhenUnset {\n\ttype: ControlType.Number\n\tdefaultValue?: number\n\tmax?: number\n\tmin?: number\n\tunit?: string\n\tstep?: number\n\tdisplayStepper?: boolean\n}\n\n/** @public */\nexport interface StringControlDescription<P = any>\n\textends BaseControlDescription<P>, WithOptional, WithHiddenWhenUnset {\n\ttype: ControlType.String\n\tdefaultValue?: string\n\tplaceholder?: string\n\tobscured?: boolean\n\tdisplayTextArea?: boolean\n\tpreventLocalization?: boolean\n\t/** @internal */\n\tmaxLength?: number\n}\n\n/** @internal */\nexport interface RichTextControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.RichText\n\tdefaultValue?: string\n\tplaceholder?: string\n\tpreventLocalization?: boolean\n\tmaxLength?: number\n}\n\n/**\n * @deprecated Please use {@link ControlType.Padding} and {@link ControlType.BorderRadius}.\n * @public\n */\nexport interface FusedNumberControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.FusedNumber\n\tdefaultValue?: number\n\ttoggleKey: keyof P\n\ttoggleTitles: [string, string]\n\tvalueKeys: [keyof P, keyof P, keyof P, keyof P]\n\tvalueLabels: [string, string, string, string]\n\tmin?: number\n}\n\n/**\n * @deprecated Please use {@link ControlType.Padding} and {@link ControlType.BorderRadius}.\n * @public\n */\nexport interface DeprecatedFusedNumberControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.FusedNumber\n\tvalueKeys: [keyof P, keyof P, keyof P, keyof P]\n\tvalueLabels: [string, string, string, string]\n\tmin?: number\n\t// deprecated\n\tsplitKey: keyof P\n\tsplitLabels: [string, string]\n}\n\n/** @internal */\nexport type Keyable<T> = T extends string ? T : never\n\n/** @public */\nexport interface EnumControlDescription<P = any> extends BaseControlDescription<P>, WithOptional, WithHiddenWhenUnset {\n\ttype: ControlType.Enum\n\tdefaultValue?: string | boolean | number | null\n\toptions: (string | boolean | number | null)[]\n\toptionTitles?: string[]\n\t/** Display a segmented control instead of a dropdown. Not supported when optional. */\n\tdisplaySegmentedControl?: boolean\n\t/**  Used when displaySegmentedControl is enabled. If not given defaults to horizontal */\n\tsegmentedControlDirection?: \"horizontal\" | \"vertical\"\n\t/**  Used when displaySegmentedControl is enabled @internal */\n\toptionIcons?: SegmentedControlIcon[] | { [K in keyof P]: { [V in Keyable<P[K]>]: SegmentedControlIcon[] } }\n}\n\n/**\n * @deprecated Use {@link EnumControlDescription} instead, and enable displaySegmentedControl.\n * @public\n */\nexport interface SegmentedEnumControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.SegmentedEnum\n\tdefaultValue?: string\n\toptions: string[]\n\toptionTitles?: string[]\n}\n\n/** @public */\nexport interface ColorControlDescription<P = any> extends BaseControlDescription<P>, WithOptional, WithHiddenWhenUnset {\n\ttype: ControlType.Color\n\tdefaultValue?: string\n}\n\n/**\n * @deprecated Use {@link ResponsiveImageControlDescription} instead.\n * @public\n */\nexport interface ImageControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.Image\n}\n\n/** @public */\nexport interface ResponsiveImageControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.ResponsiveImage\n}\n\n/**\n * Supported types are:\n * 1. Valid media types (`\"image/png\"`, `\"audio/*\"`, `\"\u2731/\u2731\"`)\n * 2. File extensions with a leading dot (`\".png\"`)\n * 3. `\"*\"` (`.*` as a pseudo file extension was confirmed to allow everything in file pickers of all three major browser engines)\n * 4. File extensions WITHOUT a leading dot (`\"png\"`) \u2013 unlike in browser APIs \u2013 for backward compatibility and in case something doesn't parse as a media type\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/file#unique_file_type_specifiers\n */\nexport type AllowedFileTypes = readonly string[]\n/** @public */\nexport interface FileControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.File\n\tallowedFileTypes: AllowedFileTypes\n}\n\n/**\n * @deprecated Use {@link SlotControlDescription} instead.\n * @public\n */\nexport interface ComponentInstanceDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.ComponentInstance\n}\n\n/** @public */\nexport interface SlotControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.Slot\n\tmaxCount?: number\n}\n\n/** @public */\nexport interface ArrayControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.Array\n\tcontrol: ArrayItemControlDescription<P>\n\t/** @deprecated This property has been renamed to control. */\n\tpropertyControl?: ArrayItemControlDescription<P>\n\t/**\n\t * @internal This is used by framer internally. Use at your own risk.\n\t */\n\tminCount?: number\n\tmaxCount?: number\n\tdefaultValue?: any[]\n}\n\n/** @public */\nexport interface EventHandlerControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.EventHandler\n}\n\n/** @internal */\nexport interface ChangeHandlerControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.ChangeHandler\n\tchanges: string & keyof P\n}\n\n/** @public */\nexport interface TransitionControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.Transition\n\tdefaultValue?: null | Transition\n}\n\n/** @public */\nexport interface LinkControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.Link\n\tdefaultValue?: string\n}\n\n/** @internal */\nexport interface LinkRelValuesControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.LinkRelValues\n\tdefaultValue?: readonly SupportedLinkRelValue[]\n}\n\n/** @public */\nexport interface DateControlDescription<P = any> extends BaseControlDescription<P>, WithOptional, WithHiddenWhenUnset {\n\ttype: ControlType.Date\n\tdisplayTime?: boolean\n\tdefaultValue?: string\n}\n\n/**\n * @remarks This feature is still in beta\n * @public\n */\nexport interface ObjectControlDescription<P = any>\n\textends BaseControlDescription<P>, WithOptional, WithHiddenWhenUnset {\n\ttype: ControlType.Object\n\tcontrols: { [key: string]: ObjectPropertyControlDescription }\n\tdefaultValue?: { [key: string]: any } // TODO: add type safety\n\tbuttonTitle?: string\n\ticon?: ObjectControlIcon\n}\n\n/** @internal */\nexport interface PageScopeControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.PageScope\n}\n\n/** @internal */\nexport interface ScrollSectionRefControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.ScrollSectionRef\n}\n\n/** @internal */\nexport interface CustomCursorControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.CustomCursor\n}\n\n/**\n * @public\n */\nexport interface BorderControlDescription<P = any>\n\textends BaseControlDescription<P>, WithOptional, WithHiddenWhenUnset {\n\ttype: ControlType.Border\n\tdefaultValue?: Border\n}\n\n/**\n * @public\n * Represents a border style.\n * Either borderWidth or the equivalent per-side\n * values (e.g borderTopWidth, borderLeftWidth, borderRightWidth, borderBottomWidth)\n * will be provided.\n */\nexport interface Border {\n\tborderColor?: string\n\tborderStyle?: BorderStyle\n\tborderWidth?: number\n\tborderTopWidth?: number\n\tborderLeftWidth?: number\n\tborderRightWidth?: number\n\tborderBottomWidth?: number\n}\n\n/**\n * @public\n */\nexport interface CursorControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.Cursor\n\tdefaultValue?: string\n}\n\nexport interface PaddingControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.Padding\n\tdefaultValue?: string\n}\n\nexport interface BorderRadiusControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.BorderRadius\n\tdefaultValue?: string\n}\n\nexport interface GapControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.Gap\n\tdefaultValue?: string\n}\n\n/** @internal */\nexport interface CollectionReferenceControlDescription<P = any>\n\textends BaseControlDescription<P>, WithOptional, WithHiddenWhenUnset {\n\ttype: ControlType.CollectionReference\n\tdataIdentifier: string\n\tdefaultValue?: string\n}\n\n/** @internal */\nexport interface MultiCollectionReferenceControlDescription<P = any>\n\textends BaseControlDescription<P>, WithOptional, WithHiddenWhenUnset {\n\ttype: ControlType.MultiCollectionReference\n\tdataIdentifier: string\n\tdefaultValue?: string[]\n}\n\nexport interface TrackingIdControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.TrackingId\n\tdefaultValue?: string\n}\n\n/** @internal */\nexport interface VectorSetItemControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.VectorSetItem\n\tsetModuleId: string\n\tdefaultValue: {\n\t\tidentifier: string\n\t\tmoduleId: string\n\t}\n}\n\n/** @internal */\nexport interface Coordinate {\n\tlatitude: number\n\tlongitude: number\n}\n\n/** @internal */\nexport interface Location {\n\tcoordinate: Coordinate\n\t/** Optional place name (e.g., \"Eiffel Tower\", \"Framer\") */\n\ttitle?: string\n\t/** Optional formatted address string (e.g., \"Rozengracht 207, 1016 LZ Amsterdam, Netherlands\") */\n\taddress?: string\n}\n\n/** @internal */\nexport interface LocationControlDescription<P = any>\n\textends BaseControlDescription<P>, WithOptional, WithHiddenWhenUnset {\n\ttype: ControlType.Location\n\tdefaultValue?: Location\n}\n\ninterface FontControlDescriptionBase<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.Font\n\tcontrols?: \"basic\" | \"extended\"\n\tdisplayTextAlignment?: boolean\n\tdisplayFontSize?: boolean\n\tdefaultValue?: FontControlDefaultValueBase\n}\n\ninterface FontControlDescriptionSansSerif<P = any> extends FontControlDescriptionBase<P> {\n\tdefaultFontType?: \"sans-serif\"\n\tdefaultValue?: FontControlDefaultValueWithVariant\n}\n\ninterface FontControlDescriptionSerif<P = any> extends FontControlDescriptionBase<P> {\n\tdefaultFontType?: \"serif\"\n\tdefaultValue?: FontControlDefaultValueBase\n}\n\ninterface FontControlDescriptionMonospace<P = any> extends FontControlDescriptionBase<P> {\n\tdefaultFontType?: \"monospace\"\n\tdefaultValue?: FontControlDefaultValueBase\n}\n\nexport type FontControlDescription<P = any> =\n\t| FontControlDescriptionSansSerif<P>\n\t| FontControlDescriptionMonospace<P>\n\t| FontControlDescriptionSerif<P>\n\ninterface FontControlDefaultValueBase {\n\ttextAlign?: \"left\" | \"right\" | \"center\" | \"justify\"\n\tfontSize?: string | number\n\tletterSpacing?: string | number\n\tlineHeight?: string | number\n}\n\ninterface FontControlDefaultValueWithVariant extends FontControlDefaultValueBase {\n\tvariant?: FramerFontVariant\n}\n\n/** @public */\nexport interface BoxShadowControlDescription<P = any> extends BaseControlDescription<P> {\n\ttype: ControlType.BoxShadow\n\tdefaultValue?: string | readonly BoxShadow[]\n}\n\n/**\n * Segment Control Icons provided by Framer\n * @internal\n */\nexport type SegmentedControlIcon =\n\t| \"align-left\"\n\t| \"align-center\"\n\t| \"align-right\"\n\t| \"align-top\"\n\t| \"align-middle\"\n\t| \"align-bottom\"\n\t| \"direction-up\"\n\t| \"direction-right\"\n\t| \"direction-down\"\n\t| \"direction-left\"\n\t| \"direction-horizontal\"\n\t| \"direction-vertical\"\n\t| \"direction-all\"\n\t| \"text-align-left\"\n\t| \"text-align-center\"\n\t| \"text-align-right\"\n\t| \"text-align-top\"\n\t| \"text-align-middle\"\n\t| \"text-align-bottom\"\n\t| \"navigation-transition-instant\"\n\t| \"navigation-transition-magicMotion\"\n\t| \"navigation-transition-push\"\n\t| \"navigation-transition-modal\"\n\t| \"navigation-transition-overlay\"\n\t| \"navigation-transition-fade\"\n\t| \"navigation-transition-flip\"\n\t| \"orientation-portrait\"\n\t| \"orientation-landscape\"\n\n/**\n * Object Control Icons provided by Framer\n */\nexport type ObjectControlIcon = \"object\" | \"effect\" | \"color\" | \"interaction\" | \"boolean\"\n", "function getNavigator(): Navigator | undefined {\n\treturn typeof navigator !== \"undefined\" ? navigator : undefined\n}\n\nfunction getWindow(): (Window & typeof globalThis) | undefined {\n\treturn typeof window !== \"undefined\" ? window : undefined\n}\n\n// Operating System Detection\n\nconst macRegex = /Mac/u\nconst winRegex = /Win/u\nconst iOSRegex = /iPhone|iPod|iPad/iu\nconst macIntelRegex = /MacIntel/iu\nconst androidRegex = /android/iu\n\n/**\n * @deprecated\n * - When checking for whether a keyboard event happened with the Cmd button pressed, use {@link isCommandKeyPressed} instead.\n * - When checking for whether the keyboard has a Cmd button, use {@link isAppleDevice} instead. iPads also have keyboards.\n * - When checking for scrollbar visibility: don\u2019t (visibility is configurable in macOS), or use CSS and `window.matchMedia()`.\n */\nexport function isMacOS(): boolean {\n\tconst nav = getNavigator()\n\treturn nav ? macRegex.test(nav.platform) : false\n}\n\nexport function isWindows(): boolean {\n\tconst nav = getNavigator()\n\treturn nav ? winRegex.test(nav.platform) : false\n}\n\nexport function isIOS(): boolean {\n\tconst nav = getNavigator()\n\tif (!nav) return false\n\n\tif (iOSRegex.test(nav.platform)) return true\n\n\t// iPadOS might be detected as MacIntel, so we need to check for maxTouchPoints.\n\treturn macIntelRegex.test(nav.platform) && nav.maxTouchPoints != null && nav.maxTouchPoints > 2\n}\n\n/** Returns true if the device is running macOS or iOS. */\nexport function isAppleDevice(): boolean {\n\treturn isMacOS() || isIOS()\n}\n\nexport function isAndroid(): boolean {\n\tconst nav = getNavigator()\n\treturn nav ? androidRegex.test(nav.userAgent) : false\n}\n\n// Browser Detection\n\nconst edgeRegex = /Edg\\//u\nexport function isEdge(): boolean {\n\tconst nav = getNavigator()\n\treturn nav ? edgeRegex.test(nav.userAgent) : false\n}\n\nconst chromeRegex = /Chrome/u\nconst googleVendorRegex = /Google Inc/u\nexport function isChrome(): boolean {\n\tconst nav = getNavigator()\n\treturn nav ? chromeRegex.test(nav.userAgent) && googleVendorRegex.test(nav.vendor) && !isEdge() : false\n}\n\nconst appleWebKitRegex = /AppleWebKit\\//u\nexport function isWebKit(): boolean {\n\tconst nav = getNavigator()\n\treturn nav ? appleWebKitRegex.test(nav.userAgent) && !isChrome() && !isEdge() : false\n}\n\nconst safariRegex = /Safari/u\nconst appleComputerRegex = /Apple Computer/u\nexport function isSafari(): boolean {\n\tconst nav = getNavigator()\n\treturn nav ? safariRegex.test(nav.userAgent) && appleComputerRegex.test(nav.vendor) : false\n}\n\nexport function isSafariDesktop(): boolean {\n\treturn isSafari() && !isTouch()\n}\n\nconst firefoxRegex = /Firefox\\/\\d+\\.\\d+$/u\nexport function isFirefox(): boolean {\n\tconst nav = getNavigator()\n\treturn nav ? firefoxRegex.test(nav.userAgent) : false\n}\n\nexport function isBrowser(): boolean {\n\treturn typeof document === \"object\"\n}\n\n// Browser Version Helpers\n\nconst chromeVersionRegex = /Chrome\\/(\\d+)/u\nexport function chromeMainVersion(): number {\n\tconst nav = getNavigator()\n\tif (!nav) return -1\n\tconst result = chromeVersionRegex.exec(nav.userAgent)\n\tif (!result || !result[1]) return -1\n\n\tconst version = parseInt(result[1])\n\treturn Number.isFinite(version) ? version : -1\n}\n\nconst safariVersionRegex = /Version\\/([\\d.]+)/u\nexport function safariVersion(): number {\n\tconst nav = getNavigator()\n\tif (!nav) return -1\n\tconst result = safariVersionRegex.exec(nav.userAgent)\n\tif (result?.[1]) {\n\t\treturn parseFloat(result[1])\n\t}\n\treturn -1\n}\n\n// Client Environment Detection\n\nconst framerXRegex = /FramerX/u\nexport function isFramerX(): boolean {\n\tconst nav = getNavigator()\n\treturn nav ? framerXRegex.test(nav.userAgent) : false\n}\n\nexport function isElectron(): boolean {\n\tconst nav = getNavigator()\n\treturn nav ? nav.userAgent.includes(\"Electron\") : false\n}\n\nexport function isEditorBar(): boolean {\n\tconst win = getWindow()\n\treturn win ? win.location.pathname.startsWith(\"/edit\") : false\n}\n\n// Build Environment Detection\n\nexport function isTest(): boolean {\n\treturn process.env.NODE_ENV === \"test\"\n}\n\nexport function isProduction(): boolean {\n\treturn process.env.NODE_ENV === \"production\"\n}\n\n// Device Detection\n\nexport function isTouch(): boolean {\n\tconst win = getWindow()\n\tconst nav = getNavigator()\n\tif (!win || !nav) return false\n\n\treturn \"ontouchstart\" in win || nav.maxTouchPoints > 0\n}\n\n/**\n * Returns `true` if the primary input device is a \"fine\" pointer (e.g., mouse, trackpad).\n * Returns `false` for \"coarse\" pointers (e.g., touchscreens) or if `window.matchMedia` is not available.\n *\n * @important Use this when differentiating between mouse/trackpad interactions and touch interactions.\n * For checking if *any* touch capability exists, use `isTouch()`.\n *\n * @note Both mouse and trackpad are treated as \"fine\" pointers and should prefer mouseDown behavior.\n */\nexport function hasFinePointer(): boolean {\n\tconst win = getWindow()\n\tif (!win || typeof win.matchMedia !== \"function\") {\n\t\treturn false\n\t}\n\treturn win.matchMedia(\"(pointer: fine)\").matches\n}\n\n/**\n * Returns `true` if the device is a small touchscreen (e.g., a phone).\n * Returns `false` for tablets, laptops with touchscreens, and desktops.\n *\n * Use this to apply mobile-specific UI adaptations (e.g., larger touch targets,\n * different menu placement) that should NOT apply to iPads or other large-screen\n * touch devices that have enough space for desktop-style UI.\n */\nexport function isSmallTouchScreen(): boolean {\n\tif (hasFinePointer()) return false\n\n\tconst win = getWindow()\n\tif (!win) return false\n\n\t// 430px matches the mobile breakpoint used across the app\n\treturn Math.min(win.innerWidth, win.innerHeight) <= 430\n}\n\nconst tabletRegex = /tablet|iPad|Nexus 9/iu\nconst mobileRegex = /mobi/iu\n\nexport function deviceType(): \"desktop\" | \"phone\" | \"tablet\" {\n\t// https://github.com/jeffmcmahan/device-detective/blob/master/bin/device-detect.js\n\tconst nav = getNavigator()\n\tif (nav && tabletRegex.test(nav.userAgent)) return \"tablet\"\n\tif (nav && mobileRegex.test(nav.userAgent)) return \"phone\"\n\treturn \"desktop\"\n}\n\nexport function isDesktop(): boolean {\n\treturn deviceType() === \"desktop\"\n}\n\nexport function isPhone(): boolean {\n\treturn deviceType() === \"phone\"\n}\n\nexport function isTablet(): boolean {\n\treturn deviceType() === \"tablet\"\n}\n\nexport function isMobile(): boolean {\n\treturn isPhone() || isTablet()\n}\n\n// Embedded and Webview Detection\n\nconst embeddedRegex = /Instagram|FB_IAB\\/FB4A|FBAN\\/FBIOS|BytedanceWebview|Twitter|LinkedIn/iu\nexport function isEmbedded(): boolean {\n\t// Attempt to detect embedded webviews from social media platforms\n\t// FB\u2026 = Facebook (https://developers.facebook.com/docs/sharing/best-practices)\n\t// BytedanceWebview = TikTok\n\tconst nav = getNavigator()\n\treturn nav ? embeddedRegex.test(nav.userAgent) : false\n}\n\n// See https://stackoverflow.com/a/61251124\nfunction isAndroidWebView(): boolean {\n\tconst nav = getNavigator()\n\treturn nav ? isChrome() && nav.userAgent.toLowerCase().includes(\"; wv)\") : false\n}\n\nfunction isIosWebView(): boolean {\n\tconst nav = getNavigator()\n\treturn nav ? isWebKit() && !nav.userAgent.toLowerCase().includes(\"safari/\") : false\n}\n\n// We don't aim to support webview detection on platforms other than Android and iOS\nexport function isWebView(): boolean {\n\treturn isAndroidWebView() || isIosWebView()\n}\n\n// URL Helpers\n\nconst absoluteUrlRegex = /^[a-z]{1,8}:\\/\\/.*$/iu\n\nexport function isRelativeUrl(url: string): boolean {\n\treturn !absoluteUrlRegex.test(url)\n}\n\nexport function isFileUrl(url: string): boolean {\n\treturn url.startsWith(\"file://\")\n}\n\nexport function isDataUrl(url: string): boolean {\n\treturn url.startsWith(\"data:\")\n}\n\nconst localServerUrlRegex1 = /[a-z]{1,8}:\\/\\/127\\.0\\.0\\.1/iu\nconst localServerUrlRegex2 = /[a-zA-Z]{1,8}:\\/\\/localhost/u\n\nexport function isLocalServerUrl(url: string): boolean {\n\treturn localServerUrlRegex1.test(url) || localServerUrlRegex2.test(url)\n}\n\nexport function isLocalUrl(url: string): boolean {\n\tif (isFileUrl(url)) return true\n\tif (isLocalServerUrl(url)) return true\n\treturn false\n}\n\n// Keyboard Helpers\n\nexport function isCommandKeyPressed(event: { metaKey: boolean; ctrlKey: boolean }): boolean {\n\t// eslint-disable-next-line no-restricted-syntax -- This is the replacement function that\u2019s referenced by the ban\n\treturn isAppleDevice() ? event.metaKey : event.ctrlKey\n}\n", "import { isBrowser } from \"@framerjs/shared/src/environment.ts\"\nimport React, { useInsertionEffect } from \"react\"\nimport type { StylesheetContextValue } from \"../render/StyleSheetContext.ts\"\nimport { StyleSheetContext } from \"../render/StyleSheetContext.ts\"\nimport { RenderTarget } from \"../render/types/RenderEnvironment.ts\"\nimport * as CSS from \"../render/utils/setDocumentStyles.ts\"\nimport { isFunction } from \"../utils/utils.ts\"\n\nconst framerPostSSRCSSSelector = \"style[data-framer-css-ssr-minified]\"\n\n// Figure out which elements had their styles server-rendered \u2013 and avoid injecting their styles again.\n// We\u2019re doing this for a) performance, b) DX (this reduces the number of duplicated styles in DevTools).\n// (Using /* #__PURE__ */ to make sure this gets removed from the bundle when `withCSS` is tree-shaken away: https://www.notion.so/framer/Preventing-side-effects-in-library-modules-tree-shaking-54ab6ebf7256459a816a0c689f476fd1?pvs=4.)\nconst componentsWithServerRenderedStyles: Set<string> = /* #__PURE__ */ (() => {\n\tif (!isBrowser()) return new Set()\n\n\tconst componentsWithSSRStylesAttr = document\n\t\t.querySelector(framerPostSSRCSSSelector)\n\t\t?.getAttribute(\"data-framer-components\")\n\n\tif (!componentsWithSSRStylesAttr) return new Set()\n\n\treturn new Set(componentsWithSSRStylesAttr.split(\" \"))\n})()\n\n/**\n * Marks <style> tags that are created by Framer and must be minified and moved to <head> during SSG.\n * We don\u2019t minify and move non-Framer <style> tags because that\u2019d cause hydration mismatches (e.g.\n * when a <style> tag is added by a code component.)\n *\n * @deprecated This is no longer used by withCSS, but we still use it tag some global styles.\n *\n * @internal\n */\nexport const framerCSSMarker = \"data-framer-css-ssr\"\n\n/**\n * Render a React component with css that will be injected into the document's\n * head when the component is first rendered. The escapedCSS argument can either\n * be a string where each line is a css rule, or an array of css rule strings.\n *\n * @public\n */\nexport const withCSS = <T extends object>(\n\tComponent: React.ComponentType<T>,\n\tescapedCSS: ((target: RenderTarget, props?: T) => string[]) | string[] | string,\n\tcomponentSerializationId: string,\n) =>\n\tReact.forwardRef((props: T, ref) => {\n\t\tconst { sheet, cache } = React.useContext<StylesheetContextValue | undefined>(StyleSheetContext) ?? {}\n\t\t// This might be `undefined` in older components that got published before https://github.com/framer/FramerStudio/pull/13459,\n\t\t// or for code components / overrides, where it was left out before making the arg mandatory.\n\t\tconst id: string | undefined = componentSerializationId\n\n\t\tif (!isBrowser()) {\n\t\t\tif (isFunction(escapedCSS)) escapedCSS = escapedCSS(RenderTarget.current(), props)\n\t\t\tconst concatenatedCSS = Array.isArray(escapedCSS) ? escapedCSS.join(\"\\n\") : escapedCSS\n\t\t\tcssCollector.add(concatenatedCSS, id)\n\t\t}\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: has been like this for a long time\n\t\tuseInsertionEffect(() => {\n\t\t\t// If the styles already exist in the head due to SSG, avoid re-adding them to improve hydration performance.\n\t\t\tif (id && componentsWithServerRenderedStyles.has(id)) return\n\t\t\tconst css = isFunction(escapedCSS)\n\t\t\t\t? escapedCSS(RenderTarget.current(), props)\n\t\t\t\t: Array.isArray(escapedCSS)\n\t\t\t\t\t? escapedCSS\n\t\t\t\t\t: escapedCSS.split(\"\\n\")\n\t\t\tcss.forEach(rule => rule && CSS.injectCSSRule(rule, sheet, cache))\n\t\t}, [])\n\n\t\treturn <Component {...props} ref={ref} />\n\t})\n\nclass CSSCollector {\n\tprivate styles: Set<string> = new Set()\n\tprivate componentIds: Set<string> = new Set()\n\n\tadd(css: string, componentId: string | undefined) {\n\t\tthis.styles.add(css)\n\t\tif (componentId) this.componentIds.add(componentId)\n\t}\n\n\tgetStyles(): Iterable<string, unknown, unknown> {\n\t\treturn this.styles\n\t}\n\n\tgetComponentIds(): Iterable<string, unknown, unknown> {\n\t\treturn this.componentIds\n\t}\n\n\tclear() {\n\t\tthis.styles.clear()\n\t\tthis.componentIds.clear()\n\t}\n}\n\nexport const cssCollector = /* @__PURE__ */ new CSSCollector()\n", "import React from \"react\"\n\n/** @internal */\nexport interface StylesheetContextValue {\n\treadonly sheet: CSSStyleSheet\n\treadonly cache: Set<string>\n}\n\n/** @internal */\nexport const StyleSheetContext = /* @__PURE__ */ React.createContext<StylesheetContextValue | undefined>(undefined)\n", "const defaultCache = new Set<string>()\nlet defaultSheet: CSSStyleSheet | undefined\n\n/**\n * Add CSS to the document.\n *\n * @param cssRule - CSS rule to add to the document\n */\nexport function injectCSSRule(cssRule: string, sheet: CSSStyleSheet | undefined, cache: Set<string> = defaultCache) {\n\tif (!cssRule || cache.has(cssRule) || typeof document === \"undefined\") return\n\n\tcache.add(cssRule)\n\n\tif (!sheet) {\n\t\tif (!defaultSheet) {\n\t\t\tconst styleElement = document.createElement(\"style\")\n\t\t\tstyleElement.setAttribute(\"type\", \"text/css\")\n\t\t\tstyleElement.setAttribute(\"data-framer-css\", \"true\")\n\n\t\t\t// document.head technically may in fact be null:\n\t\t\t// https://html.spec.whatwg.org/multipage/dom.html#dom-document-head-dev\n\t\t\tif (!document.head) {\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\t\tconsole.warn(\"not injecting CSS: the document is missing a <head> element\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdocument.head.appendChild(styleElement)\n\n\t\t\tif (styleElement.sheet) {\n\t\t\t\tdefaultSheet = styleElement.sheet\n\t\t\t} else {\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\t\tconsole.warn(\"not injecting CSS: injected <style> element does not have a sheet\", styleElement)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tsheet = defaultSheet\n\t}\n\n\ttry {\n\t\tsheet.insertRule(cssRule, sheet.cssRules.length)\n\t} catch {\n\t\t// Assume that errors are from malformed rules, or rules that are not\n\t\t// valid in the current browser, and swallow the error.\n\t\t//\n\t\t// For example, `input[type=\"range\"]::-moz-range-thumb` will error in\n\t\t// Chrome, but not Firefox.\n\t}\n}\n", "let isFlexboxGapSupportedCached: boolean | undefined\n\n/* @internal */\nexport function isFlexboxGapSupported() {\n\tif (isFlexboxGapSupportedCached !== undefined) {\n\t\treturn isFlexboxGapSupportedCached\n\t}\n\n\t// Source: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/css/flexgap.js\n\t// create flex container with row-gap set\n\tconst flex = document.createElement(\"div\")\n\tObject.assign(flex.style, {\n\t\tposition: \"absolute\", // avoid layout shift\n\t\tdisplay: \"flex\",\n\t\tflexDirection: \"column\",\n\t\trowGap: \"1px\",\n\t})\n\n\t// create two elements inside it\n\tflex.appendChild(document.createElement(\"div\"))\n\tflex.appendChild(document.createElement(\"div\"))\n\n\t// append to the DOM (needed to obtain scrollHeight)\n\tdocument.body.appendChild(flex)\n\tconst isSupported = flex.scrollHeight === 1 // flex container should be 1px high from the row-gap\n\tif (flex.parentNode) {\n\t\tflex.parentNode.removeChild(flex)\n\t}\n\n\tisFlexboxGapSupportedCached = isSupported\n\treturn isSupported\n}\n", "import { isFlexboxGapSupported } from \"./isFlexboxGapSupported.ts\"\n\n/**\n * @internal\n */\nexport const flexboxGapNotSupportedClass = \"flexbox-gap-not-supported\"\n\nlet initialized = false\n/**\n * @internal\n */\nexport function installFlexboxGapWorkaroundIfNeeded() {\n\tif (initialized) return\n\tinitialized = true\n\tif (isFlexboxGapSupported()) return\n\tdocument.body.classList.add(flexboxGapNotSupportedClass)\n}\n", "const richTextStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] p,\n[data-framer-component-type=\"DeprecatedRichText\"] div,\n[data-framer-component-type=\"DeprecatedRichText\"] h1,\n[data-framer-component-type=\"DeprecatedRichText\"] h2,\n[data-framer-component-type=\"DeprecatedRichText\"] h3,\n[data-framer-component-type=\"DeprecatedRichText\"] h4,\n[data-framer-component-type=\"DeprecatedRichText\"] h5,\n[data-framer-component-type=\"DeprecatedRichText\"] h6,\n[data-framer-component-type=\"DeprecatedRichText\"] li,\n[data-framer-component-type=\"DeprecatedRichText\"] ol,\n[data-framer-component-type=\"DeprecatedRichText\"] ul,\n[data-framer-component-type=\"DeprecatedRichText\"] span:not([data-text-fill]) {\n    font-family: var(--framer-font-family, Inter, Inter Placeholder, sans-serif);\n    font-style: var(--framer-font-style, normal);\n    font-weight: var(--framer-font-weight, 400);\n    color: var(--framer-text-color, #000);\n    font-size: var(--framer-font-size, 16px);\n    letter-spacing: var(--framer-letter-spacing, 0);\n    text-transform: var(--framer-text-transform, none);\n    text-decoration: var(--framer-text-decoration, none);\n    line-height: var(--framer-line-height, 1.2em);\n    text-align: var(--framer-text-alignment, start);\n}\n`\n\nconst richTextParagraphSpacingStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] p:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] div:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] h1:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] h2:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] h3:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] h4:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] h5:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] h6:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] ol:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] ul:not(:first-child),\n[data-framer-component-type=\"DeprecatedRichText\"] .framer-image:not(:first-child) {\n    margin-top: var(--framer-paragraph-spacing, 0);\n}\n`\n\nconst richTextBackgroundMaskStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] span[data-text-fill] {\n    display: inline-block;\n    background-clip: text;\n    -webkit-background-clip: text;\n    -webkit-text-fill-color: transparent;\n}\n`\n\nconst richTextLinkStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] a,\n[data-framer-component-type=\"DeprecatedRichText\"] a span:not([data-text-fill]) {\n    font-family: var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif));\n    font-style: var(--framer-link-font-style, var(--framer-font-style, normal));\n    font-weight: var(--framer-link-font-weight, var(--framer-font-weight, 400));\n    color: var(--framer-link-text-color, var(--framer-text-color, #000));\n    font-size: var(--framer-link-font-size, var(--framer-font-size, 16px));\n    text-transform: var(--framer-link-text-transform, var(--framer-text-transform, none));\n    text-decoration: var(--framer-link-text-decoration, var(--framer-text-decoration, none));\n}\n`\n\nconst richTextLinkHoverStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] a:hover,\n[data-framer-component-type=\"DeprecatedRichText\"] a:hover span:not([data-text-fill]) {\n    font-family: var(--framer-link-hover-font-family, var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif)));\n    font-style: var(--framer-link-hover-font-style, var(--framer-link-font-style, var(--framer-font-style, normal)));\n    font-weight: var(--framer-link-hover-font-weight, var(--framer-link-font-weight, var(--framer-font-weight, 400)));\n    color: var(--framer-link-hover-text-color, var(--framer-link-text-color, var(--framer-text-color, #000)));\n    font-size: var(--framer-link-hover-font-size, var(--framer-link-font-size, var(--framer-font-size, 16px)));\n    text-transform: var(--framer-link-hover-text-transform, var(--framer-link-text-transform, var(--framer-text-transform, none)));\n    text-decoration: var(--framer-link-hover-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, none)));\n}\n`\n\nconst richTextLinkCurrentStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] a[data-framer-page-link-current],\n[data-framer-component-type=\"DeprecatedRichText\"] a[data-framer-page-link-current] span:not([data-text-fill]):not([data-nested-link]) {\n    font-family: var(--framer-link-current-font-family, var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif)));\n    font-style: var(--framer-link-current-font-style, var(--framer-link-font-style, var(--framer-font-style, normal)));\n    font-weight: var(--framer-link-current-font-weight, var(--framer-link-font-weight, var(--framer-font-weight, 400)));\n    color: var(--framer-link-current-text-color, var(--framer-link-text-color, var(--framer-text-color, #000)));\n    font-size: var(--framer-link-current-font-size, var(--framer-link-font-size, var(--framer-font-size, 16px)));\n    text-transform: var(--framer-link-current-text-transform, var(--framer-link-text-transform, var(--framer-text-transform, none)));\n    text-decoration: var(--framer-link-current-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, none)));\n}\n`\n\nconst richTextLinkCurrentHoverStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] a[data-framer-page-link-current]:hover,\n[data-framer-component-type=\"DeprecatedRichText\"] a[data-framer-page-link-current]:hover span:not([data-text-fill]):not([data-nested-link]) {\n    font-family: var(--framer-link-hover-font-family, var(--framer-link-current-font-family, var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif))));\n    font-style: var(--framer-link-hover-font-style, var(--framer-link-current-font-style, var(--framer-link-font-style, var(--framer-font-style, normal))));\n    font-weight: var(--framer-link-hover-font-weight, var(--framer-link-current-font-weight, var(--framer-link-font-weight, var(--framer-font-weight, 400))));\n    color: var(--framer-link-hover-text-color, var(--framer-link-current-text-color, var(--framer-link-text-color, var(--framer-text-color, #000))));\n    font-size: var(--framer-link-hover-font-size, var(--framer-link-current-font-size, var(--framer-link-font-size, var(--framer-font-size, 16px))));\n    text-transform: var(--framer-link-hover-text-transform, var(--framer-link-current-text-transform, var(--framer-link-text-transform, var(--framer-text-transform, none))));\n    text-decoration: var(--framer-link-hover-text-decoration, var(--framer-link-current-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, none))));\n}\n`\n\nconst richTextBoldStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] strong {\n    font-weight: bolder;\n}\n`\n\nconst richTextItalicStylesRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] em {\n    font-style: italic;\n}\n`\n\n// Sync with RichTextEditorWithToolbar.styles.ts\nconst richTextImageRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] .framer-image {\n    display: block;\n    max-width: 100%;\n    height: auto;\n}\n`\n\nconst richTextBlockElementResetRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] p,\n[data-framer-component-type=\"DeprecatedRichText\"] div,\n[data-framer-component-type=\"DeprecatedRichText\"] h1,\n[data-framer-component-type=\"DeprecatedRichText\"] h2,\n[data-framer-component-type=\"DeprecatedRichText\"] h3,\n[data-framer-component-type=\"DeprecatedRichText\"] h4,\n[data-framer-component-type=\"DeprecatedRichText\"] h5,\n[data-framer-component-type=\"DeprecatedRichText\"] h6 {\n    margin: 0;\n    padding: 0;\n}\n`\n\nconst richTextStylesPresetResetRule = `\n[data-framer-component-type=\"DeprecatedRichText\"] .text-styles-preset-reset {\n    --framer-font-family: Inter, Inter Placeholder, sans-serif;\n    --framer-font-style: normal;\n    --framer-font-weight: 500;\n    --framer-text-color: #000;\n    --framer-font-size: 16px;\n    --framer-letter-spacing: 0;\n    --framer-text-transform: none;\n    --framer-text-decoration: none;\n    --framer-line-height: 1.2em;\n    --framer-text-alignment: start;\n    --framer-font-open-type-features: normal;\n    --font-variation-settings: normal;\n}\n`\n\nconst richTextStylesList = `\n[data-framer-component-type=\"DeprecatedRichText\"] ul,\n[data-framer-component-type=\"DeprecatedRichText\"] ol {\n    display: table;\n    width: 100%;\n    padding-left: 0;\n    margin: 0;\n}\n`\n\nconst richTextStylesListItem = `\n[data-framer-component-type=\"DeprecatedRichText\"] li {\n    display: table-row;\n    counter-increment: list-item;\n    list-style: none;\n}\n`\n\nconst richTextStylesNumberedListMarker = `\n[data-framer-component-type=\"DeprecatedRichText\"] ol > li::before {\n    display: table-cell;\n    width: 2.25ch;\n    box-sizing: border-box;\n    padding-right: 0.75ch;\n    content: counter(list-item) \".\";\n    white-space: nowrap;\n}\n`\n\nconst richTextStylesBulletedListMarker = `\n[data-framer-component-type=\"DeprecatedRichText\"] ul > li::before {\n    display: table-cell;\n    width: 2.25ch;\n    box-sizing: border-box;\n    padding-right: 0.75ch;\n    content: \"\u2022\";\n}\n`\n\nexport const deprecatedRichTextCSSRules = [\n\t`[data-framer-component-type=\"DeprecatedRichText\"] { cursor: inherit; }`,\n\trichTextStylesPresetResetRule,\n\trichTextBlockElementResetRule,\n\trichTextStylesRule,\n\trichTextParagraphSpacingStylesRule,\n\trichTextBackgroundMaskStylesRule,\n\trichTextLinkStylesRule,\n\trichTextLinkHoverStylesRule,\n\trichTextLinkCurrentStylesRule,\n\trichTextLinkCurrentHoverStylesRule,\n\trichTextBoldStylesRule,\n\trichTextItalicStylesRule,\n\trichTextImageRule,\n\trichTextStylesList,\n\trichTextStylesListItem,\n\trichTextStylesNumberedListMarker,\n\trichTextStylesBulletedListMarker,\n]\n", "import type { CSSProperties } from \"react\"\nimport React from \"react\"\nimport { assert } from \"../../../utils/assert.ts\"\n\n/**\n * FormInputStyleVariableNames represents all of the known\n * CSS variables available to be set for inputs within a form.\n * @internal\n */\nexport enum FormInputStyleVariableNames {\n\tPadding = \"--framer-input-padding\",\n\t// We collect the per corner radius values and have separate CSS variables for each corner\n\t// in order to maintain some compatibility with the existing collectRadius function.\n\tBorderRadiusTopLeft = \"--framer-input-border-radius-top-left\",\n\tBorderRadiusTopRight = \"--framer-input-border-radius-top-right\",\n\tBorderRadiusBottomRight = \"--framer-input-border-radius-bottom-right\",\n\tBorderRadiusBottomLeft = \"--framer-input-border-radius-bottom-left\",\n\tCornerShape = \"--framer-input-corner-shape\",\n\tBorderColor = \"--framer-input-border-color\",\n\tBorderTopWidth = \"--framer-input-border-top-width\",\n\tBorderRightWidth = \"--framer-input-border-right-width\",\n\tBorderBottomWidth = \"--framer-input-border-bottom-width\",\n\tBorderLeftWidth = \"--framer-input-border-left-width\",\n\tBorderStyle = \"--framer-input-border-style\",\n\tBackground = \"--framer-input-background\",\n\tFontFamily = \"--framer-input-font-family\",\n\tFontWeight = \"--framer-input-font-weight\",\n\tFontSize = \"--framer-input-font-size\",\n\tFontColor = \"--framer-input-font-color\",\n\tFontStyle = \"--framer-input-font-style\",\n\tFontLetterSpacing = \"--framer-input-font-letter-spacing\",\n\tFontTextAlignment = \"--framer-input-font-text-alignment\",\n\tFontLineHeight = \"--framer-input-font-line-height\",\n\tFontOpenType = \"--framer-input-font-open-type-features\",\n\tFontVariationAxes = \"--framer-input-font-variation-axes\",\n\n\tPlaceholderColor = \"--framer-input-placeholder-color\",\n\tBoxShadow = \"--framer-input-box-shadow\",\n\n\t// Focused style variables\n\tFocusedBorderColor = \"--framer-input-focused-border-color\",\n\tFocusedBorderWidth = \"--framer-input-focused-border-width\",\n\tFocusedBorderStyle = \"--framer-input-focused-border-style\",\n\tFocusedBackground = \"--framer-input-focused-background\",\n\tFocusedBoxShadow = \"--framer-input-focused-box-shadow\",\n\tFocusedTransition = \"--framer-input-focused-transition\",\n\n\t// Boolean input style variables\n\tBooleanCheckedBackground = \"--framer-input-boolean-checked-background\",\n\tBooleanCheckedBorderColor = \"--framer-input-boolean-checked-border-color\",\n\tBooleanCheckedBorderWidth = \"--framer-input-boolean-checked-border-width\",\n\tBooleanCheckedBorderStyle = \"--framer-input-boolean-checked-border-style\",\n\tBooleanCheckedBoxShadow = \"--framer-input-boolean-checked-box-shadow\",\n\tBooleanCheckedTransition = \"--framer-input-boolean-checked-transition\",\n\n\tInvalidTextColor = \"--framer-input-invalid-text-color\",\n\n\t// Icon\n\tIconBackgroundImage = \"--framer-input-icon-image\",\n\tIconMaskImage = \"--framer-input-icon-mask-image\",\n\tIconColor = \"--framer-input-icon-color\",\n\tIconContent = \"--framer-input-icon-content\",\n\n\tWrapperHeight = \"--framer-input-wrapper-height\",\n}\n\n// Alias the enum locally to avoid long css rules.\nconst Var = FormInputStyleVariableNames\n\nexport const inputClassName = \"framer-form-input\"\nexport const inputWrapperClassName = \"framer-form-input-wrapper\"\nexport const emptyValueClassName = \"framer-form-input-empty\"\n\nexport const forcedFocusClassName = \"framer-form-input-forced-focus\"\nexport const forcedCheckedClassName = \"framer-form-input-forced-checked\"\n\nfunction cssValue(value: string | number) {\n\tif (typeof value === \"number\") return value\n\tif (value.startsWith(\"--\")) return css.variable(value)\n\tif (value === \"\") return '\"\"'\n\treturn value\n}\n\ntype VendorPrefixDeclaration = Record<`-${string}`, string>\ntype CSSDeclaration = { [K in keyof CSSProperties]: CSSProperties[K] | string } & VendorPrefixDeclaration\n\n/** Tools for generating css for form inputs. */\nexport const css = /* @__PURE__ */ (() => {\n\t/**\n\t * A lightweight camelCase to kebab-case CSS templating function. References to a css variable\n\t * will be automatically wrapped in var().\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-shadow -- Can't rename either\n\tfunction css(selector: string, declaration: CSSDeclaration) {\n\t\tlet output = \" \"\n\t\tfor (const key in declaration) {\n\t\t\tconst value = declaration[key as keyof typeof declaration]\n\t\t\tassert(value !== undefined, \"Encountered `undefined` in CSSDeclaration\")\n\t\t\toutput += `${key.replace(/([A-Z])/gu, \"-$1\").toLowerCase()}: ${cssValue(value)}; `\n\t\t}\n\t\treturn selector + \" {\" + output + \"}\"\n\t}\n\n\t/**\n\t * Create a reference to a css variable with optional fallbacks. Variable fallbacks will be\n\t * nested as expected.\n\t */\n\tcss.variable = (...variables: [...string[], string] | [string, ...string[]]): string => {\n\t\tconst lastItem = variables[variables.length - 1]\n\t\tassert(lastItem !== undefined, \"Zero variables passed to `css.variable`\")\n\t\tlet value = lastItem.startsWith(\"--\") ? `var(${lastItem})` : lastItem\n\t\tfor (let index = variables.length - 2; index >= 0; index--) {\n\t\t\tconst element = variables[index]\n\t\t\tvalue = `var(${element}, ${value})`\n\t\t}\n\t\treturn value\n\t}\n\n\treturn css\n})()\n\nexport const sharedInputCSS = /* @__PURE__ */ (() => [\n\tcss(`.${inputClassName}`, {\n\t\tpadding: css.variable(Var.Padding),\n\t\tbackground: \"transparent\",\n\t\tfontFamily: css.variable(Var.FontFamily),\n\t\tfontWeight: css.variable(Var.FontWeight),\n\t\tfontSize: css.variable(Var.FontSize),\n\t\tfontStyle: css.variable(Var.FontStyle),\n\t\tcolor: css.variable(Var.FontColor),\n\t\tfontFeatureSettings: css.variable(Var.FontOpenType),\n\t\tfontVariationSettings: css.variable(Var.FontVariationAxes),\n\t\tborder: \"none\",\n\t\ttextOverflow: \"ellipsis\",\n\t\twhiteSpace: \"nowrap\",\n\t\toverflow: \"hidden\",\n\t\twidth: \"100%\",\n\t\theight: css.variable(Var.WrapperHeight, \"100%\"),\n\t\tletterSpacing: css.variable(Var.FontLetterSpacing),\n\t\ttextAlign: css.variable(Var.FontTextAlignment),\n\t\tlineHeight: css.variable(Var.FontLineHeight),\n\t}),\n\tcss(`.${inputClassName}:focus-visible`, { outline: \"none\" }),\n])()\n\nexport const inputWrapperCSS = /* @__PURE__ */ (() => [css(`.${inputWrapperClassName}`, { overflow: \"hidden\" })])()\n\nexport const inputBorderAllSides = /* @__PURE__ */ `var(${Var.BorderTopWidth}) var(${Var.BorderRightWidth}) var(${Var.BorderBottomWidth}) var(${Var.BorderLeftWidth})`\n\n// We can't use normal CSS borders on focus, because different border widths between normal and\n// focused states could cause the elements to jump (due to overall size constraints of\n// the element changing). Instead we use a different element to display the focused border,\n// which is absolutely positioned over the input, with all pointer events disabled.\n// The result is that borders are applied like an inset box shadow so that the overall size of\n// the input never changes, and doesn't cause any jumps.\n// This approach is roughly analogous to how borders are implemented for frames.\nexport const inputBorderCSS = /* @__PURE__ */ (() => [\n\t`.${inputWrapperClassName}:after {\n        content: \"\";\n        pointer-events: none;\n        box-sizing: border-box;\n        position: absolute;\n        top: 0;\n        left: 0;\n        width: 100%;\n        height: 100%;\n        border-top-left-radius: var(${Var.BorderRadiusTopLeft});\n        border-top-right-radius: var(${Var.BorderRadiusTopRight});\n        border-bottom-right-radius: var(${Var.BorderRadiusBottomRight});\n        border-bottom-left-radius: var(${Var.BorderRadiusBottomLeft});\n        corner-shape: var(${Var.CornerShape});\n        border-color: var(${Var.BorderColor});\n        border-top-width: var(${Var.BorderTopWidth});\n        border-right-width: var(${Var.BorderRightWidth});\n        border-bottom-width: var(${Var.BorderBottomWidth});\n        border-left-width: var(${Var.BorderLeftWidth});\n        border-style: var(${Var.BorderStyle});\n        transition: var(${Var.FocusedTransition});\n        transition-property: border-color, border-width, border-style, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, corner-shape;\n    }`,\n])()\n\nconst customValidityKey = \"customError\" satisfies keyof ValidityState\nconst validKey = \"valid\" satisfies keyof ValidityState\n\nfunction isRelevantValidityStateKey(key: string): key is keyof Omit<ValidityState, \"valid\" | \"customError\"> {\n\treturn key !== customValidityKey && key !== validKey\n}\n\n/**\n * Check the native validity of an input returning true as soon as we detect an\n * invalid state, skipping \"valid\", and \"customError\" which will always be true\n * because we set an empty string custom error to hide native warnings.\n */\nfunction isInvalid(validity: ValidityState): boolean {\n\tfor (const key in validity) {\n\t\tif (!isRelevantValidityStateKey(key)) continue\n\t\tif (validity?.[key] === true) return true\n\t}\n\treturn false\n}\n\n/**\n * In some browsers, when a form is submitted, inputs with invalid values will\n * show a native warning. This is great for simple inputs. However in the case\n * where a designer has designed their own invalid state, these warnings can be\n * overwhelming. To avoid them, this hook allows setting a custom validity\n * warning when the form is submitted and the calling input is invalid. Then the\n * input will listen to onChange, and as soon as the input becomes valid again,\n * will call a provided onValid callback. This allows designers to control the\n * complete lifecycle of an input.\n */\nexport function useCustomValidity(\n\tonValid?: () => void,\n\tonInvalid?: (e: React.FormEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void,\n\tonChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void,\n\tonBlur?: (e: React.FormEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void,\n\tonFocus?: (e: React.FormEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void,\n) {\n\tconst isValidRef = React.useRef<boolean | null>(null)\n\n\tconst handleInvalid = React.useCallback(\n\t\t(e: React.FormEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => {\n\t\t\tif (!onInvalid) return\n\t\t\t// If we have already become invalid, don't call the onInvalid\n\t\t\t// callback over and over again.\n\t\t\tif (isValidRef.current === false) return\n\n\t\t\tisValidRef.current = false\n\n\t\t\t// Set and report a custom invalid state to prevent the default\n\t\t\t// browser warnings.\n\t\t\te.currentTarget.setCustomValidity(\" \")\n\t\t\te.currentTarget.reportValidity()\n\n\t\t\tonInvalid(e)\n\t\t},\n\t\t[onInvalid],\n\t)\n\n\tconst handleChange = React.useCallback(\n\t\t(e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => {\n\t\t\tonChange?.(e)\n\t\t\tif (!onInvalid && !onValid) return\n\n\t\t\tconst validity = e.target.validity\n\t\t\tif (isValidRef.current === false && !isInvalid(validity)) {\n\t\t\t\t// Clear the invalid state.\n\t\t\t\te.currentTarget.setCustomValidity(\"\")\n\t\t\t\te.target.reportValidity()\n\n\t\t\t\tisValidRef.current = true\n\t\t\t\tonValid?.()\n\t\t\t}\n\t\t},\n\t\t[onInvalid, onValid, onChange],\n\t)\n\n\tconst handleBlur = React.useCallback(\n\t\t(e: React.FormEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => {\n\t\t\tif (!onInvalid) {\n\t\t\t\tonBlur?.(e)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (isValidRef.current === false) return\n\t\t\tconst validity = e.currentTarget.validity\n\n\t\t\tif (isInvalid(validity)) {\n\t\t\t\thandleInvalid(e)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If the input has an onInvalid callback, only blur if the input is\n\t\t\t// valid. In Framer, this will only be the case when an onInvalid\n\t\t\t// variant is setup, and we want to allow showing an invalid input\n\t\t\t// on blur. Of course, technically this means that a code override\n\t\t\t// on an input won't call `onBlur` in all cases if the underlying\n\t\t\t// input has an onInvalid handler. In this case, to work around this\n\t\t\t// behavior, the user would need to either set onInvalid to\n\t\t\t// undefined, or use document.addEventListener to handle all blurs.\n\t\t\tonBlur?.(e)\n\t\t},\n\t\t[handleInvalid, onBlur, onInvalid],\n\t)\n\n\treturn React.useMemo(() => {\n\t\treturn {\n\t\t\tonInvalid: handleInvalid,\n\t\t\tonChange: handleChange,\n\t\t\tonBlur: handleBlur,\n\t\t\tonFocus,\n\t\t} as const\n\t}, [handleInvalid, handleChange, handleBlur, onFocus])\n}\n\nexport const rightIconSpacing = 10\nexport const iconSpacing = 8\nexport const iconSize = 16\n\nexport const iconImageCSS: CSSDeclaration = /* @__PURE__ */ (() => ({\n\tbackgroundRepeat: \"no-repeat\",\n\tbackgroundSize: `${iconSize}px`,\n\tmaskRepeat: \"no-repeat\",\n\tmaskSize: `${iconSize}px`,\n\tbackgroundColor: css.variable(Var.IconColor),\n}))()\n\nexport const inputIconCSSDeclaration: CSSDeclaration = /* @__PURE__ */ (() => ({\n\tcontent: \"\",\n\tdisplay: \"block\",\n\tposition: \"absolute\",\n\tright: 0,\n\ttop: 0,\n\tbottom: 0,\n\twidth: `${iconSize}px`,\n\tboxSizing: \"content-box\",\n\tpadding: css.variable(Var.Padding),\n\tborder: \"none\",\n\tpointerEvents: \"none\",\n\t...iconImageCSS,\n}))()\n", "import type { MotionStyle } from \"framer-motion\"\nimport { css } from \"../../render/presentation/Forms/shared.ts\"\n\nfunction createRGBVariableFallbacks(variables: string[], fallback: string) {\n\treturn css.variable(...variables.flatMap(variable => [`${variable}-rgb`, variable]), fallback)\n}\n\nexport const defaultRichTextContainerStyle = {\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\tjustifyContent: \"flex-start\",\n} as const satisfies MotionStyle\n\nconst defaultTextFillStyle = {\n\tdisplay: \"inline-block\",\n} as const satisfies MotionStyle\n\nconst defaultImageStyle = {\n\tdisplay: \"block\",\n} as const satisfies MotionStyle\n\n/**\n * Components might be wrapped in a .ssr-variant in server-side rendering if they have property overrides.\n * We need to consider this when selecting direct children.\n * We might have the same problem with layouting styles outside rich text too, but so far haven't noticed.\n */\nfunction selectComponentChild(parentSelector: string, childSelector: string) {\n\treturn `${parentSelector} > ${childSelector}, ${parentSelector} > .ssr-variant > ${childSelector}`\n}\n\nexport const richTextCSSRules = /* @__PURE__ */ (() => [\n\t/**\n\t * RichTextContainer styles can get overridden by other static or inline styles collected in\n\t * style collectors, as well as styles defined directly in the @link{RichText.tsx} component.\n\t *\n\t * NOTE: `display: flex` can get overridden with `display: -webkit-box` in\n\t * @link{collectTextTruncation.ts} if the text is truncated. In this case, the flex-specific\n\t * properties are not supported, e.g. `justify-content`. This is ok because truncated text has\n\t * auto height and doesn't support vertical alignment. In any case, keep this in mind when\n\t * using other flex-specific properties.\n\t * */\n\n\t/* css */ `\n        [data-framer-component-type=\"RichTextContainer\"] {\n            display: ${defaultRichTextContainerStyle.display};\n            flex-direction: ${defaultRichTextContainerStyle.flexDirection};\n            justify-content: ${defaultRichTextContainerStyle.justifyContent};\n            outline: none;\n            flex-shrink: 0;\n        }\n    `,\n\n\t/* css */ `\n        p.framer-text,\n        div.framer-text,\n        figure.framer-text,\n        h1.framer-text,\n        h2.framer-text,\n        h3.framer-text,\n        h4.framer-text,\n        h5.framer-text,\n        h6.framer-text,\n        ol.framer-text,\n        ul.framer-text {\n            margin: 0;\n            padding: 0;\n        }\n    `,\n\n\t/* css */ `\n        p.framer-text,\n        div.framer-text,\n        h1.framer-text,\n        h2.framer-text,\n        h3.framer-text,\n        h4.framer-text,\n        h5.framer-text,\n        h6.framer-text,\n        li.framer-text,\n        ol.framer-text,\n        ul.framer-text,\n        mark.framer-text,\n        span.framer-text:not([data-text-fill]) {\n            font-family: var(--framer-font-family-preview, var(--framer-blockquote-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif)));\n            font-style: var(--framer-font-style-preview, var(--framer-blockquote-font-style, var(--framer-font-style, normal)));\n            font-weight: var(--framer-font-weight-preview, var(--framer-blockquote-font-weight, var(--framer-font-weight, 400)));\n            color: var(--framer-blockquote-text-color, var(--framer-text-color, #000));\n            font-size: calc(var(--framer-blockquote-font-size, var(--framer-font-size, 16px)) * var(--framer-font-size-scale, 1));\n            letter-spacing: var(--framer-blockquote-letter-spacing, var(--framer-letter-spacing, 0));\n            text-transform: var(--framer-blockquote-text-transform, var(--framer-text-transform, none));\n            text-decoration-line: var(--framer-blockquote-text-decoration, var(--framer-text-decoration, initial));\n            text-decoration-style: var(--framer-blockquote-text-decoration-style, var(--framer-text-decoration-style, initial));\n            text-decoration-color: var(--framer-blockquote-text-decoration-color, var(--framer-text-decoration-color, initial));\n            text-decoration-thickness: var(--framer-blockquote-text-decoration-thickness, var(--framer-text-decoration-thickness, initial));\n            text-decoration-skip-ink: var(--framer-blockquote-text-decoration-skip-ink, var(--framer-text-decoration-skip-ink, initial));\n            text-underline-offset: var(--framer-blockquote-text-decoration-offset, var(--framer-text-decoration-offset, initial));\n            line-height: var(--framer-blockquote-line-height, var(--framer-line-height, 1.2em));\n            text-align: var(--framer-blockquote-text-alignment, var(--framer-text-alignment, start));\n            -webkit-text-stroke-width: var(--framer-text-stroke-width, initial);\n            -webkit-text-stroke-color: var(--framer-text-stroke-color, initial);\n            -moz-font-feature-settings: var(--framer-font-open-type-features, initial);\n            -webkit-font-feature-settings: var(--framer-font-open-type-features, initial);\n            font-feature-settings: var(--framer-font-open-type-features, initial);\n            font-variation-settings: var(--framer-font-variation-axes-preview, var(--framer-font-variation-axes, normal));\n            text-wrap: var(--framer-text-wrap-override, var(--framer-text-wrap));\n        }\n    `,\n\t/* css */ `\n        mark.framer-text,\n        p.framer-text,\n        div.framer-text,\n        h1.framer-text,\n        h2.framer-text,\n        h3.framer-text,\n        h4.framer-text,\n        h5.framer-text,\n        h6.framer-text,\n        li.framer-text,\n        ol.framer-text,\n        ul.framer-text {\n            background-color: var(--framer-blockquote-text-background-color, var(--framer-text-background-color, initial));\n            border-radius: var(--framer-blockquote-text-background-radius, var(--framer-text-background-radius, initial));\n            corner-shape: var(--framer-blockquote-text-background-corner-shape, var(--framer-text-background-corner-shape, initial));\n            padding: var(--framer-blockquote-text-background-padding, var(--framer-text-background-padding, initial));\n        }\n    `,\n\t/* css */ `\n        @supports not (color: color(display-p3 1 1 1)) {\n            p.framer-text,\n            div.framer-text,\n            h1.framer-text,\n            h2.framer-text,\n            h3.framer-text,\n            h4.framer-text,\n            h5.framer-text,\n            h6.framer-text,\n            li.framer-text,\n            ol.framer-text,\n            ul.framer-text,\n            span.framer-text:not([data-text-fill]) {\n                color: ${createRGBVariableFallbacks([\"--framer-blockquote-text-color\", \"--framer-text-color\"], \"#000\")};\n                -webkit-text-stroke-color: ${createRGBVariableFallbacks([\"--framer-text-stroke-color\"], \"initial\")};\n            }\n\n            mark.framer-text {\n                background-color: ${createRGBVariableFallbacks([\"--framer-blockquote-text-background-color\", \"--framer-text-background-color\"], \"initial\")};\n            }\n        }\n    `,\n\n\t/* css */ `\n        .framer-fit-text .framer-text {\n            white-space: nowrap;\n            white-space-collapse: preserve;\n        }\n    `,\n\n\t/* css */ `\n        strong.framer-text {\n            font-family: var(--framer-blockquote-font-family-bold, var(--framer-font-family-bold));\n            font-style: var(--framer-blockquote-font-style-bold, var(--framer-font-style-bold));\n            font-weight: var(--framer-blockquote-font-weight-bold, var(--framer-font-weight-bold, bolder));\n            font-variation-settings: var(--framer-blockquote-font-variation-axes-bold, var(--framer-font-variation-axes-bold));\n        }\n    `,\n\n\t/* css */ `\n        em.framer-text {\n            font-family: var(--framer-blockquote-font-family-italic, var(--framer-font-family-italic));\n            font-style: var(--framer-blockquote-font-style-italic, var(--framer-font-style-italic, italic));\n            font-weight: var(--framer-blockquote-font-weight-italic, var(--framer-font-weight-italic));\n            font-variation-settings: var(--framer-blockquote-font-variation-axes-italic, var(--framer-font-variation-axes-italic));\n        }\n    `,\n\n\t/* css */ `\n        em.framer-text > strong.framer-text {\n            font-family: var(--framer-blockquote-font-family-bold-italic, var(--framer-font-family-bold-italic));\n            font-style: var(--framer-blockquote-font-style-bold-italic, var(--framer-font-style-bold-italic, italic));\n            font-weight: var(--framer-blockquote-font-weight-bold-italic, var(--framer-font-weight-bold-italic, bolder));\n            font-variation-settings: var(--framer-blockquote-font-variation-axes-bold-italic, var(--framer-font-variation-axes-bold-italic));\n        }\n    `,\n\n\t/* css */ `\n        p.framer-text:not(:first-child),\n        div.framer-text:not(:first-child),\n        h1.framer-text:not(:first-child),\n        h2.framer-text:not(:first-child),\n        h3.framer-text:not(:first-child),\n        h4.framer-text:not(:first-child),\n        h5.framer-text:not(:first-child),\n        h6.framer-text:not(:first-child),\n        ol.framer-text:not(:first-child),\n        ul.framer-text:not(:first-child),\n        blockquote.framer-text:not(:first-child),\n        table.framer-text:not(:first-child),\n        figure.framer-text:not(:first-child),\n        .framer-image.framer-text:not(:first-child) {\n            margin-top: var(--framer-blockquote-paragraph-spacing, var(--framer-paragraph-spacing, 0));\n        }\n    `,\n\n\t// The first child of a list item is a paragraph. If the second child is a\n\t// nested list we don't want it to have paragraph spacing.\n\t/* css */ `\n        li.framer-text > ul.framer-text:nth-child(2),\n        li.framer-text > ol.framer-text:nth-child(2) {\n            margin-top: 0;\n        }\n    `,\n\n\t// background-clip: text clips to the physical dimensions of text as appose\n\t// to the rendered dimensions. normal text will bleed out side these\n\t// constraints but since this is just a clipping mask over the area the text\n\t// takes up we have cases where the text will get clipped. That is why we\n\t// need to expand the area that the gradient applies to to allow users to\n\t// use low line-heights. This will result in gradients not aligning\n\t// perfectly to the edges of the text. but this is a acceptable trade off at\n\t// this point. For now we increase the area of the clipping mask on the\n\t// bottom (for descenders) and the right for italic or wide fonts.\n\t/* css */ `\n        .framer-text[data-text-fill] {\n            display: ${defaultTextFillStyle.display};\n            background-clip: text;\n            -webkit-background-clip: text;\n            /* make this a transparent color if you want to visualise the clipping  */\n            -webkit-text-fill-color: transparent;\n            padding: max(0em, calc(calc(1.3em - var(--framer-blockquote-line-height, var(--framer-line-height, 1.3em))) / 2));\n            margin: min(0em, calc(calc(1.3em - var(--framer-blockquote-line-height, var(--framer-line-height, 1.3em))) / -2));\n        }\n    `,\n\n\t/* css */ `\n        code.framer-text,\n        code.framer-text span.framer-text:not([data-text-fill]) {\n            font-family: var(--framer-code-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif));\n            font-style: var(--framer-blockquote-font-style, var(--framer-code-font-style, var(--framer-font-style, normal)));\n            font-weight: var(--framer-blockquote-font-weight, var(--framer-code-font-weight, var(--framer-font-weight, 400)));\n            color: var(--framer-blockquote-text-color, var(--framer-code-text-color, var(--framer-text-color, #000)));\n            font-size: calc(var(--framer-blockquote-font-size, var(--framer-font-size, 16px)) * var(--framer-font-size-scale, 1));\n            letter-spacing: var(--framer-blockquote-letter-spacing, var(--framer-letter-spacing, 0));\n            line-height: var(--framer-blockquote-line-height, var(--framer-line-height, 1.2em));\n        }\n    `,\n\n\t/* css */ `\n        @supports not (color: color(display-p3 1 1 1)) {\n            code.framer-text,\n            code.framer-text span.framer-text:not([data-text-fill]) {\n                color: ${createRGBVariableFallbacks([\"--framer-blockquote-text-color\", \"--framer-code-text-color\", \"--framer-text-color\"], \"#000\")};\n            }\n        }\n    `,\n\n\t/* css */ `\n        blockquote.framer-text {\n            margin-block-start: initial;\n            margin-block-end: initial;\n            margin-inline-start: initial;\n            margin-inline-end: initial;\n            unicode-bidi: initial;\n        }\n    `,\n\n\t/* css */ `\n        a.framer-text,\n        a.framer-text span.framer-text:not([data-text-fill]),\n        span.framer-text[data-nested-link],\n        span.framer-text[data-nested-link] span.framer-text:not([data-text-fill]) {\n            /* Ensure the color is inherited from the link style rather than the parent text for nested spans */\n            color: inherit;\n            font-family: var(--framer-font-family-preview, var(--framer-blockquote-font-family, var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif))));\n            font-style: var(--framer-font-style-preview, var(--framer-blockquote-font-style, var(--framer-link-font-style, var(--framer-font-style, normal))));\n            font-weight: var(--framer-font-weight-preview, var(--framer-blockquote-font-weight, var(--framer-link-font-weight, var(--framer-font-weight, 400))));\n            font-size: calc(var(--framer-blockquote-font-size, var(--framer-font-size, 16px)) * var(--framer-font-size-scale, 1));\n            text-transform: var(--framer-blockquote-text-transform, var(--framer-link-text-transform, var(--framer-text-transform, none)));\n            /* Cursor inherit to overwrite the user agent stylesheet on rich text links. */\n            cursor: var(--framer-custom-cursors, pointer);\n            /* Don't inherit background styles from any parent text style. */\n            background-color: initial;\n            border-radius: var(--framer-link-text-background-radius, initial);\n            corner-shape: var(--framer-link-text-background-corner-shape, initial);\n            padding: var(--framer-link-text-background-padding, initial);\n        }\n    `,\n\n\t// Animateable link styles can't be applied to the nested spans of links because it breaks animations\n\t/* css */ `\n        a.framer-text,\n        span.framer-text[data-nested-link] {\n            color: var(--framer-blockquote-text-color, var(--framer-link-text-color, var(--framer-text-color, #000)));\n            text-decoration-line: var(--framer-blockquote-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, initial)));\n            text-decoration-style: var(--framer-blockquote-text-decoration-style, var(--framer-link-text-decoration-style, var(--framer-text-decoration-style, initial)));\n            text-decoration-color: var(--framer-blockquote-text-decoration-color, var(--framer-link-text-decoration-color, var(--framer-text-decoration-color, initial)));\n            text-decoration-thickness: var(--framer-blockquote-text-decoration-thickness, var(--framer-link-text-decoration-thickness, var(--framer-text-decoration-thickness, initial)));\n            text-decoration-skip-ink: var(--framer-blockquote-text-decoration-skip-ink, var(--framer-link-text-decoration-skip-ink, var(--framer-text-decoration-skip-ink, initial)));\n            text-underline-offset: var(--framer-blockquote-text-decoration-offset, var(--framer-link-text-decoration-offset, var(--framer-text-decoration-offset, initial)));\n            /* Don't inherit background styles from any parent text style. */\n            background-color: var(--framer-link-text-background-color, initial);\n        }\n    `,\n\n\t/* css */ `\n        @supports not (color: color(display-p3 1 1 1)) {\n            a.framer-text,\n            span.framer-text[data-nested-link] {\n                color: ${createRGBVariableFallbacks([\"--framer-blockquote-text-color\", \"--framer-link-text-color\", \"--framer-text-color\"], \"#000\")};\n                background-color: ${createRGBVariableFallbacks([\"--framer-link-text-background-color\"], \"initial\")};\n                text-decoration-color: ${createRGBVariableFallbacks([\"--framer-link-text-decoration-color\", \"--framer-text-decoration-color\"], \"currentcolor\")};\n            }\n        }\n    `,\n\n\t/* css */ `\n    code.framer-text a.framer-text,\n    code.framer-text a.framer-text span.framer-text:not([data-text-fill]),\n    code.framer-text span.framer-text[data-nested-link],\n    code.framer-text span.framer-text[data-nested-link] span.framer-text:not([data-text-fill]) {\n        font-family: var(--framer-code-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif));\n        font-style: var(--framer-blockquote-font-style, var(--framer-code-font-style, var(--framer-font-style, normal)));\n        font-weight: var(--framer-blockquote-font-weight, var(--framer-code-font-weight, var(--framer-font-weight, 400)));\n        color: inherit;\n        font-size: calc(var(--framer-blockquote-font-size, var(--framer-font-size, 16px)) * var(--framer-font-size-scale, 1));\n    }\n`,\n\n\t/* css */ `\n    code.framer-text a.framer-text,\n    code.framer-text span.framer-text[data-nested-link] {\n        color: var(--framer-blockquote-text-color, var(--framer-link-text-color, var(--framer-code-text-color, var(--framer-text-color, #000))));\n    }\n`,\n\n\t/* css */ `\n    @supports not (color: color(display-p3 1 1 1)) {\n        code.framer-text a.framer-text,\n        code.framer-text a.framer-text span.framer-text:not([data-text-fill]),\n        code.framer-text span.framer-text[data-nested-link],\n        code.framer-text span.framer-text[data-nested-link] span.framer-text:not([data-text-fill]) {\n            color: ${createRGBVariableFallbacks([\"--framer-blockquote-text-color\", \"--framer-link-text-color\", \"--framer-code-text-color\", \"--framer-text-color\"], \"#000\")};\n        }\n    }\n`,\n\n\t/* css */ `\n        a.framer-text:hover,\n        a.framer-text:hover span.framer-text:not([data-text-fill]),\n        span.framer-text[data-nested-link]:hover,\n        span.framer-text[data-nested-link]:hover span.framer-text:not([data-text-fill]) {\n            font-family: var(--framer-font-family-preview, var(--framer-link-hover-font-family, var(--framer-blockquote-font-family, var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif)))));\n            font-style: var(--framer-font-style-preview, var(--framer-link-hover-font-style, var(--framer-blockquote-font-style, var(--framer-link-font-style, var(--framer-font-style, normal)))));\n            font-weight: var(--framer-font-weight-preview, var(--framer-link-hover-font-weight, var(--framer-blockquote-font-weight, var(--framer-link-font-weight, var(--framer-font-weight, 400)))));\n            font-size: calc(var(--framer-link-hover-font-size, var(--framer-blockquote-font-size, var(--framer-font-size, 16px))) * var(--framer-font-size-scale, 1));\n            text-transform: var(--framer-link-hover-text-transform, var(--framer-blockquote-text-transform, var(--framer-link-text-transform, var(--framer-text-transform, none))));\n            border-radius: var(--framer-link-hover-text-background-radius, var(--framer-link-text-background-radius, var(--framer-text-background-radius, initial)));\n            corner-shape: var(--framer-link-hover-text-background-corner-shape, var(--framer-link-text-background-corner-shape, var(--framer-text-background-corner-shape, initial)));\n            padding: var(--framer-link-hover-text-background-padding, var(--framer-link-text-background-padding, var(--framer-text-background-padding, initial)));\n        }\n    `,\n\n\t/* css */ `\n        a.framer-text:hover,\n        span.framer-text[data-nested-link]:hover {\n            color: var(--framer-link-hover-text-color, var(--framer-blockquote-text-color, var(--framer-link-text-color, var(--framer-text-color, #000))));\n            text-decoration-line: var(--framer-link-hover-text-decoration, var(--framer-blockquote-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, initial))));\n            text-decoration-style: var(--framer-link-hover-text-decoration-style, var(--framer-blockquote-text-decoration-style, var(--framer-link-text-decoration-style, var(--framer-text-decoration-style, initial))));\n            text-decoration-color: var(--framer-link-hover-text-decoration-color, var(--framer-blockquote-text-decoration-color, var(--framer-link-text-decoration-color, var(--framer-text-decoration-color, initial))));\n            text-decoration-thickness: var(--framer-link-hover-text-decoration-thickness, var(--framer-blockquote-text-decoration-thickness, var(--framer-link-text-decoration-thickness, var(--framer-text-decoration-thickness, initial))));\n            text-decoration-skip-ink: var(--framer-link-hover-text-decoration-skip-ink, var(--framer-blockquote-text-decoration-skip-ink, var(--framer-link-text-decoration-skip-ink, var(--framer-text-decoration-skip-ink, initial))));\n            text-underline-offset: var(--framer-link-hover-text-decoration-offset, var(--framer-blockquote-text-decoration-offset, var(--framer-link-text-decoration-offset, var(--framer-text-decoration-offset, initial))));\n            background-color: var(--framer-link-hover-text-background-color, var(--framer-link-text-background-color, var(--framer-text-background-color, initial)));\n        }\n    `,\n\n\t/* css */ `\n    @supports not (color: color(display-p3 1 1 1)) {\n        a.framer-text:hover,\n        span.framer-text[data-nested-link]:hover {\n            color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-color\", \"--framer-blockquote-text-color\", \"--framer-link-text-color\", \"--framer-text-color\"], \"#000\")};\n            background-color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-background-color\", \"--framer-link-text-background-color\", \"--framer-text-background-color\"], \"initial\")};\n            text-decoration-color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-decoration-color\", \"--framer-link-text-decoration-color\", \"--framer-text-decoration-color\"], \"currentcolor\")};\n        }\n    }\n    `,\n\n\t/* css */ `\n        code.framer-text a.framer-text:hover,\n        code.framer-text span.framer-text[data-nested-link]:hover {\n            color: var(--framer-link-hover-text-color, var(--framer-blockquote-text-color, var(--framer-link-text-color, var(--framer-code-text-color, var(--framer-text-color, #000)))));\n        }\n    `,\n\n\t/* css */ `\n    @supports not (color: color(display-p3 1 1 1)) {\n        code.framer-text a.framer-text:hover,\n        code.framer-text span.framer-text[data-nested-link]:hover {\n            color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-color\", \"--framer-blockquote-text-color\", \"--framer-link-text-color\", \"--framer-code-text-color\", \"--framer-text-color\"], \"#000\")};\n        }\n    }\n   `,\n\n\t/* css */ `\n        a.framer-text[data-framer-page-link-current],\n        a.framer-text[data-framer-page-link-current] span.framer-text:not([data-text-fill]),\n        span.framer-text[data-framer-page-link-current],\n        span.framer-text[data-framer-page-link-current] span.framer-text:not([data-text-fill]) {\n            font-family: var(--framer-font-family-preview, var(--framer-link-current-font-family, var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif))));\n            font-style: var(--framer-font-style-preview, var(--framer-link-current-font-style, var(--framer-link-font-style, var(--framer-font-style, normal))));\n            font-weight: var(--framer-font-weight-preview, var(--framer-link-current-font-weight, var(--framer-link-font-weight, var(--framer-font-weight, 400))));\n            font-size: calc(var(--framer-link-current-font-size, var(--framer-link-font-size, var(--framer-font-size, 16px))) * var(--framer-font-size-scale, 1));\n            text-transform: var(--framer-link-current-text-transform, var(--framer-link-text-transform, var(--framer-text-transform, none)));\n            border-radius: var(--framer-link-current-text-background-radius, var(--framer-link-text-background-radius, initial));\n            corner-shape: var(--framer-link-current-text-background-corner-shape, var(--framer-link-text-background-corner-shape, initial));\n            padding: var(--framer-link-current-text-background-padding, var(--framer-link-text-background-padding, initial));\n        }\n    `,\n\n\t/* css */ `\n        a.framer-text[data-framer-page-link-current],\n        span.framer-text[data-framer-page-link-current] {\n            color: var(--framer-link-current-text-color, var(--framer-link-text-color, var(--framer-text-color, #000)));\n            text-decoration-line: var(--framer-link-current-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, initial)));\n            text-decoration-style: var(--framer-link-current-text-decoration-style, var(--framer-link-text-decoration-style, var(--framer-text-decoration-style, initial)));\n            text-decoration-color: var(--framer-link-current-text-decoration-color, var(--framer-link-text-decoration-color, var(--framer-text-decoration-color, initial)));\n            text-decoration-thickness: var(--framer-link-current-text-decoration-thickness, var(--framer-link-text-decoration-thickness, var(--framer-text-decoration-thickness, initial)));\n            text-decoration-skip-ink: var(--framer-link-current-text-decoration-skip-ink, var(--framer-link-text-decoration-skip-ink, var(--framer-text-decoration-skip-ink, initial)));\n            text-underline-offset: var(--framer-link-current-text-decoration-offset, var(--framer-link-text-decoration-offset, var(--framer-text-decoration-offset, initial)));\n            background-color: var(--framer-link-current-text-background-color, var(--framer-link-text-background-color, var(--framer-text-background-color, initial)));\n        }\n    `,\n\n\t/* css */ `\n        @supports not (color: color(display-p3 1 1 1)) {\n            a.framer-text[data-framer-page-link-current],\n            span.framer-text[data-framer-page-link-current]{\n                color: ${createRGBVariableFallbacks([\"--framer-link-current-text-color\", \"--framer-link-text-color\", \"--framer-text-color\"], \"#000\")};\n                background-color: ${createRGBVariableFallbacks([\"--framer-link-current-text-background-color\", \"--framer-link-text-background-color\", \"--framer-text-background-color\"], \"initial\")};\n                text-decoration-color: ${createRGBVariableFallbacks([\"--framer-link-current-text-decoration-color\", \"--framer-link-text-decoration-color\", \"--framer-text-decoration-color\"], \"currentcolor\")};\n            }\n        }\n    `,\n\n\t/* css */ `\n        code.framer-text a.framer-text[data-framer-page-link-current],\n        code.framer-text a.framer-text[data-framer-page-link-current] span.framer-text:not([data-text-fill]),\n        code.framer-text span.framer-text[data-framer-page-link-current],\n        code.framer-text span.framer-text[data-framer-page-link-current] span.framer-text:not([data-text-fill]) {\n            font-family: var(--framer-code-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif));\n            font-style: var(--framer-code-font-style, var(--framer-font-style, normal));\n            font-weight: var(--framer-code-font-weight, var(--framer-font-weight, 400));\n            color: inherit;\n            font-size: calc(var(--framer-link-current-font-size, var(--framer-link-font-size, var(--framer-font-size, 16px))) * var(--framer-font-size-scale, 1));\n        }\n    `,\n\n\t/* css */ `\n        code.framer-text a.framer-text[data-framer-page-link-current],\n        code.framer-text span.framer-text[data-framer-page-link-current] {\n            color: var(--framer-link-current-text-color, var(--framer-link-text-color, var(--framer-code-text-color, var(--framer-text-color, #000))));\n        }\n    `,\n\n\t/* css */ `\n        @supports not (color: color(display-p3 1 1 1)) {\n            code.framer-text a.framer-text[data-framer-page-link-current],\n            code.framer-text a.framer-text[data-framer-page-link-current] span.framer-text:not([data-text-fill]),\n            code.framer-text span.framer-text[data-framer-page-link-current],\n            code.framer-text span.framer-text[data-framer-page-link-current] span.framer-text:not([data-text-fill]) {\n                color: ${createRGBVariableFallbacks([\"--framer-link-current-text-color\", \"--framer-link-text-color\", \"--framer-code-text-color\", \"--framer-text-color\"], \"#000\")};\n                background-color: ${createRGBVariableFallbacks([\"--framer-link-current-text-background-color\", \"--framer-link-text-background-color\", \"--framer-text-background-color\"], \"initial\")};\n            }\n        }\n    `,\n\n\t/* css */ `\n        a.framer-text[data-framer-page-link-current]:hover,\n        a.framer-text[data-framer-page-link-current]:hover span.framer-text:not([data-text-fill]),\n        span.framer-text[data-framer-page-link-current]:hover,\n        span.framer-text[data-framer-page-link-current]:hover span.framer-text:not([data-text-fill]) {\n            color: inherit;\n            font-family: var(--framer-font-family-preview, var(--framer-link-hover-font-family, var(--framer-link-current-font-family, var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif)))));\n            font-style: var(--framer-font-style-preview, var(--framer-link-hover-font-style, var(--framer-link-current-font-style, var(--framer-link-font-style, var(--framer-font-style, normal)))));\n            font-weight: var(--framer-font-weight-preview, var(--framer-link-hover-font-weight, var(--framer-link-current-font-weight, var(--framer-link-font-weight, var(--framer-font-weight, 400)))));\n            font-size: calc(var(--framer-link-hover-font-size, var(--framer-link-current-font-size, var(--framer-link-font-size, var(--framer-font-size, 16px)))) * var(--framer-font-size-scale, 1));\n            text-transform: var(--framer-link-hover-text-transform, var(--framer-link-current-text-transform, var(--framer-link-text-transform, var(--framer-text-transform, none))));\n            border-radius: var(--framer-link-hover-text-background-radius, var(--framer-link-current-text-background-radius, var(--framer-link-text-background-radius, initial)));\n            corner-shape: var(--framer-link-hover-text-background-corner-shape, var(--framer-link-current-text-background-corner-shape, var(--framer-link-text-background-corner-shape, initial)));\n            padding: var(--framer-link-hover-text-background-padding, var(--framer-link-current-text-background-padding, var(--framer-link-text-background-padding, initial)));\n        }\n    `,\n\n\t/* css */ `\n        a.framer-text[data-framer-page-link-current]:hover,\n        span.framer-text[data-framer-page-link-current]:hover {\n            color: var(--framer-link-hover-text-color, var(--framer-link-current-text-color, var(--framer-link-text-color, var(--framer-text-color, #000))));\n            text-decoration-line: var(--framer-link-hover-text-decoration, var(--framer-link-current-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, initial))));\n            text-decoration-style: var(--framer-link-hover-text-decoration-style, var(--framer-link-current-text-decoration-style, var(--framer-link-text-decoration-style, var(--framer-text-decoration-style, initial))));\n            text-decoration-color: var(--framer-link-hover-text-decoration-color, var(--framer-link-current-text-decoration-color, var(--framer-link-text-decoration-color, var(--framer-text-decoration-color, initial))));\n            text-decoration-thickness: var(--framer-link-hover-text-decoration-thickness, var(--framer-link-current-text-decoration-thickness, var(--framer-link-text-decoration-thickness, var(--framer-text-decoration-thickness, initial))));\n            text-decoration-skip-ink: var(--framer-link-hover-text-decoration-skip-ink, var(--framer-link-current-text-decoration-skip-ink, var(--framer-link-text-decoration-skip-ink, var(--framer-text-decoration-skip-ink, initial))));\n            text-underline-offset: var(--framer-link-hover-text-decoration-offset, var(--framer-link-current-text-decoration-offset, var(--framer-link-text-decoration-offset, var(--framer-text-decoration-offset, initial))));\n            background-color: var(--framer-link-hover-text-background-color, var(--framer-link-current-text-background-color, var(--framer-link-text-background-color, initial)));\n        }\n    `,\n\n\t/* css */ `\n        @supports not (color: color(display-p3 1 1 1)) {\n            a.framer-text[data-framer-page-link-current]:hover,\n            span.framer-text[data-framer-page-link-current]:hover {\n                color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-color\", \"--framer-link-current-text-color\", \"--framer-link-text-color\", \"--framer-code-text-color\", \"--framer-text-color\"], \"#000\")};\n                background-color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-background-color\", \"--framer-link-current-text-background-color\", \"--framer-link-text-background-color\"], \"initial\")};\n                text-decoration-color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-decoration-color\", \"--framer-link-current-text-decoration-color\", \"--framer-link-text-decoration-color\", \"--framer-text-decoration-color\"], \"currentcolor\")};\n            }\n        }\n    `,\n\n\t/* css */ `\n        code.framer-text a.framer-text[data-framer-page-link-current]:hover,\n        code.framer-text span.framer-text[data-framer-page-link-current]:hover {\n            color: var(--framer-link-hover-text-color, var(--framer-link-current-text-color, var(--framer-link-text-color, var(--framer-code-text-color, var(--framer-text-color, #000)))));\n        }\n    `,\n\n\t/* css */ `\n        @supports not (color: color(display-p3 1 1 1)) {\n            code.framer-text a.framer-text[data-framer-page-link-current]:hover,\n            code.framer-text a.framer-text[data-framer-page-link-current]:hover span.framer-text:not([data-text-fill]),\n            code.framer-text span.framer-text[data-framer-page-link-current]:hover,\n            code.framer-text span.framer-text[data-framer-page-link-current]:hover span.framer-text:not([data-text-fill]) {\n                color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-color\", \"--framer-link-current-text-color\", \"--framer-link-text-color\", \"--framer-code-text-color\", \"--framer-text-color\"], \"#000\")};\n                background-color: ${createRGBVariableFallbacks([\"--framer-link-hover-text-background-color\", \"--framer-link-current-text-background-color\", \"--framer-link-text-background-color\"], \"initial\")};\n            }\n        }\n    `,\n\n\t/* css */ `\n        .framer-image.framer-text {\n            display: ${defaultImageStyle.display};\n            max-width: 100%;\n            height: auto;\n        }\n    `,\n\n\t/* css */ `\n        .text-styles-preset-reset.framer-text {\n            --framer-font-family: Inter, Inter Placeholder, sans-serif;\n            --framer-font-style: normal;\n            --framer-font-weight: 500;\n            --framer-text-color: #000;\n            --framer-font-size: 16px;\n            --framer-letter-spacing: 0;\n            --framer-text-transform: none;\n            --framer-text-decoration: none;\n            --framer-text-decoration-style: none;\n            --framer-text-decoration-color: none;\n            --framer-text-decoration-thickness: none;\n            --framer-text-decoration-skip-ink: none;\n            --framer-text-decoration-offset: none;\n            --framer-line-height: 1.2em;\n            --framer-text-alignment: start;\n            --framer-font-open-type-features: normal;\n            --framer-text-background-color: initial;\n            --framer-text-background-radius: initial;\n            --framer-text-background-corner-shape: initial;\n            --framer-text-background-padding: initial;\n        }\n    `,\n\n\t/* css */ `\n        ol.framer-text {\n            --list-style-type: decimal;\n        }\n    `,\n\n\t// Why all the `position: relative` and `position: absolute` and `::before` tricks?\n\t// We want ul\u2019s disks and ol\u2019s numbers to be left-aligned at the start of the line.\n\t// There\u2019s no way to do that with ::marker styles alone, so we have to resort to this trick.\n\t/* css */ `\n        ul.framer-text,\n        ol.framer-text {\n            padding-inline-start: 0;\n            position: relative;\n        }\n    `,\n\n\t/* css */ `\n        li.framer-text {\n            counter-increment: list-item;\n            list-style: none;\n            padding-inline-start: 2ch;\n        }\n    `,\n\n\t// font-variant-numeric: tabular-nums enables monospaced numbers (which is neat in a vertical list of numbers)\n\t// and makes `li`s match the default browser styles better.\n\t/* css */ `\n        ol.framer-text > li.framer-text::before {\n            position: absolute;\n            inset-inline-start: 0;\n            content: counter(list-item, var(--list-style-type)) \".\";\n            font-variant-numeric: tabular-nums;\n        }\n    `,\n\n\t// Why this? Due to `position: absolute` (see above), if a list has a lot of items, the numbers\n\t// might start overlapping the text content. This compensates for that. The trick is based on\n\t// https://alistapart.com/article/quantity-queries-for-css/#section6. The trick doesn\u2019t account\n\t// for lists longer than 1,000,000 items, but if you have a list of 1,000,000 items, you\u2019ll have\n\t// other problems \u00AF\\_(\u30C4)_/\u00AF\n\t/* css */ `\n        ol.framer-text > li.framer-text:nth-last-child(n + 10),\n        ol.framer-text > li.framer-text:nth-last-child(n + 10) ~ li {\n            padding-inline-start: 3ch;\n        }\n    `,\n\n\t/* css */ `\n        ol.framer-text > li.framer-text:nth-last-child(n + 100),\n        ol.framer-text > li.framer-text:nth-last-child(n + 100) ~ li {\n            padding-inline-start: 4ch;\n        }\n    `,\n\n\t/* css */ `\n        ol.framer-text > li.framer-text:nth-last-child(n + 1000),\n        ol.framer-text > li.framer-text:nth-last-child(n + 1000) ~ li {\n            padding-inline-start: 5ch;\n        }\n    `,\n\n\t/* css */ `\n        ol.framer-text > li.framer-text:nth-last-child(n + 10000),\n        ol.framer-text > li.framer-text:nth-last-child(n + 10000) ~ li {\n            padding-inline-start: 6ch;\n        }\n    `,\n\n\t/* css */ `\n        ol.framer-text > li.framer-text:nth-last-child(n + 100000),\n        ol.framer-text > li.framer-text:nth-last-child(n + 100000) ~ li {\n            padding-inline-start: 7ch;\n        }\n    `,\n\n\t/* css */ `\n        ol.framer-text > li.framer-text:nth-last-child(n + 1000000),\n        ol.framer-text > li.framer-text:nth-last-child(n + 1000000) ~ li {\n            padding-inline-start: 8ch;\n        }\n    `,\n\n\t/* css */ `\n        ul.framer-text > li.framer-text::before {\n            position: absolute;\n            inset-inline-start: 0;\n            content: \"\u2022\";\n        }\n    `,\n\n\t/* css */ `\n        .framer-table-wrapper {\n            overflow-x: auto;\n        }\n    `,\n\n\t/* css */ `\n        table.framer-text,\n        .framer-table-wrapper table.framer-text {\n            border-collapse: separate;\n            border-spacing: 0;\n            table-layout: auto;\n            word-break: normal;\n            width: 100%;\n        }\n    `,\n\n\t/* css */ `\n        td.framer-text,\n        th.framer-text {\n            min-width: 16ch;\n            vertical-align: top;\n        }\n    `,\n\n\t// Modules can have highly specific three-class selectors in case of PropertyOverrides, so dimension styles will only work with !important\n\n\t/* css */ `\n        ${selectComponentChild('.framer-text-module[data-width=\"fill\"]', \":first-child\")} {\n            width: 100% !important;\n        }\n    `,\n])()\n\n/**\n * Safari <=16 doesn't support text truncation (-webkit-line-clamp) of elements with block-level\n * ancestors. To workaround this, we render all ancestors as inline elements, so that the browser\n * can truncate the text as it would normally.\n *\n * Then we add a line break after each of the elements that we rendered inline, to retain as much of\n * the original structure as possible. It is not perfect, but it gets us most of functionality and\n * appearance for Safari <=16 users.\n *\n * We use CSS variables that are only defined when the text is truncated, so that the fix is only\n * applied to truncated text. This is better than using data attributes to target text truncated\n * nodes, because it doesn't cause unnecessary SSG variants/branches to be generated.\n *\n * @see https://stackoverflow.com/questions/70897195/line-clamp-webkit-not-working-in-safari\n * @see https://framer-team.slack.com/archives/C01B14R6E22/p1756882450581289\n * @see https://framer-team.slack.com/archives/CR3CYA1D4/p1757005728045899\n * */\n\nexport const textTruncationDisplayInlineVariableForSafari16 = \"--text-truncation-display-inline-for-safari-16\"\nexport const textTruncationDisplayNoneVariableForSafari16 = \"--text-truncation-display-none-for-safari-16\"\nexport const textTruncationLineBreakVariableForSafari16 = \"--text-truncation-line-break-for-safari-16\"\n\nconst blockLikeElementSelectors = [\n\t\"div.framer-text\",\n\t\"p.framer-text\",\n\t\"h1.framer-text\",\n\t\"h2.framer-text\",\n\t\"h3.framer-text\",\n\t\"h4.framer-text\",\n\t\"h5.framer-text\",\n\t\"h6.framer-text\",\n\t\"ol.framer-text\",\n\t\"ul.framer-text\",\n\t\"li.framer-text\",\n\t\"blockquote.framer-text\",\n\t\".framer-text.framer-image\",\n]\n\nconst anySafariVersion = \"(background: -webkit-named-image(i))\"\nconst safari17OrGreater = \"(contain-intrinsic-size: inherit)\"\n\nexport const safari16TextTruncationFix = /* @__PURE__ */ (() => [\n\t`@supports ${anySafariVersion} and (not ${safari17OrGreater}) {\n        /* Render block-like elements inline when text is truncated, otherwise default to user agent (revert)  */\n        ${blockLikeElementSelectors.join(\", \")} { display: var(${textTruncationDisplayInlineVariableForSafari16}, revert) }\n\n        /* Add a line break after each block-like element that we render inline, to resemble the block-like behavior */\n        ${blockLikeElementSelectors.map(selector => `${selector}::after`).join(\", \")} { content: var(${textTruncationLineBreakVariableForSafari16}); white-space: pre; }\n\n        /* Don't render modules (e.g. videos, code-blocks), or tables when text is truncated, because often these can't be truncated and their children might be block elements */\n        .framer-text.framer-text-module,\n        .framer-text.framer-table-wrapper { display: var(${textTruncationDisplayNoneVariableForSafari16}, revert) }\n\n        /* Render text-fill elements inline when text is truncated, otherwise default to their default value (e.g. inline-block) */\n        p.framer-text[data-text-fill] { display: var(${textTruncationDisplayInlineVariableForSafari16}, ${defaultTextFillStyle.display}) }\n    }`,\n])()\n", "import { withCSS } from \"../../modules/withCSS.tsx\"\nimport { flexboxGapNotSupportedClass } from \"../../modules/workaroundFlexboxGapNotSupported.ts\"\nimport { RenderTarget } from \"../../render/types/RenderEnvironment.ts\"\nimport { deprecatedRichTextCSSRules } from \"./injectDeprecatedRichTextRules.ts\"\nimport { richTextCSSRules, safari16TextTruncationFix } from \"./injectRichTextRules.ts\"\nimport * as CSS from \"./setDocumentStyles.ts\"\n\nconst componentCSSRules: string[] = [`[data-framer-component-type] { position: absolute; }`]\n\n// A note about text CSS. Older Framer projects generated text like this:\n//\n//     <div><!-- wrapper -->\n//       <div><!-- first line (\"block\" in DraftJS parlance) -->\n//         <span style=\"bold\">Hello </span><span>world</span><br>\n//       </div>\n//       <div><!-- second line, etc. --></div>\n//     </div>\n//\n// Newer projects generate text like this:\n//\n//     <span><!-- wrapper, can pick from span (default), p, h1-h6 -->\n//       <span><!-- first line (\"block\" in DraftJS parlance) -->\n//         <span style=\"bold\">Hello </span><span>world</span><br>\n//       </span>\n//       <span><!-- second line, etc. --></span>\n//     </span>\n//\n// All of this might further be wrapped in an <a>, e.g.:\n//\n//     <!-- after introducing semantic tags -->\n//     <a>\n//       <h1><!-- wrapper -->\n//         <span><!-- block -->\n//           <span style=\"bold\">Hello </span><span>world</span><br>\n//         </span>\n//       </h1>\n//     </a>\n//\n//     <!-- before introducing semantic tags -->\n//     <a><!-- is also the wrapper -->\n//       <div><!-- block -->\n//         <span style=\"bold\">Hello </span><span>world</span><br>\n//       </div>\n//     </a>\n//\n// And the inline spans can also be <a> instead, e.g.:\n//\n//     <span><!-- wrapper -->\n//       <span><!-- block -->\n//         <span style=\"bold\">Hello </span><a>world</a><br>\n//       </span>\n//     </span>\n//\n// The library CSS needs to support all of that.\n\nconst textAlignmentRule = `\n[data-framer-component-type=\"Text\"] > * {\n    text-align: var(--framer-text-alignment, start);\n}`\n\nconst textBlockSpanRule = `\n[data-framer-component-type=\"Text\"] span span,\n[data-framer-component-type=\"Text\"] p span,\n[data-framer-component-type=\"Text\"] h1 span,\n[data-framer-component-type=\"Text\"] h2 span,\n[data-framer-component-type=\"Text\"] h3 span,\n[data-framer-component-type=\"Text\"] h4 span,\n[data-framer-component-type=\"Text\"] h5 span,\n[data-framer-component-type=\"Text\"] h6 span {\n    display: block;\n}`\n\nconst textInlineSpanRule = `\n[data-framer-component-type=\"Text\"] span span span,\n[data-framer-component-type=\"Text\"] p span span,\n[data-framer-component-type=\"Text\"] h1 span span,\n[data-framer-component-type=\"Text\"] h2 span span,\n[data-framer-component-type=\"Text\"] h3 span span,\n[data-framer-component-type=\"Text\"] h4 span span,\n[data-framer-component-type=\"Text\"] h5 span span,\n[data-framer-component-type=\"Text\"] h6 span span {\n    display: unset;\n}`\n\nconst renderTextStylesRule = `\n[data-framer-component-type=\"Text\"] div div span,\n[data-framer-component-type=\"Text\"] a div span,\n[data-framer-component-type=\"Text\"] span span span,\n[data-framer-component-type=\"Text\"] p span span,\n[data-framer-component-type=\"Text\"] h1 span span,\n[data-framer-component-type=\"Text\"] h2 span span,\n[data-framer-component-type=\"Text\"] h3 span span,\n[data-framer-component-type=\"Text\"] h4 span span,\n[data-framer-component-type=\"Text\"] h5 span span,\n[data-framer-component-type=\"Text\"] h6 span span,\n[data-framer-component-type=\"Text\"] a {\n    font-family: var(--font-family);\n    font-style: var(--font-style);\n    font-weight: min(calc(var(--framer-font-weight-increase, 0) + var(--font-weight, 400)), 900);\n    color: var(--text-color);\n    letter-spacing: var(--letter-spacing);\n    font-size: var(--font-size);\n    text-transform: var(--text-transform);\n    --text-decoration: var(--framer-text-decoration-style, solid) var(--framer-text-decoration, none) var(--framer-text-decoration-color, currentcolor) var(--framer-text-decoration-thickness, auto);\n    --text-decoration-skip-ink: var(--framer-text-decoration-skip-ink);\n    --text-underline-offset: var(--framer-text-decoration-offset);\n    line-height: var(--line-height);\n}`\n\nconst textStylesRule = `\n[data-framer-component-type=\"Text\"] div div span,\n[data-framer-component-type=\"Text\"] a div span,\n[data-framer-component-type=\"Text\"] span span span,\n[data-framer-component-type=\"Text\"] p span span,\n[data-framer-component-type=\"Text\"] h1 span span,\n[data-framer-component-type=\"Text\"] h2 span span,\n[data-framer-component-type=\"Text\"] h3 span span,\n[data-framer-component-type=\"Text\"] h4 span span,\n[data-framer-component-type=\"Text\"] h5 span span,\n[data-framer-component-type=\"Text\"] h6 span span,\n[data-framer-component-type=\"Text\"] a {\n    --font-family: var(--framer-font-family);\n    --font-style: var(--framer-font-style);\n    --font-weight: var(--framer-font-weight);\n    --text-color: var(--framer-text-color);\n    --letter-spacing: var(--framer-letter-spacing);\n    --font-size: var(--framer-font-size);\n    --text-transform: var(--framer-text-transform);\n    --text-decoration: var(--framer-text-decoration-style, solid) var(--framer-text-decoration, none) var(--framer-text-decoration-color, currentcolor) var(--framer-text-decoration-thickness, auto);\n    --text-decoration-skip-ink: var(--framer-text-decoration-skip-ink);\n    --text-underline-offset: var(--framer-text-decoration-offset);\n    --line-height: var(--framer-line-height);\n}`\n\nconst linkStylesRule = `\n[data-framer-component-type=\"Text\"] a,\n[data-framer-component-type=\"Text\"] a div span,\n[data-framer-component-type=\"Text\"] a span span span,\n[data-framer-component-type=\"Text\"] a p span span,\n[data-framer-component-type=\"Text\"] a h1 span span,\n[data-framer-component-type=\"Text\"] a h2 span span,\n[data-framer-component-type=\"Text\"] a h3 span span,\n[data-framer-component-type=\"Text\"] a h4 span span,\n[data-framer-component-type=\"Text\"] a h5 span span,\n[data-framer-component-type=\"Text\"] a h6 span span {\n    --font-family: var(--framer-link-font-family, var(--framer-font-family));\n    --font-style: var(--framer-link-font-style, var(--framer-font-style));\n    --font-weight: var(--framer-link-font-weight, var(--framer-font-weight));\n    --text-color: var(--framer-link-text-color, var(--framer-text-color));\n    --font-size: var(--framer-link-font-size, var(--framer-font-size));\n    --text-transform: var(--framer-link-text-transform, var(--framer-text-transform));\n    --text-decoration: var(--framer-link-text-decoration-style, var(--framer-text-decoration-style, solid)) var(--framer-link-text-decoration, var(--framer-text-decoration, none)) var(--framer-link-text-decoration-color, var(--framer-text-decoration-color, currentcolor)) var(--framer-link-text-decoration-thickness, var(--framer-text-decoration-thickness, auto));\n    --text-decoration-skip-ink: var(--framer-link-text-decoration-skip-ink, var(--framer-text-decoration-skip-ink));\n    --text-underline-offset: var(--framer-link-text-decoration-offset, var(--framer-text-decoration-offset));\n}`\n\nconst linkHoverStylesRule = `\n[data-framer-component-type=\"Text\"] a:hover,\n[data-framer-component-type=\"Text\"] a div span:hover,\n[data-framer-component-type=\"Text\"] a span span span:hover,\n[data-framer-component-type=\"Text\"] a p span span:hover,\n[data-framer-component-type=\"Text\"] a h1 span span:hover,\n[data-framer-component-type=\"Text\"] a h2 span span:hover,\n[data-framer-component-type=\"Text\"] a h3 span span:hover,\n[data-framer-component-type=\"Text\"] a h4 span span:hover,\n[data-framer-component-type=\"Text\"] a h5 span span:hover,\n[data-framer-component-type=\"Text\"] a h6 span span:hover {\n    --font-family: var(--framer-link-hover-font-family, var(--framer-link-font-family, var(--framer-font-family)));\n    --font-style: var(--framer-link-hover-font-style, var(--framer-link-font-style, var(--framer-font-style)));\n    --font-weight: var(--framer-link-hover-font-weight, var(--framer-link-font-weight, var(--framer-font-weight)));\n    --text-color: var(--framer-link-hover-text-color, var(--framer-link-text-color, var(--framer-text-color)));\n    --font-size: var(--framer-link-hover-font-size, var(--framer-link-font-size, var(--framer-font-size)));\n    --text-transform: var(--framer-link-hover-text-transform, var(--framer-link-text-transform, var(--framer-text-transform)));\n    --text-decoration: var(--framer-link-hover-text-decoration-style, var(--framer-link-text-decoration-style, var(--framer-text-decoration-style, solid))) var(--framer-link-hover-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, none))) var(--framer-link-hover-text-decoration-color, var(--framer-link-text-decoration-color, var(--framer-text-decoration-color, currentcolor))) var(--framer-link-hover-text-decoration-thickness, var(--framer-link-text-decoration-thickness, var(--framer-text-decoration-thickness, auto)));\n    --text-decoration-skip-ink: var(--framer-link-hover-text-decoration-skip-ink, var(--framer-link-text-decoration-skip-ink, var(--framer-text-decoration-skip-ink)));\n    --text-underline-offset: var(--framer-link-hover-text-decoration-offset, var(--framer-link-text-decoration-offset, var(--framer-text-decoration-offset)));\n}`\n\nconst linkCurrentStylesRule = `\n[data-framer-component-type=\"Text\"].isCurrent a,\n[data-framer-component-type=\"Text\"].isCurrent a div span,\n[data-framer-component-type=\"Text\"].isCurrent a span span span,\n[data-framer-component-type=\"Text\"].isCurrent a p span span,\n[data-framer-component-type=\"Text\"].isCurrent a h1 span span,\n[data-framer-component-type=\"Text\"].isCurrent a h2 span span,\n[data-framer-component-type=\"Text\"].isCurrent a h3 span span,\n[data-framer-component-type=\"Text\"].isCurrent a h4 span span,\n[data-framer-component-type=\"Text\"].isCurrent a h5 span span,\n[data-framer-component-type=\"Text\"].isCurrent a h6 span span {\n    --font-family: var(--framer-link-current-font-family, var(--framer-link-font-family, var(--framer-font-family)));\n    --font-style: var(--framer-link-current-font-style, var(--framer-link-font-style, var(--framer-font-style)));\n    --font-weight: var(--framer-link-current-font-weight, var(--framer-link-font-weight, var(--framer-font-weight)));\n    --text-color: var(--framer-link-current-text-color, var(--framer-link-text-color, var(--framer-text-color)));\n    --font-size: var(--framer-link-current-font-size, var(--framer-link-font-size, var(--framer-font-size)));\n    --text-transform: var(--framer-link-current-text-transform, var(--framer-link-text-transform, var(--framer-text-transform)));\n    --text-decoration: var(--framer-link-current-text-decoration-style, var(--framer-link-text-decoration-style, var(--framer-text-decoration-style, solid))) var(--framer-link-current-text-decoration, var(--framer-link-text-decoration, var(--framer-text-decoration, none))) var(--framer-link-current-text-decoration-color, var(--framer-link-text-decoration-color, var(--framer-text-decoration-color, currentcolor))) var(--framer-link-current-text-decoration-thickness, var(--framer-link-text-decoration-thickness, var(--framer-text-decoration-thickness, auto)));\n    --text-decoration-skip-ink: var(--framer-link-current-text-decoration-skip-ink, var(--framer-link-text-decoration-skip-ink, var(--framer-text-decoration-skip-ink)));\n    --text-underline-offset: var(--framer-link-current-text-decoration-offset, var(--framer-link-text-decoration-offset, var(--framer-text-decoration-offset)));\n}`\n\n// [data-framer-component-text-autosized] is no longer used, but still supported\n// included to maintain backwards compatibility for smart components that were\n// generated before it was removed:\n// https://github.com/framer/FramerStudio/pull/8270.\nconst textCSSRules = [\n\t`[data-framer-component-type=\"Text\"] { cursor: inherit; }`,\n\t`[data-framer-component-text-autosized] * { white-space: pre; }`,\n\ttextAlignmentRule,\n\ttextBlockSpanRule,\n\ttextInlineSpanRule,\n\trenderTextStylesRule,\n\ttextStylesRule,\n\tlinkStylesRule,\n\tlinkHoverStylesRule,\n\tlinkCurrentStylesRule,\n]\n\n/**\n * In generated code sticky is set via CSS, we don't want to set `position:\n * relative` here since it has a higher precedence. Code-gen stack children will\n * receive their `position: relative` through style overrides.\n */\nconst stackPositionRule = `\n:not([data-framer-generated]) > [data-framer-stack-content-wrapper] > *,\n:not([data-framer-generated]) > [data-framer-stack-content-wrapper] > [data-framer-component-type],\n:not([data-framer-generated]) > [data-framer-stack-content-wrapper] > [data-framer-legacy-stack-gap-enabled] > *,\n:not([data-framer-generated]) > [data-framer-stack-content-wrapper] > [data-framer-legacy-stack-gap-enabled] > [data-framer-component-type] {\n    position: relative;\n}`\n\n/**\n * Our isFlexboxGapSupported helper relies on DOM measurement, which is not 100%\n * reliable, it could return false while the user agent actually supports gap,\n * for example, if the document is not visible at the time the check runs.\n * Therefore we need to make sure if it determines gap is not supported, we\n * don't use the gap CSS at all, otherwise we end up with double gaps. We could\n * remove the unset rule when we have a proper way to test flexbox gap support.\n * see: https://github.com/framer/company/issues/23712\n * Since the gap variable is available for all stack descendants, we also need\n * to make sure `gap` is used for the ones that's using flexbox gap (has their\n * own --stack-native-gap set), that way nested stacks with different gap\n * settings would work as expected.\n */\nconst nativeStackGapRules: string[] = /* @__PURE__ */ (() => [\n\t`[data-framer-stack-content-wrapper][data-framer-stack-gap-enabled=\"true\"] {\n        row-gap: var(--stack-native-row-gap);\n        column-gap: var(--stack-native-column-gap);\n    }`,\n\t`.${flexboxGapNotSupportedClass} [data-framer-stack-content-wrapper][data-framer-stack-gap-enabled=\"true\"] {\n        row-gap: unset;\n        column-gap: unset;\n    }`,\n])()\n\nconst stackGapRule = /* @__PURE__ */ (() => `\n.${flexboxGapNotSupportedClass} [data-framer-legacy-stack-gap-enabled=\"true\"] > *, [data-framer-legacy-stack-gap-enabled=\"true\"][data-framer-stack-flexbox-gap=\"false\"] {\n    margin-top: calc(var(--stack-gap-y) / 2);\n    margin-bottom: calc(var(--stack-gap-y) / 2);\n    margin-right: calc(var(--stack-gap-x) / 2);\n    margin-left: calc(var(--stack-gap-x) / 2);\n}\n`)()\n\n/* This should take the language direction into account */\nconst stackDirectionRuleVertical = /* @__PURE__ */ (() => `\n.${flexboxGapNotSupportedClass}\n[data-framer-stack-direction-reverse=\"false\"]\n[data-framer-legacy-stack-gap-enabled=\"true\"]\n> *:first-child,\n[data-framer-stack-direction-reverse=\"false\"]\n[data-framer-legacy-stack-gap-enabled=\"true\"][data-framer-stack-flexbox-gap=\"false\"]\n> *:first-child,\n.${flexboxGapNotSupportedClass}\n[data-framer-stack-direction-reverse=\"true\"]\n[data-framer-legacy-stack-gap-enabled=\"true\"]\n> *:last-child,\n[data-framer-stack-direction-reverse=\"true\"]\n[data-framer-legacy-stack-gap-enabled=\"true\"][data-framer-stack-flexbox-gap=\"false\"]\n> *:last-child {\n    margin-top: 0;\n    margin-left: 0;\n}`)()\n\n/* This should take the language direction into account */\nconst stackDirectionRuleHorizontal = /* @__PURE__ */ (() => `\n.${flexboxGapNotSupportedClass}\n[data-framer-stack-direction-reverse=\"false\"]\n[data-framer-legacy-stack-gap-enabled=\"true\"]\n> *:last-child,\n[data-framer-stack-direction-reverse=\"false\"]\n[data-framer-legacy-stack-gap-enabled=\"true\"][data-framer-stack-flexbox-gap=\"false\"]\n> *:last-child,\n.${flexboxGapNotSupportedClass}\n[data-framer-stack-direction-reverse=\"true\"]\n[data-framer-legacy-stack-gap-enabled=\"true\"]\n> *:first-child,\n[data-framer-stack-direction-reverse=\"true\"]\n[data-framer-legacy-stack-gap-enabled=\"true\"][data-framer-stack-flexbox-gap=\"false\"]\n> *:first-child {\n    margin-right: 0;\n    margin-bottom: 0;\n}`)()\n\nconst stackCSSRules: string[] = /* @__PURE__ */ (() => [\n\tstackPositionRule,\n\tstackGapRule,\n\t...nativeStackGapRules,\n\tstackDirectionRuleVertical,\n\tstackDirectionRuleHorizontal,\n])()\n\nconst navigationCSSRules: string[] = [\n\t`\nNavigationContainer\n[data-framer-component-type=\"NavigationContainer\"] > *,\n[data-framer-component-type=\"NavigationContainer\"] > [data-framer-component-type] {\n    position: relative;\n}`,\n]\n\nconst scrollCSSRules: string[] = [\n\t`[data-framer-component-type=\"Scroll\"]::-webkit-scrollbar { display: none; }`,\n\t`[data-framer-component-type=\"ScrollContentWrapper\"] > * { position: relative; }`,\n]\n\nconst nativeScrollCSSRules: string[] = [\n\t`[data-framer-component-type=\"NativeScroll\"] { -webkit-overflow-scrolling: touch; }`,\n\t`[data-framer-component-type=\"NativeScroll\"] > * { position: relative; }`,\n\t`[data-framer-component-type=\"NativeScroll\"].direction-both { overflow-x: auto; overflow-y: auto; }`,\n\t`[data-framer-component-type=\"NativeScroll\"].direction-vertical { overflow-x: hidden; overflow-y: auto; }`,\n\t`[data-framer-component-type=\"NativeScroll\"].direction-horizontal { overflow-x: auto; overflow-y: hidden; }`,\n\t`[data-framer-component-type=\"NativeScroll\"].direction-vertical > * { width: 100% !important; }`,\n\t`[data-framer-component-type=\"NativeScroll\"].direction-horizontal > * { height: 100% !important; }`,\n\t`[data-framer-component-type=\"NativeScroll\"].scrollbar-hidden::-webkit-scrollbar { display: none; }`,\n]\n\nconst deviceComponentCSSRules: string[] = [\n\t`[data-framer-component-type=\"DeviceComponent\"].no-device > * { width: 100% !important; height: 100% !important; }`,\n]\n\nconst pageContentWrapperWrapperCSSRules: string[] = [\n\t`[data-framer-component-type=\"PageContentWrapper\"] > *, [data-framer-component-type=\"PageContentWrapper\"] > [data-framer-component-type] { position: relative; }`,\n]\n\nconst presenceCSS: string[] = [\n\t`[data-is-present=\"false\"], [data-is-present=\"false\"] * { pointer-events: none !important; }`,\n]\n\n/**\n * Framer Motion has a lengthy cross-fade when doing shared layout animations to cover up morphing\n * between the lead and follow layers. When building a lightbox, this is undesirable because we only\n * want to see the high resolution image for the entire enter AND exit animation.\n *\n * Using this !important rule allows us to achieve this without complicated/custom framer-motion\n * animation overrides - retaining the lead image at full opacity for its entire existence.\n */\nconst lightboxCSS: string[] = [`.framer-lightbox-container { opacity: 1 !important; pointer-events: auto !important; }`]\n\nconst cursorCSS: string[] = [\n\t`[data-framer-cursor=\"pointer\"] { cursor: pointer; }`,\n\t`[data-framer-cursor=\"grab\"] { cursor: grab; }`,\n\t`[data-framer-cursor=\"grab\"]:active { cursor: grabbing; }`,\n]\n\nconst frameCSS: string[] = [\n\t// Non-sites prototyping projects render with FrameWithMotion and Stacks. In\n\t// that context this rule ensures pointer events work in a specific way\n\t// designed for prototypes that we don't care about anymore in sites. We\n\t// can't remove it for legacy reasons, but sites will never render any\n\t// elements that are impacted by this rule. However, users can still use the\n\t// <Frame> api in code, at which point this rule will kick in. We don't\n\t// encourage the use of this API anymore, and bugs that come from this will\n\t// be the user's concern.\n\t`[data-framer-component-type=\"Frame\"] *, [data-framer-component-type=\"Stack\"] * { pointer-events: auto; }`,\n\t// This is fully deprecated, and will never exist in code that is generated\n\t// after 24/01/2023. There will be existing code-generated that depends on\n\t// this rule existing, so we can't remove it.\n\t`[data-framer-generated] * { pointer-events: unset }`,\n]\n\nconst resetCSS: string[] = [\n\t`[data-reset=\"button\"] {\n        border-width: 0;\n        padding: 0;\n        background: none;\n}`,\n]\n\nconst hideScrollbars: string[] = [\n\t`[data-hide-scrollbars=\"true\"]::-webkit-scrollbar { width: 0px; height: 0px; }`,\n\t`[data-hide-scrollbars=\"true\"]::-webkit-scrollbar-thumb { background: transparent; }`,\n\t`[data-hide-scrollbars=\"true\"] { scrollbar-width: none; }`,\n]\n\nexport const willChangeOverrideCSSVariable = \"--framer-will-change-override\"\n\n/**\n * Smart Components and Layout Templates are serialized to javascript and instances are rendered on\n * the canvas. Elements in these components may include effects, which need to be layerised in the\n * published site and preview, but not on the the canvas. This variable can be set to \"none\" on the\n * canvas, to disable layerisation.\n */\nexport const willChangeEffectOverrideCSSVariable = \"--framer-will-change-effect-override\"\n\nexport const willChangeFilterOverrideCSSVariable = \"--framer-will-change-filter-override\"\n\nconst anySafariVersion = \"(background: -webkit-named-image(i))\"\nconst safari16OrGreater = \"(grid-template-rows: subgrid)\"\n// See: https://webkit.org/blog/17333/webkit-features-in-safari-26-0/\nconst safari26OrGreater = \"(position-area: top right)\"\n\n// For Safari 15, if overflow hidden is set, and there is a border radius, the\n// element must be layer backed. Otherwise the border radius will be ignored by\n// child elements that are themselves layer backed. This can be some component\n// with will-change set, but also happens when children animate. Note this was\n// fixed with Safari 16. We use @supports rules to conservatively apply this\n// only to Safari <16.\nconst willChangeTransformRules = (isPreview: boolean) =>\n\tisPreview\n\t\t? [\n\t\t\t\t`body { ${willChangeOverrideCSSVariable}: none; }`,\n\t\t\t\t`@supports ${anySafariVersion} and (not ${safari16OrGreater}) { body { ${willChangeOverrideCSSVariable}: transform; } }`,\n\t\t\t]\n\t\t: [`body { ${willChangeOverrideCSSVariable}: none; ${willChangeEffectOverrideCSSVariable}: none; }`]\n\nconst willChangeFilterRules = (isPreview: boolean) =>\n\tisPreview\n\t\t? [\n\t\t\t\t`body { ${willChangeFilterOverrideCSSVariable}: none; }`,\n\t\t\t\t`@supports ${anySafariVersion} and (not ${safari26OrGreater}) { body { ${willChangeFilterOverrideCSSVariable}: filter; } }`,\n\t\t\t]\n\t\t: [`body { ${willChangeFilterOverrideCSSVariable}: none; }`]\n\n/**\n * Add propagation-blocking if we're not on the canvas. If we add this while on the canvas,\n * strange behaviour can appear in the Component panel, with the drag event being blocked.\n */\nconst frameCSSRules = (isPreview: boolean): string[] => {\n\treturn isPreview ? frameCSS : []\n}\n\nconst svgCSSRules: string[] = [`.svgContainer svg { display: block; }`]\n\n/** CSS custom property used for overflow: clip fallback. */\nexport const overflowClipFallbackCSSVariable = \"--overflow-clip-fallback\"\n\n/**\n * Safari 15 does not support the overflow: clip property, so when `overflow: clip` is not\n * supported, we set `--overflow-clip-fallback: hidden`, which is then used in:\n *\n * ```css\n * overflow: var(--overflow-clip-fallback, clip)\n * ```\n *\n * This allows us to remove this fallback later, without having to regenerate all the existing\n * modules, since they will default to `clip` if `--overflow-clip-fallback` is not set.\n *\n * Note: we use `@supports` to set `--overflow-clip-fallback` because `var()` fallbacks don't work\n * for invalid/unsupported values, only for undefined css variables, which means the following would\n * NOT work:\n *\n * ```css\n * --clip: clip\n * overflow: var(--clip, hidden)\n * ```\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_cascading_variables/Using_CSS_custom_properties#invalid_custom_properties\n */\nconst overflowClipFallbackCSSRules: string[] = /* @__PURE__ */ (() => [\n\t`@supports (not (overflow: clip)) {\n        :root { ${overflowClipFallbackCSSVariable}: hidden; }\n    }`,\n])()\n\nexport const oneIfCornerShapeSupportedCSSVariable = \"--one-if-corner-shape-supported\"\n\nconst cornerShapeCSSRules: string[] = /* @__PURE__ */ (() => [\n\t`@supports (corner-shape: superellipse(2)) { :root { ${oneIfCornerShapeSupportedCSSVariable}: 1 } }`,\n])()\n\nconst combineCSSRules = (isPreview: boolean): string[] => [\n\t...willChangeTransformRules(isPreview),\n\t...willChangeFilterRules(isPreview),\n\t...componentCSSRules,\n\t...textCSSRules,\n\t...richTextCSSRules,\n\t...deprecatedRichTextCSSRules,\n\t...stackCSSRules,\n\t...navigationCSSRules,\n\t...scrollCSSRules,\n\t...nativeScrollCSSRules,\n\t...pageContentWrapperWrapperCSSRules,\n\t...deviceComponentCSSRules,\n\t...presenceCSS,\n\t...cursorCSS,\n\t...frameCSSRules(isPreview),\n\t...svgCSSRules,\n\t...resetCSS,\n\t...hideScrollbars,\n\t...overflowClipFallbackCSSRules,\n\t...lightboxCSS,\n\t...safari16TextTruncationFix,\n\t...cornerShapeCSSRules,\n]\n\n// Only generate preview and non preview styles once\n/** @internal */\nexport const combinedCSSRules = /* @__PURE__ */ combineCSSRules(false)\n\n/** @internal */\nexport const combinedCSSRulesForPreview = /* @__PURE__ */ combineCSSRules(true)\n\nexport function getCombinedCSSRules() {\n\treturn RenderTarget.current() === RenderTarget.preview ? combinedCSSRulesForPreview : combinedCSSRules\n}\n\nexport function withLibraryCSS<T extends object>(Component: React.ComponentType<T>) {\n\treturn withCSS(Component, getCombinedCSSRules, \"framer-lib-combinedCSSRules\")\n}\n\n/** @internal */\nexport function injectComponentCSSRulesWithSheet(sheet: CSSStyleSheet, cache: Set<string>) {\n\tconst styles = RenderTarget.current() === RenderTarget.preview ? combinedCSSRulesForPreview : combinedCSSRules\n\tfor (const rule of styles) {\n\t\tCSS.injectCSSRule(rule, sheet, cache)\n\t}\n}\n", "import type React from \"react\"\nimport type { ColorControlDescription, ControlDescription, PropertyControls } from \"../render/types/PropertyControls.ts\"\nimport { ControlType } from \"../render/types/PropertyControls.ts\"\nimport { isArray, isBoolean, isFunction, isNumber, isObject, isString, isUndefined } from \"./utils.ts\"\n\nfunction isReactComponent(component: unknown): component is React.ComponentType {\n\t// Before we were using `instanceof React.Component` instead of `isObject` but unfortunately\n\t// that check isn't compatible with `React.forwardRef`.\n\treturn isObject(component) || isFunction(component)\n}\n\nconst optionalKey: keyof Pick<ColorControlDescription, \"optional\"> = \"optional\"\n\nfunction controlIsOptional(control: PropertyControls[string]): boolean {\n\treturn !!control && optionalKey in control && control[optionalKey] === true\n}\n\nfunction shouldBeNever(_: never) {}\n\nfunction getControlDefaultValue(control: ControlDescription): unknown {\n\ttry {\n\t\tswitch (control.type) {\n\t\t\tcase ControlType.String:\n\t\t\tcase ControlType.CollectionReference:\n\t\t\tcase ControlType.Color:\n\t\t\tcase ControlType.Date:\n\t\t\tcase ControlType.Link:\n\t\t\tcase ControlType.BoxShadow:\n\t\t\tcase ControlType.Padding:\n\t\t\tcase ControlType.BorderRadius:\n\t\t\tcase ControlType.Gap:\n\t\t\t\treturn isString(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.Boolean:\n\t\t\t\treturn isBoolean(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.Enum:\n\t\t\t\tif (isUndefined(control.defaultValue)) return undefined\n\t\t\t\treturn control.options.includes(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.FusedNumber:\n\t\t\tcase ControlType.Number:\n\t\t\t\treturn isNumber(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.Transition:\n\t\t\t\treturn isObject(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.Border:\n\t\t\t\treturn isObject(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.Font:\n\t\t\tcase ControlType.Location:\n\t\t\t\treturn isObject(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.LinkRelValues:\n\t\t\t\treturn isArray(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.MultiCollectionReference:\n\t\t\t\treturn isArray(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.Object: {\n\t\t\t\tconst value = isObject(control.defaultValue) ? control.defaultValue : {}\n\n\t\t\t\tif (isObject(control.controls)) {\n\t\t\t\t\tapplyControlDefaultsToDefaultProps(value, control.controls)\n\t\t\t\t}\n\n\t\t\t\treturn value\n\t\t\t}\n\t\t\tcase ControlType.Array:\n\t\t\t\treturn isArray(control.defaultValue) ? control.defaultValue : undefined\n\t\t\tcase ControlType.File:\n\t\t\tcase ControlType.Image:\n\t\t\tcase ControlType.RichText:\n\t\t\tcase ControlType.PageScope:\n\t\t\tcase ControlType.EventHandler:\n\t\t\tcase ControlType.ChangeHandler:\n\t\t\tcase ControlType.SegmentedEnum:\n\t\t\tcase ControlType.ResponsiveImage:\n\t\t\tcase ControlType.ComponentInstance:\n\t\t\tcase ControlType.Slot:\n\t\t\tcase ControlType.ScrollSectionRef:\n\t\t\tcase ControlType.CustomCursor:\n\t\t\tcase ControlType.Cursor:\n\t\t\tcase ControlType.TrackingId:\n\t\t\tcase ControlType.VectorSetItem:\n\t\t\t\treturn undefined // No default\n\n\t\t\tdefault:\n\t\t\t\t// We are not asserting because we never want this to crash. It's run while a user is coding.\n\t\t\t\tshouldBeNever(control)\n\t\t\t\treturn undefined\n\t\t}\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\nfunction applyControlDefaultsToDefaultProps(defaultProps: Record<string, unknown>, controls: PropertyControls) {\n\tfor (const controlKey in controls) {\n\t\tconst control = controls[controlKey]\n\t\tif (!control) continue\n\n\t\t// Ignore if a value is already set\n\t\tconst currentDefault = defaultProps[controlKey]\n\t\tif (!isUndefined(currentDefault)) continue\n\n\t\t// Ignore if the value needs to support undefined\n\t\tif (controlIsOptional(control)) continue\n\n\t\t// Get default value from control\n\t\tconst defaultValue = getControlDefaultValue(control)\n\t\tif (isUndefined(defaultValue)) continue\n\n\t\tdefaultProps[controlKey] = defaultValue\n\t}\n}\n\nfunction getDefaultProps(component: React.ComponentType): Record<string, unknown> {\n\tif (isObject(component.defaultProps)) {\n\t\treturn component.defaultProps\n\t}\n\tconst defaultProps = {}\n\tcomponent.defaultProps = defaultProps\n\treturn defaultProps\n}\n\nexport function applyControlDefaultsToReactDefaultProps(component: unknown, controls: PropertyControls) {\n\tif (!isReactComponent(component)) return\n\tconst defaultProps = getDefaultProps(component)\n\tapplyControlDefaultsToDefaultProps(defaultProps, controls)\n}\n", "import type React from \"react\"\nimport type { AnyCollection } from \"../modules/cms/types.ts\"\nimport type { PropertyControls } from \"../render/types/PropertyControls.ts\"\nimport { applyControlDefaultsToReactDefaultProps } from \"./applyControlDefaultsToReactDefaultProps.ts\"\n\ntype HigherOrderComponent<Props> = (Component: React.ComponentType<Props>, props?: Props) => React.ComponentType<Props>\n\n/**\n * Extends component with property controls\n *\n * ```typescript\n * export const MyComponent = props => <h1>{props.header}</h1>\n *\n * addPropertyControls(MyComponent, {\n *   header:  { type: ControlType.String, title: \"Header\" },\n * })\n *\n * ```\n * @public\n */\nexport function addPropertyControls<Props = any>(\n\tcomponent: React.ComponentType<Props> | React.ForwardRefExoticComponent<Props> | HigherOrderComponent<Props>,\n\tpropertyControls: PropertyControls<Props>,\n) {\n\tObject.assign(component, { propertyControls })\n\tapplyControlDefaultsToReactDefaultProps(component, propertyControls)\n}\n\n/**\n * Get the property controls for a component\n * @param component - The component to retrieve the property controls for\n * @returns The property controls for the given component\n * @internal\n */\nexport function getPropertyControls<Props = any>(\n\tcomponent: React.ComponentType<Props> | React.ForwardRefExoticComponent<Props> | AnyCollection,\n): PropertyControls<Props> | undefined {\n\t// We need to cast the component here because the function accepts any component type by design\n\treturn (component as any).propertyControls\n}\n", "// You should probably never remove presets from here, or we risk breaking\n// projects, unless we also migrate the obsolete presets.\n/**\n * @internal\n */\nexport type DevicePresetID =\n\t// Phones\n\t| \"iphone-11\"\n\t| \"iphone-12-pro\"\n\t| \"iphone-12-pro-max\"\n\t| \"iphone-12\"\n\t| \"iphone-12-mini\"\n\t| \"iphone-11-pro\"\n\t| \"iphone-11-pro-max\"\n\t| \"iphone-8\"\n\t| \"iphone-8-plus\"\n\t| \"iphone-se\"\n\t| \"samsung-note-10\"\n\t| \"samsung-galaxy-s7\"\n\t| \"pixel-4\"\n\t| \"pixel-4-xl\"\n\t| \"pixel-5\"\n\t// Desktops and Laptops\n\t| \"macbook-air\"\n\t| \"macbook-pro-13\"\n\t| \"macbook-pro-16\"\n\t| \"imac-21-5\"\n\t| \"imac-27\"\n\t| \"pro-display-xdr\"\n\t| \"dell-xps\"\n\t| \"surface-book\"\n\t// Tablets\n\t| \"ipad\"\n\t| \"ipad-mini\"\n\t| \"ipad-air\"\n\t| \"ipad-pro-11\"\n\t| \"ipad-pro-12-9\"\n\t| \"surface-3\"\n\t| \"surface-pro-4\"\n\t// Watches\n\t| \"apple-watch-44\"\n\t| \"apple-watch-40\"\n\t// TVs\n\t| \"tv-4k\"\n\t| \"tv-full-hd\"\n\t// Deprecated\n\t| \"720p\"\n\t| \"900p\"\n\t| \"1080p\"\n\t| \"1440p\"\n\t| \"4k\"\n\nexport const defaultPresetId: DevicePresetID = \"iphone-12-pro\"\n/**\n * @internal\n */\nexport interface DeviceColor {\n\tcolorValue: string\n\ttitle: string\n\tid: string\n}\n/**\n * @internal\n */\nexport interface DevicePreset {\n\tid: DevicePresetID\n\ttitle: string\n\n\tdisableRotation?: boolean\n\n\tscreenWidth: number\n\tscreenHeight: number\n\tscreenRadius?: number\n\tscreenMask?: string\n\n\tclayBezelTop?: number\n\tclayBezelRight?: number\n\tclayBezelBottom?: number\n\tclayBezelLeft?: number\n\tclayBezelRadius?: number\n\texternalClay?: {\n\t\twidth: number\n\t\theight: number\n\t\tscreenOffsetTop: number\n\t\tscreenOffsetLeft: number\n\t}\n\n\trealisticImage?: {\n\t\twidth: number\n\t\theight: number\n\t\tscreenOffsetTop: number\n\t\tscreenOffsetLeft: number\n\t\tavailableColors?: DeviceColor[]\n\t\thandOffset?: {\n\t\t\tleft?: number\n\t\t\tright?: number\n\t\t\tbottom?: number\n\t\t}\n\t}\n}\n\n// Phones ------------------------------------------------------------------------------------------------------------------------\nconst presetsBase = /* @__PURE__ */ (() => ({\n\tiPhonePro: {\n\t\t// Screen mask takes care of the rounded screen corners for iPhones Pro,\n\t\t// and actually using a radius here produces visual artifacts in Chrome.\n\t\tscreenRadius: /* 38 */ 0,\n\t\tclayBezelLeft: 21,\n\t\tclayBezelRight: 21,\n\t\tclayBezelTop: 21,\n\t\tclayBezelBottom: 21,\n\t\tclayBezelRadius: 38 + 21,\n\t},\n\tiPhone8: {\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 24,\n\t\tclayBezelRight: 24,\n\t\tclayBezelTop: 96,\n\t\tclayBezelBottom: 96,\n\t\tclayBezelRadius: 38 * 1.5,\n\t},\n\tiPadPro: {\n\t\tscreenRadius: 25,\n\t\tclayBezelLeft: 38,\n\t\tclayBezelRight: 38,\n\t\tclayBezelTop: 38,\n\t\tclayBezelBottom: 38,\n\t\tclayBezelRadius: 25 + 38,\n\t},\n\tdesktop: {\n\t\tclayBezelLeft: 20,\n\t\tclayBezelRight: 20,\n\t\tclayBezelTop: 20,\n\t\tclayBezelBottom: 20,\n\t\tclayBezelRadius: 20,\n\t},\n}))()\n\n/**\n * @internal\n */\nexport const devicePresets: DevicePreset[] = /* @__PURE__ */ (() => [\n\t{\n\t\tid: \"iphone-12\",\n\t\ttitle: \"iPhone 12\",\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 22,\n\t\tclayBezelRight: 22,\n\t\tclayBezelTop: 22,\n\t\tclayBezelBottom: 22,\n\t\tclayBezelRadius: 66,\n\t\tscreenWidth: 390,\n\t\tscreenHeight: 844,\n\t\texternalClay: {\n\t\t\twidth: 500,\n\t\t\theight: 974,\n\t\t\tscreenOffsetTop: 65,\n\t\t\tscreenOffsetLeft: 55,\n\t\t},\n\t\tscreenMask:\n\t\t\t'<g style=\"transform: scale(0.5);\"><path d=\"M171.2 0c2.3 0 4 .5 5.4 1.3 1.6 1 2.8 2.2 3.7 3.8.8 1.6 1.2 2.3 1.2 4.9 0 12 2.2 19 6.2 26.5s9.8 13.3 17.3 17.4c7.5 4 15.8 6.1 30.6 6.1h311.5c14.3 0 22.5-2.2 29.9-6.1 7.5-4 13.3-10 17.3-17.4 4-7.5 6.2-14.5 6.2-26.5 0-2.6.4-3.2 1.1-4.9.8-1.6 2-2.9 3.4-3.8 1.4-.8 3.2-1.3 5.4-1.3h54.2c40.1 0 54.7 4.2 69.4 12a81.8 81.8 0 0134 34c7.8 14.7 12 29.3 12 69.4v1457.2c0 40.1-4.2 54.7-12 69.4a81.8 81.8 0 01-34 34c-14.7 7.8-29.3 12-69.4 12H115.4c-40.1 0-54.7-4.2-69.4-12a81.8 81.8 0 01-34-34c-7.8-14.7-12-29.3-12-69.4V115.4C0 75.3 4.2 60.7 12 46a81.8 81.8 0 0134-34C60.7 4.2 75.3 0 115.4 0h55.4z\" fill=\"#000\" fill-rule=\"evenodd\"/></g>',\n\t\trealisticImage: {\n\t\t\twidth: 490,\n\t\t\theight: 944,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 50,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"black\", title: \"Black\", colorValue: \"#2E2C36\" },\n\t\t\t\t{ id: \"white\", title: \"White\", colorValue: \"#F7F3F0\" },\n\t\t\t\t{ id: \"blue\", title: \"Blue\", colorValue: \"#14496D\" },\n\t\t\t\t{ id: \"green\", title: \"Green\", colorValue: \"#DAF0D9\" },\n\t\t\t\t{ id: \"red\", title: \"Red\", colorValue: \"#DB4141\" },\n\t\t\t],\n\t\t\thandOffset: { left: 29, right: 29, bottom: 29 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-12-mini\",\n\t\ttitle: \"iPhone 12 Mini\",\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 22,\n\t\tclayBezelRight: 22,\n\t\tclayBezelTop: 22,\n\t\tclayBezelBottom: 22,\n\t\tclayBezelRadius: 66,\n\t\tscreenWidth: 360,\n\t\tscreenHeight: 780,\n\t\texternalClay: {\n\t\t\twidth: 450,\n\t\t\theight: 890,\n\t\t\tscreenOffsetTop: 55,\n\t\t\tscreenOffsetLeft: 45,\n\t\t},\n\t\tscreenMask:\n\t\t\t'<g style=\"transform: scale(0.5);\"><path d=\"M142 18c0 19 14 47 43 48h349c31 0 44-29 44-48 0-12 4-18 14-18h18c38 0 52 4 66 11 14 8 25 19 33 33v1c7 14 11 28 11 65v1340c0 38-4 52-11 66-8 14-19 25-33 33h-1c-14 7-28 11-65 11H110c-38 0-52-4-66-11-14-8-25-19-33-33v-1c-7-13-11-27-11-64V110c0-38 4-52 11-66 8-14 19-25 33-33h1C58 4 72 0 109 0h16c11 0 17 6 17 18z\" fill=\"#000\" fill-rule=\"evenodd\"/></g>',\n\t\trealisticImage: {\n\t\t\twidth: 460,\n\t\t\theight: 880,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 50,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"black\", title: \"Black\", colorValue: \"#2E2C36\" },\n\t\t\t\t{ id: \"white\", title: \"White\", colorValue: \"#F7F3F0\" },\n\t\t\t\t{ id: \"blue\", title: \"Blue\", colorValue: \"#14496D\" },\n\t\t\t\t{ id: \"green\", title: \"Green\", colorValue: \"#DAF0D9\" },\n\t\t\t\t{ id: \"red\", title: \"Red\", colorValue: \"#DB4141\" },\n\t\t\t],\n\t\t\thandOffset: { left: 31.5, right: 30.5 /* 1t */, bottom: 30 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-12-pro\",\n\t\ttitle: \"iPhone 12 Pro\",\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 22,\n\t\tclayBezelRight: 22,\n\t\tclayBezelTop: 22,\n\t\tclayBezelBottom: 22,\n\t\tclayBezelRadius: 66,\n\t\tscreenWidth: 390,\n\t\tscreenHeight: 844,\n\t\texternalClay: {\n\t\t\twidth: 494,\n\t\t\theight: 968,\n\t\t\tscreenOffsetTop: 62,\n\t\t\tscreenOffsetLeft: 52,\n\t\t},\n\t\tscreenMask:\n\t\t\t'<g style=\"transform: scale(0.5);\"><path d=\"M171.2 0c2.3 0 4 .5 5.4 1.3 1.6 1 2.8 2.2 3.7 3.8.8 1.6 1.2 2.3 1.2 4.9 0 12 2.2 19 6.2 26.5s9.8 13.3 17.3 17.4c7.5 4 15.8 6.1 30.6 6.1h311.5c14.3 0 22.5-2.2 29.9-6.1 7.5-4 13.3-10 17.3-17.4 4-7.5 6.2-14.5 6.2-26.5 0-2.6.4-3.2 1.1-4.9.8-1.6 2-2.9 3.4-3.8 1.4-.8 3.2-1.3 5.4-1.3h54.2c40.1 0 54.7 4.2 69.4 12a81.8 81.8 0 0134 34c7.8 14.7 12 29.3 12 69.4v1457.2c0 40.1-4.2 54.7-12 69.4a81.8 81.8 0 01-34 34c-14.7 7.8-29.3 12-69.4 12H115.4c-40.1 0-54.7-4.2-69.4-12a81.8 81.8 0 01-34-34c-7.8-14.7-12-29.3-12-69.4V115.4C0 75.3 4.2 60.7 12 46a81.8 81.8 0 0134-34C60.7 4.2 75.3 0 115.4 0h55.4z\" fill=\"#000\" fill-rule=\"evenodd\"/></g>',\n\t\trealisticImage: {\n\t\t\twidth: 490,\n\t\t\theight: 944,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 50,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"graphite\", title: \"Graphite\", colorValue: \"#585753\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E5E6E1\" },\n\t\t\t\t{ id: \"pacific-blue\", title: \"Pacific Blue\", colorValue: \"#415D6C\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#FCECD5\" },\n\t\t\t],\n\t\t\thandOffset: { left: 29, right: 29, bottom: 29 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-12-pro-max\",\n\t\ttitle: \"iPhone 12 Pro Max\",\n\t\tscreenRadius: 50, // to prevent leaking pixel in the corners, see https://github.com/framer/company/issues/20429\n\t\tclayBezelLeft: 22,\n\t\tclayBezelRight: 22,\n\t\tclayBezelTop: 22,\n\t\tclayBezelBottom: 22,\n\t\tclayBezelRadius: 66,\n\t\tscreenWidth: 428,\n\t\tscreenHeight: 926,\n\t\texternalClay: {\n\t\t\twidth: 532,\n\t\t\theight: 1050,\n\t\t\tscreenOffsetTop: 62,\n\t\t\tscreenOffsetLeft: 52,\n\t\t},\n\t\tscreenMask:\n\t\t\t'<path d=\"M102 0c6 0 7 3 7 9 0 10 7 23 24 23h164c13 0 22-12 22-23 0-6 1-9 7-9h34c24 0 32 2 41 7s15 11 20 20 7 17 7 41v790c0 24-2 32-7 41s-11 15-20 20-17 7-41 7H68c-24 0-32-2-41-7s-15-11-20-20-7-17-7-41V68c0-24 2-32 7-41S18 12 27 7s17-7 41-7h34z\" fill=\"#000\" fill-rule=\"evenodd\"/>',\n\t\trealisticImage: {\n\t\t\twidth: 528,\n\t\t\theight: 1026,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 50,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"graphite\", title: \"Graphite\", colorValue: \"#585753\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E5E6E1\" },\n\t\t\t\t{ id: \"pacific-blue\", title: \"Pacific Blue\", colorValue: \"#415D6C\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#FCECD5\" },\n\t\t\t],\n\t\t\thandOffset: { left: 28.5, right: 28, bottom: 29 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-11\",\n\t\ttitle: \"iPhone 11\",\n\t\t// Screen mask takes care of the rounded screen corners for iPhones Pro,\n\t\t// and actually using a radius here produces visual artifacts in Chrome.\n\t\tscreenRadius: /* 38 */ 0,\n\t\tclayBezelLeft: 35.5,\n\t\tclayBezelRight: 35.5,\n\t\tclayBezelTop: 35.5,\n\t\tclayBezelBottom: 35.5,\n\t\tclayBezelRadius: 77,\n\t\tscreenWidth: 414,\n\t\tscreenHeight: 896,\n\t\texternalClay: {\n\t\t\twidth: 524,\n\t\t\theight: 1026,\n\t\t\tscreenOffsetTop: 65,\n\t\t\tscreenOffsetLeft: 55,\n\t\t},\n\t\tscreenMask:\n\t\t\t'<path d=\"M85.5 0C89.1 0 92 3 92 6.5c.3 6 1.5 10 3.4 13.5 2.2 4.1 5.5 7.4 9.6 9.6 4.2 2.2 8.9 3.4 17 3.4h170c8.1 0 12.8-1.2 17-3.4 4.1-2.2 7.4-5.5 9.6-9.6A31 31 0 00322 6.5c0-3.6 3-6.5 6.5-6.5h32.3c18.5 0 25.2 2 32 5.5 6.7 3.7 12 9 15.7 15.7 3.6 6.8 5.5 13.5 5.5 32v789.6c0 18.5-2 25.2-5.5 32-3.7 6.7-9 12-15.7 15.7-6.8 3.6-13.5 5.5-32 5.5H53.2c-18.5 0-25.2-2-32-5.5-6.7-3.7-12-9-15.7-15.7C2 868 0 861.3 0 842.8V53.2c0-18.5 2-25.2 5.5-32 3.7-6.7 9-12 15.7-15.7C28 2 34.7 0 53.2 0h32.3z\" fill=\"#000\" fill-rule=\"nonzero\"/>',\n\t\trealisticImage: {\n\t\t\twidth: 514,\n\t\t\theight: 996,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 50,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"black\", title: \"Black\", colorValue: \"#202120\" },\n\t\t\t\t{ id: \"white\", title: \"White\", colorValue: \"#F9F6EF\" },\n\t\t\t\t{ id: \"purple\", title: \"Purple\", colorValue: \"#D1CDDB\" },\n\t\t\t\t{ id: \"green\", title: \"Green\", colorValue: \"#ADE0CD\" },\n\t\t\t\t{ id: \"red\", title: \"Red\", colorValue: \"#B90D2E\" },\n\t\t\t\t{ id: \"yellow\", title: \"Yellow\", colorValue: \"#FFE680\" },\n\t\t\t],\n\t\t\thandOffset: { left: 14.5, right: 14.5, bottom: 14.5 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-11-pro\",\n\t\ttitle: \"iPhone 11 Pro\",\n\t\t...presetsBase.iPhonePro,\n\t\tscreenWidth: 375,\n\t\tscreenHeight: 812,\n\t\texternalClay: {\n\t\t\twidth: 485,\n\t\t\theight: 942,\n\t\t\tscreenOffsetTop: 65,\n\t\t\tscreenOffsetLeft: 55,\n\t\t},\n\t\tscreenMask:\n\t\t\t'<path d=\"M292 8.668V9c0 9.266-7.07 21-23.332 21h-162C90.402 30 83.332 18.266 83.332 9v-.332c0-4.285 0-8.668-7.664-8.668H43.332C16.312 0 0 16.313 0 43.332v725.336C0 795.688 16.313 812 43.332 812h288.336c27.02 0 43.332-16.313 43.332-43.332V43.332C375 16.312 358.687 0 331.668 0h-32C292 0 292 4.383 292 8.668zm0 0\"/>',\n\t\trealisticImage: {\n\t\t\twidth: 475,\n\t\t\theight: 912,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 50,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#52514F\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#EBEBE3\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#FBD7BD\" },\n\t\t\t\t{ id: \"midnight-green\", title: \"Midnight Green\", colorValue: \"#4F5850\" },\n\t\t\t],\n\t\t\thandOffset: { left: 24.5 /* 1t */, right: 24.5 /* 1t */, bottom: 23.5 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-11-pro-max\",\n\t\ttitle: \"iPhone 11 Pro Max\",\n\t\t...presetsBase.iPhonePro,\n\t\tscreenWidth: 414,\n\t\tscreenHeight: 896,\n\t\texternalClay: {\n\t\t\twidth: 524,\n\t\t\theight: 1026,\n\t\t\tscreenOffsetTop: 65,\n\t\t\tscreenOffsetLeft: 55,\n\t\t},\n\t\tscreenMask:\n\t\t\t'<path d=\"M96 0c3.313 0 5.91 2.688 6 6 .18 6.645 1.191 10.148 2.938 13.41 1.917 3.586 4.73 6.402 8.316 8.317 3.586 1.918 7.441 2.941 15.445 2.941h156.602c8.004 0 11.86-1.023 15.445-2.941 3.586-1.915 6.399-4.73 8.317-8.317 1.746-3.265 2.746-6.758 2.937-13.41.094-3.313 2.688-6 6-6h46.004c17.387 0 23.687 1.809 30.043 5.21 6.355 3.4 11.344 8.388 14.742 14.743C412.191 26.31 414 32.61 414 49.996v796.008c0 17.387-1.809 23.687-5.21 30.043-3.4 6.355-8.388 11.344-14.743 14.742-6.356 3.402-12.656 5.211-30.043 5.211H49.996c-17.387 0-23.687-1.809-30.043-5.21-6.355-3.4-11.344-8.388-14.742-14.743C1.809 869.69 0 863.39 0 846.004V49.996C0 32.61 1.809 26.31 5.21 19.953c3.4-6.355 8.388-11.344 14.743-14.742C26.31 1.809 32.61 0 49.996 0zm0 0\"/>',\n\t\trealisticImage: {\n\t\t\twidth: 514,\n\t\t\theight: 996,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 50,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#52514F\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#EBEBE3\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#FBD7BD\" },\n\t\t\t\t{ id: \"midnight-green\", title: \"Midnight Green\", colorValue: \"#4F5850\" },\n\t\t\t],\n\t\t\thandOffset: { left: 23.5, right: 24.5, bottom: 24 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-8\",\n\t\ttitle: \"iPhone 8\",\n\t\t...presetsBase.iPhone8,\n\t\tscreenWidth: 375,\n\t\tscreenHeight: 667,\n\t\texternalClay: {\n\t\t\twidth: 491,\n\t\t\theight: 971,\n\t\t\tscreenOffsetLeft: 58,\n\t\t\tscreenOffsetTop: 152,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 475,\n\t\t\theight: 927,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 130,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#28282A\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#DFE1E2\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#F6E6DB\" },\n\t\t\t],\n\t\t\thandOffset: { left: 22, right: 22, bottom: 18.5 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-8-plus\",\n\t\ttitle: \"iPhone 8 Plus\",\n\t\t...presetsBase.iPhone8,\n\t\tscreenWidth: 414,\n\t\tscreenHeight: 736,\n\t\texternalClay: {\n\t\t\twidth: 530,\n\t\t\theight: 1064,\n\t\t\tscreenOffsetLeft: 58,\n\t\t\tscreenOffsetTop: 164,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 514,\n\t\t\theight: 996,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 130,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#28282A\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#DFE1E2\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#F6E6DB\" },\n\t\t\t],\n\t\t\thandOffset: { left: 21, right: 20.5 /* 1t */, bottom: 19 },\n\t\t},\n\t},\n\t{\n\t\tid: \"iphone-se\",\n\t\ttitle: \"iPhone SE\",\n\t\tscreenWidth: 320,\n\t\tscreenHeight: 568,\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 20,\n\t\tclayBezelRight: 20,\n\t\tclayBezelTop: 112,\n\t\tclayBezelBottom: 112,\n\t\tclayBezelRadius: 38 * 1.5,\n\t\texternalClay: {\n\t\t\twidth: 436,\n\t\t\theight: 872,\n\t\t\tscreenOffsetLeft: 58,\n\t\t\tscreenOffsetTop: 152,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 420,\n\t\t\theight: 828,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 130,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#C3C4C8\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E1E2E4\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#EFD8BD\" },\n\t\t\t\t{ id: \"rose-gold\", title: \"Rose Gold\", colorValue: \"#F7CFCA\" },\n\t\t\t],\n\t\t\thandOffset: { left: 22, right: 22, bottom: 26.5 },\n\t\t},\n\t},\n\t{\n\t\tid: \"samsung-galaxy-s7\",\n\t\ttitle: \"Samsung Galaxy S7\",\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 22,\n\t\tclayBezelRight: 22,\n\t\tclayBezelTop: 22,\n\t\tclayBezelBottom: 22,\n\t\tclayBezelRadius: 66,\n\t\tscreenWidth: 360,\n\t\tscreenHeight: 640,\n\t\texternalClay: {\n\t\t\twidth: 454,\n\t\t\theight: 880,\n\t\t\tscreenOffsetTop: 120,\n\t\t\tscreenOffsetLeft: 47,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 440,\n\t\t\theight: 860,\n\t\t\tscreenOffsetLeft: 40,\n\t\t\tscreenOffsetTop: 110,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"black\", title: \"Black\", colorValue: \"#2E2C36\" },\n\t\t\t\t{ id: \"white\", title: \"White\", colorValue: \"#F7F3F0\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E5E6E1\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#FCECD5\" },\n\t\t\t],\n\t\t\thandOffset: { left: 26 /* 1t */, right: 25.5 /* 1t */, bottom: 32 },\n\t\t},\n\t},\n\t// deprecated\n\t{\n\t\tid: \"samsung-note-10\",\n\t\ttitle: \"Samsung Note 10\",\n\t\tscreenWidth: 360,\n\t\tscreenHeight: 760,\n\t\tscreenRadius: 10,\n\t\tclayBezelLeft: 7,\n\t\tclayBezelRight: 7,\n\t\tclayBezelTop: 15,\n\t\tclayBezelBottom: 15,\n\t\tclayBezelRadius: 15,\n\t},\n\t{\n\t\tid: \"pixel-5\",\n\t\ttitle: \"Google Pixel 5\",\n\t\tscreenRadius: 31,\n\t\tclayBezelLeft: 22,\n\t\tclayBezelRight: 22,\n\t\tclayBezelTop: 22,\n\t\tclayBezelBottom: 22,\n\t\tclayBezelRadius: 66,\n\t\tscreenWidth: 360,\n\t\tscreenHeight: 780,\n\t\texternalClay: {\n\t\t\twidth: 460,\n\t\t\theight: 900,\n\t\t\tscreenOffsetTop: 60,\n\t\t\tscreenOffsetLeft: 50,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 920 / 2,\n\t\t\theight: 1760 / 2,\n\t\t\tscreenOffsetLeft: 100 / 2,\n\t\t\tscreenOffsetTop: 100 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"just-black\", title: \"Just Black\", colorValue: \"#2E2C36\" },\n\t\t\t\t{ id: \"sorta-sage\", title: \"Sorta Sage\", colorValue: \"#B7C9C0\" },\n\t\t\t],\n\t\t\thandOffset: { left: 31.5, right: 31 /* 1t */, bottom: 31 /* 1t */ },\n\t\t},\n\t},\n\t{\n\t\tid: \"pixel-4\",\n\t\ttitle: \"Google Pixel 4\",\n\t\tscreenWidth: 360,\n\t\tscreenHeight: 760,\n\t\tscreenRadius: 34,\n\t\tclayBezelLeft: 10,\n\t\tclayBezelRight: 10,\n\t\tclayBezelTop: 50,\n\t\tclayBezelBottom: 25,\n\t\tclayBezelRadius: 50,\n\t\texternalClay: {\n\t\t\twidth: 460,\n\t\t\theight: 938,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 89,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 460,\n\t\t\theight: 920,\n\t\t\tscreenOffsetLeft: 50,\n\t\t\tscreenOffsetTop: 80,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"clearly-white\", title: \"Clearly White\", colorValue: \"#EAEDF2\" },\n\t\t\t\t{ id: \"just-black\", title: \"Just Black\", colorValue: \"#1A1A1A\" },\n\t\t\t\t{ id: \"oh-so-orange\", title: \"Oh So Orange\", colorValue: \"#FF7A68\" },\n\t\t\t],\n\t\t\thandOffset: { left: 35.5, right: 35.5 /* 1t */, bottom: 57 /* 1t */ },\n\t\t},\n\t},\n\n\t// Desktop ------------------------------------------------------------------------------------------------------------------------\n\t{\n\t\tid: \"macbook-air\",\n\t\ttitle: \"MacBook Air\",\n\t\tscreenWidth: 1440,\n\t\tscreenHeight: 900,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 1890,\n\t\t\theight: 1125,\n\t\t\tscreenOffsetLeft: 225,\n\t\t\tscreenOffsetTop: 98,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 3848 / 2,\n\t\t\theight: 2240 / 2,\n\t\t\tscreenOffsetLeft: 484 / 2,\n\t\t\tscreenOffsetTop: 196 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E5E6E1\" },\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#B1B5B7\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#FCECD5\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"macbook-pro-13\",\n\t\ttitle: `MacBook Pro 13\"`,\n\t\tscreenWidth: 1440,\n\t\tscreenHeight: 900,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 1914,\n\t\t\theight: 1169,\n\t\t\tscreenOffsetLeft: 236,\n\t\t\tscreenOffsetTop: 109,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 3916 / 2,\n\t\t\theight: 2330 / 2,\n\t\t\tscreenOffsetLeft: 518 / 2,\n\t\t\tscreenOffsetTop: 218 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E5E6E1\" },\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#B1B5B7\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"macbook-pro-16\",\n\t\ttitle: `MacBook Pro 16\"`,\n\t\tscreenWidth: 1536,\n\t\tscreenHeight: 960,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 1984,\n\t\t\theight: 1179,\n\t\t\tscreenOffsetLeft: 225,\n\t\t\tscreenOffsetTop: 78,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 4032 / 2,\n\t\t\theight: 2348 / 2,\n\t\t\tscreenOffsetLeft: 480 / 2,\n\t\t\tscreenOffsetTop: 148 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E5E6E1\" },\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#B1B5B7\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"imac-21-5\",\n\t\ttitle: `iMac 21.5\"`,\n\t\tscreenWidth: 2048,\n\t\tscreenHeight: 1152,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 2288,\n\t\t\theight: 1892,\n\t\t\tscreenOffsetLeft: 120,\n\t\t\tscreenOffsetTop: 120,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 4562 / 2,\n\t\t\theight: 3796 / 2,\n\t\t\tscreenOffsetLeft: 232 / 2,\n\t\t\tscreenOffsetTop: 244 / 2,\n\t\t},\n\t},\n\t{\n\t\tid: \"imac-27\",\n\t\ttitle: `iMac 27\"`,\n\t\tscreenWidth: 2560,\n\t\tscreenHeight: 1440,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 2848,\n\t\t\theight: 2351,\n\t\t\tscreenOffsetLeft: 144,\n\t\t\tscreenOffsetTop: 151,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 5676 / 2,\n\t\t\theight: 4720 / 2,\n\t\t\tscreenOffsetLeft: 278 / 2,\n\t\t\tscreenOffsetTop: 292 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E5E6E1\" },\n\t\t\t\t{ id: \"pro\", title: \"Pro\", colorValue: \"#5F5E63\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"pro-display-xdr\",\n\t\ttitle: `Pro Display XDR`,\n\t\tscreenWidth: 3008,\n\t\tscreenHeight: 1692,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 3148,\n\t\t\theight: 2325,\n\t\t\tscreenOffsetLeft: 70,\n\t\t\tscreenOffsetTop: 60,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 6276 / 2,\n\t\t\theight: 4695 / 2,\n\t\t\tscreenOffsetLeft: 130 / 2,\n\t\t\tscreenOffsetTop: 130 / 2,\n\t\t},\n\t},\n\t{\n\t\tid: \"dell-xps\",\n\t\ttitle: `Dell XPS`,\n\t\tscreenWidth: 1920,\n\t\tscreenHeight: 1080,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 2624,\n\t\t\theight: 1381,\n\t\t\tscreenOffsetLeft: 352,\n\t\t\tscreenOffsetTop: 57,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 5412 / 2,\n\t\t\theight: 2746 / 2,\n\t\t\tscreenOffsetLeft: 786 / 2,\n\t\t\tscreenOffsetTop: 108 / 2,\n\t\t},\n\t},\n\t{\n\t\tid: \"surface-book\",\n\t\ttitle: `Microsoft Surface Book`,\n\t\tscreenWidth: 1500,\n\t\tscreenHeight: 1000,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 2089,\n\t\t\theight: 1234,\n\t\t\tscreenOffsetLeft: 296,\n\t\t\tscreenOffsetTop: 93,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 4200 / 2,\n\t\t\theight: 2508 / 2,\n\t\t\tscreenOffsetLeft: 600 / 2,\n\t\t\tscreenOffsetTop: 210 / 2,\n\t\t},\n\t},\n\n\t// Tablets ------------------------------------------------------------------------------------------------------------------------\n\t{\n\t\tid: \"ipad\",\n\t\ttitle: \"iPad\",\n\t\tscreenRadius: 0,\n\t\tscreenWidth: 810,\n\t\tscreenHeight: 1080,\n\t\tclayBezelLeft: 30,\n\t\tclayBezelRight: 30,\n\t\tclayBezelTop: 95,\n\t\tclayBezelBottom: 95,\n\t\tclayBezelRadius: 0,\n\t\texternalClay: {\n\t\t\twidth: 966,\n\t\t\theight: 1378,\n\t\t\tscreenOffsetLeft: 78,\n\t\t\tscreenOffsetTop: 149,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 1920 / 2,\n\t\t\theight: 2720 / 2,\n\t\t\tscreenOffsetLeft: 75,\n\t\t\tscreenOffsetTop: 140,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#C3C4C8\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E1E2E4\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#EFD8BD\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"ipad-mini\",\n\t\ttitle: \"iPad Mini\",\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 49,\n\t\tclayBezelRight: 49,\n\t\tclayBezelTop: 49,\n\t\tclayBezelBottom: 49,\n\t\tclayBezelRadius: 49,\n\t\tscreenWidth: 768,\n\t\tscreenHeight: 1024,\n\t\texternalClay: {\n\t\t\twidth: 924,\n\t\t\theight: 1384,\n\t\t\tscreenOffsetLeft: 78,\n\t\t\tscreenOffsetTop: 180,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 1856 / 2,\n\t\t\theight: 2728 / 2,\n\t\t\tscreenOffsetLeft: 160 / 2,\n\t\t\tscreenOffsetTop: 340 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#C3C4C8\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E1E2E4\" },\n\t\t\t\t{ id: \"gold\", title: \"Gold\", colorValue: \"#EFD8BD\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"ipad-air\",\n\t\ttitle: \"iPad Air\",\n\t\tscreenRadius: 18,\n\t\tclayBezelLeft: 49,\n\t\tclayBezelRight: 49,\n\t\tclayBezelTop: 49,\n\t\tclayBezelBottom: 49,\n\t\tclayBezelRadius: 49,\n\t\tscreenWidth: 820,\n\t\tscreenHeight: 1180,\n\t\texternalClay: {\n\t\t\twidth: 994,\n\t\t\theight: 1374,\n\t\t\tscreenOffsetLeft: 87,\n\t\t\tscreenOffsetTop: 97,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 1960 / 2,\n\t\t\theight: 2680 / 2,\n\t\t\tscreenOffsetLeft: 160 / 2,\n\t\t\tscreenOffsetTop: 160 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#C3C4C8\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E1E2E4\" },\n\t\t\t\t{ id: \"rose-gold\", title: \"Rose Gold\", colorValue: \"#ECCBC4\" },\n\t\t\t\t{ id: \"blue\", title: \"Blue\", colorValue: \"#CBDAE6\" },\n\t\t\t\t{ id: \"green\", title: \"Green\", colorValue: \"#DAF0D9\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"ipad-pro-11\",\n\t\ttitle: \"iPad Pro 11\u2033\",\n\t\tscreenRadius: 17,\n\t\tclayBezelLeft: 49,\n\t\tclayBezelRight: 49,\n\t\tclayBezelTop: 49,\n\t\tclayBezelBottom: 49,\n\t\tclayBezelRadius: 49,\n\t\tscreenWidth: 834,\n\t\tscreenHeight: 1194,\n\t\texternalClay: {\n\t\t\twidth: 990,\n\t\t\theight: 1370,\n\t\t\tscreenOffsetLeft: 78,\n\t\t\tscreenOffsetTop: 88,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 1968 / 2,\n\t\t\theight: 2688 / 2,\n\t\t\tscreenOffsetLeft: 75,\n\t\t\tscreenOffsetTop: 75,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#C3C4C8\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E1E2E4\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"ipad-pro-12-9\",\n\t\ttitle: \"iPad Pro 12.9\u2033\",\n\t\t...presetsBase.iPadPro,\n\t\tscreenRadius: 17,\n\t\tscreenWidth: 1024,\n\t\tscreenHeight: 1366,\n\t\texternalClay: {\n\t\t\twidth: 1180,\n\t\t\theight: 1542,\n\t\t\tscreenOffsetLeft: 78,\n\t\t\tscreenOffsetTop: 88,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 2348 / 2,\n\t\t\theight: 3032 / 2,\n\t\t\tscreenOffsetLeft: 75,\n\t\t\tscreenOffsetTop: 75,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"space-grey\", title: \"Space Grey\", colorValue: \"#C3C4C8\" },\n\t\t\t\t{ id: \"silver\", title: \"Silver\", colorValue: \"#E1E2E4\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"surface-3\",\n\t\ttitle: \"Microsoft Surface 3\",\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 49,\n\t\tclayBezelRight: 49,\n\t\tclayBezelTop: 49,\n\t\tclayBezelBottom: 49,\n\t\tclayBezelRadius: 49,\n\t\tscreenWidth: 960,\n\t\tscreenHeight: 640,\n\t\texternalClay: {\n\t\t\twidth: 1184,\n\t\t\theight: 864,\n\t\t\tscreenOffsetLeft: 112,\n\t\t\tscreenOffsetTop: 112,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 2280 / 2,\n\t\t\theight: 1580 / 2,\n\t\t\tscreenOffsetLeft: 180 / 2,\n\t\t\tscreenOffsetTop: 150 / 2,\n\t\t},\n\t},\n\t{\n\t\tid: \"surface-pro-4\",\n\t\ttitle: \"Microsoft Surface Pro 4\",\n\t\tscreenRadius: 0,\n\t\tclayBezelLeft: 49,\n\t\tclayBezelRight: 49,\n\t\tclayBezelTop: 49,\n\t\tclayBezelBottom: 49,\n\t\tclayBezelRadius: 49,\n\t\tscreenWidth: 1368,\n\t\tscreenHeight: 912,\n\t\texternalClay: {\n\t\t\twidth: 1592,\n\t\t\theight: 1136,\n\t\t\tscreenOffsetLeft: 112,\n\t\t\tscreenOffsetTop: 112,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 3176 / 2,\n\t\t\theight: 2224 / 2,\n\t\t\tscreenOffsetLeft: 220 / 2,\n\t\t\tscreenOffsetTop: 200 / 2,\n\t\t},\n\t},\n\n\t// Watches ------------------------------------------------------------------------------------------------------------------------\n\t{\n\t\tid: \"apple-watch-44\",\n\t\ttitle: `Apple Watch 44mm`,\n\t\tscreenRadius: 33,\n\t\tscreenWidth: 184,\n\t\tscreenHeight: 224,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 298,\n\t\t\theight: 502,\n\t\t\tscreenOffsetLeft: 57,\n\t\t\tscreenOffsetTop: 129,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 548 / 2,\n\t\t\theight: 908 / 2,\n\t\t\tscreenOffsetLeft: 90 / 2,\n\t\t\tscreenOffsetTop: 230 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"black\", title: \"Black\", colorValue: \"#2E2C36\" },\n\t\t\t\t{ id: \"white\", title: \"White\", colorValue: \"#F7F3F0\" },\n\t\t\t\t{ id: \"yellow\", title: \"Yellow\", colorValue: \"#FDDC6C\" },\n\t\t\t\t{ id: \"orange\", title: \"Orange\", colorValue: \"#F35C56\" },\n\t\t\t],\n\t\t},\n\t},\n\t{\n\t\tid: \"apple-watch-40\",\n\t\ttitle: `Apple Watch 40mm`,\n\t\tscreenRadius: 27,\n\t\tscreenWidth: 162,\n\t\tscreenHeight: 197,\n\t\tdisableRotation: true,\n\t\texternalClay: {\n\t\t\twidth: 280,\n\t\t\theight: 463,\n\t\t\tscreenOffsetLeft: 59,\n\t\t\tscreenOffsetTop: 124,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 504 / 2,\n\t\t\theight: 854 / 2,\n\t\t\tscreenOffsetLeft: 90 / 2,\n\t\t\tscreenOffsetTop: 230 / 2,\n\t\t\tavailableColors: [\n\t\t\t\t{ id: \"black\", title: \"Black\", colorValue: \"#2E2C36\" },\n\t\t\t\t{ id: \"white\", title: \"White\", colorValue: \"#F7F3F0\" },\n\t\t\t\t{ id: \"yellow\", title: \"Yellow\", colorValue: \"#FDDC6C\" },\n\t\t\t\t{ id: \"orange\", title: \"Orange\", colorValue: \"#F35C56\" },\n\t\t\t],\n\t\t},\n\t},\n\n\t// TVs ------------------------------------------------------------------------------------------------------------------------\n\t{\n\t\tid: \"tv-full-hd\",\n\t\ttitle: `Full HD`,\n\t\tscreenRadius: 0,\n\t\tscreenWidth: 1920,\n\t\tscreenHeight: 1080,\n\t\texternalClay: {\n\t\t\twidth: 1968,\n\t\t\theight: 1168,\n\t\t\tscreenOffsetLeft: 24,\n\t\t\tscreenOffsetTop: 12,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 4040 / 2,\n\t\t\theight: 2360 / 2,\n\t\t\tscreenOffsetLeft: 100 / 2,\n\t\t\tscreenOffsetTop: 100 / 2,\n\t\t},\n\t},\n\t{\n\t\tid: \"tv-4k\",\n\t\ttitle: `4K`,\n\t\tscreenRadius: 0,\n\t\tscreenWidth: 3840,\n\t\tscreenHeight: 2160,\n\t\texternalClay: {\n\t\t\twidth: 3908,\n\t\t\theight: 2308,\n\t\t\tscreenOffsetLeft: 34,\n\t\t\tscreenOffsetTop: 24,\n\t\t},\n\t\trealisticImage: {\n\t\t\twidth: 7960 / 2,\n\t\t\theight: 4600 / 2,\n\t\t\tscreenOffsetLeft: 140 / 2,\n\t\t\tscreenOffsetTop: 140 / 2,\n\t\t},\n\t},\n\n\t// Old devices ------------------------------------------------------------------------------------------------------------------------\n\n\t// deprecated\n\t{\n\t\tid: \"720p\",\n\t\ttitle: \"720p\",\n\t\t...presetsBase.desktop,\n\t\tscreenWidth: 720,\n\t\tscreenHeight: 1280,\n\t},\n\n\t// deprecated\n\t{\n\t\tid: \"900p\",\n\t\ttitle: \"900p\",\n\t\t...presetsBase.desktop,\n\t\tscreenWidth: 900,\n\t\tscreenHeight: 1440,\n\t},\n\n\t// deprecated\n\t{\n\t\tid: \"1080p\",\n\t\ttitle: \"1080p\",\n\t\t...presetsBase.desktop,\n\t\tscreenWidth: 1080,\n\t\tscreenHeight: 1920,\n\t},\n\n\t// deprecated\n\t{\n\t\tid: \"1440p\",\n\t\ttitle: \"1440p\",\n\t\t...presetsBase.desktop,\n\t\tscreenWidth: 1440,\n\t\tscreenHeight: 2560,\n\t},\n\n\t// deprecated\n\t{\n\t\tid: \"4k\",\n\t\ttitle: \"4K\",\n\t\t...presetsBase.desktop,\n\t\tscreenWidth: 2160,\n\t\tscreenHeight: 3840,\n\t},\n])()\n\nexport const deviceCodeComponentPresetIds = [\n\t\"iphone-12\",\n\t\"iphone-12-mini\",\n\t\"iphone-12-pro\",\n\t\"iphone-11\",\n\t\"iphone-11-pro\",\n\t\"iphone-11-pro-max\",\n\t\"iphone-8\",\n\t\"iphone-8-plus\",\n\t\"iphone-se\",\n\t\"samsung-note-10\",\n\t\"pixel-4\",\n\t\"ipad\",\n\t\"ipad-pro-11\",\n\t\"ipad-pro-12-9\",\n\t\"720p\",\n\t\"900p\",\n\t\"1080p\",\n\t\"1440p\",\n\t\"4k\",\n]\n\nexport const deviceCodeComponentPresets = /* @__PURE__ */ devicePresets.filter(preset =>\n\tdeviceCodeComponentPresetIds.includes(preset.id),\n)\n\nconst devicePresetsMap = /* @__PURE__ */ devicePresets.reduce(\n\t(map, preset) => {\n\t\tmap[preset.id] = preset\n\t\treturn map\n\t},\n\t{} as Record<DevicePresetID, DevicePreset>,\n)\n\n/**\n * @internal\n */\nexport function getDevicePreset(presetId: DevicePresetID): DevicePreset {\n\treturn devicePresetsMap[presetId] ?? devicePresetsMap[defaultPresetId]\n}\n", "import type React from \"react\"\nimport { encodeSVGForCSS } from \"../../utils/utils.ts\"\nimport type { DeviceOptions } from \"./Device.tsx\"\nimport { getColorsFromTheme } from \"./Device.tsx\"\nimport type { DeviceColor, DevicePreset, DevicePresetID } from \"./presets.ts\"\nimport { defaultPresetId, getDevicePreset } from \"./presets.ts\"\n\n// Props for the DeviceCodeComponent. This is split into a separate module so\n// that you can import the props interface and the funtion to convert props to\n// DeviceOptions, without pulling the Framer library, on which the code\n// component module depends.\n\n/**\n * @internal\n */\nexport interface DeviceCodeComponentProps {\n\tchildren: React.ReactNode[]\n\n\tpreset: DevicePresetID | \"custom\" | \"no-device\"\n\tcustomWidth: number\n\tcustomHeight: number\n\tcustomBezel: number\n\tisMixedBezel: boolean\n\tbezelTop: number\n\tbezelRight: number\n\tbezelBottom: number\n\tbezelLeft: number\n\tcustomBezelRadius: number\n\tcustomScreenRadius: number\n\torientation: \"portrait\" | \"landscape\"\n\tskin?: \"realistic\" | \"clay\"\n\ttheme: \"light\" | \"dark\"\n\tshadow: boolean\n\thand?: string\n\tbackgroundColor?: string\n\tcolorId?: string\n}\n\n/**\n * @internal\n */\nexport const defaultDeviceProps: Omit<DeviceCodeComponentProps, \"children\"> = {\n\tpreset: defaultPresetId,\n\tcustomWidth: 375,\n\tcustomHeight: 800,\n\tcustomBezel: 20,\n\tisMixedBezel: false,\n\tbezelTop: 20,\n\tbezelRight: 20,\n\tbezelBottom: 20,\n\tbezelLeft: 20,\n\tcustomBezelRadius: 20,\n\tcustomScreenRadius: 0,\n\torientation: \"portrait\",\n\tskin: \"clay\",\n\ttheme: \"dark\",\n\tshadow: true,\n\tbackgroundColor: undefined,\n}\n\ninterface ConvertPropsToDeviceOptions extends Omit<DeviceCodeComponentProps, \"children\"> {\n\trotated?: boolean\n}\n\n/**\n * @internal\n */\nexport function convertPropsToDeviceOptions(\n\tprops: ConvertPropsToDeviceOptions,\n\t{ forceOldClay = false }: { forceOldClay?: boolean } = {},\n): DeviceOptions | undefined {\n\tif (props.preset === \"no-device\") {\n\t\treturn\n\t}\n\tlet preset: Omit<DevicePreset, \"id\" | \"title\">\n\tif (props.preset === \"custom\") {\n\t\tpreset = {\n\t\t\tscreenWidth: props.customWidth,\n\t\t\tscreenHeight: props.customHeight,\n\t\t\tscreenRadius: props.customScreenRadius,\n\t\t\tclayBezelTop: props.isMixedBezel ? props.bezelTop : props.customBezel,\n\t\t\tclayBezelRight: props.isMixedBezel ? props.bezelRight : props.customBezel,\n\t\t\tclayBezelBottom: props.isMixedBezel ? props.bezelBottom : props.customBezel,\n\t\t\tclayBezelLeft: props.isMixedBezel ? props.bezelLeft : props.customBezel,\n\t\t\tclayBezelRadius: props.customBezelRadius,\n\t\t}\n\t} else {\n\t\tpreset = getDevicePreset(props.preset)\n\t}\n\tconst colors = getColorsFromTheme(props.theme)\n\tconst shadowColor = colors.shadowColor\n\tconst shadow = props.shadow ? `0 10px 30px ${shadowColor}` : undefined\n\n\tconst rotate = !preset.disableRotation && (props.orientation === \"landscape\" || props.rotated)\n\n\tlet deviceWidth: number\n\tlet deviceHeight: number\n\tlet screenOffsetTop: number\n\tlet screenOffsetLeft: number\n\tlet colorId = props.colorId\n\tlet appearance: DeviceOptions[\"appearance\"]\n\tif ((props.skin === undefined || props.skin === \"realistic\") && preset.realisticImage && props.preset) {\n\t\tdeviceWidth = preset.realisticImage.width\n\t\tdeviceHeight = preset.realisticImage.height\n\t\tscreenOffsetTop = preset.realisticImage.screenOffsetTop\n\t\tscreenOffsetLeft = preset.realisticImage.screenOffsetLeft\n\t\tcolorId = colorId ?? colorIdForTheme(props.theme, preset.realisticImage.availableColors)\n\t\tappearance = {\n\t\t\ttype: \"realistic\",\n\t\t\timageUrl: colorId\n\t\t\t\t? `https://preview.framercdn.com/images/devices/${props.preset}-${colorId}.png`\n\t\t\t\t: `https://preview.framercdn.com/images/devices/${props.preset}.png`,\n\t\t\timageWidth: preset.realisticImage.width,\n\t\t\timageHeight: preset.realisticImage.height,\n\t\t\trotateImage: rotate,\n\t\t}\n\t} else {\n\t\tdeviceWidth = preset.screenWidth + (preset.clayBezelLeft ?? 0) + (preset.clayBezelRight ?? 0)\n\t\tdeviceHeight = preset.screenHeight + (preset.clayBezelTop ?? 0) + (preset.clayBezelBottom ?? 0)\n\t\tscreenOffsetTop = preset.clayBezelTop ?? 0\n\t\tscreenOffsetLeft = preset.clayBezelLeft ?? 0\n\n\t\t// use external clay if available\n\t\tif (preset.externalClay && !forceOldClay) {\n\t\t\tdeviceWidth = preset.externalClay.width\n\t\t\tdeviceHeight = preset.externalClay.height\n\t\t\tscreenOffsetTop = preset.externalClay.screenOffsetTop\n\t\t\tscreenOffsetLeft = preset.externalClay.screenOffsetLeft\n\t\t\tappearance = {\n\t\t\t\ttype: \"external-clay\",\n\t\t\t\timageUrl: `https://preview.framercdn.com/images/devices/${props.preset}-${props.theme}.svg`,\n\t\t\t\timageWidth: preset.externalClay.width,\n\t\t\t\timageHeight: preset.externalClay.height,\n\t\t\t\trotateImage: rotate,\n\t\t\t}\n\t\t} else {\n\t\t\tappearance = {\n\t\t\t\ttype: \"clay\",\n\t\t\t\tbezelRadius: preset.clayBezelRadius !== undefined ? `${preset.clayBezelRadius}px` : undefined,\n\t\t\t\tbezelColor: colors.bezelColor,\n\t\t\t\tbezelShadeColor: colors.bezelShadeColor,\n\t\t\t}\n\t\t}\n\t}\n\n\tlet screenWidth = preset.screenWidth\n\tlet screenHeight = preset.screenHeight\n\n\tif (rotate) {\n\t\t// Computer screenOffsetRight pre-rotation, this will become the top\n\t\t// offset post-rotation.\n\t\tconst screenOffsetRight = deviceWidth - screenWidth - screenOffsetLeft\n\t\t;[deviceWidth, deviceHeight] = [deviceHeight, deviceWidth]\n\t\t;[screenWidth, screenHeight] = [screenHeight, screenWidth]\n\t\t;[screenOffsetTop, screenOffsetLeft] = [screenOffsetRight, screenOffsetTop]\n\t}\n\n\tconst handOffset = preset.realisticImage?.handOffset\n\n\treturn {\n\t\tdeviceWidth,\n\t\tdeviceHeight,\n\t\tappearance,\n\t\tscreenWidth,\n\t\tscreenHeight,\n\t\tscreenOffsetTop,\n\t\tscreenOffsetLeft,\n\t\tscreenRadius: preset.screenRadius !== undefined ? `${preset.screenRadius}px` : undefined,\n\t\tscreenMaskImage:\n\t\t\tappearance.type !== \"realistic\" && preset.screenMask\n\t\t\t\t? makeScreenMaskImage({\n\t\t\t\t\t\tmask: preset.screenMask,\n\t\t\t\t\t\t// width/height of the mask = screen width/height pre-rotation\n\t\t\t\t\t\twidth: preset.screenWidth,\n\t\t\t\t\t\theight: preset.screenHeight,\n\t\t\t\t\t\trotate,\n\t\t\t\t\t})\n\t\t\t\t: undefined,\n\t\tscreenColor: colors.screenColor,\n\t\tshadow,\n\t\thand:\n\t\t\tprops.hand !== undefined && supportsHand(props)\n\t\t\t\t? {\n\t\t\t\t\t\timageUrl: `https://preview.framercdn.com/images/hands/${props.hand}.png`,\n\t\t\t\t\t\toffsetLeft: handOffset?.left,\n\t\t\t\t\t\toffsetRight: handOffset?.right,\n\t\t\t\t\t\toffsetBottom: handOffset?.bottom,\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\tbackground: props.backgroundColor,\n\t\ttheme: props.theme,\n\t\tcolorId,\n\t}\n}\n\nfunction makeScreenMaskImage({\n\tmask,\n\twidth,\n\theight,\n\trotate = false,\n}: {\n\tmask: string\n\twidth: number\n\theight: number\n\trotate?: boolean\n}) {\n\tconst transform = rotate\n\t\t? // Rotate 90 degrees counter-clockwise around (0,0), then move the\n\t\t\t// result down into the viewport (rightmost transform is applied first).\n\t\t\t`transform=\"translate(0 ${width}) rotate(-90)\"`\n\t\t: \"\"\n\treturn encodeSVGForCSS(\n\t\t`<svg xmlns=\"http://www.w3.org/2000/svg\" viewport=\"0 0 ${width} ${height}\" preserveAspectRatio=\"none\"><g x=\"0\" y=\"0\" ${transform}>${mask}</g></svg>`,\n\t)\n}\n\nconst lightColors = new Set([\"white\", \"silver\", \"clearly-white\", \"sorta-sage\"])\nconst darkColors = new Set([\"black\", \"space-grey\", \"graphite\", \"just-black\", \"pro\"])\n\n/** @internal */\nexport function colorIdForTheme(\n\ttheme: \"light\" | \"dark\",\n\tavailableColors: DeviceColor[] | undefined,\n): string | undefined {\n\tif (!availableColors) return\n\tconst colors = theme === \"light\" ? lightColors : darkColors\n\tfor (const color of availableColors) {\n\t\tif (colors.has(color.id)) {\n\t\t\treturn color.id\n\t\t}\n\t}\n\t// If we can't find a color matching the theme, pick the first one\n\treturn availableColors[0]?.id\n}\n\nexport function supportsHand({ preset: presetId, skin, orientation = \"portrait\" }: Partial<DeviceCodeComponentProps>) {\n\tif (!presetId || presetId === \"custom\" || presetId === \"no-device\" || orientation === \"landscape\") return false\n\tconst preset = getDevicePreset(presetId)\n\treturn skin !== \"clay\" && preset.realisticImage?.handOffset !== undefined\n}\n", "import React from \"react\"\n\nfunction applyMetaTag(name: string, props: Record<string, string>) {\n\tlet tag = document.querySelector(`meta[name=\"${name}\"]`)\n\n\tif (!tag) {\n\t\ttag = document.createElement(\"meta\")\n\t\tdocument.getElementsByTagName(\"head\")[0]?.appendChild(tag)\n\t\ttag.setAttribute(\"name\", name)\n\t}\n\n\tfor (const [k, v] of Object.entries(props)) {\n\t\ttag.setAttribute(k, v)\n\t}\n}\n\nexport function usePrototypingMetaTags() {\n\t// Inject meta tags so mobile browser UI gets hidden when opening it on a phone\n\tReact.useEffect(() => {\n\t\tapplyMetaTag(\"mobile-web-app-capable\", { content: \"yes\" })\n\t\tapplyMetaTag(\"apple-mobile-web-app-capable\", { content: \"yes\" })\n\t\tapplyMetaTag(\"apple-mobile-web-app-status-bar-style\", {\n\t\t\tcontent: \"black-translucent\",\n\t\t})\n\t\tapplyMetaTag(\"viewport\", {\n\t\t\tcontent: \"viewport-fit=cover, user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1\",\n\t\t})\n\t}, [])\n}\n", "import React from \"react\"\nimport { FrameWithMotion } from \"../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { RenderEnvironment, RenderTarget } from \"../render/types/RenderEnvironment.ts\"\n\nexport interface Props {\n\tchildren: React.ReactNode\n\tsize: { width?: string | number; height?: string | number }\n\ttitle?: string\n\tdescription?: React.ReactNode\n\thide?: boolean\n\tinsideUserCodeComponent?: boolean\n\tposition?: React.CSSProperties[\"position\"]\n}\n\n/** @internal */\nexport function EmptyState({\n\ttitle = \"\",\n\tdescription = \"Click and drag the connector to any frame on the canvas \u2192\",\n\tchildren,\n\tsize,\n\thide,\n\tinsideUserCodeComponent = false,\n\tposition = \"absolute\",\n}: Props) {\n\tconst { target } = RenderEnvironment\n\tconst childCount = React.Children.count(children)\n\n\tif (insideUserCodeComponent && childCount === 0) {\n\t\treturn <FrameWithMotion {...size} data-name=\"placeholder\" />\n\t}\n\n\tif (target !== RenderTarget.canvas) return null\n\tif (hide) return null\n\tif (childCount !== 0) return null\n\n\treturn (\n\t\t<FrameWithMotion\n\t\t\tkey=\"empty-state\"\n\t\t\tclassName=\"framerInternalUI-canvasPlaceholder\"\n\t\t\ttop={0}\n\t\t\tleft={0}\n\t\t\tbottom={0}\n\t\t\tright={0}\n\t\t\tstyle={{ position, ...size }}\n\t\t>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\talignItems: \"center\",\n\t\t\t\t\tlineHeight: \"1.4\",\n\t\t\t\t\theight: \"100%\",\n\t\t\t\t\twidth: \"100%\",\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\tdisplay: \"flex\",\n\t\t\t\t\t\talignItems: \"center\",\n\t\t\t\t\t\tjustifyContent: \"center\",\n\t\t\t\t\t\tflexDirection: \"column\",\n\t\t\t\t\t\twidth: \"100%\",\n\t\t\t\t\t\t// Use a mask to fade out the right edge of the content as it gets cropped.\n\t\t\t\t\t\tWebkitMaskImage: `linear-gradient(90deg, black, black calc(100% - 12px * ${scaleFactor}), transparent)`,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<Title>{title}</Title>\n\t\t\t\t\t<Description>{description}</Description>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</FrameWithMotion>\n\t)\n}\n\nconst scaleFactor = \"var(--framerInternalCanvas-canvasPlaceholderContentScaleFactor, 1)\"\n\nexport function Title({ children }: { children?: React.ReactNode }) {\n\treturn (\n\t\t<span\n\t\t\tstyle={{\n\t\t\t\tdisplay: \"flex\",\n\t\t\t\tflexDirection: \"column\",\n\t\t\t\ttextAlign: \"center\",\n\t\t\t\tflexGrow: 1,\n\t\t\t\tflexShrink: 0,\n\t\t\t\tfontWeight: 600,\n\t\t\t\tmarginBottom: \"5px\",\n\t\t\t}}\n\t\t>\n\t\t\t{children}\n\t\t</span>\n\t)\n}\n\nfunction Description({ children }: { children?: React.ReactNode }) {\n\treturn (\n\t\t<span\n\t\t\tstyle={{\n\t\t\t\tdisplay: \"flex\",\n\t\t\t\tflexDirection: \"column\",\n\t\t\t\ttextAlign: \"center\",\n\t\t\t\tflexGrow: 1,\n\t\t\t\tflexShrink: 0,\n\t\t\t\tfontWeight: 400,\n\t\t\t\tmaxWidth: \"200px\",\n\t\t\t}}\n\t\t>\n\t\t\t{children}\n\t\t</span>\n\t)\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { isValidMotionProp, resolveMotionValue } from \"framer-motion\"\nimport type { RefObject } from \"react\"\nimport React, { forwardRef, useContext, useRef } from \"react\"\nimport { isStaticRenderer } from \"../../../modules/useIsStaticRenderer.ts\"\nimport { asRecord } from \"../../../utils/asRecord.ts\"\nimport { isPropValid } from \"../../../utils/isPropValid.ts\"\nimport { runtime } from \"../../../utils/runtimeInjection.ts\"\nimport { BackgroundImageComponent } from \"../../style/BackgroundImageComponent.tsx\"\nimport type { ImageAltProps } from \"../../style/BackgroundImageComponent.tsx\"\nimport { Border } from \"../../style/BorderComponent.tsx\"\nimport { backgroundImageFromProps } from \"../../style/backgroundImageFromProps.ts\"\nimport type { BackgroundProperties } from \"../../traits/Background.ts\"\nimport type { FitImageDimensionType } from \"../../types/BackgroundImage.ts\"\nimport { DimensionType } from \"../../types/Constraints.ts\"\nimport type { ConstraintConfiguration, NewConstraintProperties, ParentSize } from \"../../types/NewConstraints.tsx\"\nimport {\n\tParentSizeState,\n\tconstraintsEnabled,\n\tisAutoSized,\n\tuseConstraints,\n\tuseProvideParentSize,\n} from \"../../types/NewConstraints.tsx\"\nimport type { Rect } from \"../../types/Rect.ts\"\nimport { RenderTarget } from \"../../types/RenderEnvironment.ts\"\nimport { getIntrinsicSizeForBackgroundImage } from \"../../utils/getIntrinsicSizeForBackgroundImage.ts\"\nimport { htmlElementAsMotionComponent } from \"../../utils/htmlElementAsMotionComponent.ts\"\nimport { withLibraryCSS } from \"../../utils/injectComponentCSSRules.ts\"\nimport { layoutHintDataPropsForCenter } from \"../../utils/layoutHintDataPropsForCenter.ts\"\nimport { nodeIdFromString } from \"../../utils/nodeIdFromString.ts\"\nimport { countNodeRender } from \"../../utils/performanceDebugging.ts\"\nimport { processOverrideForwarding } from \"../../utils/processOverrideForwarding.ts\"\nimport { transformTemplate } from \"../../utils/transformTemplate.ts\"\nimport { useLayoutId } from \"../../utils/useLayoutId.ts\"\nimport { useMeasureLayout } from \"../../utils/useMeasureLayout.ts\"\nimport { ComponentContainerContext } from \"../ComponentContainerContext.tsx\"\nimport type { LayerProps } from \"../Layer.tsx\"\nimport { Layer } from \"../Layer.tsx\"\nimport { getStyleForFrameProps, hasLeftAndRight, hasTopAndBottom } from \"./getStyleForFrameProps.ts\"\nimport type {\n\tBaseFrameProps,\n\tCSSTransformProperties,\n\tFrameLayoutProperties,\n\tMotionDivProps,\n\tVisualProperties,\n} from \"./types.ts\"\n\nfunction hasEvents(props: Partial<FrameProps>) {\n\tfor (const key in props) {\n\t\tif (\n\t\t\tkey === \"drag\" ||\n\t\t\tkey.startsWith(\"while\") ||\n\t\t\t(typeof asRecord(props)[key] === \"function\" && key.startsWith(\"on\") && !key.includes(\"Animation\"))\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\nconst pointerEvents = [\n\t\"onClick\",\n\t\"onDoubleClick\",\n\t\"onMouse\",\n\t\"onMouseDown\",\n\t\"onMouseUp\",\n\t\"onTapDown\",\n\t\"onTap\",\n\t\"onTapUp\",\n\t\"onPointer\",\n\t\"onPointerDown\",\n\t\"onPointerUp\",\n\t\"onTouch\",\n\t\"onTouchDown\",\n\t\"onTouchUp\",\n]\nconst pointerEventsSet = /* @__PURE__ */ (() =>\n\tnew Set([\n\t\t...pointerEvents,\n\t\t...pointerEvents.map(event => `${event}Capture`), // Add capture event variants\n\t]))()\n\nfunction getCursorFromEvents(props: Partial<FrameProps>) {\n\tif (props.drag) {\n\t\treturn \"grab\"\n\t}\n\n\tfor (const key in props) {\n\t\tif (pointerEventsSet.has(key)) {\n\t\t\treturn \"pointer\"\n\t\t}\n\t}\n\n\treturn undefined\n}\n\nconst overflowKey: keyof React.CSSProperties = \"overflow\"\nfunction hasScrollableContent(props: Partial<FrameProps>): boolean {\n\tif (hasScrollingOverflow(props)) return true\n\tif (!props.style) return false\n\tif (hasScrollingOverflow(props.style)) return true\n\treturn false\n}\n\nfunction hasScrollingOverflow(props: Partial<Record<typeof overflowKey, unknown>>) {\n\tif (overflowKey in props && (props[overflowKey] === \"scroll\" || props[overflowKey] === \"auto\")) return true\n\treturn false\n}\n\n/** @internal */\nexport function unwrapFrameProps(\n\tframeProps: Partial<FrameLayoutProperties & ConstraintConfiguration>,\n): Partial<NewConstraintProperties> {\n\tconst {\n\t\tleft,\n\t\ttop,\n\t\tbottom,\n\t\tright,\n\t\twidth,\n\t\theight,\n\t\tcenter,\n\t\t_constraints,\n\t\tsize,\n\t\twidthType,\n\t\theightType,\n\t\tpositionFixed,\n\t\tpositionAbsolute,\n\t} = frameProps\n\n\tconst minWidth = resolveMotionValue(frameProps.minWidth)\n\tconst minHeight = resolveMotionValue(frameProps.minHeight)\n\tconst maxWidth = resolveMotionValue(frameProps.maxWidth)\n\tconst maxHeight = resolveMotionValue(frameProps.maxHeight)\n\n\tconst constraintProps: Partial<NewConstraintProperties> = {\n\t\ttop: resolveMotionValue(top),\n\t\tleft: resolveMotionValue(left),\n\t\tbottom: resolveMotionValue(bottom),\n\t\tright: resolveMotionValue(right),\n\t\twidth: resolveMotionValue(width),\n\t\theight: resolveMotionValue(height),\n\t\tsize: resolveMotionValue(size),\n\t\tcenter,\n\t\t_constraints,\n\t\twidthType,\n\t\theightType,\n\t\tpositionFixed,\n\t\tpositionAbsolute,\n\t\tminWidth,\n\t\tminHeight,\n\t\tmaxWidth,\n\t\tmaxHeight,\n\t}\n\treturn constraintProps\n}\n\n/** @public */\nexport interface FrameProps\n\textends\n\t\tImageAltProps,\n\t\tBackgroundProperties,\n\t\tVisualProperties,\n\t\tOmit<MotionDivProps, \"color\" | \"children\">,\n\t\tCSSTransformProperties,\n\t\tLayerProps,\n\t\tFrameLayoutProperties,\n\t\tConstraintConfiguration,\n\t\tBaseFrameProps {\n\tcomponentType?: string\n\tas?: keyof HTMLElementTagNameMap | \"svg\"\n\t/** @internal */\n\t__layoutId?: string | undefined\n\t/** @internal */\n\t__fromCanvasComponent?: boolean\n\t/** @internal */\n\t__portal?: React.ReactNode\n\t/** @internal */\n\tfitImageDimension?: FitImageDimensionType\n}\n\nexport const defaultFrameRect = { x: 0, y: 0, width: 200, height: 200 }\n\nexport function useStyleAndRect(props: Partial<FrameProps>): [MotionStyle, Rect | null] {\n\tconst inCodeComponent = useContext(ComponentContainerContext)\n\n\tconst { style, _initialStyle, __fromCanvasComponent, size } = props\n\tconst unwrappedProps = unwrapFrameProps(props)\n\tconst constraintsRect = useConstraints(unwrappedProps)\n\n\tconst defaultStyle: MotionStyle = {\n\t\tdisplay: \"block\",\n\t\tflex: style?.flex ?? \"0 0 auto\",\n\t\tuserSelect: RenderTarget.current() !== RenderTarget.preview ? \"none\" : undefined,\n\t}\n\n\tif (!props.__fromCanvasComponent) {\n\t\t// XXX: this is hack until we find a better solution\n\t\tdefaultStyle.backgroundColor = props.background === undefined ? \"rgba(0, 170, 255, 0.3)\" : undefined\n\t}\n\n\t// To support setting overflow: auto on stacks in generated code, especially\n\t// in responsive screens, we need to ensure that pointerEvents: \"none\" is\n\t// not set if the Frame has no interaction events. There is no other way to\n\t// check in generated responsive screens, because overflow is set via css\n\t// classes, not inline style.\n\tconst shouldDisablePointerEvents = !hasEvents(props) && !props.__fromCanvasComponent && !hasScrollableContent(props)\n\tconst safeToEditPointerEvents = props.style ? !(\"pointerEvents\" in props.style) : true\n\tif (shouldDisablePointerEvents && safeToEditPointerEvents) {\n\t\tdefaultStyle.pointerEvents = \"none\"\n\t}\n\n\tconst addTextCentering =\n\t\tReact.Children.count(props.children) > 0 &&\n\t\tReact.Children.toArray(props.children).every(child => {\n\t\t\treturn typeof child === \"string\" || typeof child === \"number\"\n\t\t})\n\tconst centerTextStyle = addTextCentering && {\n\t\tdisplay: \"flex\",\n\t\talignItems: \"center\",\n\t\tjustifyContent: \"center\",\n\t\ttextAlign: \"center\",\n\t}\n\n\tconst propsStyle = getStyleForFrameProps(props)\n\n\tif (size === undefined && !__fromCanvasComponent) {\n\t\tif (!hasLeftAndRight(propsStyle)) {\n\t\t\tdefaultStyle.width = defaultFrameRect.width\n\t\t}\n\n\t\tif (!hasTopAndBottom(propsStyle)) {\n\t\t\tdefaultStyle.height = defaultFrameRect.height\n\t\t}\n\t}\n\n\tif (unwrappedProps.minWidth !== undefined) {\n\t\tdefaultStyle.minWidth = unwrappedProps.minWidth\n\t}\n\n\tif (unwrappedProps.minHeight !== undefined) {\n\t\tdefaultStyle.minHeight = unwrappedProps.minHeight\n\t}\n\n\tlet constraintsStyle: MotionStyle = {}\n\n\tif (constraintsEnabled(unwrappedProps)) {\n\t\t// When we have an auto-sized dimension, the constraints rect will be\n\t\t// based on stale cached values, so we won't use it.\n\t\tif (constraintsRect && !isAutoSized(props)) {\n\t\t\tconstraintsStyle = {\n\t\t\t\tleft: constraintsRect.x,\n\t\t\t\ttop: constraintsRect.y,\n\t\t\t\twidth: constraintsRect.width,\n\t\t\t\theight: constraintsRect.height,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t}\n\t\t}\n\t}\n\n\t// In theory we should not have constraints and props styles at the same time\n\t// because we use constraints internally in vekter and top level props are only for usage from customer code\n\t//\n\t// In practice we have it with code overrides\n\t// But we take `propsStyle` priority in any case now\n\tObject.assign(defaultStyle, centerTextStyle, _initialStyle, propsStyle, constraintsStyle, style)\n\t// React styling library doesn't work well when combining long-hand and short-hand values, so we just use short-hand values always\n\tObject.assign(defaultStyle, {\n\t\toverflowX: defaultStyle.overflowX ?? defaultStyle.overflow,\n\t\toverflowY: defaultStyle.overflowY ?? defaultStyle.overflow,\n\t\toverflow: undefined,\n\t})\n\n\tLayer.applyWillChange(props, defaultStyle, true)\n\n\tlet resultStyle = defaultStyle\n\tif (!defaultStyle.transform) {\n\t\t// Reset the transform explicitly, because Framer Motion will not treat undefined values as 0 and still generate a transform\n\t\tresultStyle = { x: 0, y: 0, ...defaultStyle }\n\t}\n\n\tconst isRenderingStaticContent = isStaticRenderer()\n\tif (props.positionSticky) {\n\t\tif (!isRenderingStaticContent || runtime.isOnPageCanvas || inCodeComponent) {\n\t\t\tresultStyle.position = \"sticky\"\n\t\t\tresultStyle.willChange = \"transform\"\n\t\t\tresultStyle.top = props.positionStickyTop\n\t\t\tresultStyle.right = props.positionStickyRight\n\t\t\tresultStyle.bottom = props.positionStickyBottom\n\t\t\tresultStyle.left = props.positionStickyLeft\n\t\t}\n\t} else if (isRenderingStaticContent) {\n\t\tif (props.positionFixed) {\n\t\t\t// on-page editing requires \"position: fixed\" as a published website\n\t\t\tresultStyle.position = runtime.isOnPageCanvas ? \"fixed\" : \"absolute\"\n\t\t} else if (props.positionAbsolute) {\n\t\t\tresultStyle.position = \"absolute\"\n\t\t}\n\t}\n\n\t// Work around a framer-motion bug where key: undefined style values which\n\t// are moved to transforms add `fn(undefined)` to the transform string. Issue:\n\t// https://github.com/framer/company/issues/25915.\n\tif (\"rotate\" in resultStyle && resultStyle.rotate === undefined) {\n\t\tdelete resultStyle.rotate\n\t}\n\n\treturn [resultStyle, constraintsRect]\n}\n\n// These properties are considered valid React DOM props because they're valid\n// SVG props, so we need to manually exclude them.\nconst filteredProps = new Set([\n\t\"width\",\n\t\"height\",\n\t\"opacity\",\n\t\"overflow\",\n\t\"radius\",\n\t\"background\",\n\t\"color\",\n\t\"x\",\n\t\"y\",\n\t\"z\",\n\t\"rotate\",\n\t\"rotateX\",\n\t\"rotateY\",\n\t\"rotateZ\",\n\t\"scale\",\n\t\"scaleX\",\n\t\"scaleY\",\n\t\"skew\",\n\t\"skewX\",\n\t\"skewY\",\n\t\"originX\",\n\t\"originY\",\n\t\"originZ\",\n])\n\nfunction getMotionProps(props: Partial<FrameProps>): MotionDivProps {\n\tconst motionProps: Record<string, unknown> = {}\n\n\tfor (const key in props) {\n\t\tconst isValid = isValidMotionProp(key) || isPropValid(key)\n\t\tif (isValid && !filteredProps.has(key)) {\n\t\t\tmotionProps[key] = asRecord(props)[key]\n\t\t} else if (key === \"positionTransition\" || key === \"layoutTransition\") {\n\t\t\t/** Support legacy layout animation props */\n\t\t\tmotionProps[\"layout\"] = true\n\t\t\tif (typeof asRecord(props)[key] !== \"boolean\" && !props.transition) {\n\t\t\t\tmotionProps[\"transition\"] = asRecord(props)[key]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn motionProps\n}\n\nfunction hasDataFramerName(props: Partial<FrameProps>) {\n\treturn \"data-framer-name\" in props\n}\n\n/** @internal */\nconst VisibleFrame = /* @__PURE__ */ forwardRef(function VisibleFrame(\n\tprops: Partial<FrameProps>,\n\tforwardedRef: RefObject<HTMLDivElement> | null,\n) {\n\tconst { name, center, border, _border, __portal } = props\n\tconst { props: propsWithOverrides, children } = processOverrideForwarding(props)\n\tconst motionProps = getMotionProps(propsWithOverrides)\n\tconst layoutId = useLayoutId(props)\n\tconst cursor = getCursorFromEvents(props)\n\tconst fallbackRef = useRef<HTMLDivElement>(null)\n\tconst ref = forwardedRef ?? fallbackRef\n\n\tconst dataProps = {\n\t\t\"data-framer-component-type\": props.componentType ?? \"Frame\",\n\t\t\"data-framer-cursor\": cursor,\n\t\t\"data-framer-highlight\": cursor === \"pointer\" ? true : undefined,\n\t\t\"data-layoutid\": layoutId,\n\t\t\"data-framer-offset-parent-id\": asRecord(props)[\"data-framer-offset-parent-id\"],\n\t}\n\n\t// Vekter provides the `data-framer-name` prop. However to maintain api\n\t// compatibility when Frame is used in code, set `data-framer-name` if\n\t// `name` is provided and `data-framer-name` is not.\n\tif (!hasDataFramerName(props) && name) {\n\t\tasRecord(dataProps)[\"data-framer-name\"] = name\n\t}\n\n\tconst [currentStyle, rect] = useStyleAndRect(propsWithOverrides)\n\n\tconst unwrappedProps = unwrapFrameProps(propsWithOverrides)\n\tconst autoSized = isAutoSized(unwrappedProps)\n\n\tif (center && !(rect && !autoSized && constraintsEnabled(unwrappedProps))) {\n\t\tif (!motionProps.transformTemplate) motionProps.transformTemplate = transformTemplate(center)\n\t\tObject.assign(dataProps, layoutHintDataPropsForCenter(center))\n\t} else if (!motionProps.transformTemplate) {\n\t\tmotionProps.transformTemplate = undefined\n\t}\n\n\tuseMeasureLayout(props, ref)\n\n\tconst backgroundImage = backgroundImageFromProps(props)\n\n\t// The parentSize resolved here won't be used if a parent further up the\n\t// tree disabled parent size resolution (e.g. when rendering inside a code component)\n\tconst inCodeComponent = useContext(ComponentContainerContext)\n\tconst parentSize = resolveParentSize(propsWithOverrides, unwrappedProps, rect, inCodeComponent)\n\tconst wrappedContent = useProvideParentSize(\n\t\t<>\n\t\t\t{backgroundImage ? (\n\t\t\t\t<BackgroundImageComponent\n\t\t\t\t\talt={props.alt ?? \"\"}\n\t\t\t\t\timage={backgroundImage}\n\t\t\t\t\tcontainerSize={rect ?? undefined}\n\t\t\t\t\tnodeId={props.id && nodeIdFromString(props.id)}\n\t\t\t\t\tlayoutId={layoutId}\n\t\t\t\t/>\n\t\t\t) : null}\n\n\t\t\t{children}\n\n\t\t\t<Border {..._border} border={border} layoutId={layoutId} />\n\t\t</>,\n\t\tparentSize,\n\t)\n\n\tconst MotionComponent = htmlElementAsMotionComponent(props.as)\n\n\tconst intrinsicSize = getIntrinsicSizeForBackgroundImage(backgroundImage)\n\tif (props.fitImageDimension && intrinsicSize) {\n\t\tcurrentStyle[props.fitImageDimension] = \"auto\"\n\t\tcurrentStyle.aspectRatio = intrinsicSize.width / intrinsicSize.height\n\t}\n\n\treturn (\n\t\t<MotionComponent {...dataProps} {...motionProps} layoutId={layoutId} style={currentStyle} ref={ref}>\n\t\t\t{wrappedContent}\n\t\t\t{__portal}\n\t\t</MotionComponent>\n\t)\n})\n\n/** @internal */\nconst FrameWithMotionInner = /* @__PURE__ */ forwardRef<HTMLDivElement, Partial<FrameProps>>(\n\tfunction FrameWithMotion(props, ref) {\n\t\tcountNodeRender()\n\t\tconst { visible = true } = props\n\t\tif (!visible) return null\n\n\t\treturn <VisibleFrame {...props} ref={ref} />\n\t},\n)\n\n/** @internal */\nexport const FrameWithMotion = /* @__PURE__ */ withLibraryCSS(FrameWithMotionInner)\n\nfunction resolveParentSize(\n\tprops: Partial<FrameProps>,\n\tunwrappedProps: Partial<NewConstraintProperties>,\n\trect: Rect | null,\n\tinCodeComponent: boolean,\n): ParentSize {\n\tif (inCodeComponent) {\n\t\tconst parentSize = rect ? { width: rect.width, height: rect.height } : ParentSizeState.Disabled\n\t\treturn parentSize\n\t}\n\n\tconst { _usesDOMRect } = props\n\tconst {\n\t\twidthType = DimensionType.FixedNumber,\n\t\theightType = DimensionType.FixedNumber,\n\t\twidth,\n\t\theight,\n\t} = unwrappedProps\n\n\t// The constraints rect might be based on stale layout information, or\n\t// return defaults if this is a DOM layout node, so we won't use it unless\n\t// `usesDOMRect` is also false\n\tif (rect && !_usesDOMRect) {\n\t\treturn rect\n\t}\n\n\t// Even if we can't resolve a full rect (e.g. when the node relies on DOM\n\t// layout for positioning), we might still be able to provide a size if this\n\t// is a fixed-size node\n\tif (\n\t\twidthType === DimensionType.FixedNumber &&\n\t\theightType === DimensionType.FixedNumber &&\n\t\ttypeof width === \"number\" &&\n\t\ttypeof height === \"number\"\n\t) {\n\t\treturn { width, height }\n\t}\n\n\t// If this is a DOM layout node, or position fixed, we need to return\n\t// DisabledForCurrentLevel, instead of Disabled, because that way children\n\t// will still render using DOM layout, but we won't prevent any descendants\n\t// from using a resolved parent size further down the hierarchy\n\tif (_usesDOMRect || props.positionFixed || props.positionAbsolute) {\n\t\treturn ParentSizeState.DisabledForCurrentLevel\n\t}\n\n\t// If all else fails, return unknown\n\treturn ParentSizeState.Unknown\n}\n", "import { useState } from \"react\"\nimport { RenderTarget } from \"../render/types/RenderEnvironment.ts\"\n\n/**\n * Returns true if the caller is executed in a Framer Canvas or Export Canvas environment, or false\n * otherwise. This function could be used outside of a React component; the value it returns will\n * never change.\n *\n * @public\n */\nexport function isStaticRenderer() {\n\tconst currentTarget = RenderTarget.current()\n\treturn currentTarget === RenderTarget.canvas || currentTarget === RenderTarget.export\n}\n\n/**\n * Returns a constant value based on whether the caller is mounted in a Framer Canvas or Export\n * Canvas environment.\n *\n * If you need to use this outside of React, use `isStaticRenderer()` instead.\n *\n * @public\n */\nexport function useIsStaticRenderer() {\n\t// Even though `isStaticRenderer` returns a constant value and can be easily used inside React\n\t// components, we still offer the non-hook version of it for consistency with existing APIs. To\n\t// make sure this hook isn\u2019t used outside of React and actually follows rules of hooks, we call\n\t// a useState inside it.\n\tconst [isStatic] = useState(() => isStaticRenderer())\n\treturn isStatic\n}\n", "/** No-op operation that casts an object to a record */\nexport const asRecord = <O extends object>(object: O) => object as Record<string | number | symbol, O[keyof O]>\n", "/**\n * @license Emotion v11.0.0\n * MIT License\n *\n * Copyright (c) Emotion team and other contributors\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/*\n * The code below is copied from the emotion repo to reduce external\n * dependencies and to have control over the build output.\n */\n\n// https://github.com/emotion-js/emotion/blob/%40emotion/is-prop-valid%401.2.0/packages/memoize/src/index.js\nfunction memoize<V>(fn: (arg: string) => V): (arg: string) => V {\n\tconst cache = Object.create(Object.prototype)\n\n\treturn (arg: string) => {\n\t\tif (cache[arg] === undefined) cache[arg] = fn(arg)\n\t\treturn cache[arg]\n\t}\n}\n\n// https://github.com/emotion-js/emotion/blob/%40emotion/is-prop-valid%401.2.0/packages/is-prop-valid/src/props.js\nconst reactPropsRegex =\n\t/^(?:children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|[dkrxyz]|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y1|y2|yChannelSelector|zoomAndPan|for|class|autofocus|(?:[Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*)$/u // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23\n\n// https://github.com/emotion-js/emotion/blob/%40emotion/is-prop-valid%401.2.0/packages/is-prop-valid/src/index.js\nexport const isPropValid = /* #__PURE__ */ memoize(\n\tprop =>\n\t\treactPropsRegex.test(prop) ||\n\t\t(prop.charCodeAt(0) === 111 /* o */ && prop.charCodeAt(1) === 110 /* n */ && prop.charCodeAt(2) < 91) /* Z+1 */,\n)\n", "import { type CSSProperties, type ComponentType, useMemo } from \"react\"\nimport type { FontshareFont } from \"../render/fonts/FontshareSource.ts\"\nimport type { GoogleWebFontFamily, GoogleWebFontFamilyWithAxes } from \"../render/fonts/GoogleFontSource.ts\"\nimport type { Asset } from \"../render/fonts/types.ts\"\nimport type { Action, ActionControls } from \"../render/types/Action.ts\"\nimport type { BackgroundImage } from \"../render/types/BackgroundImage.ts\"\nimport type { Size } from \"../render/types/Size.ts\"\nimport { warnOnce } from \"../utils/warnOnce.ts\"\n\n// This is copied over from `src/app/assets/src/types/AssetResolver.ts` to avoid\n// importing external modules into the library.\n\n/**\n * @internal\n */\nexport type AssetSize = \"auto\" | \"lossless\" | \"small\" | \"medium\" | \"large\" | \"full\"\n\n/**\n * @internal\n * This type is duplicated in AssetResolver.ts:\n * https://github.com/framer/FramerStudio/blob/f7a636cc5b461e06b87b768bdf2c7b353b4f6bde/src/app/assets/src/types/AssetResolver.ts#L8\n */\nexport interface AssetContext {\n\tpreferredSize?: AssetSize\n\tpixelSize?: number\n\tisFramerResourceURL?: boolean\n\tisExport?: boolean\n}\n\n/**\n * @internal\n */\nexport type AssetResolver = (identifier: string | undefined, context: AssetContext) => string | undefined\n\n/**\n * The Runtime lives in ./Source/Runtime and implements Vekter-specific\n * functionality. Because the implementation of this functionality might change,\n * we don't want to make it part of Framer Library. Some functions, however, are\n * exposed to the user as exports from `\"framer\"`.\n *\n * This file provides a way for the runtime to inject the functionality into\n * Framer Library. This should make it easier to keep Vekter compatible with\n * multiple Framer Library versions.\n */\n\n/**\n * This interface contains the functions injected by the runtime. Adding a new\n * function to this interface is fine. but:\n *\n * BE CAREFUL UPDATING THE TYPES OF EXISTING FUNCTIONS\n *\n * Because these types are only checked at compile time, they only can provide a\n * guarantee that old versions of the Library will keep working if they don't\n * change. If you do need to change existing types, the runtime needs to make\n * sure it provides backwards compatibility for old versions of Framer Library.\n * @internal\n */\nexport interface Runtime {\n\tRenderPlaceholder: ComponentType<{ error: { message: string; title?: string } }>\n\taddActionControls<Options extends { [key: string]: unknown }>(\n\t\taction: Action<Options>,\n\t\ttitle: string,\n\t\tcontrols: ActionControls<Options>,\n\t): void\n\tassetResolver: AssetResolver\n\tqueueMeasureRequest(id: string, element: Element, children: Element[], selector?: string): void\n\tfetchGoogleFontsList(): Promise<{\n\t\tstaticFonts: GoogleWebFontFamily[]\n\t\tvariableFonts: GoogleWebFontFamilyWithAxes[]\n\t}>\n\tfetchFontshareFontsList(): Promise<FontshareFont[]>\n\tfetchBuiltInFontsList(): Promise<Asset[]>\n\timagePlaceholderSvg: string\n\tuseImageElement(image: BackgroundImage, containerSize?: Size, nodeId?: string): HTMLImageElement\n\tuseImageSource(image: BackgroundImage, containerSize?: Size, nodeId?: string): string\n\tcanRenderOptimizedCanvasImage(source: string): boolean\n\trenderOptimizedCanvasImage(contentDiv: HTMLElement, source: string, style: CSSProperties, nodeId?: string): void\n\tgetLogger(id: string): Logger | undefined\n\tisOnPageCanvas: boolean\n}\n\ninterface Logger {\n\ttrace(...parts: unknown[]): void\n\tdebug(...parts: unknown[]): void\n\tinfo(...parts: unknown[]): void\n\twarn(...parts: unknown[]): void\n\terror(...parts: unknown[]): void\n}\n\nconst mockWithWarning = (message: string) => {\n\treturn () => {\n\t\twarnOnce(message)\n\t}\n}\n\nconst mockWithoutWarning = () => {\n\treturn () => {}\n}\n\n/** This stores the injected implementations */\nconst implementation: Partial<Runtime> = {\n\t// We need a default implementation for useImageSource and useImageElement as it is used for\n\t// rendering image backgrounds which would break otherwise. The default value is used for HTML\n\t// export and when using the library without Framer.\n\timagePlaceholderSvg: `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"126\" height=\"126\"><path id=\"a\" d=\"M126 0v21.584L21.584 126H0v-17.585L108.415 0H126Zm0 108.414V126h-17.586L126 108.414Zm0-84v39.171L63.585 126H24.414L126 24.414Zm0 42v39.17L105.584 126h-39.17L126 66.414ZM105.586 0 0 105.586V66.415L66.415 0h39.171Zm-42 0L0 63.586V24.415L24.415 0h39.171Zm-42 0L0 21.586V0h21.586Z\" fill=\"rgb(136, 136, 136, 0.2)\" fill-rule=\"evenodd\"/></svg>`,\n\tuseImageSource(image) {\n\t\treturn image.src ?? \"\"\n\t},\n\tuseImageElement(image, rect, nodeId) {\n\t\tconst src = runtime.useImageSource(image, rect, nodeId)\n\n\t\treturn useMemo(() => {\n\t\t\tconst element = new Image()\n\t\t\telement.src = src\n\t\t\t// srcSet doesn't need resolving via useImageSource, since these are\n\t\t\t// currently only used in generated components, where resolution happens\n\t\t\t// during code-generation.\n\t\t\tif (image.srcSet) element.srcset = image.srcSet\n\t\t\treturn element\n\t\t}, [src, image.srcSet])\n\t},\n\tcanRenderOptimizedCanvasImage() {\n\t\treturn false\n\t},\n\tisOnPageCanvas: false,\n}\n\nlet isRuntimeInjected = false\nconst runtimeProxy: ProxyHandler<Runtime> = {\n\tget(target, key, reciever) {\n\t\tif (Reflect.has(target, key)) {\n\t\t\treturn Reflect.get(target, key, reciever)\n\t\t}\n\n\t\t// We don't want to warn about attempted logs either in production or\n\t\t// in environments where it's not available, like tests.\n\t\tif ([\"getLogger\"].includes(String(key))) {\n\t\t\treturn mockWithoutWarning()\n\t\t}\n\n\t\tif (isRuntimeInjected) {\n\t\t\treturn mockWithWarning(`${String(key)} is not available in this version of Framer.`)\n\t\t}\n\n\t\treturn mockWithWarning(`${String(key)} is only available inside of Framer. https://www.framer.com/`)\n\t},\n}\n\n/**\n * This proxy makes sure that any key on the runtime object will return a\n * function that logs a warning to the console. Functions for which a\n * implementation is provided are available through this object, e.g.\n * `runtime.addActionControls()`\n * @internal\n */\nexport const runtime: Runtime = /* @__PURE__ */ new Proxy(implementation as Runtime, runtimeProxy)\n\n/**\n * This function is used by the `initializeRuntime()` function of the runtime to\n * provide the implementation of the functions defined in the `Runtime`\n * interface.\n * @internal\n */\nexport function _injectRuntime(injectedRuntime: Partial<Runtime>) {\n\tObject.assign(implementation, injectedRuntime)\n\tisRuntimeInjected = true\n}\n", "import { motion } from \"framer-motion\"\nimport React, { useCallback, type HTMLAttributes } from \"react\"\nimport { runtime } from \"../../utils/runtimeInjection.ts\"\nimport { encodeSVGForCSS, isNumber, isString } from \"../../utils/utils.ts\"\nimport type { BackgroundImage, ImageFit } from \"../types/BackgroundImage.ts\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport type { Size } from \"../types/Size.ts\"\nimport { cornerPropertiesToInherit } from \"../utils/corners.ts\"\nimport { roundToHalfPixel } from \"../utils/roundedNumber.ts\"\nimport { getSrcSet } from \"./getSrcSet.ts\"\n\nconst wrapperStyle: React.CSSProperties = /* @__PURE__ */ (() => ({\n\tposition: \"absolute\",\n\t...cornerPropertiesToInherit,\n\ttop: 0,\n\tright: 0,\n\tbottom: 0,\n\tleft: 0,\n}))()\n\nfunction getPlaceholderStyle(): React.CSSProperties {\n\treturn {\n\t\tbackgroundRepeat: \"repeat\",\n\t\tbackgroundPosition: \"left top\",\n\t\tbackgroundSize: \"64px auto\",\n\t\tbackgroundImage: encodeSVGForCSS(runtime.imagePlaceholderSvg),\n\t}\n}\n\nfunction cssObjectFit(imageFit?: ImageFit) {\n\tswitch (imageFit) {\n\t\tcase \"fit\":\n\t\t\treturn \"contain\"\n\t\tcase \"stretch\":\n\t\t\treturn \"fill\"\n\t\tdefault:\n\t\t\treturn \"cover\"\n\t}\n}\n\nfunction cssObjectPosition(positionX: BackgroundImage[\"positionX\"], positionY: BackgroundImage[\"positionY\"]): string {\n\tconst x = positionX ?? \"center\"\n\tconst y = positionY ?? \"center\"\n\tif (x === \"center\" && y === \"center\") return \"center\"\n\treturn x + \" \" + y\n}\n\nfunction getImageStyle(image: BackgroundImage): React.CSSProperties {\n\treturn {\n\t\tdisplay: \"block\",\n\t\twidth: \"100%\",\n\t\theight: \"100%\",\n\t\t...cornerPropertiesToInherit,\n\t\tobjectPosition: cssObjectPosition(image.positionX, image.positionY),\n\t\tobjectFit: cssObjectFit(image.fit),\n\t}\n}\n\nexport interface ImageAltProps {\n\t/**\n\t * Previously, alt was set on the BackgroundImage object. This caused issues\n\t * where the entire object would need to be replaced in order to update the\n\t * alt attribute. Now we provide a specific prop for the alt attribute so it\n\t * can change even if the background object does not and vice versa. This\n\t * needs to be optional so that old sites and Smart Components generated\n\t * with alt in the BackgroundImage object do not error. Those sites and\n\t * Smart Components will correctly fallback to BackgroundImage.alt.\n\t */\n\talt?: string\n}\n\ninterface InnerImageProps extends ImageAltProps {\n\timage: BackgroundImage\n\tcontainerSize?: Size\n\tnodeId?: string\n\tdraggable?: HTMLAttributes<HTMLDivElement>[\"draggable\"]\n\tavoidAsyncDecoding?: boolean\n}\n\n/**\n * This defines the following behavior:\n * - While the image is loading, or JS hasn\u2019t loaded yet: render with decoding=\"async\" (unless\n *   forced otherwise)\n * - Once the image is loaded: switch to decoding=\"auto\"\n *\n * This ensures images don\u2019t introduce animation jank when they are mounted for the first time, but\n * also don\u2019t experience white flashes [1] when their `src` changes later (eg due to a resize or a\n * `sizes` change).\n * [1] https://framer-team.slack.com/archives/C01B14R6E22/p1736530731563399\n */\nfunction useDecodingAttribute(avoidAsyncDecoding: boolean | undefined) {\n\tconst currentDecoding = React.useRef<\"sync\" | \"async\" | \"auto\">(avoidAsyncDecoding ? \"auto\" : \"async\")\n\n\tconst switchDecodingToAuto = useCallback((node: HTMLImageElement) => {\n\t\tcurrentDecoding.current = \"auto\"\n\t\tnode.decoding = \"auto\"\n\t}, [])\n\n\tconst onImageLoad = useCallback(\n\t\t(event: React.SyntheticEvent<HTMLImageElement>) => {\n\t\t\tswitchDecodingToAuto(event.currentTarget)\n\t\t},\n\t\t[switchDecodingToAuto],\n\t)\n\n\tconst onImageMount = useCallback(\n\t\t(node: HTMLImageElement | null) => {\n\t\t\tif (node?.complete) switchDecodingToAuto(node)\n\t\t},\n\t\t[switchDecodingToAuto],\n\t)\n\n\treturn { decoding: currentDecoding.current, onImageLoad, onImageMount }\n}\n\nfunction StaticImage({ image, containerSize, nodeId, alt, draggable, avoidAsyncDecoding }: InnerImageProps) {\n\tconst source = runtime.useImageSource(image, containerSize, nodeId)\n\tconst imageStyle = getImageStyle(image)\n\n\tconst { decoding, onImageLoad, onImageMount } = useDecodingAttribute(avoidAsyncDecoding)\n\n\tconst { srcSet, src } = !(\"srcSet\" in image)\n\t\t? getSrcSet(image.nodeFixedSize, image, source)\n\t\t: { src: source, srcSet: image.srcSet }\n\n\treturn (\n\t\t// eslint-disable-next-line framer-studio/require-async-decoding -- we conditionally apply it\n\t\t<img\n\t\t\t// Ignoring hydration warning; during hydration, `sizes` and `loading` attributes might differ\n\t\t\t// from what React sets because we rewrite them in `rewriteResponsiveImages` in SSG.\n\t\t\tsuppressHydrationWarning\n\t\t\tref={onImageMount}\n\t\t\tdecoding={decoding}\n\t\t\t// @ts-expect-error React 18 expects `fetchpriority` but TS only supports `fetchPriority`: https://github.com/facebook/react/issues/25682, https://github.com/facebook/react/issues/28946\n\t\t\t// eslint-disable-next-line react/no-unknown-property\n\t\t\tfetchpriority={image.fetchPriority}\n\t\t\t// ! important: DO NOT alter the order of `loading`, `sizes`, `srcset` and `src` attributes.\n\t\t\t// see https://github.com/framer/company/issues/29035.\n\t\t\tloading={image.loading}\n\t\t\twidth={image.pixelWidth}\n\t\t\theight={image.pixelHeight}\n\t\t\tsizes={srcSet ? image.sizes : undefined}\n\t\t\t// We don't need to resolve srcSet with useImageSource,\n\t\t\t// because these are currently only used in generated\n\t\t\t// components, where resolution happens during\n\t\t\t// code-generation.\n\t\t\tsrcSet={srcSet}\n\t\t\tsrc={src}\n\t\t\t// ! end of order-sensitive attributes.\n\n\t\t\tonLoad={onImageLoad}\n\t\t\talt={alt ?? image.alt ?? \"\"}\n\t\t\tstyle={imageStyle}\n\t\t\tdraggable={draggable}\n\t\t/>\n\t)\n}\n\nfunction CanvasImage({ image, containerSize, nodeId }: InnerImageProps) {\n\tconst wrapperRef = React.useRef<HTMLDivElement>(null)\n\tconst imageElement = runtime.useImageElement(image, containerSize, nodeId)\n\tconst imageStyle = getImageStyle(image)\n\n\t// This is not compatible with server side rendering, but that's ok, this is only meant when\n\t// rendering vekter's canvas.\n\tReact.useLayoutEffect(() => {\n\t\tconst wrapper = wrapperRef.current\n\n\t\tif (wrapper === null) return\n\t\twrapper.appendChild(imageElement)\n\n\t\treturn () => {\n\t\t\twrapper.removeChild(imageElement)\n\t\t}\n\t}, [imageElement])\n\n\tObject.assign(imageElement.style, imageStyle)\n\n\treturn <div ref={wrapperRef} style={{ display: \"contents\", ...cornerPropertiesToInherit }} />\n}\n\nfunction OptimizedCanvasImage({ nodeId, image, containerSize }: InnerImageProps) {\n\tconst wrapperRef = React.useRef<HTMLDivElement>(null)\n\tconst source = runtime.useImageSource(image, containerSize, nodeId)\n\n\tReact.useLayoutEffect(() => {\n\t\tconst wrapper = wrapperRef.current\n\t\tif (wrapper === null) return\n\n\t\tconst imageStyle = getImageStyle(image)\n\t\truntime.renderOptimizedCanvasImage(wrapper, source, imageStyle, nodeId)\n\t}, [nodeId, image, source])\n\n\treturn <div ref={wrapperRef} style={{ display: \"contents\", ...cornerPropertiesToInherit }} />\n}\n\ninterface Props extends InnerImageProps {\n\tlayoutId?: string\n}\n\nexport function BackgroundImageComponent({ layoutId, image, ...props }: Props) {\n\tif (layoutId) {\n\t\tlayoutId += \"-background\"\n\t}\n\n\tlet fallbackWrapperStyles: React.CSSProperties | null = null\n\n\tlet needsMotion = !!layoutId\n\tlet imageNode: React.ReactNode = null\n\tif (isString(image.src)) {\n\t\tif (image.fit === \"tile\" && image.pixelWidth && image.pixelHeight) {\n\t\t\t// If the fit is set to 'tile' then we want to use\n\t\t\t// a css background instead of an img element\n\t\t\t// so we set the imageNode to null and apply the relevant\n\t\t\t// background image properties to the wrapper element.\n\t\t\tconst backgroundSize = isNumber(image.backgroundSize) ? image.backgroundSize : 1\n\n\t\t\tconst tileSize = {\n\t\t\t\twidth: Math.round(backgroundSize * image.pixelWidth),\n\t\t\t\theight: Math.round(backgroundSize * image.pixelHeight),\n\t\t\t}\n\n\t\t\t// image.backgroundSize is a floating point number like 0.05\n\t\t\t// so we need to multiply it by the pixelWidth to get the pixel\n\t\t\t// value for the backgroundSize so that the size of the tile is\n\t\t\t// a function of the image width + background size percentage.\n\t\t\t// e.g image is 64px/64px and backgroundSize is 0.05, the tile size\n\t\t\t// should be 3.2px\n\t\t\t// We divide the pixel width by 2 because we assume that most designers\n\t\t\t// will be working with 2x (retina) assets.\n\t\t\t// And finally we round it to half pixel to avoid sub-pixel rendering issues when the fill image is an SVG.\n\t\t\tconst roundedBackgroundSize = roundToHalfPixel(backgroundSize * (image.pixelWidth / 2))\n\t\t\t// biome-ignore lint/correctness/useHookAtTopLevel: This is ok since this function acts just like a util to get the source.\n\t\t\tconst imageSource = runtime.useImageSource(image, tileSize)\n\t\t\tfallbackWrapperStyles = {\n\t\t\t\t...wrapperStyle,\n\t\t\t\tbackgroundImage: `url(${imageSource})`,\n\t\t\t\tbackgroundRepeat: \"repeat\",\n\t\t\t\tbackgroundPosition: cssObjectPosition(image.positionX, image.positionY),\n\t\t\t\topacity: undefined,\n\t\t\t\tborder: 0,\n\t\t\t\tbackgroundSize: `${roundedBackgroundSize}px auto`,\n\t\t\t}\n\n\t\t\timageNode = null\n\n\t\t\t// TODO: Currently we opt out this branch from the optimization, as we don't know if the styles need animation or not.\n\t\t\tneedsMotion = true\n\t\t} else if (RenderTarget.current() !== RenderTarget.canvas) {\n\t\t\timageNode = (\n\t\t\t\t<StaticImage\n\t\t\t\t\timage={image}\n\t\t\t\t\t// We don\u2019t want async decoding when exporting images. https://github.com/framer/FramerStudio/pull/19956\n\t\t\t\t\tavoidAsyncDecoding={RenderTarget.current() === RenderTarget.export}\n\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t\t)\n\t\t} else if (\n\t\t\t// biome-ignore lint/correctness/useHookAtTopLevel: This is ok since this function acts just like a util to get the source.\n\t\t\truntime.canRenderOptimizedCanvasImage(runtime.useImageSource(image))\n\t\t) {\n\t\t\timageNode = <OptimizedCanvasImage image={image} {...props} />\n\t\t} else {\n\t\t\timageNode = <CanvasImage image={image} {...props} />\n\t\t}\n\t}\n\n\tconst style = imageNode ? wrapperStyle : (fallbackWrapperStyles ?? { ...wrapperStyle, ...getPlaceholderStyle() })\n\n\treturn needsMotion ? (\n\t\t<motion.div layoutId={layoutId} style={style} data-framer-background-image-wrapper>\n\t\t\t{imageNode}\n\t\t</motion.div>\n\t) : (\n\t\t<div style={style} data-framer-background-image-wrapper>\n\t\t\t{imageNode}\n\t\t</div>\n\t)\n}\n", "import type { CSSProperties } from \"react\"\n\nexport const cornerPropertiesToInherit = {\n\tborderRadius: \"inherit\",\n\tcornerShape: \"inherit\",\n} as const satisfies CSSProperties\n", "import type { VariantDimensions } from \"./types/Asset.ts\"\n\n/**\n * Scale multipliers for generating `srcSet` attributes based on fixed size nodes.\n */\nexport const FixedSizeScaleVariants = [1, 2, 2.2] as const\n\n// This is duplicated in src/library/src/render/presentation/withLightbox.tsx. Ideally they stay in\n// sync to increase likelihood of cached size variants.\nconst ValidSteps = [512, 1024, 2048, 4096] as const\nconst enum Orientation {\n\tHorizontal = 0,\n\tVertical = 1,\n}\n\nexport function getVariantsDimensions(width?: number, height?: number): VariantDimensions[] | undefined {\n\tif (width === undefined || height === undefined) return\n\n\t// lead is the leading dimension, being the max between width and height.\n\t// follow is the non-leading dimension.\n\t// lead + follow will be used to correctly calculate the relative aspect ratio.\n\tlet lead = width,\n\t\tfollow = height,\n\t\t// orient is the orientation of the image, being it horizontal or vertical\n\t\torient: Orientation = Orientation.Horizontal\n\n\tif (height > width) {\n\t\tlead = height\n\t\tfollow = width\n\t\torient = Orientation.Vertical\n\t}\n\t// ratio is the aspect ratio of the image, as a floating point value\n\tconst ratio = lead / follow\n\n\t// sizes are the available resizing steps that will be applied to the given image.\n\t// At most they will match all the steps defined in the ValidSteps const.\n\tconst sizes: VariantDimensions[] = []\n\tfor (const step of ValidSteps) {\n\t\tif (lead <= step) return sizes\n\n\t\tsizes.push({\n\t\t\tmaxSideSize: step,\n\t\t\twidth: orient === Orientation.Horizontal ? step : Math.trunc(step / ratio),\n\t\t})\n\t}\n\n\treturn sizes\n}\n", "import { FixedSizeScaleVariants, getVariantsDimensions } from \"@framerjs/assets/src/getVariantsDimensions.ts\"\nimport type { VariantDimensions } from \"@framerjs/assets/src/types/Asset.ts\"\nimport type { BackgroundImage } from \"../types/BackgroundImage.ts\"\n\nfunction urlWithScaleDownTo(url: string, scaleDownTo: number | null): string {\n\ttry {\n\t\tconst urlObj = new URL(url)\n\t\tif (scaleDownTo) {\n\t\t\turlObj.searchParams.set(\"scale-down-to\", `${scaleDownTo}`)\n\t\t} else {\n\t\t\t// Some old codegenned image sources still include `?scale-down-to` parameter.\n\t\t\t// Let\u2019s delete it explicitly to make sure we serve the full variant.\n\t\t\turlObj.searchParams.delete(\"scale-down-to\")\n\t\t}\n\t\treturn urlObj.toString()\n\t} catch {\n\t\t// new URL() might throw. To avoid crashing the whole site when this happens, let\u2019s just fall back to the original URL.\n\t\treturn url\n\t}\n}\n\n// Variants smaller than 512 (16,32,64 respectively)\n// should not appear in the `srcset`\n// as they are used for tiling backgrounds only.\nexport const MinVariantSizeForSourceSet = 512\n\nfunction getResponsiveSrcSet(\n\tsource: string,\n\timage: BackgroundImage,\n\tvariants: VariantDimensions[] | undefined,\n): string | undefined {\n\tif (!variants || variants.length === 0) return undefined\n\tif (!image.pixelWidth) return undefined\n\n\tconst srcSet: string[] = []\n\n\tfor (const variant of variants) {\n\t\tif (variant.width < MinVariantSizeForSourceSet) continue\n\n\t\tconst url = urlWithScaleDownTo(source, variant.maxSideSize)\n\t\tsrcSet.push(`${url} ${variant.width}w`)\n\t}\n\t// Other code might assume the original image is last in the `srcset`]\n\tsrcSet.push(`${urlWithScaleDownTo(source, null)} ${image.pixelWidth}w`)\n\n\treturn srcSet.join(\", \") || undefined\n}\n\n// Examples: calculating scale-down-to for fixed-size images\n//\n// When image is smaller than node (needs upscaling):\n//   Image: 100\u00D7200, Node: 200\u00D7400 \u2192 Scale ratio = max(2, 2) = 2 \u2192 scale-down-to = 400\n//   Image: 100\u00D7200, Node: 400\u00D7200 \u2192 Scale ratio = max(4, 1) = 4 \u2192 scale-down-to = 800\n//   Image: 100\u00D7200, Node: 300\u00D7300 \u2192 Scale ratio = max(3, 1.5) = 3 \u2192 scale-down-to = 600\n//\n// When image is larger than node (needs downscaling):\n//   Image: 1000\u00D72000, Node: 200\u00D7400 \u2192 Scale ratio = max(0.2, 0.2) = 0.2 \u2192 scale-down-to = 400\n//   Image: 1000\u00D72000, Node: 400\u00D7200 \u2192 Scale ratio = max(0.4, 0.1) = 0.4 \u2192 scale-down-to = 800\n//\n// We need to use the maximum scale ratio to ensure the image covers the entire container.\n// This ensures no blurry edges when aspect ratios differ.\nfunction getFixedSrcSets(\n\tsource: string,\n\timage: BackgroundImage,\n\tnodeFixedSize: BackgroundImage[\"nodeFixedSize\"],\n): { src: string; scale: number }[] | undefined {\n\tif (!image.pixelWidth || !image.pixelHeight) return undefined\n\tif (!nodeFixedSize?.width || !nodeFixedSize?.height) return undefined\n\tconst srcSet: { src: string; scale: number }[] = []\n\n\tconst imageMaxSide = Math.max(image.pixelWidth, image.pixelHeight)\n\n\t// The node dimensions determine how much we will need to scale\n\t// Use the maximum scale ratio to ensure full coverage\n\tconst scaleRatio = Math.max(nodeFixedSize.width / image.pixelWidth, nodeFixedSize.height / image.pixelHeight)\n\n\tfor (const variant of FixedSizeScaleVariants) {\n\t\t// The intrinsic size is used for the scale-down-to param\n\t\tconst scaleMaxSideSizeTo = Math.round(imageMaxSide * variant * scaleRatio)\n\t\tconst url = urlWithScaleDownTo(source, scaleMaxSideSizeTo)\n\t\tsrcSet.push({\n\t\t\tsrc: url,\n\t\t\tscale: variant,\n\t\t})\n\t}\n\n\treturn srcSet\n}\n\nexport function getSrcSet(\n\tnodeFixedSize: BackgroundImage[\"nodeFixedSize\"],\n\timage: BackgroundImage,\n\tsource: string,\n): { src: string | undefined; srcSet: string | undefined } {\n\tif (![\"auto\", \"lossless\"].includes(image.preferredSize ?? \"\")) {\n\t\treturn { src: source, srcSet: undefined }\n\t}\n\tif (nodeFixedSize) {\n\t\tconst fixedSrcSets = getFixedSrcSets(source, image, nodeFixedSize)\n\t\tif (!fixedSrcSets?.length) return { src: source, srcSet: undefined }\n\n\t\tconst [x1, ...rest] = fixedSrcSets\n\t\treturn { src: x1?.src, srcSet: rest.map(({ src, scale }) => `${src} ${scale}x`).join(\", \") }\n\t} else {\n\t\tconst variants = getVariantsDimensions(image.pixelWidth, image.pixelHeight)\n\t\treturn { src: source, srcSet: getResponsiveSrcSet(source, image, variants) }\n\t}\n}\n", "import type { MotionStyle, MotionValue } from \"framer-motion\"\nimport { motion } from \"framer-motion\"\nimport type React from \"react\"\nimport { cornerPropertiesToInherit } from \"../utils/corners.ts\"\n\n/** @public */\nexport type BorderStyle = \"solid\" | \"dashed\" | \"dotted\" | \"double\"\n/** @internal */\nexport interface BorderComponentProps {\n\tborderWidth: number | Partial<{ top: number; bottom: number; left: number; right: number }>\n\tborderColor: string\n\tborderStyle: BorderStyle\n\tborder?: string | MotionValue<string>\n\tlayoutId?: string | undefined\n}\n/** @internal */\nexport function collectBorderStyleForProps(\n\tprops: Partial<BorderComponentProps>,\n\tstyle: React.CSSProperties,\n\tcollapseEqualBorders: boolean = true,\n) {\n\tconst { borderWidth, borderStyle, borderColor } = props\n\tif (!borderWidth) {\n\t\treturn\n\t}\n\tlet borderTop: number | undefined\n\tlet borderBottom: number | undefined\n\tlet borderLeft: number | undefined\n\tlet borderRight: number | undefined\n\tif (typeof borderWidth === \"number\") {\n\t\tborderTop = borderBottom = borderLeft = borderRight = borderWidth\n\t} else {\n\t\tborderTop = borderWidth.top || 0\n\t\tborderBottom = borderWidth.bottom || 0\n\t\tborderLeft = borderWidth.left || 0\n\t\tborderRight = borderWidth.right || 0\n\t}\n\tif (borderTop === 0 && borderBottom === 0 && borderLeft === 0 && borderRight === 0) {\n\t\treturn\n\t}\n\n\t// Equal border\n\tif (collapseEqualBorders && borderTop === borderBottom && borderTop === borderLeft && borderTop === borderRight) {\n\t\tstyle.border = `${borderTop}px ${borderStyle} ${borderColor}`\n\t\treturn\n\t}\n\n\tstyle.borderStyle = props.borderStyle\n\tstyle.borderColor = props.borderColor\n\tstyle.borderTopWidth = `${borderTop}px`\n\tstyle.borderBottomWidth = `${borderBottom}px`\n\tstyle.borderLeftWidth = `${borderLeft}px`\n\tstyle.borderRightWidth = `${borderRight}px`\n}\n\nexport function Border(props: Partial<BorderComponentProps>): JSX.Element | null {\n\tconst layoutId = props.layoutId ? `${props.layoutId}-border` : undefined\n\n\tif (!props.borderWidth) {\n\t\treturn null\n\t}\n\tconst style: React.CSSProperties = {\n\t\tposition: \"absolute\",\n\t\tleft: 0,\n\t\tright: 0,\n\t\ttop: 0,\n\t\tbottom: 0,\n\t\t...cornerPropertiesToInherit,\n\t\tpointerEvents: \"none\",\n\t}\n\n\tif (props.border) {\n\t\t;(style as MotionStyle).border = props.border\n\t\treturn <motion.div style={style} />\n\t}\n\n\tcollectBorderStyleForProps(props, style, false)\n\n\treturn <motion.div data-frame-border style={style} layoutId={layoutId} />\n}\n", "import type { AssetSize } from \"@framerjs/assets\"\nimport type { RelativeNumber } from \"./RelativeNumber.ts\"\n\n/** @public */\nexport type ImageFit = \"fill\" | \"fit\" | \"stretch\" | \"tile\"\n\n/** @public */\nexport interface BackgroundImage {\n\t// We set this to undefined to render a placeholder image.\n\tsrc: string | undefined\n\talt?: string\n\t/** @deprecated - only be present in code generated before ~Nov 2025; Image components generate `srcSet`s now */\n\tsrcSet?: string | undefined\n\tnodeFixedSize?: { width: number; height: number } | undefined\n\tpreferredSize?: AssetSize\n\tsizes?: string\n\tpixelWidth?: number\n\tpixelHeight?: number\n\tintrinsicWidth?: number\n\tintrinsicHeight?: number\n\tpositionX?: \"left\" | \"center\" | \"right\" | RelativeNumber\n\tpositionY?: \"top\" | \"center\" | \"bottom\" | RelativeNumber\n\tfit?: ImageFit\n\n\t// Used the scale the background when the ImageFit is set to \"tiled\"\n\tbackgroundSize?: number\n\tloading?: \"lazy\" | \"eager\"\n\t// As of Oct 2024, fetchPriority is not used anywhere by the codegen,\n\t// but we\u2019re supporting it because users have repeatedly asked for it.\n\t// We\u2019re also likely to use it in the future when https://github.com/framer/company/issues/29868 ships.\n\tfetchPriority?: \"high\" | \"low\"\n}\n\nconst key: keyof BackgroundImage = \"src\"\n\n/** @public */\nexport const BackgroundImage = {\n\tisImageObject: function (image: unknown): image is object & BackgroundImage {\n\t\tif (!image || typeof image === \"string\") return false\n\t\treturn typeof image === \"object\" && key in image\n\t},\n}\n\n/** @internal */\nexport type FitImageDimensionType = \"width\" | \"height\"\n", "import { Animatable } from \"../../animation/Animatable/Animatable.ts\"\nimport { isString } from \"../../utils/utils.ts\"\nimport type { LayerProps } from \"../presentation/Layer.tsx\"\nimport type { Background, BackgroundProperties, DeprecatedBackgroundProperties } from \"../traits/Background.ts\"\nimport { BackgroundImage } from \"../types/BackgroundImage.ts\"\n\nfunction applyForwardOverrides(\n\tbackground: BackgroundImage,\n\tprops: Partial<DeprecatedBackgroundProperties & LayerProps>,\n): BackgroundImage {\n\tconst { _forwardedOverrideId, _forwardedOverrides, id } = props\n\tconst forwardedOverrideId = _forwardedOverrideId ?? id\n\tconst src = _forwardedOverrides && forwardedOverrideId ? _forwardedOverrides[forwardedOverrideId] : undefined\n\tif (src && typeof src === \"string\") {\n\t\tbackground = { ...background, src }\n\t}\n\treturn background\n}\n\n/** @internal */\nexport function backgroundImageFromProps(\n\tprops: Partial<DeprecatedBackgroundProperties & BackgroundProperties>,\n): BackgroundImage | undefined {\n\tconst { background, image } = props\n\tif (image !== undefined && background && !BackgroundImage.isImageObject(background)) {\n\t\t// Give precedence to background prop that is not set to an image\n\t\treturn\n\t}\n\tlet backgroundImage: Background | null = null\n\n\tif (isString(image)) {\n\t\tbackgroundImage = { alt: \"\", src: image }\n\t} else {\n\t\tbackgroundImage = Animatable.get(background, null)\n\t}\n\tif (!BackgroundImage.isImageObject(backgroundImage)) {\n\t\treturn\n\t}\n\treturn applyForwardOverrides(backgroundImage, props)\n}\n", "import type { BackgroundImage } from \"../types/BackgroundImage.ts\"\n\nexport function getIntrinsicSizeForBackgroundImage(background: BackgroundImage | undefined) {\n\tif (!background) return undefined\n\n\tif (background.pixelHeight && background.pixelWidth) {\n\t\treturn { width: background.pixelWidth, height: background.pixelHeight }\n\t}\n\n\t// If there is no src then the image will fallback to a placeholder so we provide a default to avoid layout collapse\n\tif (background.src === undefined) return { width: 1, height: 1 }\n\n\t// Should fallback to measuring the image size\n\treturn undefined\n}\n", "import { motion } from \"framer-motion\"\n\n/** Get a motion component based on a HTML element name, if undefined it will default to motion.div */\nexport function htmlElementAsMotionComponent(asElem: undefined | keyof HTMLElementTagNameMap | \"svg\") {\n\t// Filter out new elements defined in HTMLElementTagNameMap, but not known to Motion/React yet\n\treturn asElem && asElem !== \"search\" && asElem !== \"slot\" && asElem !== \"template\"\n\t\t? (motion[asElem] as (typeof motion)[\"div\"])\n\t\t: motion[\"div\"]\n}\n", "import * as environment from \"@framerjs/shared/src/environment.ts\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\n\nconst isChrome = /* @__PURE__ */ environment.isChrome()\n\ninterface LayoutHintDataProps {\n\t\"data-framer-layout-hint-center-x\"?: boolean\n\t\"data-framer-layout-hint-center-y\"?: boolean\n}\n\nexport function collectLayoutHintDataProps(props: LayoutHintDataProps, center: boolean | \"x\" | \"y\" | undefined) {\n\tprops[\"data-framer-layout-hint-center-x\"] = center === true || center === \"x\" ? true : undefined\n\tprops[\"data-framer-layout-hint-center-y\"] = center === true || center === \"y\" ? true : undefined\n}\n\n/**\n * Returns a set of layout hint data props, which will be used to correctly\n * infer the correct translation offset when measuring DOM nodes in Chrome.\n *\n * Important: To be used ONLY when a transform template is set. Transform\n * templates use a -50% translation to center elements. When measuring DOM\n * nodes, we use the resulting computed style transform to differentiate between\n * a translation (transform) offset and a position (layout) offset. When\n * reporting the -50% value in the resulting transform matrix, Chrome will\n * report the 50% as based on the _painted_ rect of the element, but will\n * actually use the actual computed width, which might not be the same as the\n * painted width, when determining where to paint the element. To get to the\n * \"real\" offset, we use the layout hints to tell the measuring code that it\n * should just throw away the information reported in the transform matrix and\n * make its own calculation based on the computed size.\n *\n * This function has no effect outside of Chrome or the Canvas RenderTarget.\n *\n * @internal\n * @param center\n */\n\nexport function layoutHintDataPropsForCenter(center: boolean | \"x\" | \"y\" | undefined) {\n\tconst props: LayoutHintDataProps = {}\n\n\tif (!center || !isChrome || RenderTarget.current() !== RenderTarget.canvas) {\n\t\treturn props\n\t}\n\n\tcollectLayoutHintDataProps(props, center)\n\n\treturn props\n}\n", "/** Copy of nodeIDFromString() in Vekter NodeID.ts module */\nexport function nodeIdFromString(str: string): string {\n\treturn str.replace(/^id_/u, \"\").replace(/\\\\/gu, \"\")\n}\n", "import { asRecord } from \"../../utils/asRecord.ts\"\nimport { safeWindow } from \"../../utils/safeWindow.ts\"\n\nexport function countNodeRender() {\n\tif (process.env.NODE_ENV === \"production\") return\n\tconst perf = asRecord(safeWindow)[\"perf\"]\n\tif (!perf) return\n\t;(perf as any).nodeRender()\n}\n", "import React from \"react\"\n\n/**\n * Modifies children to forward overrides of design components to their childern.\n */\ninterface ProcessOverrideForwardingReturnType {\n\tprops: any\n\tchildren: React.ReactNode | undefined\n}\n\nexport function processOverrideForwarding(props: any, children?: React.ReactNode): ProcessOverrideForwardingReturnType {\n\tif (!children) {\n\t\tchildren = props.children\n\t\tif (!children) return { props, children }\n\t}\n\n\tconst _forwardedOverrides: { [key: string]: any } | undefined = props._forwardedOverrides\n\n\tif (!_forwardedOverrides) return { props, children }\n\n\tchildren = React.Children.map(children, (child: React.ReactNode) => {\n\t\tif (!React.isValidElement(child)) return child\n\t\treturn React.cloneElement(child as any, { _forwardedOverrides })\n\t})\n\n\treturn { props, children }\n}\n", "/** @public */\nexport function transformTemplate(center?: boolean | \"x\" | \"y\") {\n\treturn (_: any, generated: string) => {\n\t\tif (center === true) {\n\t\t\treturn `translate(-50%, -50%) ${generated}`\n\t\t} else {\n\t\t\tif (center === \"x\") {\n\t\t\t\treturn `translateX(-50%) ${generated}`\n\t\t\t} else if (center === \"y\") {\n\t\t\t\treturn `translateY(-50%) ${generated}`\n\t\t\t}\n\t\t}\n\t\treturn generated || \"none\"\n\t}\n}\n", "import type { MotionProps } from \"framer-motion\"\nimport { useContext, useMemo } from \"react\"\nimport { LayoutIdContext } from \"../../components/AnimateLayout/LayoutIdContext.tsx\"\n\ninterface UseMagicMotionProps {\n\tlayoutId?: string\n\t/**\n\t * An id to use as the basis of generated layout ids. This will usually be\n\t * the node id. If a layoutIdKey is not provided we will not attempt to\n\t * generate a layoutId.\n\t */\n\tlayoutIdKey?: string\n\tname?: string\n\tduplicatedFrom?: string[]\n\t__fromCodeComponentNode?: boolean\n\tdrag?: MotionProps[\"drag\"]\n}\n\n/**\n * @internal\n */\nexport function useLayoutId(\n\tprops: UseMagicMotionProps,\n\t{ specificLayoutId, postfix }: { specificLayoutId?: string; postfix?: string } = {},\n): string | undefined {\n\tconst { name, layoutIdKey, duplicatedFrom, __fromCodeComponentNode = false, drag } = props\n\tconst { getLayoutId, enabled } = useContext(LayoutIdContext)\n\n\treturn useMemo<string | undefined>(() => {\n\t\t// If automatic layoutId's are disabled, but a Frame is used in code, and provides a layoutId, always use it.\n\t\tif (!enabled) return props.layoutId\n\n\t\tconst existingLayoutId = specificLayoutId || props.layoutId\n\n\t\t// If no existing layoutId is provided, we do not generate a layoutId if:\n\t\t// - No id is provided (a requirement for generating layoutIds)\n\t\t// - The layer is not draggable, because magic motion and dragging are not supported (drag)\n\t\t// - The layer should not be animated with magic motion (layoutIdKey)\n\t\t// - The layer is the direct child of a ComponentContainer (Scroll/Page should always use specificLayoutId)\n\t\tif (!existingLayoutId) {\n\t\t\tif (drag || !layoutIdKey || __fromCodeComponentNode) return undefined\n\t\t}\n\n\t\t// If provided, use an existing layoutId, otherwise generate one with the LayoutIdContext.\n\t\tconst layoutIdCandidate = existingLayoutId || getLayoutId({ id: layoutIdKey, name, duplicatedFrom })\n\n\t\t// If for some reason we can't generate a layoutId, don't provide a layoutId.\n\t\tif (!layoutIdCandidate) return undefined\n\n\t\t// If we have provided a postfix, postfix whatever layoutId we've decided to use with the string, and return it.\n\t\treturn postfix ? `${layoutIdCandidate}-${postfix}` : layoutIdCandidate\n\t}, [enabled]) // Must return a stable value as layoutIds must be stable between all renders.\n}\n", "import type { RefObject } from \"react\"\nimport { useContext } from \"react\"\nimport { useIsomorphicLayoutEffect } from \"../../useIsomorphicLayoutEffect.ts\"\nimport { runtime } from \"../../utils/runtimeInjection.ts\"\nimport { ComponentContainerContext } from \"../presentation/ComponentContainerContext.tsx\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport { getMeasurableCodeComponentChildren } from \"./getMeasurableCodeComponentChildren.ts\"\nimport { nodeIdFromString } from \"./nodeIdFromString.ts\"\n\n// Returns all children that need to be considered for layout measurements of\n// this node. This is usually used to skip over invisible, or border elements\n// since they don't contribute to the layout of the node. Elements returned from\n// this function will also be used in calculating the content size for \"Fit Content\".\ntype GetChildrenFn = (element: Element) => Element[]\n\n/**\n * Adds the element and its children to the layout measure queue\n *\n * @internal\n */\nexport function useMeasureLayout(\n\tprops: { id?: string; visible?: boolean; _needsMeasure?: boolean },\n\tref: RefObject<Element | null>,\n\tgetChildren: GetChildrenFn = () => [],\n\toptions: { skipHook?: boolean } = {},\n) {\n\tconst { id, visible, _needsMeasure } = props\n\tconst { skipHook = false } = options\n\tconst inCodeComponent = useContext(ComponentContainerContext)\n\tconst onCanvas = RenderTarget.current() === RenderTarget.canvas\n\n\tuseIsomorphicLayoutEffect(() => {\n\t\t// must be on the canvas, not in a code component, and must not be\n\t\t// explicitly skipped through skipHook\n\t\tif (!onCanvas || inCodeComponent || skipHook) {\n\t\t\treturn\n\t\t}\n\n\t\t// must have a valid ref, id, be visible and need measure\n\t\tif (!(ref.current && id && visible && _needsMeasure)) {\n\t\t\treturn\n\t\t}\n\n\t\truntime.queueMeasureRequest(nodeIdFromString(id), ref.current, getChildren(ref.current))\n\t})\n}\n\n/**\n * Attempts to find the closest component container ancestor to a reference\n * element, and add a layout measure request for it. Used when an element inside\n * a code component has caused a layout shift outside of the normal render loop\n * (such as when fonts load), and needs to trigger a re-measure of its container.\n *\n * @param element\n * @internal\n */\nexport function measureClosestComponentContainer(element: Element) {\n\tconst container = element.closest(\"[data-framer-component-container]\")\n\tif (!container) return\n\n\truntime.queueMeasureRequest(nodeIdFromString(container.id), container, getMeasurableCodeComponentChildren(container))\n}\n", "import { useEffect, useLayoutEffect } from \"react\"\n\n/**\n * Swaps `useLayoutEffect` for `useEffect` on the server to avoid React warnings.\n * NOTE! The effect won't run on the server.\n */\nexport const useIsomorphicLayoutEffect = typeof document !== \"undefined\" ? useLayoutEffect : useEffect\n", "import React from \"react\"\n\n/**\n * React context used to determine if we're inside a code component.\n * @internal\n */\nexport const ComponentContainerContext = /* @__PURE__ */ React.createContext(false)\n", "import { isBrowser } from \"@framerjs/shared/src/environment.ts\"\nimport React, { useEffect } from \"react\"\nimport { useForceUpdate } from \"../../modules/useForceUpdate.ts\"\nimport type { Size } from \"../../render/types/Size.ts\"\nimport { useIsomorphicLayoutEffect } from \"../../useIsomorphicLayoutEffect.ts\"\n\nconst DEFAULT_SIZE = 200\n\ntype ObserverCallback = (size: Size) => void\nclass SharedObserver {\n\t// Note: we don\u2019t want to use #-style private fields here because (as of esbuild 0.17)\n\t// they leave non-tree-shakeable symbols in the bundle: https://framer-team.slack.com/archives/C05V49Q4NJ2/p1715653184830179\n\tprivate sharedResizeObserver\n\tprivate callbacks = new WeakMap<Element, ObserverCallback>()\n\n\tconstructor() {\n\t\tthis.sharedResizeObserver = new ResizeObserver(this.updateResizedElements.bind(this))\n\t}\n\n\tprivate updateResizedElements(entries: ResizeObserverEntry[]) {\n\t\tfor (const entry of entries) {\n\t\t\tconst callbackForElement = this.callbacks.get(entry.target)\n\t\t\tif (callbackForElement) callbackForElement(entry.contentRect)\n\t\t}\n\t}\n\n\tobserveElementWithCallback(element: Element, callback: ObserverCallback) {\n\t\tthis.sharedResizeObserver.observe(element)\n\t\tthis.callbacks.set(element, callback)\n\t}\n\n\tunobserve(element: Element) {\n\t\tthis.sharedResizeObserver.unobserve(element)\n\t\tthis.callbacks.delete(element)\n\t}\n}\n\nconst sharedResizeObserver = /* @__PURE__ */ (() => (isBrowser() ? new SharedObserver() : undefined))()\n\nexport function useRerenderOnResize(ref: React.RefObject<Element> | undefined): void {\n\tconst update = useForceUpdate()\n\n\tuseEffect(() => {\n\t\tconst element = ref?.current\n\t\tif (!element) return\n\t\tsharedResizeObserver?.observeElementWithCallback(ref.current, update)\n\n\t\treturn () => {\n\t\t\tsharedResizeObserver?.unobserve(element)\n\t\t}\n\t}, [ref, update])\n}\n\n/**\n * Uses a globally shared resize observer, and returns an updated\n * size object when the element's size changes. This is the recommended way to\n * use a Resize Observer: https://github.com/WICG/resize-observer/issues/59.\n * @deprecated only used in the deprecated `withMeasuredSize` HoC\n */\nfunction useMeasuredSize(ref: React.MutableRefObject<HTMLDivElement | null>) {\n\tconst forceUpdate = useForceUpdate()\n\tconst size = React.useRef<Size | null>(null)\n\n\tfunction updateSize(newSize: Size) {\n\t\t// Ignore 0 entries, usually indicative of an element that is hidden, or\n\t\t// nested inside a hidden element. This is common on the canvas where\n\t\t// elements out of the viewport will be contained in an element with\n\t\t// `display: none`. We could technically check the bounding client rect\n\t\t// to make sure the element isn't visible, but that would force a style\n\t\t// recalc and negate any performance benefits of skipping the update\n\t\tif (newSize.width === 0 && newSize.height === 0) return\n\n\t\tif (!size.current || newSize.height !== size.current.height || newSize.width !== size.current.width) {\n\t\t\tsize.current = { width: newSize.width, height: newSize.height }\n\t\t\t// This may need startTransition to avoid synchronous, blocking re-renders.\n\t\t\t// However, this hook is deprecated. Let's not modify the behavior.\n\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition -- deprecated hook\n\t\t\tforceUpdate()\n\t\t}\n\t}\n\n\t// On mount, immediately measure and set a size. This will defer paint until\n\t// no more updates are scheduled. Additionally add our element to the shared\n\t// ResizeObserver with a callback to perform when the element resizes.\n\t// Finally, remove the element from the observer when the component is unmounted.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: has always been this way\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (!ref.current) return\n\t\tconst { offsetWidth, offsetHeight } = ref.current\n\n\t\t// Defer paint until initial size is added.\n\t\tupdateSize({\n\t\t\twidth: offsetWidth,\n\t\t\theight: offsetHeight,\n\t\t})\n\n\t\t// Resize observer will race to add the initial size, but since the size\n\t\t// is set above, it won't trigger a render on mount since it should\n\t\t// match the measured size. Future executions of the callback will\n\t\t// trigger renders if the size changes.\n\t\t// biome-ignore lint/style/noNonNullAssertion: we know it exists\n\t\tsharedResizeObserver!.observeElementWithCallback(ref.current, updateSize)\n\n\t\treturn () => {\n\t\t\tif (!ref.current) return\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: we know it exists\n\t\t\tsharedResizeObserver!.unobserve(ref.current)\n\t\t}\n\t}, [])\n\n\treturn size.current\n}\n\n/**\n * @internal\n */\nexport const SIZE_COMPATIBILITY_WRAPPER_ATTRIBUTE = \"data-framer-size-compatibility-wrapper\"\n\ninterface OptionalSizeProps {\n\twidth?: number | string\n\theight?: number | string\n}\n\n/**\n * A HoC to enhance code components that depend on being rendered with exact\n * width and height props with width and height props determined via a shared\n * ResizeObserver.\n *\n * @FIXME Do not depend on this HoC. The current plan is to turn it into a no-op\n * after a deprecation period. If we need to provide this functionality to\n * customers after we migrate to a modules-first ecosystem, then we can provide\n * a new copy of this HoC or the `useMeasuredSize` hook, and recommend use\n * without a module version, allowing everyone to share the same ResizeObserver\n * on a single canvas.\n *\n * @internal\n */\nexport const withMeasuredSize =\n\t<T extends OptionalSizeProps>(Component: React.ComponentType<T>) =>\n\t(props: T) => {\n\t\tconst ref = React.useRef<HTMLDivElement>(null)\n\t\tconst size = useMeasuredSize(ref)\n\t\tconst dataProps = { [SIZE_COMPATIBILITY_WRAPPER_ATTRIBUTE]: true }\n\n\t\t// The initial render will be delayed until the measured size is available.\n\t\tconst shouldRender = Boolean(size)\n\n\t\t// In the export case, we'll sometimes be provided with explicit width and\n\t\t// height to use as fallback. This is a temporary measure and will only\n\t\t// happen when the used width / height is a fixed number. This code should\n\t\t// be removed once we're no longer using `renderToStaticMarkup` for export.\n\t\tconst fallbackWidth = props.width ?? DEFAULT_SIZE\n\t\tconst fallbackHeight = props.height ?? DEFAULT_SIZE\n\n\t\treturn (\n\t\t\t<div style={{ width: \"100%\", height: \"100%\", pointerEvents: \"none\" }} ref={ref} {...dataProps}>\n\t\t\t\t{shouldRender && (\n\t\t\t\t\t<Component {...props} width={size?.width ?? fallbackWidth} height={size?.height ?? fallbackHeight} />\n\t\t\t\t)}\n\t\t\t</div>\n\t\t)\n\t}\n", "import React from \"react\"\n\n/**\n * @public\n */\nexport function useForceUpdate() {\n\tconst [_, setForcedRenderCount] = React.useState(0)\n\n\t// startTransition is disabled here because usage of `useForceUpdate`\n\t// without startTransition Is linted independently.\n\t// eslint-disable-next-line framer-studio/no-setstate-without-transition\n\treturn React.useCallback(() => setForcedRenderCount(v => v + 1), [])\n}\n", "import { SIZE_COMPATIBILITY_WRAPPER_ATTRIBUTE } from \"../../components/hoc/withMeasuredSize.tsx\"\n\n/**\n * @internal\n *\n * Returns a plain array of references to all children, which should be\n * considered for content size calculations on this node (e.g. when running \"Fit\n * Content\" on it)\n *\n * @param element the element of the component container\n */\nexport function getMeasurableCodeComponentChildren(element: Element) {\n\t// Skip over withMeasuredSize compatibility wrapper\n\tconst childrenCollection =\n\t\telement.firstElementChild && element.firstElementChild.hasAttribute(SIZE_COMPATIBILITY_WRAPPER_ATTRIBUTE)\n\t\t\t? element.firstElementChild.children\n\t\t\t: element.children\n\n\treturn [...childrenCollection].filter(isMeasurable).map(unwrapInlinedDisplayContents)\n}\n\n/**\n * Rough check if an element of a HTMLCollection has measurable layout (can be\n * rendered as anything other than \"display: none\") _without_ querying its\n * computed styles, because we want to avoid a style recalculation penalty.\n *\n * @param element an HTMLCollection node\n */\n\nfunction isMeasurable(element: Node) {\n\t// Filter out certain HTMLElement subclasses that don't represent measurable elements\n\tif (\n\t\telement instanceof HTMLBaseElement ||\n\t\telement instanceof HTMLHeadElement ||\n\t\telement instanceof HTMLLinkElement ||\n\t\telement instanceof HTMLMetaElement ||\n\t\telement instanceof HTMLScriptElement ||\n\t\telement instanceof HTMLStyleElement ||\n\t\telement instanceof HTMLTitleElement\n\t) {\n\t\treturn false\n\t}\n\n\treturn element instanceof HTMLElement || element instanceof SVGElement\n}\n\n/**\n * Checks if an element has \"display: contents\" in its inline styles, and if\n * yes, returns the first measurable descendant. We intentionally _only_ check\n * the inlined display style, because reading it should not cause a style recalc\n * and it covers the use cases we have right now - wrapper divs around smart\n * components.\n *\n * @param element\n * @returns\n */\n\nfunction unwrapInlinedDisplayContents(element: Element): Element {\n\tif (!(element instanceof HTMLElement)) return element\n\tif (element.children.length === 0) return element\n\tif (element.style.display !== \"contents\") return element\n\n\tconst firstMeasurableChild = [...element.children].find(isMeasurable)\n\tif (firstMeasurableChild) {\n\t\treturn unwrapInlinedDisplayContents(firstMeasurableChild)\n\t}\n\n\treturn element\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport type React from \"react\"\nimport type { ReactNode } from \"react\"\nimport { Component } from \"react\"\nimport { asRecord } from \"../../utils/asRecord.ts\"\nimport type { Rect } from \"../types/Rect.ts\"\nimport { isEqual } from \"../utils/isEqual.ts\"\nimport { forceLayerBackingWithCSSProperties, forceLayerBackingWithMotionStyle } from \"../utils/setLayerBacked.ts\"\nimport { resetSetStyle } from \"../utils/useWebkitFixes.ts\"\n\n/** @public */\nexport interface IdentityProps {\n\t/** An unique id for the layer */\n\tid?: string\n\tduplicatedFrom?: string[]\n}\n\nexport interface WillChangeTransformProp {\n\t/** @deprecated */\n\twillChangeTransform?: boolean\n}\n\n/** @public */\nexport interface DOMLayoutProps {\n\t/** @internal */\n\t_needsMeasure?: boolean\n\t/** @internal */\n\t_usesDOMRect?: boolean\n\t/** @internal */\n\t_domRect?: Rect | null\n}\n\n/** @public */\nexport interface LayerProps extends IdentityProps, WillChangeTransformProp, DOMLayoutProps {\n\tchildren?: ReactNode\n\tkey?: React.Attributes[\"key\"]\n\t/**\n\t * @internal a stable identifier to use when generating layoutIds based on\n\t * duplicatedFrom.\n\t */\n\tlayoutIdKey?: string\n\t/**\n\t * @internal the prefixed node id, used for the forwarded overrides look up\n\t */\n\t_forwardedOverrideId?: string\n\t/** @internal */\n\t_forwardedOverrides?: { [key: string]: unknown }\n\t/** @internal */\n\t_index?: number\n\t/** @internal */\n}\n\n// Confused how two definitions with the same name work? See https://stackoverflow.com/a/67697999\n// Note that `Layer` in `InstanceType<typeof Layer>` refers to the constant, not the type.\n/** @public */\nexport type Layer = InstanceType<typeof Layer>\n/** @public */\nexport const Layer = /* @__PURE__ */ (() => {\n\t// We\u2019re wrapping the whole Layer class with `@__PURE__` because esbuild\n\t// can\u2019t compile static class properties in a tree-shakeable way: https://github.com/evanw/esbuild/issues/3765.\n\t// The wrapper allows them to stay in the IIFE and be tree-shaken.\n\t// If/when esbuild fixes that issue, we can remove `export type Layer`\n\t// and `export const Layer` and just export the class directly.\n\tclass Layer<P extends Partial<LayerProps>, S> extends Component<P, S> {\n\t\tstatic readonly defaultProps: LayerProps = {}\n\n\t\tstatic applyWillChange(props: WillChangeTransformProp, style: MotionStyle, usingMotionStyle: boolean) {\n\t\t\tif (props.willChangeTransform) {\n\t\t\t\tif (usingMotionStyle) {\n\t\t\t\t\tforceLayerBackingWithMotionStyle(style)\n\t\t\t\t} else {\n\t\t\t\t\tforceLayerBackingWithCSSProperties(style)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/** @private (Just using `private` breaks compilation unless using `stripInternal`) */\n\t\tlayerElement: HTMLElement | SVGElement | null = null\n\n\t\tsetLayerElement = (element: HTMLElement | SVGElement | null) => {\n\t\t\tthis.layerElement = element\n\t\t}\n\n\t\t/** @internal */\n\t\toverride shouldComponentUpdate(nextProps: P, nextState: S) {\n\t\t\treturn nextProps._needsMeasure || this.state !== nextState || !isEqual(this.props, nextProps)\n\t\t}\n\n\t\t/** @internal */\n\t\toverride componentDidUpdate(prevProps: P) {\n\t\t\t// Workarounds for WebKit bugs\n\n\t\t\t// Some styles have to be toggled to take effect in certain situations.\n\t\t\t// Not using type safety, uses lots of internal knowledge for efficiency\n\t\t\t// To use this as a hook, see useWebKitFixes\n\n\t\t\tif (asRecord(this.props)[\"clip\"] && asRecord(this.props)[\"radius\"] === 0 && asRecord(prevProps)[\"radius\"] !== 0) {\n\t\t\t\tresetSetStyle(this.layerElement, \"overflow\", \"hidden\", false)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Layer\n})()\n", "import { isFramerX, isSafari, isTest } from \"@framerjs/shared/src/environment.ts\"\nimport type { MotionStyle } from \"framer-motion\"\nimport type { CSSProperties } from \"react\"\nimport { isString } from \"../../utils/utils.ts\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\n\n/**\n * This file contains a bunch of helpers to force browser to render elements\n * with layer backing (GPU accelleration)\n */\n\n/**\n * The string in this smallValue is very specifically \"0.000001px\".\n *\n * - Safari before Catalina will change 1e-7 into 0.0000001px\n * - Safari in Catalina will change 0.0000001px into 1e-7\n *\n * So this value should be \"0.000001px\" (1e-6) and not smaller, because\n * otherwise it will break the string replacement for removing the translateZ\n * hack.\n */\nconst smallValue = \"0.000001px\"\nexport const translateZ = /* @__PURE__ */ (() => ` translateZ(${smallValue})`)()\n// We only apply this hack on the canvas and in Safari or FramerX\nconst useTranslateZHack = /* @__PURE__ */ (() => isFramerX() || isSafari() || isTest())()\n\n/**\n * Forces layer backing during rendering with a motion style\n */\nexport function forceLayerBackingWithMotionStyle(motionStyle: MotionStyle): void {\n\t// This forces 3d acceleration on Chrome\n\tmotionStyle.willChange = \"transform\"\n\n\t// We only want to use the translateZ hack on the canvas\n\tconst onCanvas = RenderTarget.current() === RenderTarget.canvas\n\n\tif (useTranslateZHack && onCanvas) {\n\t\tmotionStyle.translateZ = smallValue\n\t}\n}\n\n/**\n * Forces layer backing during rendering with React's CSS properties\n *\n * @internal\n */\nexport function forceLayerBackingWithCSSProperties(cssProperties: CSSProperties | MotionStyle) {\n\t// This forces 3d acceleration on Chrome\n\tcssProperties.willChange = \"transform\"\n\tsetTranslateZHack(cssProperties, true)\n}\n\n/**\n * Forces layer backing by changing the style of an HTML Element that is already\n * rendered to the DOM\n * @param element The HTML element to force the layer backing on\n * @param enabled Whether to enable forced layer backing. If `true` the styles\n * will be modified to force layer backing. If `false` those styles will be\n * removed from the element\n */\nexport function forceLayerBackingOnElement(element: HTMLElement, enabled: boolean) {\n\tif (enabled) {\n\t\tconst willChange = element.style.willChange || \"\"\n\t\tif (willChange !== \"transform\") {\n\t\t\t// This forces 3d acceleration on Chrome\n\t\t\telement.style.willChange = \"transform\"\n\t\t}\n\t} else {\n\t\telement.style.removeProperty(\"will-change\")\n\t}\n\tsetTranslateZHack(element.style, enabled)\n}\n\n/**\n * Within Safari we can force gpu layers (avoid dumping them) by adding a small\n * translateZ value:\n * https://github.com/WebKit/webkit/blob/6ddbf54e861f9df5e0171422c32cc6173120f717/LayoutTests/compositing/layer-creation/compositing-policy.html#L23\n * So to prevent this memory heuristic to trigger, we also rig those layers with\n * a tiny translateZ property.\n */\n\nfunction setTranslateZHack(style: CSSStyleDeclaration | CSSProperties | MotionStyle, enabled: boolean) {\n\tconst onCanvas = RenderTarget.current() === RenderTarget.canvas\n\tif (!useTranslateZHack || !onCanvas) {\n\t\t// We only want to use the translateZ hack in Safari and FramerX on the canvas\n\t\treturn\n\t}\n\tconst transform = isString(style.transform) ? style.transform || \"\" : \"\"\n\tif (enabled) {\n\t\tconst hasTranslateZ = transform.includes(translateZ)\n\t\tif (!hasTranslateZ) {\n\t\t\tstyle.transform = transform + translateZ\n\t\t}\n\t} else {\n\t\tstyle.transform = transform.replace(translateZ, \"\")\n\t}\n}\n", "import { asRecord } from \"../../utils/asRecord.ts\"\nimport { isNull, isNumber, isString } from \"../../utils/utils.ts\"\n\n/** @internal */\nexport function resetSetStyle(\n\telement: HTMLElement | SVGElement | null,\n\tkey: string,\n\ttoValue: unknown,\n\tmicrotask: boolean = true,\n) {\n\tif (!element) {\n\t\treturn\n\t}\n\n\tconst style = asRecord(element.style)\n\tconst value = toValue ? toValue : style[key]\n\tconst reset = () => {\n\t\tif (!isValidCSSStyleValue(value)) return\n\t\tstyle[key] = value\n\t}\n\tstyle[key] = null\n\tif (microtask) {\n\t\tvoid Promise.resolve().then(reset)\n\t} else {\n\t\tsetTimeout(reset, 0)\n\t}\n}\n\nfunction isValidCSSStyleValue(value: unknown): value is string | number | null {\n\treturn isString(value) || isNumber(value) || isNull(value)\n}\n", "function manageCache(cache: Map<any, any>, maxEntries: number) {\n\tconst size = cache.size\n\tif (size < maxEntries) return\n\n\t// randomly start at 0 or 1, delete every other key in a fast way\n\tlet i = Math.round(Math.random())\n\tfor (const key of cache.keys()) {\n\t\tif ((++i & 0x1) === 0x1) continue\n\t\tcache.delete(key)\n\t}\n}\n\n// cache a mapping of arguments to created values in an automatically managed cache\n/** @internal */\nexport function memoize<K, V>(maxEntries: number, cache: Map<K, V>, key: K, create: (key: K) => V) {\n\tconst r = cache.get(key)\n\tif (r) return r\n\n\tmanageCache(cache, maxEntries)\n\tconst g = create(key)\n\tcache.set(key, g)\n\treturn g\n}\n", "// https://stackoverflow.com/a/7616484\nexport const hash = (value: string) => {\n\tlet hasher = 0,\n\t\ti,\n\t\tchr\n\tif (value.length === 0) return hasher\n\tfor (i = 0; i < value.length; i++) {\n\t\tchr = value.charCodeAt(i)\n\t\thasher = (hasher << 5) - hasher + chr\n\t\thasher |= 0 // Convert to 32bit integer\n\t}\n\treturn hasher\n}\n", "import { Color } from \"./Color.ts\"\nimport { hsvToStr, stringToObject } from \"./converters.ts\"\nimport type { ColorHSL, ColorHSLA, ColorHSV, ColorHSVA, ColorRGB, ColorRGBA } from \"./types.ts\"\n\n/**\n * @internal\n */\nexport const ConvertColor = {\n\thueRotate: (color: string, angle: number) => {\n\t\treturn Color.toHslString(Color.hueRotate(Color(color), angle))\n\t},\n\n\tsetAlpha: (color: string, alpha: number) => {\n\t\treturn Color.toRgbString(Color.alpha(Color(color), alpha))\n\t},\n\n\tgetAlpha: (color: string) => {\n\t\tconst obj = stringToObject(color)\n\t\treturn obj ? obj.a : 1\n\t},\n\n\tmultiplyAlpha: (color: string, alpha: number) => {\n\t\treturn Color.toRgbString(Color.multiplyAlpha(Color(color), alpha))\n\t},\n\n\t/**\n\t * @internal\n\t */\n\ttoHexValue: (color: string) => {\n\t\treturn Color.toHex(Color(color)).toUpperCase()\n\t},\n\n\ttoHex: (color: string) => {\n\t\treturn Color.toHexString(Color(color)).toUpperCase()\n\t},\n\n\ttoRgb: (color: string) => {\n\t\treturn Color.toRgb(Color(color))\n\t},\n\n\ttoRgbString: (color: string) => {\n\t\treturn Color.toRgbString(Color(color))\n\t},\n\n\ttoHSV: (color: string) => {\n\t\treturn Color.toHsv(Color(color))\n\t},\n\n\ttoHSL: (color: string): ColorHSLA => {\n\t\treturn Color.toHsl(Color(color))\n\t},\n\n\ttoHslString: (color: string) => {\n\t\treturn Color.toHslString(Color(color))\n\t},\n\n\ttoHsvString: (color: string) => {\n\t\treturn Color.toHsvString(Color(color))\n\t},\n\n\thsvToHSLString: (hsv: ColorHSV | ColorHSVA): string => {\n\t\treturn Color.toHslString(Color(hsvToStr(hsv.h, hsv.s, hsv.v, (hsv as ColorHSVA).a)))\n\t},\n\n\t/**\n\t * @internal\n\t */\n\thsvToHexValue: (hsv: ColorHSV | ColorHSVA): string => {\n\t\treturn Color.toHex(Color(hsvToStr(hsv.h, hsv.s, hsv.v, (hsv as ColorHSVA).a))).toUpperCase()\n\t},\n\n\thsvToHex: (hsv: ColorHSV | ColorHSVA): string => {\n\t\treturn Color.toHexString(Color(hsvToStr(hsv.h, hsv.s, hsv.v, (hsv as ColorHSVA).a))).toUpperCase()\n\t},\n\n\thsvToRgbString: (hsv: ColorHSV | ColorHSVA): string => {\n\t\treturn Color.toRgbString(Color(hsvToStr(hsv.h, hsv.s, hsv.v, (hsv as ColorHSVA).a)))\n\t},\n\n\thsvToString: (hsv: ColorHSV | ColorHSVA): string => {\n\t\treturn hsvToStr(hsv.h, hsv.s, hsv.v)\n\t},\n\n\trgbaToString: (color: ColorRGB | ColorRGBA) => {\n\t\treturn Color.toRgbString(Color(color))\n\t},\n\n\t/**\n\t * @internal\n\t */\n\trgbToHexValue: (color: ColorRGB | ColorRGBA) => {\n\t\treturn Color.toHex(Color(color))\n\t},\n\n\trgbToHexString: (color: ColorRGB | ColorRGBA) => {\n\t\treturn Color.toHexString(Color(color))\n\t},\n\n\thslToString: (color: ColorHSL | ColorHSLA) => {\n\t\treturn Color.toHslString(Color(color))\n\t},\n\n\thslToRgbString: (color: ColorHSL | ColorHSLA) => {\n\t\treturn Color.toRgbString(Color(color))\n\t},\n\n\ttoColorPickerSquare: (h: number) => {\n\t\treturn Color.toRgbString(Color({ h, s: 1, l: 0.5, a: 1 }))\n\t},\n\n\tisValid: (color: string): boolean => {\n\t\treturn Color(color).isValid !== false\n\t},\n\n\tequals: (a: Color | string, b: Color | string): boolean => {\n\t\t// P3 Color strings are directly comparable without conversion.\n\t\tif (Color.isP3String(a) || Color.isP3String(b)) return a === b\n\n\t\tif (typeof a === \"string\") {\n\t\t\ta = Color(a)\n\t\t}\n\t\tif (typeof b === \"string\") {\n\t\t\tb = Color(b)\n\t\t}\n\t\treturn Color.equal(a, b)\n\t},\n\n\ttoHexOrRgbaString: (input: string) => {\n\t\tconst color = Color(input)\n\t\treturn color.a !== 1 ? Color.toRgbString(color) : Color.toHexString(color)\n\t},\n\n\t/**\n\t * Converts a color to a string to consistent formats for animating.\n\t */\n\ttoFormatString: (color: string) => {\n\t\tif (Color.isP3String(color)) return color\n\t\treturn Color.toRgbString(Color(color))\n\t},\n}\n", "import { memoize } from \"../../utils/memoize.ts\"\nimport { hash as stringHash } from \"../../utils/string.ts\"\nimport { ConvertColor } from \"../types/Color/ConvertColor.ts\"\nimport type { GradientColorStop } from \"../types/GradientColorStop.ts\"\nimport type { MultiStopGradient } from \"../types/MultiStopGradient.ts\"\nimport type { SimpleGradient } from \"../types/SimpleGradient.ts\"\n\nconst CSSVariableRegExp = /var\\(.+\\)/u\n\nconst colorCache = new Map<[string, number], string>()\nfunction cachedMultiplyAlpha(s: string, a: number): string {\n\tconst key: [string, number] = [s, a]\n\tif (CSSVariableRegExp.test(s)) {\n\t\treturn s\n\t}\n\treturn memoize(1000, colorCache, key, () => ConvertColor.multiplyAlpha(s, a))\n}\n\n/**\n * @param alpha - is optional because SVGs define the alpha as a seperate property\n * @internal\n */\nexport function gradientColorStops(\n\tgradient: SimpleGradient | MultiStopGradient,\n\talpha = 1,\n): readonly GradientColorStop[] {\n\tlet stops: readonly GradientColorStop[]\n\tif (\"stops\" in gradient) {\n\t\tstops = gradient.stops\n\t} else {\n\t\tstops = [\n\t\t\t{ value: gradient.start, position: 0 },\n\t\t\t{ value: gradient.end, position: 1 },\n\t\t]\n\t}\n\n\tif (alpha === 1) {\n\t\treturn stops\n\t} else {\n\t\treturn stops.map(stop => ({ ...stop, value: cachedMultiplyAlpha(stop.value, alpha) }))\n\t}\n}\n\nexport function gradientColorStopsHash(gradient: SimpleGradient | MultiStopGradient, alpha: number) {\n\tlet result = 0\n\tgradientColorStops(gradient, alpha).forEach((stop: GradientColorStop) => {\n\t\tresult ^= stringHash(stop.value) ^ stop.position\n\t})\n\treturn result\n}\n", "import type { GradientColorStop } from \"./GradientColorStop.ts\"\n\n/**\n * @public\n */\nexport interface MultiStopGradient {\n\tstops: readonly GradientColorStop[]\n}\n\nconst multiStopGradientKeys: (keyof MultiStopGradient)[] = [\"stops\"]\n\nexport function isMultiStopGradient(value: any): value is MultiStopGradient {\n\treturn value && multiStopGradientKeys.every(key => key in value)\n}\n", "/**\n * @public\n */\nexport interface SimpleGradient {\n\tstart: string\n\tend: string\n}\n\nconst simpleGradientKeys: (keyof SimpleGradient)[] = [\"start\", \"end\"]\n\nexport function isSimpleGradient(value: any): value is SimpleGradient {\n\treturn value && simpleGradientKeys.every(key => key in value)\n}\n", "import { isObject } from \"../../utils/utils.ts\"\nimport { gradientColorStops, gradientColorStopsHash } from \"../utils/gradientColorStops.ts\"\nimport type { MultiStopGradient } from \"./MultiStopGradient.ts\"\nimport { isMultiStopGradient } from \"./MultiStopGradient.ts\"\nimport type { SimpleGradient } from \"./SimpleGradient.ts\"\nimport { isSimpleGradient } from \"./SimpleGradient.ts\"\n/**\n * @public\n */\nexport interface LinearGradientBase {\n\talpha: number\n\tangle: number\n}\n\n/**\n * @public\n */\nexport type LinearGradient = LinearGradientBase & (SimpleGradient | MultiStopGradient)\n\nconst linearGradientKeys: (keyof LinearGradientBase)[] = [\"angle\", \"alpha\"]\n\n/**\n * @public\n */\nexport const LinearGradient = {\n\t/**\n\t * @param value -\n\t */\n\tisLinearGradient: (value: unknown): value is LinearGradient => {\n\t\treturn (\n\t\t\tisObject(value) &&\n\t\t\tlinearGradientKeys.every(key => key in value) &&\n\t\t\t(isSimpleGradient(value) || isMultiStopGradient(value))\n\t\t)\n\t},\n\n\t/** @internal */\n\thash: (linearGradient: LinearGradient): number => {\n\t\treturn linearGradient.angle ^ gradientColorStopsHash(linearGradient, linearGradient.alpha)\n\t},\n\n\t/** @internal */\n\ttoCSS: (\n\t\tlinearGradient: LinearGradient,\n\t\toverrideAngle?: number,\n\t\tgetStopValue?: (value: string) => string | undefined,\n\t) => {\n\t\tconst stops = gradientColorStops(linearGradient, linearGradient.alpha)\n\t\tconst angle = overrideAngle !== undefined ? overrideAngle : linearGradient.angle\n\t\t// Ensure integer angles in CSS output, matching `GradientAngleTool.update()`.\n\t\tconst roundedAngle = Math.round(angle)\n\t\tconst cssStops = stops.map(stop => `${getStopValue?.(stop.value) ?? stop.value} ${stop.position * 100}%`)\n\t\treturn `linear-gradient(${roundedAngle}deg, ${cssStops.join(\", \")})`\n\t},\n}\n", "import { isObject } from \"../../utils/utils.ts\"\nimport { gradientColorStops, gradientColorStopsHash } from \"../utils/gradientColorStops.ts\"\nimport type { MultiStopGradient } from \"./MultiStopGradient.ts\"\nimport { isMultiStopGradient } from \"./MultiStopGradient.ts\"\nimport type { SimpleGradient } from \"./SimpleGradient.ts\"\nimport { isSimpleGradient } from \"./SimpleGradient.ts\"\n\n/**\n * @public\n */\nexport interface RadialGradientBase {\n\talpha: number\n\twidthFactor: number\n\theightFactor: number\n\tcenterAnchorX: number\n\tcenterAnchorY: number\n}\n\n/**\n * @public\n */\nexport type RadialGradient = RadialGradientBase & (SimpleGradient | MultiStopGradient)\n\nconst radialGradientKeys: (keyof RadialGradientBase)[] = [\n\t\"widthFactor\",\n\t\"heightFactor\",\n\t\"centerAnchorX\",\n\t\"centerAnchorY\",\n\t\"alpha\",\n]\n\n/**\n * @public\n */\nexport const RadialGradient = {\n\t/**\n\t * @param value -\n\t * @public\n\t */\n\tisRadialGradient: (value: unknown): value is RadialGradient => {\n\t\treturn (\n\t\t\tisObject(value) &&\n\t\t\tradialGradientKeys.every(key => key in value) &&\n\t\t\t(isSimpleGradient(value) || isMultiStopGradient(value))\n\t\t)\n\t},\n\n\t/** @internal */\n\thash: (radialGradient: RadialGradient): number => {\n\t\treturn (\n\t\t\tradialGradient.centerAnchorX ^\n\t\t\tradialGradient.centerAnchorY ^\n\t\t\tradialGradient.widthFactor ^\n\t\t\tradialGradient.heightFactor ^\n\t\t\tgradientColorStopsHash(radialGradient, radialGradient.alpha)\n\t\t)\n\t},\n\n\t/** @internal */\n\ttoCSS: (radialGradient: RadialGradient, getStopValue?: (value: string) => string | undefined) => {\n\t\tconst { alpha, widthFactor, heightFactor, centerAnchorX, centerAnchorY } = radialGradient\n\t\tconst stops = gradientColorStops(radialGradient, alpha)\n\n\t\t// When both gradient stops are at 100% the gradient is a circle. This however\n\t\t// is not supported by Safari, so we need to make sure that one of the stops\n\t\t// is not at 100%. We do this by setting the stop before the last stop to slightly less than 100%.\n\t\tconst cssStops = stops.map((stop, index) => {\n\t\t\tconst nextStop = stops[index + 1]\n\t\t\tconst position = stop.position === 1 && nextStop?.position === 1 ? stop.position - 0.0001 : stop.position\n\t\t\treturn `${getStopValue?.(stop.value) ?? stop.value} ${position * 100}%`\n\t\t})\n\t\treturn `radial-gradient(${widthFactor * 100}% ${heightFactor * 100}% at ${centerAnchorX * 100}% ${\n\t\t\tcenterAnchorY * 100\n\t\t}%, ${cssStops.join(\", \")})`\n\t},\n}\n", "import type { MotionStyle, MotionValue } from \"framer-motion\"\nimport { Animatable } from \"../../animation/Animatable/Animatable.ts\"\nimport { isMotionValue } from \"../../render/utils/isMotionValue.ts\"\nimport type { BackgroundImage } from \"../types/BackgroundImage.ts\"\nimport { Color } from \"../types/Color/Color.ts\"\nimport type { Gradient } from \"../types/Gradient.ts\"\nimport { LinearGradient, RadialGradient } from \"../types/Gradient.ts\"\n\n/** @public */\nexport type Background = Color | Gradient | BackgroundImage | MotionValue<string> | string\n\nexport interface DeprecatedBackgroundProperties {\n\tbackground: Animatable<Background> | Background | null\n\n\t/**\n\t * @internal\n\t */\n\tbackgroundColor: string | Color\n}\n\n/** @public */\nexport interface BackgroundProperties {\n\t/**\n\t * Set the background of a `Frame`. Supports color strings, color objects and images by using `src`. Set to a semi-transparent blue color by default.\n\t * This will override the values set by the `image` property. To use a color and a image, use `backgroundColor` instead\n\t * ```jsx\n\t * <Frame background=\"#09F\"/>\n\t * <Frame background={Color({r: 255, g: 0, b: 102})} />\n\t * <Frame background={{ alpha: 1, angle: 75, start: \"#09F\", end: \"#F09\"}} />\n\t * <Frame background={{ src: \"https://example.com/logo.png\"}} />\n\t * ```\n\t * @public\n\t */\n\tbackground: Background | null\n\n\t/**\n\t * Set the background color of a `Frame`. Supports color strings and objects. Use this property to set a background color alongside the `image` property.\n\t * ```jsx\n\t * <Frame backgroundColor=\"#09F\"/>\n\t * <Frame backgroundColor={Color({r: 255, g: 0, b: 102})} />\n\t * ```\n\t * @public\n\t */\n\tbackgroundColor: string | Color\n\n\t/**\n\t * Sets a background image of a `Frame`. Will wrap the passed value in a `url('')` if needed.\n\t * @remarks\n\t * ```jsx\n\t * <Frame image=\"https://source.unsplash.com/random\" />\n\t * ```\n\t * @public\n\t */\n\timage: string\n}\n\n// Note: this does not include background images\nexport function collectBackgroundFromProps(\n\t{ background, backgroundColor }: Partial<DeprecatedBackgroundProperties | BackgroundProperties>,\n\tstyle: MotionStyle,\n) {\n\tif (backgroundColor) {\n\t\tif (typeof backgroundColor === \"string\" || isMotionValue(backgroundColor)) {\n\t\t\tstyle.backgroundColor = backgroundColor\n\t\t} else if (Color.isColorObject(background)) {\n\t\t\tstyle.backgroundColor = background.initialValue || Color.toRgbString(background)\n\t\t}\n\t} else if (background) {\n\t\tbackground = Animatable.get(background, null)\n\t\tif (typeof background === \"string\" || isMotionValue(background)) {\n\t\t\tstyle.background = background\n\t\t} else if (LinearGradient.isLinearGradient(background)) {\n\t\t\tstyle.background = LinearGradient.toCSS(background)\n\t\t} else if (RadialGradient.isRadialGradient(background)) {\n\t\t\tstyle.background = RadialGradient.toCSS(background)\n\t\t} else if (Color.isColorObject(background)) {\n\t\t\tstyle.backgroundColor = background.initialValue || Color.toRgbString(background)\n\t\t}\n\t}\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport type { FrameProps } from \"../presentation/Frame/FrameWithMotion.tsx\"\n\nexport function extractStyleFromProps(\n\tprops: Partial<FrameProps>,\n\tname: keyof FrameProps,\n\tstyleRef: MotionStyle,\n\tinto?: keyof MotionStyle,\n): void {\n\tif (into === undefined) {\n\t\tinto = name as keyof MotionStyle\n\t}\n\tif (props[name] !== undefined) {\n\t\t// biome-ignore lint/suspicious/noExplicitAny: The anys look odd, but this prevents TypeScript from doing very expensive type intersection checks (500ms+). As the arguments are still type-safe, this is ok.\n\t\t;(styleRef as Record<string, any>)[into as any] = (props as any)[name as any]\n\t\treturn\n\t}\n}\n", "import { type MotionStyle, isMotionValue, transformValue } from \"framer-motion\"\nimport type { CSSProperties } from \"react\"\nimport { collectBackgroundFromProps } from \"../../traits/Background.ts\"\nimport { extractStyleFromProps } from \"../../utils/extractStyleFromProps.ts\"\nimport type { FrameProps } from \"./FrameWithMotion.tsx\"\n\nexport function hasLeftAndRight(style?: MotionStyle): boolean {\n\tif (!style) return false\n\treturn style.left !== undefined && style.right !== undefined\n}\n\nexport function hasTopAndBottom(style?: MotionStyle): boolean {\n\tif (!style) return false\n\treturn style.top !== undefined && style.bottom !== undefined\n}\n\nexport function getStyleForFrameProps(props?: Partial<FrameProps>): MotionStyle {\n\tif (!props) {\n\t\treturn {}\n\t}\n\n\tconst style: MotionStyle = {}\n\n\t// Styles\n\tif (props.preserve3d === true) {\n\t\tstyle.transformStyle = \"preserve-3d\"\n\t} else if (props.preserve3d === false) {\n\t\tstyle.transformStyle = \"flat\"\n\t}\n\tif (props.backfaceVisible === true) {\n\t\tstyle.backfaceVisibility = \"visible\"\n\t} else if (props.backfaceVisible === false) {\n\t\tstyle.backfaceVisibility = \"hidden\"\n\t}\n\tif (style.backfaceVisibility) {\n\t\tstyle.WebkitBackfaceVisibility = style.backfaceVisibility\n\t}\n\tif (props.perspective !== undefined) {\n\t\tstyle.perspective = style.WebkitPerspective = props.perspective\n\t}\n\t// Generated Component instances set left and top via CSS. But can still be\n\t// centered with a centering transform.\n\tif (!props.__fromCanvasComponent) {\n\t\tif (props.center === true) {\n\t\t\tstyle.left = \"50%\"\n\t\t\tstyle.top = \"50%\"\n\t\t} else {\n\t\t\tif (props.center === \"x\") {\n\t\t\t\tstyle.left = \"50%\"\n\t\t\t} else if (props.center === \"y\") {\n\t\t\t\tstyle.top = \"50%\"\n\t\t\t}\n\t\t}\n\t}\n\n\tconst { cornerShape } = props\n\tif (isMotionValue(cornerShape)) {\n\t\tstyle.cornerShape = transformValue(() => `superellipse(${cornerShape.get()})`)\n\t} else if (cornerShape !== undefined) {\n\t\tstyle.cornerShape = `superellipse(${cornerShape})`\n\t}\n\n\textractStyleFromProps(props, \"size\", style)\n\textractStyleFromProps(props, \"width\", style)\n\textractStyleFromProps(props, \"height\", style)\n\textractStyleFromProps(props, \"minWidth\", style)\n\textractStyleFromProps(props, \"minHeight\", style)\n\textractStyleFromProps(props, \"top\", style)\n\textractStyleFromProps(props, \"right\", style)\n\textractStyleFromProps(props, \"bottom\", style)\n\textractStyleFromProps(props, \"left\", style)\n\textractStyleFromProps(props, \"position\", style)\n\textractStyleFromProps(props, \"overflow\", style)\n\textractStyleFromProps(props, \"opacity\", style)\n\t// avoid \"double border\" issues\n\tif (!props._border || !props._border.borderWidth) extractStyleFromProps(props, \"border\", style)\n\textractStyleFromProps(props, \"borderRadius\", style)\n\textractStyleFromProps(props, \"radius\", style, \"borderRadius\")\n\textractStyleFromProps(props, \"color\", style)\n\textractStyleFromProps(props, \"shadow\", style, \"boxShadow\")\n\textractStyleFromProps(props, \"x\", style)\n\textractStyleFromProps(props, \"y\", style)\n\textractStyleFromProps(props, \"z\", style)\n\textractStyleFromProps(props, \"rotate\", style)\n\textractStyleFromProps(props, \"rotateX\", style)\n\textractStyleFromProps(props, \"rotateY\", style)\n\textractStyleFromProps(props, \"rotateZ\", style)\n\textractStyleFromProps(props, \"scale\", style)\n\textractStyleFromProps(props, \"scaleX\", style)\n\textractStyleFromProps(props, \"scaleY\", style)\n\textractStyleFromProps(props, \"skew\", style)\n\textractStyleFromProps(props, \"skewX\", style)\n\textractStyleFromProps(props, \"skewY\", style)\n\textractStyleFromProps(props, \"originX\", style)\n\textractStyleFromProps(props, \"originY\", style)\n\textractStyleFromProps(props, \"originZ\", style)\n\tcollectBackgroundFromProps(props, style as CSSProperties)\n\n\treturn style\n}\n", "import type { Transition } from \"framer-motion\"\nimport { AnimatePresence, useInstantLayoutTransition, useResetProjection } from \"framer-motion\"\nimport React, { Component } from \"react\"\nimport type { FrameProps } from \"../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { FrameWithMotion } from \"../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { withLibraryCSS } from \"../render/utils/injectComponentCSSRules.ts\"\nimport { assert } from \"../utils/assert.ts\"\nimport { isReactChild, isReactElement } from \"../utils/type-guards.ts\"\nimport { isObject } from \"../utils/utils.ts\"\nimport { LayoutIdProvider } from \"./AnimateLayout/LayoutIdContext.tsx\"\nimport { SharedLayoutRoot } from \"./AnimateLayout/SharedLayoutRoot.tsx\"\nimport { MagicMotionCrossfadeRoot } from \"./MagicMotionCrossfadeRoot.tsx\"\nimport { NavigationContainer } from \"./NavigationContainer.tsx\"\nimport { NavigationContext } from \"./NavigationContext.ts\"\nimport type {\n\tFadeTransitionOptions,\n\tFlipTransitionOptions,\n\tModalTransitionOptions,\n\tNavigationTransition,\n\tNavigationTransitionAnimation,\n\tNavigationTransitionBackdropColor,\n\tOverlayTransitionOptions,\n\tPushTransitionOptions,\n} from \"./NavigationTransitions.ts\"\nimport { TransitionDefaults, flipTransition, overlayTransition, pushTransition } from \"./NavigationTransitions.ts\"\nimport type { HistoryItem, NavigationAction, NavigationState, StackState } from \"./reduceNavigationStateForAction.ts\"\nimport { defaultState, reduceNavigationStateForAction } from \"./reduceNavigationStateForAction.ts\"\n\n/**\n * The navigator allows control over the built-in navigation component in Framer.\n * @public\n */\nexport interface NavigationInterface {\n\t/**\n\t * Go back to the previous screen. If a stack of overlays is presented, all overlays are dismissed.\n\t * @public\n\t * */\n\tgoBack: () => void\n\t/**\n\t * Show new screen instantly.\n\t * @param component - The incoming component\n\t * @public\n\t */\n\tinstant: (component: React.ReactNode) => void\n\t/**\n\t * Fade in new screen.\n\t * @param component - The incoming component\n\t * @param options - {@link FadeTransitionOptions}\n\t * @public\n\t */\n\tfade: (component: React.ReactNode, options?: FadeTransitionOptions) => void\n\t/**\n\t * Push new screen. Defaults from right to left, the direction can be changed using the {@link NavigationTransitionOptions}.\n\t * @param component - The incoming component\n\t * @param options - {@link PushTransitionOptions}\n\t * @public\n\t */\n\tpush: (component: React.ReactNode, options?: PushTransitionOptions) => void\n\t/**\n\t * Present modal overlay in the center.\n\t * @param component - The incoming component\n\t * @param options - {@link ModalTransitionOptions}\n\t * @public\n\t */\n\tmodal: (component: React.ReactNode, options?: ModalTransitionOptions) => void\n\t/**\n\t * Present overlay from one of four edges. The direction can be changed using the {@link NavigationTransitionOptions}.\n\t * @param component - The incoming component\n\t * @param options - {@link OverlayTransitionOptions}\n\t * @public\n\t */\n\toverlay: (component: React.ReactNode, options?: OverlayTransitionOptions) => void\n\t/**\n\t * Flip incoming and outgoing screen in 3D. The flip direction can be changed using the {@link NavigationTransitionOptions}.\n\t * @param component - The incoming component\n\t * @param options - {@link FlipTransitionOptions}\n\t * @public\n\t */\n\tflip: (component: React.ReactNode, options?: FlipTransitionOptions) => void\n\t/**\n\t * Present a screen using a custom {@link NavigationTransition}.\n\t * @param component - The incoming component\n\t * @param transition - {@link NavigationTransition}\n\t * @public\n\t */\n\tcustomTransition: (component: React.ReactNode, transition: NavigationTransition) => void\n\t/**\n\t * Animate layers with matching magicIds between screens. Layers are assigned matching IDs if they share a name, or were copied from one another.\n\t * The transition can be changed using a custom {@link NavigationTransition}.\n\t * @param component - The incoming component\n\t * @param transition - {@link NavigationTransition}\n\t * @public\n\t */\n\tmagicMotion: (component: React.ReactNode, transition: NavigationTransition) => void\n}\n\n/**\n * Provides {@link NavigationInterface} that can be used to start transitions in Framer.\n * @public\n */\nexport const NavigationConsumer = /* @__PURE__ */ (() => NavigationContext.Consumer)()\n\ntype NavigationCallback = (key: string) => void\nconst NavigationCallbackContext = /* @__PURE__ */ React.createContext<NavigationCallback | undefined>(undefined)\n/**\n * @internal\n */\nexport const NavigationCallbackProvider = /* @__PURE__ */ (() => NavigationCallbackContext.Provider)()\n\n/**\n * @internal\n */\nexport const IsInitialNavigationContext = /* @__PURE__ */ React.createContext<boolean | undefined>(undefined)\n\n/**\n * @internal\n */\nexport interface NavigationProps {\n\t/** @deprecated - still used by the old library */\n\twidth?: number\n\t/** @deprecated - still used by the old library */\n\theight?: number\n\tstyle?: React.CSSProperties\n\t/** @internal */\n\tenabled?: boolean\n}\n\ninterface LayoutProjectionHelpers {\n\tresetProjection?: () => void\n\tskipLayoutAnimation?: (cb?: () => void) => void\n}\n\n/**\n * @internal export for testing only\n *\n * We\u2019re wrapping the whole Navigation class with `@__PURE__` because esbuild\n * can\u2019t compile static class properties in a tree-shakeable way: https://github.com/evanw/esbuild/issues/3765.\n * The wrapper allows them to stay in the IIFE and be tree-shaken.\n * If/when esbuild fixes that issue, we can remove `export type NavigationClass`\n * and just export the class directly.\n */\nconst Navigation = /* @__PURE__ */ (() => {\n\treturn class Navigation\n\t\textends Component<NavigationProps & LayoutProjectionHelpers & { children?: React.ReactNode }, NavigationState>\n\t\timplements NavigationInterface\n\t{\n\t\t#lastEventTimeStamp: number | null = null\n\n\t\toverride state: NavigationState = defaultState()\n\n\t\tstatic defaultProps: NavigationProps = {\n\t\t\tenabled: true,\n\t\t}\n\n\t\tstatic override contextType = NavigationCallbackContext\n\t\tdeclare context: React.ContextType<typeof NavigationCallbackContext>\n\n\t\tconstructor(props: NavigationProps & LayoutProjectionHelpers) {\n\t\t\tsuper(props)\n\n\t\t\tconst component = this.props.children\n\t\t\tif (!component || !isReactChild(component) || !isReactElement(component)) return\n\t\t\tconst transition = { ...TransitionDefaults.Instant }\n\t\t\tconst key = component.key?.toString() || `stack-${this.state.historyItemId + 1}`\n\t\t\tconst action = { type: \"add\", key, transition, component } as const\n\n\t\t\tconst newState = reduceNavigationStateForAction(this.state, action)\n\t\t\tif (!newState) return\n\t\t\tthis.state = newState\n\t\t}\n\n\t\toverride componentDidMount() {\n\t\t\tconst historyItem = this.state.history[this.state.current]\n\t\t\t// Because this.state.history is only properly setup in the constructor\n\t\t\t// when `this.props.children` is set (to support SSG in the past), we\n\t\t\t// need to be prepared to have historyItem be undefined on mount.\n\t\t\tif (!historyItem) return\n\t\t\tthis.context?.(historyItem.key)\n\t\t}\n\n\t\toverride UNSAFE_componentWillReceiveProps(props: NavigationProps & { children?: React.ReactNode }) {\n\t\t\tconst component: React.ReactNode = props[\"children\"]\n\t\t\tif (!isReactChild(component) || !isReactElement(component)) return\n\n\t\t\tconst key = component.key?.toString()\n\n\t\t\tif (!key) return\n\n\t\t\tif (this.state.history.length === 0) {\n\t\t\t\tthis.#transition(component, TransitionDefaults.Instant)\n\t\t\t} else {\n\t\t\t\tthis.#navigationAction({ type: \"update\", key, component })\n\t\t\t}\n\t\t}\n\n\t\toverride componentWillUnmount() {\n\t\t\tthis.props.resetProjection?.()\n\t\t}\n\n\t\t#getStackState(options: { overCurrentContext: boolean }): StackState {\n\t\t\tconst { current, previous, currentOverlay, previousOverlay } = this.state\n\t\t\tif (options.overCurrentContext) {\n\t\t\t\treturn {\n\t\t\t\t\tcurrent: currentOverlay,\n\t\t\t\t\tprevious: previousOverlay,\n\t\t\t\t\thistory: this.state.overlayStack,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcurrent,\n\t\t\t\tprevious,\n\t\t\t\thistory: this.state.history,\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * To prevent bubbling events from triggering multiple transitions,\n\t\t * we ensure that the current event has a different timestamp then the event that triggered the last transition.\n\t\t * We use Window.event to ensure that even transitions invoked by code components - and may not pass a reference to the event - are caught.\n\t\t * This works better than measuring the time of transition calls with performance.now()\n\t\t * because the time between calls can get longer and longer as more screens are added to the stack,\n\t\t * preventing a deterministic time between transitions to be used to determine if they were triggered at the same time or not.\n\t\t */\n\t\t#isSameEventTransition() {\n\t\t\t// If for some reason window.event is undefined, don't block transitions.\n\t\t\tif (!globalThis.event) return false\n\t\t\treturn this.#lastEventTimeStamp === globalThis.event.timeStamp\n\t\t}\n\n\t\t#navigationAction = (action: NavigationAction) => {\n\t\t\t// If Navigation is disabled and this is not the first navigation event, ignore the action\n\t\t\tif (!this.props.enabled && this.state.history.length > 0) return\n\n\t\t\tconst newState = reduceNavigationStateForAction(this.state, action)\n\t\t\tif (!newState) return\n\n\t\t\t// Block layout animation in motion when using non-magic-motion transitions.\n\t\t\t// We trigger the transition as a callback to ensure the blocking happens first.\n\t\t\tconst { skipLayoutAnimation } = this.props\n\t\t\tconst historyItem = newState.history[newState.current]\n\n\t\t\t// Since the \"lead\" always determines which layers can animate,\n\t\t\t// and when a \"transition back\" is performed the \"lead\" is the new current container,\n\t\t\t// we need to ensure that calculations are performed by the new current container\n\t\t\t// as if it was being transitioned to with magic motion.\n\t\t\t// Since this.state.previousTransition is null unless we are animating a magic motion removal,\n\t\t\t// this is a safe way to infer this case.\n\t\t\tconst withMagicMotion =\n\t\t\t\t(action.type === \"add\" && action.transition.withMagicMotion) ||\n\t\t\t\t(action.type === \"forward\" && historyItem?.transition.withMagicMotion) ||\n\t\t\t\t(action.type === \"remove\" && !!newState.previousTransition)\n\n\t\t\tconst updateState = () => {\n\t\t\t\tthis.setState(newState)\n\t\t\t\tif (historyItem?.key) {\n\t\t\t\t\tthis.context?.(historyItem.key)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (skipLayoutAnimation && !withMagicMotion) {\n\t\t\t\tskipLayoutAnimation(updateState)\n\t\t\t} else {\n\t\t\t\tupdateState()\n\t\t\t}\n\t\t}\n\n\t\t#transition(\n\t\t\tcomponent: React.ReactNode,\n\t\t\ttransitionTraits: NavigationTransition,\n\t\t\ttransitionOptions?: NavigationTransitionAnimation & NavigationTransitionBackdropColor,\n\t\t) {\n\t\t\tif (this.#isSameEventTransition()) return\n\t\t\tthis.#lastEventTimeStamp = globalThis.event?.timeStamp || null\n\n\t\t\tif (!component || !isReactChild(component) || !isReactElement(component)) return\n\n\t\t\tconst transition = { ...transitionTraits, ...transitionOptions }\n\t\t\tconst overCurrentContext = !!transition.overCurrentContext\n\n\t\t\tif (overCurrentContext) return this.#navigationAction({ type: \"addOverlay\", transition, component })\n\n\t\t\t// If for some reason Navigation is being used in code, and a component instance isn't supplied,\n\t\t\t// generate a unique key to ensure the screen is added.\n\t\t\tconst key = component.key?.toString() || `stack-${this.state.historyItemId + 1}`\n\n\t\t\tthis.#navigationAction({ type: \"add\", key, transition, component })\n\t\t}\n\n\t\tgoBack = () => {\n\t\t\tif (this.#isSameEventTransition()) return\n\t\t\tthis.#lastEventTimeStamp = globalThis.event?.timeStamp || null\n\n\t\t\tif (this.state.currentOverlay !== -1) return this.#navigationAction({ type: \"removeOverlay\" })\n\n\t\t\treturn this.#navigationAction({ type: \"remove\" })\n\t\t}\n\n\t\tinstant(component: React.ReactNode) {\n\t\t\tthis.#transition(component, TransitionDefaults.Instant, undefined)\n\t\t}\n\n\t\tfade(component: React.ReactNode, options?: FadeTransitionOptions) {\n\t\t\tthis.#transition(component, TransitionDefaults.Fade, options)\n\t\t}\n\n\t\tpush(component: React.ReactNode, options?: PushTransitionOptions) {\n\t\t\tthis.#transition(component, pushTransition(options), options)\n\t\t}\n\n\t\tmodal(component: React.ReactNode, options?: ModalTransitionOptions) {\n\t\t\tthis.#transition(component, TransitionDefaults.Modal, options)\n\t\t}\n\n\t\toverlay(component: React.ReactNode, options?: OverlayTransitionOptions) {\n\t\t\tthis.#transition(component, overlayTransition(options), options)\n\t\t}\n\n\t\tflip(component: React.ReactNode, options?: FlipTransitionOptions) {\n\t\t\tthis.#transition(component, flipTransition(options), options)\n\t\t}\n\n\t\tmagicMotion(component: React.ReactNode, options?: NavigationTransitionAnimation) {\n\t\t\tthis.#transition(component, TransitionDefaults.MagicMotion, options)\n\t\t}\n\n\t\tcustomTransition(component: React.ReactNode, transition: NavigationTransition) {\n\t\t\tthis.#transition(component, transition)\n\t\t}\n\n\t\toverride render() {\n\t\t\tconst stackState = this.#getStackState({ overCurrentContext: false })\n\t\t\tconst overlayStackState = this.#getStackState({ overCurrentContext: true })\n\t\t\tconst activeOverlay = activeOverlayItem(overlayStackState)\n\t\t\tconst isOverlayVisible = overlayStackState.current > -1\n\n\t\t\t// Describes whether this is the first render of Navigation and its\n\t\t\t// initial content. Mostly useful for dealing with SSR and hydration,\n\t\t\t// which is why it's also accessible via IsInitialNavigationContext.\n\t\t\t//\n\t\t\t// We implement this as a history.length check, as it should only ever\n\t\t\t// be 1 right after mount, since back transitions don't pop the history\n\t\t\t// stack.\n\t\t\t//\n\t\t\t// It is expected to only ever change once, from `true` to `false`, on\n\t\t\t// the first transition after mount. This is important to make sure that\n\t\t\t// anything using the IsInitialNavigationContext doesn't unnecessarily\n\t\t\t// re-render.\n\t\t\tconst isInitial = this.state.history.length === 1\n\n\t\t\tconst contentContainers: JSX.Element[] = []\n\t\t\tfor (const [key, component] of Object.entries(this.state.containers)) {\n\t\t\t\tconst index = this.state.containerIndex[key]\n\t\t\t\tassert(index !== undefined, \"Container's index must be registered\")\n\t\t\t\tconst visualIndex = this.state.containerVisualIndex[key]\n\t\t\t\tassert(visualIndex !== undefined, \"Container's visual index must be registered\")\n\t\t\t\tconst removed = this.state.containerIsRemoved[key]\n\t\t\t\tconst historyItem = this.state.history[index]\n\t\t\t\tconst transitionProps = this.state.transitionForContainer[key]\n\t\t\t\tconst isCurrent = index === this.state.current\n\n\t\t\t\tconst isPrevious = index === this.state.previous\n\t\t\t\tconst areMagicMotionLayersPresent = isCurrent ? false : removed\n\n\t\t\t\t// Since the \"lead\" always determines which layers can animate, and\n\t\t\t\t// when a \"transition back\" is performed the \"lead\" is the new\n\t\t\t\t// current container, we need to ensure that calculations are\n\t\t\t\t// performed by the new current container as if it was being\n\t\t\t\t// transitioned to with magic motion.\n\t\t\t\t//\n\t\t\t\t// Since this.state.previousTransition is null unless we are\n\t\t\t\t// animating a magic motion removal, this is a safe way to infer\n\t\t\t\t// this case.\n\t\t\t\tconst withMagicMotion =\n\t\t\t\t\thistoryItem?.transition?.withMagicMotion || (isCurrent && !!this.state.previousTransition)\n\n\t\t\t\tcontentContainers.push(\n\t\t\t\t\t<NavigationContainer\n\t\t\t\t\t\tkey={key}\n\t\t\t\t\t\tid={key}\n\t\t\t\t\t\tindex={visualIndex}\n\t\t\t\t\t\tisInitial={isInitial}\n\t\t\t\t\t\tisCurrent={isCurrent}\n\t\t\t\t\t\tisPrevious={isPrevious}\n\t\t\t\t\t\tisOverlayed={isOverlayVisible}\n\t\t\t\t\t\tvisible={isCurrent || isPrevious}\n\t\t\t\t\t\tposition={historyItem?.transition?.position}\n\t\t\t\t\t\tinstant={isInstantContainerTransition(index, stackState)}\n\t\t\t\t\t\ttransitionProps={transitionProps}\n\t\t\t\t\t\tanimation={animationPropsForContainer(index, stackState)}\n\t\t\t\t\t\tbackfaceVisible={getBackfaceVisibleForScreen(index, stackState)}\n\t\t\t\t\t\texitAnimation={historyItem?.transition?.animation}\n\t\t\t\t\t\texitBackfaceVisible={historyItem?.transition?.backfaceVisible}\n\t\t\t\t\t\texitProps={historyItem?.transition?.enter}\n\t\t\t\t\t\twithMagicMotion={withMagicMotion}\n\t\t\t\t\t\tareMagicMotionLayersPresent={areMagicMotionLayersPresent ? false : undefined}\n\t\t\t\t\t>\n\t\t\t\t\t\t<MagicMotionCrossfadeRoot>\n\t\t\t\t\t\t\t{containerContent({\n\t\t\t\t\t\t\t\tcomponent,\n\t\t\t\t\t\t\t\ttransition: historyItem?.transition,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</MagicMotionCrossfadeRoot>\n\t\t\t\t\t</NavigationContainer>,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst overlayContainers = this.state.overlayStack.map((item, stackIndex) => {\n\t\t\t\treturn (\n\t\t\t\t\t<NavigationContainer\n\t\t\t\t\t\tisLayeredContainer\n\t\t\t\t\t\tkey={item.key}\n\t\t\t\t\t\tisCurrent={stackIndex === this.state.currentOverlay}\n\t\t\t\t\t\tposition={item.transition.position}\n\t\t\t\t\t\tinitialProps={initialPropsForOverlay(stackIndex, overlayStackState)}\n\t\t\t\t\t\ttransitionProps={transitionPropsForOverlay(stackIndex, overlayStackState)}\n\t\t\t\t\t\tinstant={isInstantContainerTransition(stackIndex, overlayStackState, true)}\n\t\t\t\t\t\tanimation={animationPropsForContainer(stackIndex, overlayStackState)}\n\t\t\t\t\t\texitProps={item.transition.enter}\n\t\t\t\t\t\tvisible={containerIsVisible(stackIndex, overlayStackState)}\n\t\t\t\t\t\tbackdropColor={backdropColorForTransition(item.transition)}\n\t\t\t\t\t\tbackfaceVisible={getBackfaceVisibleForOverlay(stackIndex, overlayStackState)}\n\t\t\t\t\t\tonTapBackdrop={backdropTapAction(item.transition, this.goBack)}\n\t\t\t\t\t\tindex={this.state.current + 1 + stackIndex}\n\t\t\t\t\t>\n\t\t\t\t\t\t{containerContent({\n\t\t\t\t\t\t\tcomponent: item.component,\n\t\t\t\t\t\t\ttransition: item.transition,\n\t\t\t\t\t\t})}\n\t\t\t\t\t</NavigationContainer>\n\t\t\t\t)\n\t\t\t})\n\n\t\t\treturn (\n\t\t\t\t<FrameWithMotion\n\t\t\t\t\tdata-framer-component-type=\"NavigationRoot\"\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\tposition=\"relative\"\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\toverflow: \"hidden\",\n\t\t\t\t\t\tbackgroundColor: \"unset\",\n\t\t\t\t\t\tpointerEvents: undefined,\n\t\t\t\t\t\t...this.props.style,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<NavigationContext.Provider value={this}>\n\t\t\t\t\t\t<IsInitialNavigationContext.Provider value={isInitial}>\n\t\t\t\t\t\t\t<NavigationContainer\n\t\t\t\t\t\t\t\tisLayeredContainer\n\t\t\t\t\t\t\t\tposition={undefined}\n\t\t\t\t\t\t\t\tinitialProps={{}}\n\t\t\t\t\t\t\t\tinstant={false}\n\t\t\t\t\t\t\t\ttransitionProps={transitionPropsForStackWrapper(activeOverlay)}\n\t\t\t\t\t\t\t\tanimation={animationForStackWrapper(activeOverlay)}\n\t\t\t\t\t\t\t\tbackfaceVisible={backfaceVisibleForStackWrapper(activeOverlay)}\n\t\t\t\t\t\t\t\tvisible\n\t\t\t\t\t\t\t\tbackdropColor={undefined}\n\t\t\t\t\t\t\t\tonTapBackdrop={undefined}\n\t\t\t\t\t\t\t\tindex={0}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<LayoutIdProvider>\n\t\t\t\t\t\t\t\t\t<SharedLayoutRoot>\n\t\t\t\t\t\t\t\t\t\t<AnimatePresence presenceAffectsLayout={false}>{contentContainers}</AnimatePresence>\n\t\t\t\t\t\t\t\t\t</SharedLayoutRoot>\n\t\t\t\t\t\t\t\t</LayoutIdProvider>\n\t\t\t\t\t\t\t</NavigationContainer>\n\t\t\t\t\t\t\t<AnimatePresence>{overlayContainers}</AnimatePresence>\n\t\t\t\t\t\t</IsInitialNavigationContext.Provider>\n\t\t\t\t\t</NavigationContext.Provider>\n\t\t\t\t</FrameWithMotion>\n\t\t\t)\n\t\t}\n\t}\n})()\n\nconst animationDefault: Transition = {\n\tstiffness: 500,\n\tdamping: 50,\n\trestDelta: 1,\n\ttype: \"spring\",\n}\n\ninterface ActiveOverlay {\n\tcurrentOverlayItem: HistoryItem | undefined\n\tpreviousOverlayItem: HistoryItem | undefined\n}\n\nfunction activeOverlayItem(overlayStack: StackState): ActiveOverlay {\n\tlet currentOverlayItem: HistoryItem | undefined\n\tlet previousOverlayItem: HistoryItem | undefined\n\tif (overlayStack.current !== -1) {\n\t\tcurrentOverlayItem = overlayStack.history[overlayStack.current]\n\t} else {\n\t\tpreviousOverlayItem = overlayStack.history[overlayStack.previous]\n\t}\n\treturn { currentOverlayItem, previousOverlayItem }\n}\n\nfunction transitionPropsForStackWrapper({ currentOverlayItem }: ActiveOverlay) {\n\treturn currentOverlayItem && currentOverlayItem.transition.exit\n}\n\nfunction animationForStackWrapper({ currentOverlayItem, previousOverlayItem }: ActiveOverlay): Transition {\n\tif (currentOverlayItem && currentOverlayItem.transition.animation) {\n\t\treturn currentOverlayItem.transition.animation\n\t}\n\tif (previousOverlayItem && previousOverlayItem.transition.animation) {\n\t\treturn previousOverlayItem.transition.animation\n\t}\n\treturn animationDefault\n}\n\nfunction backfaceVisibleForStackWrapper({ currentOverlayItem, previousOverlayItem }: ActiveOverlay) {\n\tif (currentOverlayItem) return currentOverlayItem.transition.backfaceVisible\n\treturn previousOverlayItem && previousOverlayItem.transition.backfaceVisible\n}\n\nfunction backdropColorForTransition(transition: NavigationTransition): string | undefined {\n\tif (transition.backdropColor) return transition.backdropColor\n\tif (transition.overCurrentContext) return \"rgba(4,4,15,.4)\" // iOS dim color\n\treturn undefined\n}\n\nfunction getBackfaceVisibleForOverlay(containerIndex: number, stackState: StackState): boolean | undefined {\n\tconst { current, history } = stackState\n\tif (containerIndex === current) {\n\t\t// current\n\t\tconst navigationItem = history[containerIndex]\n\t\tif (navigationItem && navigationItem.transition) {\n\t\t\treturn navigationItem.transition.backfaceVisible\n\t\t}\n\t\treturn true\n\t} else if (containerIndex < current) {\n\t\t// old\n\t\tconst navigationItem = history[containerIndex + 1]\n\t\tif (navigationItem && navigationItem.transition) {\n\t\t\treturn navigationItem.transition.backfaceVisible\n\t\t}\n\t\treturn true\n\t} else {\n\t\t// future\n\t\tconst navigationItem = history[containerIndex]\n\t\tif (navigationItem && navigationItem.transition) {\n\t\t\treturn navigationItem.transition.backfaceVisible\n\t\t}\n\t\treturn true\n\t}\n}\n\nfunction initialPropsForOverlay(containerIndex: number, stackState: StackState): Partial<FrameProps> | undefined {\n\tconst navigationItem = stackState.history[containerIndex]\n\n\tif (navigationItem) return navigationItem.transition.enter\n}\n\nfunction getBackfaceVisibleForScreen(screenIndex: number, stackState: StackState): boolean | undefined {\n\tconst { current, previous, history } = stackState\n\n\t// Entering going backwards || exiting going forward\n\tif ((screenIndex === previous && current > previous) || (screenIndex === current && current < previous)) {\n\t\treturn history[screenIndex + 1]?.transition?.backfaceVisible\n\t}\n\n\t// Entering going forward, exiting going backwards, or all other screens.\n\treturn history[screenIndex]?.transition?.backfaceVisible\n}\n\nfunction transitionPropsForOverlay(overlayIndex: number, stackState: StackState): Partial<FrameProps> | undefined {\n\tconst { current, history } = stackState\n\n\tif (overlayIndex === current) {\n\t\t// current\n\t\treturn\n\t} else if (overlayIndex < current) {\n\t\t// old\n\t\tconst navigationItem = history[overlayIndex + 1]\n\t\tif (navigationItem && navigationItem.transition) {\n\t\t\treturn navigationItem.transition.exit\n\t\t}\n\t} else {\n\t\t// future\n\t\tconst navigationItem = history[overlayIndex]\n\t\tif (navigationItem && navigationItem.transition) {\n\t\t\treturn navigationItem.transition.enter\n\t\t}\n\t}\n}\n\nfunction animationPropsForContainer(containerIndex: number, stackState: StackState): Transition {\n\tconst { current, previous, history } = stackState\n\tconst containerCurrent = previous > current ? previous : current\n\tif (containerIndex < containerCurrent) {\n\t\t// old\n\t\tconst navigationItem = history[containerIndex + 1]\n\t\tif (navigationItem && navigationItem.transition.animation) {\n\t\t\treturn navigationItem.transition.animation\n\t\t}\n\t} else if (containerIndex !== containerCurrent) {\n\t\t// future\n\t\tconst navigationItem = history[containerIndex]\n\t\tif (navigationItem && navigationItem.transition.animation) {\n\t\t\treturn navigationItem.transition.animation\n\t\t}\n\t} else {\n\t\t// current\n\t\tconst navigationItem = history[containerIndex]\n\t\tif (navigationItem?.transition.animation) {\n\t\t\treturn navigationItem.transition.animation\n\t\t}\n\t}\n\n\treturn animationDefault\n}\n\nfunction isInstantContainerTransition(\n\tcontainerIndex: number,\n\tstackState: StackState,\n\toverCurrentContext?: boolean,\n): boolean {\n\tconst { current, previous, history } = stackState\n\tif (overCurrentContext && history.length > 1) return true\n\tif (containerIndex !== previous && containerIndex !== current) return true\n\tif (current === previous) return true\n\treturn false\n}\n\nfunction containerIsVisible(containerIndex: number, stackState: StackState) {\n\tconst { current, previous } = stackState\n\tif (containerIndex > current && containerIndex > previous) return false\n\tif (containerIndex === current) return true\n\n\treturn false\n}\n\nfunction containerContent(item: { component: React.ReactNode; transition: NavigationTransition | undefined }) {\n\tconst content = React.Children.map(\n\t\titem.component,\n\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated component\n\t\t(child: React.ReactElement<{ [key: string]: any } | undefined>) => {\n\t\t\tif (!isReactChild(child) || !isReactElement(child) || !child.props) {\n\t\t\t\treturn child\n\t\t\t}\n\n\t\t\tconst props: {\n\t\t\t\twidth?: number | string\n\t\t\t\theight?: number | string\n\t\t\t\tminHeight?: number | string\n\t\t\t\tstyle: React.CSSProperties\n\t\t\t} = {\n\t\t\t\tstyle: child.props.style ?? {},\n\t\t\t}\n\n\t\t\tconst position = item?.transition?.position\n\t\t\tconst shouldStretchWidth = !position || (position.left !== undefined && position.right !== undefined)\n\t\t\tconst shouldStretchHeight = !position || (position.top !== undefined && position.bottom !== undefined)\n\n\t\t\tconst canStretchStyle = \"style\" in child.props ? isObject(child.props.style) : true\n\t\t\tif (shouldStretchWidth) {\n\t\t\t\tconst canStretchWidth = \"width\" in child.props\n\t\t\t\tif (canStretchWidth) props.width = \"100%\"\n\t\t\t\tif (canStretchStyle) props.style.width = \"100%\"\n\t\t\t}\n\t\t\tif (shouldStretchHeight) {\n\t\t\t\tconst canStretchHeight = \"height\" in child.props\n\t\t\t\tif (canStretchHeight) props.height = \"100%\"\n\t\t\t\tif (canStretchStyle) props.style.height = \"100%\"\n\t\t\t}\n\n\t\t\treturn React.cloneElement(child, props)\n\t\t},\n\t)\n\treturn content\n}\n\nfunction backdropTapAction(transition: NavigationTransition, goBackAction: () => void) {\n\tif (transition.goBackOnTapOutside !== false) return goBackAction\n}\n\n/**\n * @internal\n */\nfunction NavigationWrapper(props: NavigationProps & { children?: React.ReactNode }) {\n\tconst resetProjection = useResetProjection()\n\tconst skipLayoutAnimation = useInstantLayoutTransition()\n\n\treturn (\n\t\t<Navigation {...props} resetProjection={resetProjection} skipLayoutAnimation={skipLayoutAnimation}>\n\t\t\t{props.children}\n\t\t</Navigation>\n\t)\n}\n\nconst NavigationExport = /* @__PURE__ */ withLibraryCSS(NavigationWrapper)\n\n// Confused how two exports with the same name work? See https://stackoverflow.com/a/67697999\nexport type NavigationClass = InstanceType<typeof Navigation>\nexport { NavigationExport as Navigation, Navigation as NavigationClass }\n", "import type { IProjectionNode, Transition } from \"framer-motion\"\nimport React, { Component } from \"react\"\nimport type { LayoutTree } from \"./SharedLayoutTree.tsx\"\n\n/**\n * @internal\n */\nexport const TREE_ROOT_ID = \"__LAYOUT_TREE_ROOT\"\n\n/**\n * @internal\n */\nexport interface SharedLayoutContextProps {\n\tschedulePromoteTree: (tree: LayoutTree, transition: Transition | undefined, shouldAnimate: boolean) => void\n\tscheduleProjectionDidUpdate: () => void\n\tinitLead: (tree: LayoutTree, shouldAnimate: boolean) => void\n}\n\n/**\n * @internal\n */\nexport const SharedLayoutContext = /* @__PURE__ */ React.createContext<SharedLayoutContextProps>({\n\tschedulePromoteTree: () => {},\n\tscheduleProjectionDidUpdate: () => {},\n\tinitLead: () => {},\n})\n\n/**\n * @internal\n * Orchestrates the promotion of the descendent SharedLayoutTrees:\n * 1. When a LayoutTree mounts as a lead, it will call `initLead` to set itself\n * as the current lead without scheduling a promotion (nodes are promoted on\n * mount automatically in Motion).\n *\n * 2. When a LayoutTree becomes the lead tree, it schedules a promotion in its\n * shouldComponentUpdate lifecycle method. SharedLayoutRoot will kickoff the\n * promotion in its getSnapshotBeforeUpdate lifecycle method, when all of its\n * descendent SharedLayoutTrees finish taking snapshots.\n *\n * 3. When a LayoutTree becomes the lead tree using an non-magic-motion\n * transition, we block its React render. SharedLayoutRoot will also schedule a\n * manual projection tree update to run later in its componentDidUpdate method\n * so that we could perform cleanups correctly.\n */\nexport class SharedLayoutRoot extends Component<{ children?: React.ReactNode }> {\n\tprivate shouldAnimate: boolean = false\n\tprivate transition: Transition | undefined\n\tprivate lead: LayoutTree | undefined\n\tprivate follow: LayoutTree | undefined\n\n\tprivate scheduledPromotion: boolean = false\n\tprivate scheduledDidUpdate: boolean = false\n\n\t// Runs after all descendent SharedLayoutTree finish taking snapshots in\n\t// their getSnapshotBeforeUpdate lifecycle method.\n\toverride getSnapshotBeforeUpdate() {\n\t\tif (!this.scheduledPromotion || !this.lead || !this.follow) return null\n\n\t\tconst needsReset = this.lead?.layoutMaybeMutated && !this.shouldAnimate\n\n\t\tthis.lead.projectionNodes.forEach((projectionNode: IProjectionNode) => {\n\t\t\tprojectionNode?.promote({\n\t\t\t\tneedsReset,\n\t\t\t\ttransition: this.shouldAnimate ? this.transition : undefined,\n\t\t\t\tpreserveFollowOpacity: projectionNode.options.layoutId === TREE_ROOT_ID && !this.follow?.isExiting,\n\t\t\t})\n\t\t})\n\n\t\tif (this.shouldAnimate) {\n\t\t\t// The follow tree is going to be mutated by Magic Motion. If next\n\t\t\t// time it is promoted with an instant transition, we promote it\n\t\t\t// with needsReset to reset it to its identical layout.\n\t\t\tthis.follow.layoutMaybeMutated = true\n\t\t} else {\n\t\t\t// When promoting a tree with an instant transition we block the React\n\t\t\t// update in SharedLayoutTree, so here we schedule a didUpdate manually\n\t\t\t// on the projection tree root so we can perform cleanup & unblock the\n\t\t\t// next layout update.\n\t\t\tthis.scheduleProjectionDidUpdate()\n\t\t}\n\n\t\tthis.lead.layoutMaybeMutated = false\n\t\tthis.transition = undefined\n\t\tthis.scheduledPromotion = false\n\n\t\treturn null\n\t}\n\n\toverride componentDidUpdate() {\n\t\tif (!this.lead) return null\n\t\tif (this.scheduledDidUpdate) {\n\t\t\t// Manually trigger a didUpdate once on the projection tree root\n\t\t\tthis.lead.rootProjectionNode?.root?.didUpdate()\n\t\t\tthis.scheduledDidUpdate = false\n\t\t}\n\t}\n\n\tscheduleProjectionDidUpdate = () => {\n\t\tthis.scheduledDidUpdate = true\n\t}\n\n\t// schedule a promotion to run later in getSnapshotBeforeUpdate\n\tschedulePromoteTree = (tree: LayoutTree, transition: Transition | undefined, shouldAnimate: boolean) => {\n\t\tthis.follow = this.lead\n\t\tthis.shouldAnimate = shouldAnimate\n\t\tthis.lead = tree\n\t\tthis.transition = transition\n\t\tthis.scheduledPromotion = true\n\t}\n\n\tinitLead = (tree: LayoutTree, shouldAnimate: boolean) => {\n\t\tthis.follow = this.lead\n\t\tthis.lead = tree\n\n\t\tif (this.follow && shouldAnimate) {\n\t\t\tthis.follow.layoutMaybeMutated = true\n\t\t}\n\t}\n\n\tsharedLayoutContext = {\n\t\tschedulePromoteTree: this.schedulePromoteTree,\n\t\tscheduleProjectionDidUpdate: this.scheduleProjectionDidUpdate,\n\t\tinitLead: this.initLead,\n\t}\n\n\toverride render() {\n\t\treturn (\n\t\t\t<SharedLayoutContext.Provider value={this.sharedLayoutContext}>\n\t\t\t\t{this.props.children}\n\t\t\t</SharedLayoutContext.Provider>\n\t\t)\n\t}\n}\n", "import { motion } from \"framer-motion\"\nimport type React from \"react\"\nimport { TREE_ROOT_ID } from \"./AnimateLayout/SharedLayoutRoot.tsx\"\n\nconst rootStyles: React.CSSProperties = {\n\twidth: \"100%\",\n\theight: \"100%\",\n\tbackgroundColor: \"none\",\n}\n\n/**\n * @internal\n * When performing a magic motion transition, if the two ground frames don't\n * have matching layoutId, we still want the roots to cross-fade into each other.\n * To implement this, we wrap the content of a navigation screen in a root\n * component that's using a constant layoutId.\n */\nexport function MagicMotionCrossfadeRoot(props: { children?: React.ReactNode }) {\n\treturn (\n\t\t<motion.div layoutId={TREE_ROOT_ID} style={rootStyles}>\n\t\t\t{props.children}\n\t\t</motion.div>\n\t)\n}\n", "import type { MotionValue, Transition } from \"framer-motion\"\nimport { PresenceContext, useAnimation } from \"framer-motion\"\nimport React, { useContext, useEffect, useRef } from \"react\"\nimport { ViewportContext } from \"../modules/useAppearEffect.ts\"\nimport { FrameWithMotion } from \"../render/presentation/Frame/FrameWithMotion.tsx\"\nimport type { DeprecatedFrameWithEventsProps, FrameProps } from \"../render/presentation/Frame/index.tsx\"\nimport { isFiniteNumber } from \"../render/utils/isFiniteNumber.ts\"\nimport { LayoutIdContext } from \"./AnimateLayout/LayoutIdContext.tsx\"\nimport { SharedLayoutTree } from \"./AnimateLayout/SharedLayoutTree.tsx\"\nimport { NavigationContainerContext } from \"./NavigationContainerContext.tsx\"\nimport { NavigationTargetWrapper } from \"./NavigationTargetContext.tsx\"\nimport type { NavigationTransitionPosition } from \"./NavigationTransitions.ts\"\n\nexport interface Props {\n\tindex: number\n\tisLayeredContainer?: boolean\n\tposition: NavigationTransitionPosition | undefined\n\tisInitial?: boolean\n\n\tinitialProps?: Partial<FrameProps> | undefined\n\ttransitionProps: Partial<FrameProps> | undefined\n\texitProps?: Partial<FrameProps> | undefined\n\n\tinstant: boolean\n\tanimation: Transition\n\texitAnimation?: Transition\n\n\tvisible: boolean\n\tbackfaceVisible?: boolean\n\texitBackfaceVisible?: boolean\n\n\tonTapBackdrop?: (() => void) | undefined\n\tbackdropColor?: string | undefined\n\n\twithMagicMotion?: boolean\n\n\tareMagicMotionLayersPresent?: false | undefined\n\tisPrevious?: boolean\n\tisCurrent?: boolean\n\n\t// The value can be outdated when *not* isCurrent, due to memoization\n\tisOverlayed?: boolean\n\n\tchildren: React.ReactNode\n\tid?: string\n}\n\nexport type AnimatingProperties = Partial<DeprecatedFrameWithEventsProps> & { dimOpacity: number }\n\nexport const NavigationContainer = /* @__PURE__ */ React.memo(function NavigationContainer({\n\tisLayeredContainer,\n\tisCurrent,\n\tisPrevious,\n\tisOverlayed = false,\n\tvisible,\n\ttransitionProps,\n\tchildren,\n\tbackdropColor,\n\tonTapBackdrop,\n\tbackfaceVisible,\n\texitBackfaceVisible,\n\tanimation,\n\texitAnimation,\n\tinstant,\n\tinitialProps,\n\texitProps,\n\tposition = { top: 0, right: 0, bottom: 0, left: 0 },\n\twithMagicMotion,\n\tindex,\n\tareMagicMotionLayersPresent,\n\tid,\n\tisInitial,\n}: Props) {\n\tconst animate = useAnimation()\n\tconst presence = useContext(PresenceContext)\n\tconst { persistLayoutIdCache } = useContext(LayoutIdContext)\n\n\tconst previousState = useRef<{\n\t\twasCurrent: boolean | undefined\n\t\twasPrevious: boolean\n\t\twasBeingRemoved: boolean\n\t\twasReset: boolean\n\t\torigins: OriginProps\n\t}>({\n\t\twasCurrent: undefined,\n\t\twasPrevious: false,\n\t\twasBeingRemoved: false,\n\t\twasReset: true,\n\t\torigins: getOriginProps({}, initialProps, transitionProps),\n\t})\n\n\tconst viewportRef = useRef<HTMLDivElement | null>(null)\n\n\tconst isBeingRemoved = presence !== null && !presence.isPresent\n\n\t// When a container mounts, persist the old layoutId cache.\n\tif (isCurrent && previousState.current.wasCurrent === undefined) persistLayoutIdCache()\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>\n\tuseEffect(() => {\n\t\t// Overlays do not use animationControls to animate, don't provide isCurrent or isPrevious,\n\t\t// and don't need to update lastStateRef.\n\t\t// `animate` is mocked as undefined for tests.\n\t\tif (isLayeredContainer || !animate) return\n\n\t\tif (isBeingRemoved) {\n\t\t\tpreviousState.current = {\n\t\t\t\t...previousState.current,\n\t\t\t\twasBeingRemoved: isBeingRemoved,\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tconst { wasPrevious, wasCurrent } = previousState.current\n\n\t\tconst shouldAnimateIn =\n\t\t\t(isCurrent && !wasCurrent) ||\n\t\t\t// If the screen was being removed as a result of a \"go back\" transition, but that removal is interrupted,\n\t\t\t// resulting in this screen being restored to the current screen, we need to trigger an animation.\n\t\t\t(!isBeingRemoved && previousState.current.wasBeingRemoved && isCurrent)\n\t\tconst shouldAnimateOut = isPrevious && !wasPrevious\n\n\t\tconst origins = getOriginProps(previousState.current.origins, initialProps, transitionProps)\n\n\t\tlet wasReset = previousState.current.wasReset\n\n\t\tif (shouldAnimateIn || shouldAnimateOut) {\n\t\t\tanimate.stop()\n\t\t\tvoid animate.start({\n\t\t\t\tzIndex: index,\n\t\t\t\t...origins,\n\t\t\t\t// @TODO: Ignored for now, but should re-check later.\n\t\t\t\t...transitionProps,\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: has been this way from before the biome introduction\n\t\t\t} as any)\n\n\t\t\twasReset = false\n\t\t} else if (wasReset === false) {\n\t\t\tanimate.stop()\n\t\t\t// Set an identity transform to reset exit animations on NavigationContainer's that may need to be animated in again later.\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: has been this way from before the biome introduction\n\t\t\tanimate.set({ zIndex: index, ...allAnimatableProperties, opacity: 0 } as any)\n\n\t\t\twasReset = true\n\t\t}\n\n\t\tpreviousState.current = {\n\t\t\twasCurrent: !!isCurrent,\n\t\t\twasPrevious: !!isPrevious,\n\t\t\twasBeingRemoved: false,\n\t\t\twasReset,\n\t\t\torigins,\n\t\t}\n\n\t\t// We only need to update when the NavigationContainer's position in the stack changes, or it is removed.\n\t}, [isCurrent, isPrevious, isBeingRemoved])\n\n\tconst transition: Transition = instant\n\t\t? { type: false }\n\t\t: \"velocity\" in animation\n\t\t\t? { ...animation, velocity: 0 }\n\t\t\t: animation\n\tconst exitTransition: Transition = instant ? { type: false } : exitAnimation || animation\n\n\tconst layout: Partial<FrameProps> = { ...position }\n\tif (layout.left === undefined || layout.right === undefined) layout.width = \"auto\"\n\tif (layout.top === undefined || layout.bottom === undefined) layout.height = \"auto\"\n\n\tconst needsPerspective = contains3Dprops(transitionProps) || contains3Dprops(initialProps)\n\n\t// `perspective: 0` coupled with `backgroundColor: transparent`, combine in Firefox to cause the root element and it's children\n\t// to not be rendered until the tab is refocused. Unsetting `perspective` all together when it's not required, solves this.\n\tconst perspective = needsPerspective && (isLayeredContainer || isCurrent || isPrevious) ? 1200 : undefined\n\n\tconst identity = { ...allAnimatableProperties, ...previousState.current.origins }\n\n\tconst animations = isLayeredContainer\n\t\t? {\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: has been this way from before the biome introduction\n\t\t\t\tinitial: { ...identity, ...initialProps } as any,\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: has been this way from before the biome introduction\n\t\t\t\tanimate: { ...identity, ...transitionProps, transition } as any, // Overlay animations are sometimes instant\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: has been this way from before the biome introduction\n\t\t\t\texit: { ...identity, ...exitProps, transition: animation } as any, // Overlay exits are always animated\n\t\t\t}\n\t\t: {\n\t\t\t\tanimate,\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: has been this way from before the biome introduction\n\t\t\t\texit: { ...identity, ...exitProps, transition: exitTransition } as any,\n\t\t\t}\n\n\tconst isPresent = !(isBeingRemoved || areMagicMotionLayersPresent === false)\n\n\t// Available for descendant components to know if this is the active screen, we check for isPresent because the screen might be unmounted\n\tconst isCurrentTarget = !!isCurrent && isPresent\n\n\t// The very first item on the navigation stack should always render with\n\t// opacity 1, for SSR reasons.\n\t//\n\t// TODO: We can probably remove this if/when we create a web-specific\n\t// navigation component.\n\tconst forceOpacity = isCurrent && isInitial\n\n\treturn (\n\t\t<FrameWithMotion\n\t\t\tdata-framer-component-type=\"NavigationContainerWrapper\"\n\t\t\twidth=\"100%\"\n\t\t\theight=\"100%\"\n\t\t\tstyle={{\n\t\t\t\tposition: \"absolute\",\n\t\t\t\ttransformStyle: \"flat\",\n\t\t\t\tbackgroundColor: \"transparent\",\n\t\t\t\toverflow: \"hidden\",\n\t\t\t\t// Unlike Overlays, Screens set zIndex via animation controls to ensure it's set in parallel with the animation being played.\n\t\t\t\t// However, when a screen exits, it needs to preserve it's zIndex, which can't be applied through an `exit` animation,\n\t\t\t\t// and might be impacted by the layer created by `perspective`.\n\t\t\t\tzIndex: isLayeredContainer || isBeingRemoved || (isCurrent && withMagicMotion) ? index : undefined,\n\t\t\t\tpointerEvents: undefined,\n\t\t\t\tvisibility: visible ? \"visible\" : \"hidden\",\n\t\t\t\tperspective,\n\t\t\t}}\n\t\t>\n\t\t\t{isLayeredContainer && (\n\t\t\t\t<FrameWithMotion\n\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t\tdata-framer-component-type=\"NavigationContainerBackdrop\"\n\t\t\t\t\ttransition={animation}\n\t\t\t\t\tinitial={{ opacity: instant && visible ? 1 : 0 }} // To prevent flashing\n\t\t\t\t\tanimate={{ opacity: 1 }}\n\t\t\t\t\texit={{ opacity: 0 }}\n\t\t\t\t\tbackgroundColor={backdropColor ? backdropColor : \"transparent\"}\n\t\t\t\t\tonTap={!isBeingRemoved ? onTapBackdrop : undefined}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t<FrameWithMotion\n\t\t\t\t{...layout}\n\t\t\t\t{...animations}\n\t\t\t\ttransition={{\n\t\t\t\t\tdefault: transition,\n\t\t\t\t\toriginX: { type: false },\n\t\t\t\t\toriginY: { type: false },\n\t\t\t\t\toriginZ: { type: false },\n\t\t\t\t}}\n\t\t\t\tbackgroundColor=\"transparent\"\n\t\t\t\tbackfaceVisible={!isBeingRemoved ? backfaceVisible : exitBackfaceVisible}\n\t\t\t\tdata-framer-component-type=\"NavigationContainer\"\n\t\t\t\tdata-framer-is-current-navigation-target={!!isCurrent}\n\t\t\t\tstyle={{\n\t\t\t\t\tpointerEvents: undefined,\n\t\t\t\t\t// When we mount a new screen that is going to be animated in with animation controls,\n\t\t\t\t\t// we need to ensure that the screen is hidden until the animation starts.\n\t\t\t\t\topacity: forceOpacity || isLayeredContainer || (isCurrent && withMagicMotion) ? 1 : 0,\n\t\t\t\t}}\n\t\t\t\tdata-is-present={isPresent ? undefined : false}\n\t\t\t\tref={viewportRef}\n\t\t\t>\n\t\t\t\t<ViewportContext.Provider value={viewportRef}>\n\t\t\t\t\t<NavigationContainerContext.Provider value={isCurrentTarget}>\n\t\t\t\t\t\t<NavigationTargetWrapper isCurrent={isCurrentTarget} isOverlayed={isOverlayed}>\n\t\t\t\t\t\t\t<SharedLayoutTree\n\t\t\t\t\t\t\t\tisLead={isCurrent}\n\t\t\t\t\t\t\t\tanimatesLayout={!!withMagicMotion}\n\t\t\t\t\t\t\t\ttransition={transition}\n\t\t\t\t\t\t\t\tisExiting={!isPresent}\n\t\t\t\t\t\t\t\tisOverlayed={isOverlayed}\n\t\t\t\t\t\t\t\tid={id}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t</SharedLayoutTree>\n\t\t\t\t\t\t</NavigationTargetWrapper>\n\t\t\t\t\t</NavigationContainerContext.Provider>\n\t\t\t\t</ViewportContext.Provider>\n\t\t\t</FrameWithMotion>\n\t\t</FrameWithMotion>\n\t)\n}, shouldUsePreviousValue)\n\nfunction shouldUsePreviousValue(prevProps: Props, nextProps: Props) {\n\tif (nextProps.isCurrent === undefined) return false\n\tif (prevProps.isCurrent !== nextProps.isCurrent) return false\n\tif (prevProps.isPrevious !== nextProps.isPrevious) return false\n\t// Only re-render when isCurrent and isOverlayed changes\n\tif (nextProps.isCurrent && prevProps.isOverlayed !== nextProps.isOverlayed) return false\n\treturn true\n}\n\ntype OriginProps = Partial<{\n\toriginX: number | string | MotionValue\n\toriginY: number | string | MotionValue\n\toriginZ: number | string | MotionValue\n}>\n\nfunction getOriginProps(\n\tcurrentOriginProps: OriginProps,\n\tinitialProps: OriginProps | undefined,\n\ttransitionProps: OriginProps | undefined,\n): OriginProps {\n\tconst result: OriginProps = { ...currentOriginProps }\n\n\tif (initialProps) {\n\t\tif (isFiniteNumber(initialProps.originX)) result.originX = initialProps.originX\n\t\tif (isFiniteNumber(initialProps.originY)) result.originY = initialProps.originY\n\t\tif (isFiniteNumber(initialProps.originZ)) result.originZ = initialProps.originZ\n\t}\n\n\tif (transitionProps) {\n\t\tif (isFiniteNumber(transitionProps.originX)) result.originX = transitionProps.originX\n\t\tif (isFiniteNumber(transitionProps.originY)) result.originY = transitionProps.originY\n\t\tif (isFiniteNumber(transitionProps.originZ)) result.originZ = transitionProps.originZ\n\t}\n\n\treturn result\n}\n\n//\n// biome-ignore lint/suspicious/noExplicitAny: TODO: Refactor `any` to support `Partial<FrameProps>` | { [prop]: number | string, transition: { [prop]: { from: number | string } } }\nfunction contains3Dprops(containerProps: any | undefined) {\n\tif (!containerProps) return false\n\n\tconst containsProps = \"rotateX\" in containerProps || \"rotateY\" in containerProps || \"z\" in containerProps\n\tif (!containsProps) return false\n\n\tconst toPropsContain3d = containerProps.rotateX !== 0 || containerProps.rotateY !== 0 || containerProps.z !== 0\n\tconst fromPropsContain3d =\n\t\tcontainerProps?.transition?.rotateX.from !== 0 ||\n\t\tcontainerProps?.transition?.rotateY.from !== 0 ||\n\t\tcontainerProps?.transition?.z.from !== 0\n\n\treturn toPropsContain3d || fromPropsContain3d\n}\n\nexport const allAnimatableProperties: Partial<FrameProps> = {\n\tx: 0,\n\ty: 0,\n\tz: 0,\n\trotate: 0,\n\trotateX: 0,\n\trotateY: 0,\n\trotateZ: 0,\n\tscale: 1,\n\tscaleX: 1,\n\tscaleY: 1,\n\tscaleZ: 1,\n\tskew: 0,\n\tskewX: 0,\n\tskewY: 0,\n\toriginX: 0.5,\n\toriginY: 0.5,\n\toriginZ: 0,\n\topacity: 1,\n}\n", "import React from \"react\"\nimport type { MutableRefCallback } from \"../components/utils/refHelper.ts\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport { useSharedIntersectionObserver } from \"./useSharedIntersectionObserver.ts\"\n\n/**\n * Rather than rely on the intersectionRatio provided by an\n * IntersectionObserverEntry, we run the observer on every percent of\n * intersection, and calculate our own intersection percentage based purely off\n * of height.\n */\nconst thresholds = /* @__PURE__ */ new Array(100).fill(undefined).map((_, i) => i * 0.01)\n\n/**\n * @internal\n */\nexport const ViewportContext = /* @__PURE__ */ React.createContext<React.RefObject<HTMLElement> | null>(null)\n\nexport function useAppearEffect(\n\tref: MutableRefCallback<HTMLElement>,\n\tappearCallback: (isInView: boolean) => void,\n\toptions: {\n\t\tanimateOnce?: boolean\n\t\tthreshold?: { x?: number; y?: number }\n\t\trootMargin?: string | undefined\n\t\tenabled?: boolean\n\t},\n) {\n\tconst internalState = React.useRef({\n\t\tisInView: false,\n\t\thasAnimatedOnce: false,\n\t})\n\n\tconst { enabled, animateOnce, threshold, rootMargin = `0px 0px 0px 0px` } = options\n\n\tconst callback = React.useCallback(\n\t\t(entry: IntersectionObserverEntry) => {\n\t\t\tconst { isInView, hasAnimatedOnce } = internalState.current\n\n\t\t\tconst isIntersecting = isIntersectingWithThreshold(entry, threshold?.y ?? 0)\n\n\t\t\tif (isIntersecting && !isInView) {\n\t\t\t\tif (animateOnce && hasAnimatedOnce) return\n\t\t\t\tinternalState.current.hasAnimatedOnce = true\n\t\t\t\tinternalState.current.isInView = true\n\t\t\t\tappearCallback(true)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (!isIntersecting && isInView) {\n\t\t\t\tinternalState.current.isInView = false\n\t\t\t\tif (animateOnce) return\n\t\t\t\tappearCallback(false)\n\t\t\t\treturn\n\t\t\t}\n\t\t},\n\t\t[animateOnce, threshold?.y, appearCallback],\n\t)\n\n\tuseSharedIntersectionObserver(ref, callback, {\n\t\tthreshold: thresholds,\n\t\trootMargin,\n\t\tenabled: enabled ?? true,\n\t})\n}\n\n/**\n * Calculate the vertical intersection ratio, as a percentage of the target\n * element's height, or the window height, whichever is smaller. This ensures\n * that items that are larger than the size of the viewport are always able to\n * trigger the intersection at any threshold (0, 0.5 or 1).\n */\nfunction calculatedIntersection(intersectionRect: DOMRectReadOnly, boundingClientRect: DOMRectReadOnly): number {\n\t// Don't divide by 0.\n\tif (boundingClientRect.height === 0) return 0\n\treturn intersectionRect.height / Math.min(boundingClientRect.height, safeWindow.innerHeight)\n}\n\nfunction isIntersectingWithThreshold(\n\t{ boundingClientRect, intersectionRect, isIntersecting }: IntersectionObserverEntry,\n\tthreshold: number,\n) {\n\t// If the element is scaled to 0, return true if the element is\n\t// intersecting. The observer is capable of determining this.\n\tif (boundingClientRect.height === 0) return isIntersecting\n\treturn isIntersecting && calculatedIntersection(intersectionRect, boundingClientRect) >= threshold\n}\n", "import type { RefObject } from \"react\"\nimport { createContext, useContext } from \"react\"\nimport type { MutableRefCallback } from \"../components/utils/refHelper.ts\"\nimport { useRefEffect } from \"../components/utils/refHelper.ts\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { noop } from \"../utils/utils.ts\"\n\ntype IntersectionObserverSingleCallback = (entry: IntersectionObserverEntry, observer: IntersectionObserver) => void\n\nclass SharedIntersectionObserver {\n\t// Note: we don\u2019t want to use #-style private fields here because (as of esbuild 0.17)\n\t// they leave non-tree-shakeable symbols in the bundle: https://framer-team.slack.com/archives/C05V49Q4NJ2/p1715653184830179\n\tprivate sharedIntersectionObserver\n\tprivate callbacks = new WeakMap<Element, IntersectionObserverSingleCallback>()\n\n\tconstructor(options: IntersectionObserverInit) {\n\t\tthis.sharedIntersectionObserver = new IntersectionObserver(this.intersectionObserverCallback.bind(this), options)\n\t}\n\n\tprivate intersectionObserverCallback(entries: IntersectionObserverEntry[], observer: IntersectionObserver) {\n\t\tfor (const entry of entries) {\n\t\t\tconst callbackForElement = this.callbacks.get(entry.target)\n\t\t\tif (callbackForElement) callbackForElement(entry, observer)\n\t\t}\n\t}\n\n\tobserveElementWithCallback(element: HTMLElement, callback: IntersectionObserverSingleCallback) {\n\t\tif (!this.sharedIntersectionObserver) return\n\t\tthis.sharedIntersectionObserver.observe(element)\n\t\tthis.callbacks.set(element, callback)\n\t}\n\n\tunobserve(element: HTMLElement) {\n\t\tif (!this.sharedIntersectionObserver) return\n\t\tthis.sharedIntersectionObserver.unobserve(element)\n\t\tthis.callbacks.delete(element)\n\t}\n\tget root() {\n\t\treturn this.sharedIntersectionObserver?.root\n\t}\n}\n\ntype SharedObserverMap = Map<string, SharedIntersectionObserver>\nexport const SharedIntersectionObserverContext = /* @__PURE__ */ createContext<SharedObserverMap>(new Map())\n\ninterface IntersectionObserverOptions {\n\troot?: RefObject<Element | Document> | null\n\trootMargin?: string\n\tthreshold?: number | number[]\n\tenabled?: boolean\n}\n\nexport function observeElement(\n\tobservers: SharedObserverMap,\n\tkey: string,\n\telement: HTMLElement,\n\troot: RefObject<Element | Document> | null | undefined,\n\tcallback: IntersectionObserverSingleCallback,\n\trootMargin?: string,\n\tthreshold?: number | number[],\n) {\n\tlet observer = observers.get(key)\n\tif (!observer || observer.root !== root?.current) {\n\t\tobserver = new SharedIntersectionObserver({ root: root?.current, rootMargin, threshold })\n\t\tobservers.set(key, observer)\n\t}\n\n\tobserver.observeElementWithCallback(element, callback)\n\treturn () => {\n\t\tobserver.unobserve(element)\n\t}\n}\n\n/**\n * This hook returns a ref callback that can be used to observe an element.\n * It returns a cleanup function that should be called when `element` becomes `null`.\n *\n * @important Does not re-register the observer if options or callback changes.\n * @internal\n */\nfunction _useSharedIntersectionObserver(\n\tref: MutableRefCallback<HTMLElement>,\n\tcallback: IntersectionObserverSingleCallback,\n\toptions: IntersectionObserverOptions,\n) {\n\tconst key = useConstant(() => `${options.rootMargin}`)\n\tconst observers = useContext(SharedIntersectionObserverContext)\n\tconst { enabled, root, rootMargin, threshold } = options\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: observers are static\n\tuseRefEffect(\n\t\tref,\n\t\t(element: HTMLElement | null) => {\n\t\t\tif (!enabled) return\n\t\t\t// we don't want to re-run on cleanup. We return a cleanup function.\n\t\t\tif (element === null) return\n\n\t\t\treturn observeElement(observers, key, element, root, callback, rootMargin, threshold)\n\t\t},\n\t\t[enabled, callback, root, rootMargin, threshold],\n\t)\n}\n\n/**\n * If the client doesn't support the Intersection Observer we can save some performance.\n * @internal\n */\nexport const useSharedIntersectionObserver =\n\ttypeof IntersectionObserver === \"undefined\" ? noop : _useSharedIntersectionObserver\n", "import type * as React from \"react\"\nimport { useRef } from \"react\"\nimport { useMemoOne } from \"../../utils/useMemoOne.ts\"\nimport { isFunction, isObject } from \"../../utils/utils.ts\"\nimport { useConstant } from \"./useConstant.ts\"\n\n/**\n * Sets the ref to the given value or calls any ref functions.\n */\nexport function setRef<T>(ref: MaybeRef<T>, value: T) {\n\tif (isFunction(ref)) {\n\t\tref(value)\n\t} else if (isMutableRef(ref)) {\n\t\tref.current = value\n\t}\n}\n\nexport function isMutableRef<T>(ref: MaybeRef<T | null>): ref is React.MutableRefObject<T | null> {\n\treturn isObject(ref) && \"current\" in ref\n}\n\nexport function refHasValue<T>(ref: MaybeRef<T | null>): ref is React.MutableRefObject<T> {\n\treturn isMutableRef(ref) && ref.current !== null\n}\n\nexport type Ref<T> = React.MutableRefObject<T> | React.LegacyRef<T>\nexport type MaybeRef<T> = Ref<T> | undefined | null\n\ntype MaybeCleanup = ReturnType<Parameters<typeof React.useEffect>[0]>\ntype RefCallbackEffect<T> = (instance: T | null) => MaybeCleanup\n\n/**\n * @private only use `MutableRefCallback`.\n */\ninterface IRefWithCallback<T> extends React.MutableRefObject<T> {\n\tobserve: (fn: RefCallbackEffect<T>) => void\n\tunobserve: (fn: RefCallbackEffect<T> | undefined) => void\n\t// this tagged type ensures only the correct ref is passed to useRefEffect; a whitespace at the beginning hides it from autocomplete.\n\treadonly \" tag\": \"RefWithCallback\"\n}\n\nexport type MutableRefCallback<T> = IRefWithCallback<T | null>\n\nfunction useStableRefWithObserver<T>() {\n\t// TODO: In some cases, we only pass one callback (e.g. Link), so having a set and map is an overhead. If we ever need to optimize for memory, this is a starting point.\n\tconst callbacks = useConstant(() => new Set<RefCallbackEffect<T>>())\n\tconst cleanups = useConstant(() => new Map<RefCallbackEffect<T>, MaybeCleanup>())\n\n\treturn useConstant(\n\t\t() =>\n\t\t\t(ref: React.MutableRefObject<T | null>, refCallback?: React.RefCallback<T>): MutableRefCallback<T> => {\n\t\t\t\treturn {\n\t\t\t\t\tget current(): T | null {\n\t\t\t\t\t\treturn ref.current\n\t\t\t\t\t},\n\t\t\t\t\tset current(value) {\n\t\t\t\t\t\tif (value === ref.current) return // React doesn't execute callbacks if the value stays the same.\n\t\t\t\t\t\tref.current = value\n\n\t\t\t\t\t\t// If passed, we call the callback ref first to match native React behavior:\n\t\t\t\t\t\t// it calls from children to parents. https://codesandbox.io/p/sandbox/react-ref-order-raf-4wfcx4?file=/src/App.js\n\t\t\t\t\t\t// TODO: With React 19, ref callbacks can return a cleanup. When upgrading, we should add the returned cleanup to the `cleanups` map.\n\t\t\t\t\t\tif (refCallback) refCallback(value)\n\n\t\t\t\t\t\t// TODO: With React 19, we should rather return this as the cleanup fn instead.\n\t\t\t\t\t\t// We run the cleanups first whenever the ref changes.\n\t\t\t\t\t\tcleanups.forEach((cleanup, callback) => {\n\t\t\t\t\t\t\tif (cleanup) {\n\t\t\t\t\t\t\t\tcleanup()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcallback(null)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\tif (value === null) {\n\t\t\t\t\t\t\t// Ensure there are no dangling cleanups / callbacks after unmount.\n\t\t\t\t\t\t\tcleanups.clear()\n\t\t\t\t\t\t\tcallbacks.clear()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcallbacks.forEach(callback => {\n\t\t\t\t\t\t\tconst cleanup = callback(value)\n\t\t\t\t\t\t\tcleanups.set(callback, cleanup)\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 * Adds `fn` to the list of callbacks to be called when the ref is updated.\n\t\t\t\t\t * Executes `fn` immediately if the ref already has a value.\n\t\t\t\t\t */\n\t\t\t\t\tobserve(fn: RefCallbackEffect<T | null>) {\n\t\t\t\t\t\tcallbacks.add(fn)\n\n\t\t\t\t\t\t// If the ref has a value, we call the callback immediately.\n\t\t\t\t\t\tconst value = ref.current\n\t\t\t\t\t\tif (value) {\n\t\t\t\t\t\t\tconst cleanup = fn(value)\n\t\t\t\t\t\t\tcleanups.set(fn, cleanup)\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 * Removes `fn` from the list of callbacks.\n\t\t\t\t\t * Runs the cleanup for `fn` if it has been called before.\n\t\t\t\t\t */\n\t\t\t\t\tunobserve(fn: RefCallbackEffect<T | null> | undefined) {\n\t\t\t\t\t\tif (!fn) return\n\n\t\t\t\t\t\tcallbacks.delete(fn)\n\t\t\t\t\t\tif (!cleanups.has(fn)) return\n\n\t\t\t\t\t\tconst cleanupFn = cleanups.get(fn)\n\t\t\t\t\t\tif (cleanupFn) {\n\t\t\t\t\t\t\tcleanupFn()\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfn(null)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcleanups.delete(fn)\n\t\t\t\t\t},\n\t\t\t\t} as MutableRefCallback<T>\n\t\t\t},\n\t)\n}\n\n/**\n * Returns a ref-look-alike (current can be read and set as refs returned from `useRef`), but also allows multiple callbacks to be registered.\n * @see {@link useRefEffect} for a way to use the callback\n */\nexport function useObserverRef<T>(forwardedRef: MaybeRef<T>): MutableRefCallback<T> {\n\tconst fallbackRef = useRef<T | null>(null)\n\tconst createStableRefWithObserver = useStableRefWithObserver<T>()\n\n\t// The forwarded ref can have different shapes in React: MutableRef (objects), ref callback (functions), undefined (none passed). We need to handle all of them here:\n\t// Note: `forwardedRef` is stable. So we return a constant ref, too.\n\treturn useConstant(() => {\n\t\t// Case A: the ref is a mutable ref (object). We use it to store the node + attach a callback.\n\t\tif (isMutableRef(forwardedRef)) return createStableRefWithObserver(forwardedRef)\n\n\t\t// Case B: ref callback (function). We use the fallback ref to store the node + forward the provided ref callback.\n\t\t// TODO: We could assign a symbol to the returned observer ref and then check for that here to avoid creating nested observer refs.\n\t\tif (isFunction(forwardedRef)) return createStableRefWithObserver(fallbackRef, forwardedRef)\n\n\t\t// Case C: no ref provided\n\t\t// Some HOCs use forwarded refs to manipulate the DOM directly, so we need to return a ref object instead of a ref callback to allow for them to work.\n\t\treturn createStableRefWithObserver(fallbackRef)\n\t})\n}\n\n/**\n * Use this hook as replacement for `use(Layout)Effect` when dealing with refs in HOCs.\n * This is required, as `useEffect`s might run before the ref is attached (e.g. when a child is a Link component).\n *\n * Lifecycle:\n * - Callbacks are executed *before* (regular) layout effects. So if you want to replace `useEffect`, use the await-interaction-response pattern (so that it awaits a paint).\n * - `ref.current` updates (non-null): re-runs `effect`\n * - `ref.current` becomes null (on unmount): runs cleanup\n *\n * Cleanup if `effect` has at least run once:\n * - If `effect` it returned a function: the returned fn is called with `undefined` as parameter.\n * - If `effect` it returned undefined: `effect` is called with `null` as parameter.\n *\n * `deps` change: cleanup runs first, then the effect.\n *\n * @param ref Must stay a stable {@link useObserverRef} across renders.\n * @param effect Must be pure (calling effect+cleanup twice should yield the same result as calling it once). Not needed to be wrapped in `useCallback`.\n */\nexport function useRefEffect<T>(\n\tref: MutableRefCallback<T> | undefined,\n\teffect: RefCallbackEffect<T | null>,\n\tdeps?: React.DependencyList,\n): void {\n\tconst effectRef = useRef<RefCallbackEffect<T | null>>()\n\t// undefined on first call, and then used as a flag to know if we need to call the effect again\n\tconst depsChangedRef = useRef<undefined | boolean>()\n\n\tuseMemoOne(\n\t\t() => {\n\t\t\t// On initial call, we don't want to update the flag\n\t\t\t// This ensures we know depsChangedRef is only called when the deps change\n\t\t\tif (depsChangedRef.current !== undefined) {\n\t\t\t\tdepsChangedRef.current = true\n\t\t\t}\n\n\t\t\t// Mirrors useEffect() without deps by using a new object\n\t\t},\n\t\tdeps ?? [{}],\n\t)\n\n\tif (!ref) return\n\n\tconst depsChanged = depsChangedRef.current\n\tif (depsChanged === false) return\n\n\t// `depsChangedRef` should always be false after every invocation, as it is used as a local flag to check if deps have changed in *this* invocation.\n\t// Initially, it is `undefined`, so on first call, this activates the dependency tracking.\n\tdepsChangedRef.current = false\n\n\tref.unobserve(effectRef.current) // use(Layout)Effect runs the cleanup first when deps change, so we also run the cleanup first.\n\tref.observe(effect) // Register the next effect closure and run effect if ref has a value.\n\teffectRef.current = effect\n}\n", "import type {\n\tIProjectionNode,\n\tSwitchLayoutGroupContext as SwitchLayoutGroupContextType,\n\tTransition,\n} from \"framer-motion\"\nimport { SwitchLayoutGroupContext } from \"framer-motion\"\nimport React, { Component } from \"react\"\nimport type { SharedLayoutContextProps } from \"./SharedLayoutRoot.tsx\"\nimport { SharedLayoutContext, TREE_ROOT_ID } from \"./SharedLayoutRoot.tsx\"\n\n/**\n * @internal\n */\nexport interface LayoutTreeProps {\n\t/**\n\t * Mark the tree as being the lead tree. The lead tree in the NavigationStack will perform a\n\t * shared layout animation if `animatesLayout` is true.\n\t */\n\tisLead?: boolean\n\t/**\n\t * Mark the tree as being removed.\n\t * For example if the parent NavigationContainer is being removed, or is simulating removal.\n\t */\n\tisExiting?: boolean\n\t/**\n\t * If there is an overlay visible.\n\t */\n\tisOverlayed?: boolean\n\t/**\n\t * If performing a layout animation, use this transition.\n\t */\n\ttransition?: Transition\n\t/**\n\t * Should updating `isLead` to `true` trigger a shared layout animation.\n\t */\n\tanimatesLayout?: boolean\n\tchildren?: React.ReactNode\n\tid?: string\n}\n\ninterface ContextLayoutTreeProps extends LayoutTreeProps {\n\tsharedLayoutContext: SharedLayoutContextProps\n}\n\n/**\n * @internal\n */\nexport class LayoutTree extends Component<ContextLayoutTreeProps> {\n\t/**\n\t * SharedLayoutTrees need to reset the projections styles previously applied\n\t * on their boxes if they are becoming lead but not animating.\n\t */\n\tlayoutMaybeMutated: boolean = false\n\n\t/**\n\t * A list of projection nodes in the tree\n\t */\n\tprojectionNodes = new Map<string, IProjectionNode>()\n\n\t/**\n\t * The projection node with the smallest depth in the tree's children.\n\t */\n\trootProjectionNode?: IProjectionNode\n\n\t/**\n\t * When a tree is tagged as being removed, either by usePresence, or by\n\t * Navigation, we set it on `this` in shouldComponentUpdate so that it's\n\t * accessible by SharedLayoutRoot before the LayoutTree has updated.\n\t */\n\tisExiting?: boolean\n\n\toverride componentDidMount() {\n\t\t/**\n\t\t * Nodes are automatically promoted in Motion when they mount. We need\n\t\t * to let SharedLayoutRoot know about the first lead without scheduling\n\t\t * a promotion.\n\t\t */\n\t\tif (this.props.isLead) {\n\t\t\tthis.props.sharedLayoutContext.initLead(this, !!this.props.animatesLayout)\n\t\t}\n\t}\n\n\toverride shouldComponentUpdate(nextProps: ContextLayoutTreeProps) {\n\t\tconst { isLead, isExiting, isOverlayed, animatesLayout, transition, sharedLayoutContext } = nextProps\n\t\tthis.isExiting = isExiting\n\t\t/**\n\t\t * Since Navigation wraps it's child NavigationContainers in a NavigationContainer,\n\t\t * we need to ensure that we don't prevent updates if we are not handling layout animations.\n\t\t */\n\t\tif (isLead === undefined) return true\n\n\t\tconst hasBecomeLead = !this.props.isLead && isLead\n\t\tconst hasExitBeenCancelled = this.props.isExiting && !isExiting\n\t\tconst shouldPromote = hasBecomeLead || hasExitBeenCancelled\n\t\tconst shouldDemote = !!this.props.isLead && !isLead\n\t\tconst overlayChanged = this.props.isOverlayed !== isOverlayed\n\n\t\tif (shouldPromote || shouldDemote) {\n\t\t\tthis.projectionNodes.forEach(projection => projection?.willUpdate())\n\t\t}\n\n\t\tif (shouldPromote) {\n\t\t\tsharedLayoutContext.schedulePromoteTree(this, transition, !!animatesLayout)\n\t\t} else if (overlayChanged) {\n\t\t\t/**\n\t\t\t * When performing an overlay transition, we block the layout update\n\t\t\t * in Motion, but we don't promote the tree since the lead doesn't\n\t\t\t * change. Therefore, we still need to schedule a didUpdate manually\n\t\t\t * to unblock the layout update for the next layout animation.\n\t\t\t */\n\t\t\tsharedLayoutContext.scheduleProjectionDidUpdate()\n\t\t}\n\n\t\treturn !!shouldPromote && !!animatesLayout\n\t}\n\n\tshouldPreserveFollowOpacity = (child: IProjectionNode) => {\n\t\treturn child.options.layoutId === TREE_ROOT_ID && !this.props.isExiting\n\t}\n\n\tswitchLayoutGroupContext: SwitchLayoutGroupContextType = {\n\t\tregister: child => this.addChild(child),\n\t\tderegister: child => this.removeChild(child),\n\t\t// Configs to use for the initial promotion on mount in Motion\n\t\ttransition: this.props.isLead !== undefined && this.props.animatesLayout ? this.props.transition : undefined,\n\t\tshouldPreserveFollowOpacity: this.shouldPreserveFollowOpacity,\n\t}\n\n\taddChild(child: IProjectionNode): void {\n\t\tconst layoutId = child.options.layoutId\n\n\t\tif (layoutId) {\n\t\t\tthis.projectionNodes.set(layoutId, child)\n\t\t\tthis.setRootChild(child)\n\t\t}\n\t}\n\n\t/**\n\t * As children are added, make sure that `this.rootProjectionNode` is always the\n\t * child with the smallest depth.\n\t */\n\tsetRootChild(child: IProjectionNode) {\n\t\tif (!this.rootProjectionNode) return (this.rootProjectionNode = child)\n\n\t\tthis.rootProjectionNode = this.rootProjectionNode.depth < child.depth ? this.rootProjectionNode : child\n\t}\n\n\tremoveChild(child: IProjectionNode) {\n\t\tconst layoutId = child.options.layoutId\n\n\t\tif (layoutId) {\n\t\t\tthis.projectionNodes.delete(layoutId)\n\t\t}\n\t}\n\n\toverride render() {\n\t\treturn (\n\t\t\t<SwitchLayoutGroupContext.Provider value={this.switchLayoutGroupContext}>\n\t\t\t\t{this.props.children}\n\t\t\t</SwitchLayoutGroupContext.Provider>\n\t\t)\n\t}\n}\n\nexport const SharedLayoutTree = (props: LayoutTreeProps) => {\n\tconst sharedLayoutContext = React.useContext(SharedLayoutContext)\n\treturn <LayoutTree {...props} sharedLayoutContext={sharedLayoutContext} />\n}\n", "import React, { useContext } from \"react\"\n\n/**\n * @internal\n */\nexport const NavigationContainerContext = /* @__PURE__ */ React.createContext<boolean>(true)\n\n/**\n * Used to know if a code component is a child of the current screen.\n * This can be useful for resetting timers or interactions that need to trigger on every navigation.\n * @public\n */\nexport function useIsInCurrentNavigationTarget() {\n\t// isInCurrentNavigationTarget is `true` if the NavigationContainerContext at the root of each screen is the current screen.\n\tconst isInCurrentNavigationTarget = useContext(NavigationContainerContext)\n\n\treturn isInCurrentNavigationTarget\n}\n", "import type React from \"react\"\nimport { createContext, useCallback, useContext, useEffect, useRef } from \"react\"\nimport { isFunction } from \"../utils/utils.ts\"\nimport { useMap } from \"./utils/useMap.ts\"\n\ntype Cleanup = () => void\n// biome-ignore lint/suspicious/noConfusingVoidType: has been like this for 4 years\ntype IsCurrentCallback = (isCurrent: boolean, isOverlayed: boolean) => void | Cleanup\n\nconst NavigationTargetContext = /* @__PURE__ */ createContext<{\n\tregister: (fn: IsCurrentCallback) => void\n\tderegister: (fn: IsCurrentCallback) => void\n}>({ register: () => {}, deregister: () => {} })\n\ntype Props = React.PropsWithChildren<{ isCurrent: boolean; isOverlayed: boolean }>\n\n/**\n * @internal\n *\n * Run the registered callback when the current navigation target changes\n * @param isCurrent If the ground node is present as the current target in the preview\n */\nexport const NavigationTargetWrapper = ({ isCurrent, isOverlayed, children }: Props) => {\n\tconst callbacks = useMap<IsCurrentCallback, Cleanup | undefined>()\n\n\tconst register = useCallback(\n\t\t(fn: IsCurrentCallback) => {\n\t\t\tif (callbacks.has(fn)) {\n\t\t\t\t// Should never happen\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: intentional\n\t\t\t\tconsole.warn(\"NavigationTargetWrapper: already registered\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcallbacks.set(fn, undefined)\n\t\t},\n\t\t[callbacks /* constant, so should never change */],\n\t)\n\n\tconst deregister = useCallback(\n\t\t(fn: IsCurrentCallback) => {\n\t\t\t// Cleanup before removing the callback\n\t\t\tconst cleanup = callbacks.get(fn)\n\t\t\tcleanup?.()\n\t\t\tcallbacks.delete(fn)\n\t\t},\n\t\t[callbacks /* constant, so should never change */],\n\t)\n\n\tconst value = useRef({ register, deregister }).current\n\n\tuseEffect(() => {\n\t\tcallbacks.forEach((_, cb) => {\n\t\t\tconst newCleanup = cb(isCurrent, isOverlayed)\n\t\t\tcallbacks.set(cb, isFunction(newCleanup) ? newCleanup : undefined)\n\t\t})\n\t\treturn () => {\n\t\t\tcallbacks.forEach((cleanup, cb) => {\n\t\t\t\tif (!cleanup) return\n\t\t\t\t// Cleanup and remove cleanup callback so we never call it more than once\n\t\t\t\tcleanup()\n\t\t\t\tcallbacks.set(cb, undefined)\n\t\t\t})\n\t\t}\n\t}, [isCurrent, isOverlayed, callbacks /* constant, so should never change */])\n\n\treturn <NavigationTargetContext.Provider value={value}>{children}</NavigationTargetContext.Provider>\n}\n\n/**\n * @internal\n *\n * Register the callback on mount to the NavigationTargetWrapper, deregister it on unmount.\n * The callback will be fired when the current target changes. The callback allows a cleanup callback to be returned.\n * The cleanup will fire before the next update and on unmount.\n * @param callback A callback that receives the `isCurrent` state of the NavigateTargetWrapper\n * @param deps If present, callback will be renewed when the dependencies change.\n */\nexport function useOnCurrentTargetChange(callback: IsCurrentCallback, deps: React.DependencyList = []) {\n\tconst { register, deregister } = useContext(NavigationTargetContext)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: callback should not change while previewing\n\tuseEffect(() => {\n\t\tif (!callback) return\n\t\tregister(callback)\n\t\treturn () => deregister(callback)\n\t}, [register, deregister, ...deps])\n}\n", "import { useConstant } from \"./useConstant.ts\"\n\nfunction newMap<K, V>() {\n\treturn new Map<K, V>()\n}\n\n/** Returns a constant instance of a Map */\nexport function useMap<K, V>() {\n\treturn useConstant<Map<K, V>>(newMap)\n}\n", "import { createContext } from \"react\"\nimport type { NavigationInterface } from \"./Navigation.tsx\"\nimport { navigatorMock } from \"./NavigatorMock.tsx\"\n\n/**\n * @internal\n */\nexport const NavigationContext = /* @__PURE__ */ createContext<NavigationInterface>(navigatorMock)\n", "import { warnOnce } from \"../utils/warnOnce.ts\"\nimport type { NavigationInterface } from \"./Navigation.tsx\"\n\nclass NavigatorMock implements NavigationInterface {\n\twarning = () => {\n\t\twarnOnce(\"The Navigator API is only available inside of Framer: https://www.framer.com/\")\n\t}\n\n\tgoBack = () => this.warning()\n\tinstant = () => this.warning()\n\tfade = () => this.warning()\n\tpush = () => this.warning()\n\tmodal = () => this.warning()\n\toverlay = () => this.warning()\n\tflip = () => this.warning()\n\tcustomTransition = () => this.warning()\n\tmagicMotion = () => this.warning()\n}\n\n/**\n * @internal\n */\nexport const navigatorMock = /* @__PURE__ */ new NavigatorMock()\n", "import type { Transition } from \"framer-motion\"\nimport type { FrameLayoutProperties, FrameProps } from \"../render/presentation/Frame/index.tsx\"\n\n/**\n * @public\n */\nexport type NavigationTransitionSide = \"left\" | \"right\" | \"top\" | \"bottom\"\n\n/**\n * @public\n */\nexport type NavigationTransitionPosition = Partial<\n\tPick<FrameLayoutProperties, \"top\" | \"right\" | \"bottom\" | \"left\" | \"center\">\n>\n\n/**\n * @public\n */\nexport interface NavigationTransitionAnimation {\n\t/**\n\t * The animation defaults.\n\t */\n\tanimation?: Transition\n}\n\n/**\n * @public\n */\nexport interface NavigationTransitionBackdropColor {\n\t/**\n\t * Defines the backdrop color when the incoming screen is rendered over the current context. Defaults to the iOS dim color.\n\t */\n\tbackdropColor?: string\n}\n\n/**\n * @public\n */\nexport interface NavigationTransitionAppearsFrom extends NavigationTransitionAnimation {\n\t/**\n\t * Defines which side the target will appear from.\n\t * @remarks\n\t *\n\t * - `\"left\"`\n\t * - `\"right\"`\n\t * - `\"top\"`\n\t * - `\"bottom\"`\n\t */\n\tappearsFrom?: NavigationTransitionSide\n}\n\n/**\n * @public\n */\nexport type FadeTransitionOptions = NavigationTransitionAnimation\n\n/**\n * @public\n */\nexport interface PushTransitionOptions extends NavigationTransitionAnimation, NavigationTransitionAppearsFrom {}\n\n/**\n * @public\n */\nexport interface ModalTransitionOptions extends NavigationTransitionAnimation, NavigationTransitionBackdropColor {}\n\n/**\n * @public\n */\nexport interface OverlayTransitionOptions\n\textends NavigationTransitionAnimation, NavigationTransitionAppearsFrom, NavigationTransitionBackdropColor {}\n\n/**\n * @public\n */\nexport interface FlipTransitionOptions extends NavigationTransitionAnimation, NavigationTransitionAppearsFrom {}\n\n/**\n * Can be used to define a custom navigation transition.\n * @public\n */\nexport interface NavigationTransition extends NavigationTransitionAnimation, NavigationTransitionBackdropColor {\n\t/**\n\t * Defines the begin state of the incoming screen wrapper.\n\t */\n\tenter?: Partial<FrameProps>\n\t/**\n\t * Defines the end state of the outgoing screen wrapper.\n\t */\n\texit?: Partial<FrameProps>\n\t/**\n\t * Defines the position and size of the incoming screen wrapper. Defaults to top, right, bottom, and left of 0.\n\t */\n\tposition?: NavigationTransitionPosition\n\t/**\n\t * Defines whether the incoming screen should render over the current context, like an overlay or modal. Defaults to false.\n\t */\n\toverCurrentContext?: boolean\n\t/**\n\t * Defines whether a tap in the background should dismiss the screen presented over the current context. Defaults to true.\n\t */\n\tgoBackOnTapOutside?: boolean\n\t/**\n\t * Defines whether the backface of the incoming and outgoing screens should be visible, necessary for certain 3D transitions. Defaults to true.\n\t */\n\tbackfaceVisible?: boolean\n\t/**\n\t * Defines whether the incoming and outgoing screens should auto animate their children. Defaults to false.\n\t */\n\twithMagicMotion?: boolean\n}\n\n/**\n * @internal\n */\nexport const TransitionDefaults = {\n\tFade: {\n\t\texit: { opacity: 0 },\n\t\tenter: { opacity: 0 },\n\t} satisfies NavigationTransition,\n\n\tPushLeft: {\n\t\texit: { x: \"-30%\" },\n\t\tenter: { x: \"100%\" },\n\t} satisfies NavigationTransition,\n\n\tPushRight: {\n\t\texit: { x: \"30%\" },\n\t\tenter: { x: \"-100%\" },\n\t} satisfies NavigationTransition,\n\n\tPushUp: {\n\t\texit: { y: \"-30%\" },\n\t\tenter: { y: \"100%\" },\n\t} satisfies NavigationTransition,\n\n\tPushDown: {\n\t\texit: { y: \"30%\" },\n\t\tenter: { y: \"-100%\" },\n\t} satisfies NavigationTransition,\n\n\tInstant: {\n\t\tanimation: { type: false },\n\t\tenter: { opacity: 0 },\n\t} satisfies NavigationTransition,\n\n\tModal: {\n\t\toverCurrentContext: true,\n\t\tgoBackOnTapOutside: true,\n\t\tposition: { center: true },\n\t\tenter: { opacity: 0, scale: 1.2 },\n\t} satisfies NavigationTransition,\n\n\tOverlayLeft: {\n\t\toverCurrentContext: true,\n\t\tgoBackOnTapOutside: true,\n\t\tposition: { right: 0, top: 0, bottom: 0 },\n\t\tenter: { x: \"100%\" },\n\t} satisfies NavigationTransition,\n\n\tOverlayRight: {\n\t\toverCurrentContext: true,\n\t\tgoBackOnTapOutside: true,\n\t\tposition: { left: 0, top: 0, bottom: 0 },\n\t\tenter: { x: \"-100%\" },\n\t} satisfies NavigationTransition,\n\n\tOverlayUp: {\n\t\toverCurrentContext: true,\n\t\tgoBackOnTapOutside: true,\n\t\tposition: { bottom: 0, left: 0, right: 0 },\n\t\tenter: { y: \"100%\" },\n\t} satisfies NavigationTransition,\n\n\tOverlayDown: {\n\t\toverCurrentContext: true,\n\t\tgoBackOnTapOutside: true,\n\t\tposition: { top: 0, left: 0, right: 0 },\n\t\tenter: { y: \"-100%\" },\n\t} satisfies NavigationTransition,\n\n\tFlipLeft: {\n\t\tbackfaceVisible: false,\n\t\texit: { rotateY: -180 },\n\t\tenter: { rotateY: 180 },\n\t} satisfies NavigationTransition,\n\n\tFlipRight: {\n\t\tbackfaceVisible: false,\n\t\texit: { rotateY: 180 },\n\t\tenter: { rotateY: -180 },\n\t} satisfies NavigationTransition,\n\n\tFlipUp: {\n\t\tbackfaceVisible: false,\n\t\texit: { rotateX: 180 },\n\t\tenter: { rotateX: -180 },\n\t} satisfies NavigationTransition,\n\n\tFlipDown: {\n\t\tbackfaceVisible: false,\n\t\texit: { rotateX: -180 },\n\t\tenter: { rotateX: 180 },\n\t} satisfies NavigationTransition,\n\n\tMagicMotion: {\n\t\twithMagicMotion: true,\n\t} satisfies NavigationTransition,\n} as const\n\n/**\n * @internal\n */\nexport function pushTransition(options: NavigationTransitionAppearsFrom | undefined): NavigationTransition {\n\tconst side: NavigationTransitionSide = options && options.appearsFrom ? options.appearsFrom : \"right\"\n\tswitch (side) {\n\t\tcase \"right\":\n\t\t\treturn TransitionDefaults.PushLeft\n\t\tcase \"left\":\n\t\t\treturn TransitionDefaults.PushRight\n\t\tcase \"bottom\":\n\t\t\treturn TransitionDefaults.PushUp\n\t\tcase \"top\":\n\t\t\treturn TransitionDefaults.PushDown\n\t}\n}\n\n/**\n * @internal\n */\nexport function overlayTransition(options: NavigationTransitionAppearsFrom | undefined): NavigationTransition {\n\tconst side: NavigationTransitionSide = options && options.appearsFrom ? options.appearsFrom : \"bottom\"\n\tswitch (side) {\n\t\tcase \"right\":\n\t\t\treturn TransitionDefaults.OverlayLeft\n\t\tcase \"left\":\n\t\t\treturn TransitionDefaults.OverlayRight\n\t\tcase \"bottom\":\n\t\t\treturn TransitionDefaults.OverlayUp\n\t\tcase \"top\":\n\t\t\treturn TransitionDefaults.OverlayDown\n\t}\n}\n\n/**\n * @internal\n */\nexport function flipTransition(options: NavigationTransitionAppearsFrom | undefined): NavigationTransition {\n\tconst side: NavigationTransitionSide = options && options.appearsFrom ? options.appearsFrom : \"bottom\"\n\tswitch (side) {\n\t\tcase \"right\":\n\t\t\treturn TransitionDefaults.FlipLeft\n\t\tcase \"left\":\n\t\t\treturn TransitionDefaults.FlipRight\n\t\tcase \"bottom\":\n\t\t\treturn TransitionDefaults.FlipUp\n\t\tcase \"top\":\n\t\t\treturn TransitionDefaults.FlipDown\n\t}\n}\n", "import type { Transition } from \"framer-motion\"\nimport type React from \"react\"\nimport { asRecord } from \"../utils/asRecord.ts\"\nimport { assert } from \"../utils/assert.ts\"\nimport { objectKeys } from \"../utils/objectKeys.ts\"\nimport { isObject, isString } from \"../utils/utils.ts\"\nimport { allAnimatableProperties } from \"./NavigationContainer.tsx\"\nimport type { NavigationTransition } from \"./NavigationTransitions.ts\"\n\n/**\n * @internal\n */\nexport interface NavigationState {\n\t/** The index of the currently visible container. */\n\tcurrent: number\n\t/** The index of the last visible container. */\n\tprevious: number\n\t/** The index of the currently visible overlay. */\n\tcurrentOverlay: number\n\t/** The index of the last visible overlay. */\n\tpreviousOverlay: number\n\t/** An array of HistoryItems who's components are rendered as overlays. */\n\toverlayStack: HistoryItem[]\n\t/**\n\t * A reference to the last transition used when adding screens with magic motion.\n\t * Used to ensure the correct transition is used when navigating back.\n\t */\n\tpreviousTransition: NavigationTransition | null\n\t/**\n\t * An array of HistoryItems that records the order containers are navigated to,\n\t * the transitions used for each navigation, and the visual index the container was rendered at.\n\t * Used to enable navigating backwards through the history.\n\t */\n\thistory: HistoryItem[]\n\t/**\n\t * A record mapping a container's `key` to the component rendered by a container.\n\t * Used to stably render a single instance of each component.\n\t * The visual order is determined by `containerIndex` and `containerVisualIndex`.\n\t * Whether or not a container is the visible screen is determined by whether or not\n\t * the value of the container's `containerIndex` matches the value of `current`.\n\t */\n\tcontainers: Record<ContainerKey, React.ReactNode>\n\t/**\n\t * A record mapping a container's `key` to the current index of the container in the history.\n\t * Used to associated a single component with multiple transitions or positions in the stack.\n\t */\n\tcontainerIndex: Record<ContainerKey, number>\n\t/**\n\t * A record mapping a container's `key` to the current visual index of the container in the history.\n\t * This can sometimes differ from `containerIndex` when we navigate to an existing navigation target with a magic motion transition,\n\t * when it will be lower than the `containerIndex`. This enables smarter layering during magic motion transitions.\n\t */\n\tcontainerVisualIndex: Record<ContainerKey, number>\n\t/**\n\t * A record mapping a container's `key` to whether the container should appear to be removed by a magic motion transition.\n\t * Usually this is only true for containers that have been navigated away from by removing them.\n\t * Sometimes this is true when a container has been navigated away from by navigating forward to an existing container with magic motion.\n\t * This ensures that an animation plays in both these scenarios.\n\t */\n\tcontainerIsRemoved: Record<ContainerKey, boolean>\n\t/**\n\t * A record mapping a container's `key` to the most recent sequenced animation it should appear to animate in or out with.\n\t * This record is not updated unless the container is the `current` or `previous` screen, to ensure running animations play out.\n\t */\n\ttransitionForContainer: Record<ContainerKey, Record<string, any>>\n\t/**\n\t * When we navigate away from a container by removing it with magic motion, sometimes we cannot mark a container as removed to trigger an animation, as it was already removed.\n\t * In that scenario we need to increment it's visual index to trigger an animation, even though we are navigating backwards through history. For that we need to track a\n\t * visual index that is incremented while traveling backwards.\n\t */\n\tvisualIndex: number\n\t/** Used to generate unique overlay ids. */\n\toverlayItemId: number\n\t/** Used to generate unique history ids in the scenario where a React component is not provided, for example via code. */\n\thistoryItemId: number\n}\n\nexport const defaultState = (): NavigationState => ({\n\tcurrent: -1,\n\tprevious: -1,\n\tcurrentOverlay: -1,\n\tpreviousOverlay: -1,\n\n\tvisualIndex: 0,\n\toverlayItemId: 0,\n\thistoryItemId: 0,\n\n\thistory: [],\n\toverlayStack: [],\n\n\tcontainers: {},\n\tcontainerIndex: {},\n\tcontainerVisualIndex: {},\n\tcontainerIsRemoved: {},\n\ttransitionForContainer: {},\n\n\tpreviousTransition: null,\n})\n\n/**\n * @internal\n */\nexport interface StackState {\n\tcurrent: number\n\tprevious: number\n\thistory: HistoryItem[]\n}\n\n/**\n * @internal\n */\ntype ContainerKey = string\n\n/**\n * @internal\n */\nexport interface HistoryItem {\n\tkey: ContainerKey\n\ttransition: NavigationTransition\n\tcomponent?: React.ReactNode\n\tvisualIndex?: number\n}\n\n/**\n * @internal\n */\nexport function isPartialHistoryItem(item: unknown): item is Omit<HistoryItem, \"component\"> {\n\treturn !!item && isObject(item) && isString(item.key)\n}\n\n/**\n * @internal\n */\nexport type NavigationAction =\n\t| {\n\t\t\ttype: \"add\"\n\t\t\tkey: ContainerKey\n\t\t\ttransition: NavigationTransition\n\t\t\tcomponent: React.ReactNode\n\t  }\n\t| { type: \"addOverlay\"; transition: NavigationTransition; component: React.ReactNode }\n\t| { type: \"remove\" }\n\t| { type: \"removeOverlay\" }\n\t| { type: \"update\"; key: ContainerKey; component: React.ReactNode }\n\t| { type: \"back\" }\n\t| { type: \"forward\" }\n\n/**\n * @internal\n */\nexport function reduceNavigationStateForAction(\n\tstate: NavigationState,\n\taction: NavigationAction,\n): NavigationState | undefined {\n\tswitch (action.type) {\n\t\tcase \"addOverlay\":\n\t\t\treturn addOverlay(state, action.transition, action.component)\n\t\tcase \"removeOverlay\":\n\t\t\treturn removeOverlay(state)\n\t\tcase \"add\":\n\t\t\treturn add(state, action.key, action.transition, action.component)\n\t\tcase \"remove\":\n\t\t\treturn remove(state)\n\t\tcase \"update\":\n\t\t\treturn updateComponent(state, action.key, action.component)\n\t\tcase \"back\":\n\t\t\treturn back(state)\n\t\tcase \"forward\":\n\t\t\treturn forward(state)\n\t\tdefault:\n\t\t\treturn\n\t}\n}\n\nfunction updateComponent(currentState: NavigationState, key: ContainerKey, component: React.ReactNode) {\n\treturn {\n\t\t...currentState,\n\t\tcontainers: {\n\t\t\t...currentState.containers,\n\t\t\t[key]: component,\n\t\t},\n\t}\n}\n\n/**\n * Add a new navigation target as an overlay.\n */\nfunction addOverlay(currentState: NavigationState, transition: NavigationTransition, component: React.ReactNode) {\n\tconst currentOverlay = currentState.overlayStack[currentState.currentOverlay]\n\n\tif (currentOverlay && currentOverlay.component === component) return\n\n\tconst overlayItemId = currentState.overlayItemId + 1\n\tconst overlayStack = [\n\t\t...currentState.overlayStack,\n\t\t{\n\t\t\tkey: `stack-${overlayItemId}`,\n\t\t\tcomponent,\n\t\t\ttransition,\n\t\t},\n\t]\n\treturn {\n\t\t...currentState,\n\t\toverlayStack,\n\t\toverlayItemId,\n\t\tcurrentOverlay: Math.max(0, Math.min(currentState.currentOverlay + 1, overlayStack.length - 1)),\n\t\tpreviousOverlay: currentState.currentOverlay,\n\t}\n}\n\n/**\n * Dismiss all overlays.\n */\nfunction removeOverlay(currentState: NavigationState) {\n\treturn {\n\t\t...currentState,\n\t\toverlayStack: [],\n\t\tcurrentOverlay: -1,\n\t\tpreviousOverlay: currentState.currentOverlay,\n\t}\n}\n\n/** Navigate to a new or existing navigation target with an animated transition. */\nfunction add(\n\tcurrentState: NavigationState,\n\tkey: ContainerKey,\n\ttransition: NavigationTransition,\n\tcomponent: React.ReactNode,\n) {\n\tif (!currentState.containers[key]) currentState.containers[key] = component\n\n\t// Restart history from current, erasing navigations that we have \"gone back\" from.\n\t// It's ok to mutate currentState because we always return a copy so there is no risk of mutations between actions.\n\tcurrentState.history = currentState.history.slice(0, currentState.current + 1)\n\tcurrentState.visualIndex = Math.max(currentState.history.length, 0)\n\n\tconst currentItem = currentState.history[currentState.history.length - 1]\n\tconst isCurrentScreen = currentItem && currentItem.key === key\n\n\t// In the rare case where a navigation from an overlay, to the screen under the overlay is triggered,\n\t// just dismiss the overlay.\n\tcurrentState.overlayStack = []\n\tif (isCurrentScreen && currentState.currentOverlay > -1) {\n\t\treturn {\n\t\t\t...currentState,\n\t\t\tcurrentOverlay: -1,\n\t\t\tpreviousOverlay: currentState.currentOverlay,\n\t\t}\n\t}\n\n\t// Don't push the same screen twice.\n\tif (isCurrentScreen) return\n\n\t// Calculate whether magic motion transitions should appear as if they are navigating backwards.\n\tconst nextIndex = currentState.containerVisualIndex[key]\n\tconst removed = currentState.containerIsRemoved[key]\n\tconst shouldMoveForward =\n\t\tcurrentItem?.key && transition.withMagicMotion\n\t\t\t? isNextTargetForward(key, nextIndex, removed, currentState.history)\n\t\t\t: true\n\n\tcurrentState.history.push({\n\t\tkey,\n\t\ttransition,\n\t\tvisualIndex: shouldMoveForward ? Math.max(currentState.visualIndex, 0) : currentState.containerVisualIndex[key],\n\t})\n\n\tconst current = currentState.current + 1\n\tconst previous = currentState.current\n\n\t// If we've gone backwards through history, but are now navigating forwards again,\n\t// we need to ensure that there are no clashing indexes from previous forward navigations\n\t// stored in the `containerIndex` record by setting clashes to their most recent history index.\n\tfor (const containerKey in currentState.containerIndex) {\n\t\tif (currentState.containerIndex[containerKey] === current) {\n\t\t\tcurrentState.containerIndex[containerKey] = findLatestHistoryIndex(containerKey, currentState.history)\n\t\t}\n\t}\n\n\tcurrentState.containerIndex[key] = current\n\n\tconst { containerVisualIndex, containerIsRemoved } = magicMotionPropsForAdd(currentState, key, shouldMoveForward)\n\n\tconst transitionForContainer = updateTransitions(\n\t\tcurrent,\n\t\tprevious,\n\t\tcurrentState.history,\n\t\tcurrentState.containerIndex,\n\t\tcurrentState.transitionForContainer,\n\t)\n\n\treturn {\n\t\t...currentState,\n\t\tcurrent,\n\t\tprevious,\n\t\tcontainerVisualIndex,\n\t\tcontainerIsRemoved,\n\t\ttransitionForContainer,\n\t\tpreviousTransition: null,\n\t\tcurrentOverlay: -1,\n\t\thistoryItemId: currentState.historyItemId + 1,\n\t\tpreviousOverlay: currentState.currentOverlay,\n\t}\n}\n\n/**\n * @FIXME -- This simple function supports browser back by not removing pages.\n * This allows subsequent forward actions to navigate to an already mounted\n * component. This may have unintended effects when interacting with magic\n * motion however. Since magic motion between framer web pages will have dubious\n * value, this hasn't been implemented.\n */\nfunction back(currentState: NavigationState) {\n\tconst containers = { ...currentState.containers }\n\tconst nextState = remove(currentState)\n\tif (!nextState) return\n\n\tnextState.containers = containers\n\treturn nextState\n}\n\nfunction forward(currentState: NavigationState) {\n\tconst nextItem = currentState.history[currentState.current + 1]\n\tif (!nextItem) return\n\tconst { key, transition, component } = nextItem\n\n\tconst history = [...currentState.history]\n\tconst nextState = add(currentState, key, transition, component)\n\tif (!nextState) return\n\n\tnextState.history = history\n\n\treturn nextState\n}\n\n/**\n * Navigate away from the screen that was most recently navigated to, to the previous screen.\n * Animations will play in reverse.\n */\nfunction remove(currentState: NavigationState) {\n\tconst history = [...currentState.history.slice(0, currentState.current + 1)]\n\n\t// Don't remove the last component.\n\tif (history.length === 1) return\n\n\tconst currentItem = history.pop()\n\tif (!currentItem) return\n\n\tconst target = history[history.length - 1]\n\tassert(target, \"The navigation history must have at least one component\")\n\t// Ensure the target container is updated to be layered under the current container.\n\t// If it has been previously navigated away from, it will need to be updated.\n\t// It's ok to mutate currentState because we always return a copy so there is no risk of mutations between actions.\n\tcurrentState.containerIndex[target.key] = history.length - 1\n\n\tconst shouldRemoveContainer = history.every(item => item.key !== currentItem.key)\n\tif (shouldRemoveContainer) {\n\t\t// Remove the container from the cache, triggering it's removal from the DOM.\n\t\tdelete currentState.containers[currentItem.key]\n\t}\n\n\tconst current = currentState.current - 1\n\tconst previous = currentState.current\n\n\tconst { containerIsRemoved, containerVisualIndex, previousTransition, visualIndex } = magicMotionPropsForRemove(\n\t\tcurrentState,\n\t\ttarget,\n\t\tcurrentItem,\n\t)\n\n\tconst transitionForContainer = updateTransitions(\n\t\tcurrent,\n\t\tprevious,\n\t\tcurrentState.history,\n\t\tcurrentState.containerIndex,\n\t\tcurrentState.transitionForContainer,\n\t)\n\n\treturn {\n\t\t...currentState,\n\t\tcurrent,\n\t\tprevious,\n\t\tcontainerIsRemoved,\n\t\tcontainerVisualIndex,\n\t\tpreviousTransition,\n\t\tvisualIndex,\n\t\ttransitionForContainer,\n\t}\n}\n\n/**\n * When transitioning forwards to an existing container, update navigation state to optimize magic motion sequences.\n * In cases where we are about to navigate to a screen we have already navigated to with a magic motion transition,\n * we optimize the animation experience by simulating a back transition to solve layering issues.\n */\nfunction magicMotionPropsForAdd(currentState: NavigationState, nextKey: ContainerKey, shouldMoveForward: boolean) {\n\tconst update: Pick<NavigationState, \"containerVisualIndex\" | \"containerIsRemoved\"> = {\n\t\tcontainerVisualIndex: { ...currentState.containerVisualIndex },\n\t\tcontainerIsRemoved: { ...currentState.containerIsRemoved },\n\t}\n\n\tif (shouldMoveForward) {\n\t\t// If we have calculated that the transition should appear to move forward, the default behavior,\n\t\t// we update properties on the current and target component to animate it in.\n\t\t// Ensuring it's a valid target for measurements, and that it is not removed.\n\t\tupdate.containerVisualIndex[nextKey] = currentState.history.length - 1\n\t\tupdate.containerIsRemoved[nextKey] = false\n\t} else {\n\t\t// If we have calculated that the transition should appear to move backwards, to optimize for magic motion layering,\n\t\t// we need to set all components visited since visiting the target as removed,\n\t\t// and also ensure that components visited since visiting the target, that are not the outgoing screen,\n\t\t// can not provide bounding boxes when calculating the magic motion transition.\n\t\tconst nextVisualIndex = currentState.containerVisualIndex[nextKey]\n\t\tfor (const [key, visualIndex] of Object.entries(currentState.containerVisualIndex)) {\n\t\t\tif (nextVisualIndex !== undefined && visualIndex > nextVisualIndex) {\n\t\t\t\tupdate.containerIsRemoved[key] = true\n\t\t\t}\n\t\t}\n\t}\n\n\treturn update\n}\n\n/**\n * When transitioning back to a previous container, update navigation state to optimize magic motion sequences.\n * In cases where we have navigated forward via magic motion transitions that appear to add and remove screens,\n * while continuing to add to the history, we need to replicate the opposite navigations when transitioning back.\n */\nfunction magicMotionPropsForRemove(currentState: NavigationState, target: HistoryItem, currentItem: HistoryItem) {\n\t// Ensure the current and next components are valid magic motion targets.\n\tconst validTargets = [target.key, currentItem.key]\n\tconst nextValidTarget = currentState.history[currentState.history.length - 2]\n\tconst previousTransition = currentState.previousTransition === null ? null : { ...currentState.previousTransition }\n\n\tconst update: Pick<\n\t\tNavigationState,\n\t\t\"containerIsRemoved\" | \"containerVisualIndex\" | \"previousTransition\" | \"visualIndex\"\n\t> = {\n\t\tcontainerIsRemoved: { ...currentState.containerIsRemoved },\n\t\tcontainerVisualIndex: { ...currentState.containerVisualIndex },\n\t\tpreviousTransition,\n\t\tvisualIndex: currentState.visualIndex,\n\t}\n\n\t// Optionally prepare the next potential screen to as a valid magic motion target,\n\t// to ensure successive magic motion back transitions are already measured.\n\tif (nextValidTarget) validTargets.push(nextValidTarget.key)\n\n\t// Decide if we should appear to remove or add the next component by detecting if it was previously simulated as a backwards transition,\n\t// based on the differences between its visual index, and what its visual index should be if it hadn't been simulated as a backwards transition.\n\tconst targetVisualIndex = currentState.containerVisualIndex[target.key]\n\tconst currentVisualIndex = currentState.containerVisualIndex[currentItem.key]\n\n\tconst shouldRemoveLastKey =\n\t\t(targetVisualIndex !== undefined && currentVisualIndex !== undefined && targetVisualIndex <= currentVisualIndex) ||\n\t\t(target.visualIndex !== undefined && target.visualIndex < currentState.history.length - 1)\n\n\tconst nextIndex = target.visualIndex\n\tif (shouldRemoveLastKey) {\n\t\t// Set the last key to be removed, and set the next keys visualIndex to what it was set to last time we were at this point in history.\n\t\t// This is the normal behaviour when transitioning backwards.\n\t\tupdate.containerIsRemoved[currentItem.key] = true\n\t\tupdate.containerVisualIndex[target.key] = nextIndex !== undefined ? nextIndex : currentState.history.length - 1\n\t} else {\n\t\t// If we shouldn't remove the last key, we need to simulate a forward transition.\n\t\t// We do this by incrementing the visualIndex counter, and update the next items visual index to trigger an animation.\n\t\tupdate.visualIndex = currentState.visualIndex + 1\n\t\tupdate.containerVisualIndex[target.key] = currentState.visualIndex + 1\n\t}\n\n\t// If a transition is with magic motion, we save the transition properties to pass to AnimateSharedLayout.\n\tif (currentItem.transition.withMagicMotion) update.previousTransition = currentItem.transition || null\n\n\t// The new current component should never appear to be removed.\n\tcurrentState.containerIsRemoved[target.key] = false\n\n\treturn update\n}\n\nfunction findLatestHistoryIndex(key: ContainerKey, history: HistoryItem[]) {\n\tfor (let index = history.length; index > history.length; index--) {\n\t\tif (history[index]?.key === key) return index\n\t}\n\n\treturn -1\n}\n\nfunction updateTransitions(\n\tcurrent: number,\n\tprevious: number,\n\thistory: NavigationState[\"history\"],\n\tcontainerIndex: NavigationState[\"containerIndex\"],\n\ttransitionForContainer: NavigationState[\"transitionForContainer\"],\n) {\n\t// Set or update the transition for a container if it becomes the current or previous screen.\n\t// We don't update if the container is not the current or previous Screen, to allow running animations to play out.\n\tconst transitions = { ...transitionForContainer }\n\tfor (const [key, screenIndex] of Object.entries(containerIndex)) {\n\t\tconst transition = transitionForScreen(screenIndex, { current, previous, history })\n\t\tif (transition) {\n\t\t\ttransitions[key] = transition\n\t\t}\n\t}\n\n\treturn transitions\n}\n\nfunction isNextTargetForward(\n\tkey: ContainerKey,\n\tindex: number | undefined,\n\tremoved: boolean | undefined,\n\thistory: HistoryItem[],\n) {\n\t// If the target layer is currently removed, or a brand new layer that\n\t// doesn't have a visual index, we always move forward to it.\n\tif (removed || index === undefined) return true\n\n\t// A target layer that is visually 0 indexed will always be the first in the stack.\n\tif (index === 0) return false\n\n\t// Go forward if the next instance of the target is forward from the current visual index.\n\tconst forwardHistory = history.slice(index, history.length)\n\tif (forwardHistory.findIndex(item => item.key === key) > -1) return true\n\n\t// Bo backwards if the next instance is backwards from the current visual index.\n\tconst backwardsHistory = history.slice(0, index - 1)\n\tif (backwardsHistory.findIndex(item => item.key === key) > -1) return false\n\n\t// By default transitions appear to transition forwards.\n\treturn true\n}\n\nfunction transitionForScreen(screenIndex: number, stackState: StackState) {\n\tconst { current, previous, history } = stackState\n\n\t// If a screen has already exited, or entered and is underneath the stack,\n\t// don't update it's animation, allowing any current animations to play out.\n\tif (screenIndex !== current && screenIndex !== previous) return undefined\n\n\t// Entering going forward\n\tif (screenIndex === current && current > previous) {\n\t\tconst item = history[screenIndex]\n\t\treturn sequence(\"enter\", item?.transition.enter, item?.transition.animation)\n\t}\n\n\t// Exiting going forward\n\tif (screenIndex === previous && current > previous) {\n\t\tconst item = history[screenIndex + 1]\n\t\treturn sequence(\"exit\", item?.transition.exit, item?.transition.animation)\n\t}\n\n\t// Entering going backwards\n\tif (screenIndex === current && current < previous) {\n\t\tconst item = history[screenIndex + 1]\n\t\treturn sequence(\"enter\", item?.transition.exit, item?.transition.animation)\n\t}\n\n\t// Exiting going backwards\n\tif (screenIndex === previous && current < previous) {\n\t\tconst item = history[screenIndex]\n\t\treturn sequence(\"exit\", item?.transition.enter, item?.transition.animation)\n\t}\n}\n\nconst allAnimatableKeys = /* @__PURE__ */ objectKeys(allAnimatableProperties)\nfunction sequence(direction: \"enter\" | \"exit\", transition?: any, animation?: Transition) {\n\tconst value: typeof allAnimatableProperties = {}\n\tconst from: Record<string, unknown> = {}\n\n\t// Create an identity animation.\n\tallAnimatableKeys.forEach(property => {\n\t\tvalue[property] = allAnimatableProperties[property]\n\t\tfrom[property] = {\n\t\t\t...animation,\n\t\t\tfrom: allAnimatableProperties[property],\n\t\t}\n\t})\n\n\t// If a transition is provided, add the desired transition properties to the identity animation.\n\tif (transition) {\n\t\tObject.keys(transition).forEach(property => {\n\t\t\tif (transition[property] === undefined) return\n\n\t\t\tconst transitionTo = transition[property]\n\t\t\tconst transitionFrom =\n\t\t\t\ttypeof transition[property] === \"string\"\n\t\t\t\t\t? `${asRecord(allAnimatableProperties)[property]}%`\n\t\t\t\t\t: asRecord(allAnimatableProperties)[property]\n\n\t\t\tasRecord(value)[property] = direction === \"enter\" ? transitionFrom : transitionTo\n\t\t\tfrom[property] = {\n\t\t\t\t...animation,\n\t\t\t\tfrom: direction === \"enter\" ? transitionTo : transitionFrom,\n\t\t\t\tvelocity: 0,\n\t\t\t}\n\t\t})\n\t}\n\n\t// Always return at least the identity animation.\n\treturn {\n\t\t...value,\n\t\ttransition: {\n\t\t\t...from,\n\t\t},\n\t}\n}\n", "import hoistNonReactStatic from \"hoist-non-react-statics\"\nimport React from \"react\"\nimport type {\n\tNavigationTransitionBackdropColor,\n\tNavigationTransitionSide,\n} from \"../../components/NavigationTransitions.ts\"\nimport type { NavigationTransitionDirection } from \"../../render/types/NavigationLink.ts\"\nimport { NavigationTransitionType } from \"../../render/types/NavigationLink.ts\"\nimport { NavigationContext } from \"../NavigationContext.ts\"\n\n/**\n * @internal\n * @deprecated - Will be replaced. Use navigation action instead.\n */\nexport function WithNavigator<T, BaseProps extends React.ClassAttributes<T>>(\n\tBaseComponent: React.ComponentType<BaseProps & { onTap?: any }>,\n\tnavigationTransition: string,\n\tnavigationTransitionDirection: NavigationTransitionDirection,\n\tNavigationTarget: (() => React.ReactNode) | undefined,\n\tnavigationTransitionOptions?: NavigationTransitionBackdropColor,\n): React.ComponentClass<BaseProps> {\n\tconst InternalWithNavigator = class extends React.Component<BaseProps> {\n\t\toverride render() {\n\t\t\treturn (\n\t\t\t\t<NavigationContext.Consumer>\n\t\t\t\t\t{navigation => {\n\t\t\t\t\t\tconst navigate = () => {\n\t\t\t\t\t\t\tif (navigationTransition === \"goBack\") {\n\t\t\t\t\t\t\t\tnavigation.goBack()\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!NavigationTarget) return\n\n\t\t\t\t\t\t\tconst component = NavigationTarget()\n\t\t\t\t\t\t\tconst appearsFrom = transitionDirectionToSide(navigationTransitionDirection)\n\n\t\t\t\t\t\t\tswitch (navigationTransition) {\n\t\t\t\t\t\t\t\tcase NavigationTransitionType.instant:\n\t\t\t\t\t\t\t\t\tnavigation.instant(component)\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tcase NavigationTransitionType.fade:\n\t\t\t\t\t\t\t\t\tnavigation.fade(component)\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tcase NavigationTransitionType.modal:\n\t\t\t\t\t\t\t\t\tnavigation.modal(component, navigationTransitionOptions)\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tcase NavigationTransitionType.push:\n\t\t\t\t\t\t\t\t\tnavigation.push(component, { appearsFrom })\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tcase NavigationTransitionType.overlay:\n\t\t\t\t\t\t\t\t\tnavigation.overlay(component, {\n\t\t\t\t\t\t\t\t\t\t...navigationTransitionOptions,\n\t\t\t\t\t\t\t\t\t\tappearsFrom,\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tcase NavigationTransitionType.flip:\n\t\t\t\t\t\t\t\t\tnavigation.flip(component, { appearsFrom })\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tcase NavigationTransitionType.magicMotion:\n\t\t\t\t\t\t\t\t\tnavigation.magicMotion(component, {})\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Invoke the component\u2019s normal onTap handler as well as the navigation function.\n\t\t\t\t\t\tconst { onTap, ...props } = this.props as any\n\t\t\t\t\t\tif (onTap) {\n\t\t\t\t\t\t\tprops.onTap = (...args: unknown[]) => {\n\t\t\t\t\t\t\t\tonTap.apply(this, args)\n\t\t\t\t\t\t\t\tnavigate.apply(this, args)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tprops.onTap = navigate\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn <BaseComponent {...props} />\n\t\t\t\t\t}}\n\t\t\t\t</NavigationContext.Consumer>\n\t\t\t)\n\t\t}\n\t}\n\n\thoistNonReactStatic(InternalWithNavigator, BaseComponent)\n\treturn InternalWithNavigator\n}\n\n// Convert deprecated transitionDirection to transitionSide\nfunction transitionDirectionToSide(direction: NavigationTransitionDirection): NavigationTransitionSide {\n\tswitch (direction) {\n\t\tcase \"left\":\n\t\t\treturn \"right\"\n\t\tcase \"right\":\n\t\t\treturn \"left\"\n\t\tcase \"up\":\n\t\t\treturn \"bottom\"\n\t\tcase \"down\":\n\t\t\treturn \"top\"\n\t}\n}\n", "import type { NavigationTransitionBackdropColor } from \"../../components/NavigationTransitions.ts\"\n\n/**\n * @internal\n * @deprecated\n */\nexport enum NavigateTo {\n\tPrevious = \"@Previous\",\n}\n\n/**\n * @internal\n * @deprecated\n */\nexport type NavigationTarget = string | NavigateTo.Previous\n\n/**\n * @internal\n * @deprecated\n */\nexport enum NavigationTransitionType {\n\tpush = \"push\",\n\tinstant = \"instant\",\n\tfade = \"fade\",\n\tmodal = \"modal\",\n\toverlay = \"overlay\",\n\tflip = \"flip\",\n\tmagicMotion = \"magicMotion\",\n}\n\n/**\n * @internal\n * @deprecated\n */\nexport type NavigationTransitionDirection = \"left\" | \"right\" | \"up\" | \"down\"\n\n/**\n * @internal\n * @deprecated\n */\nexport interface NavigationLink {\n\tnavigationTarget: NavigationTarget\n\tnavigationTransition: NavigationTransitionType\n\tnavigationTransitionDirection: NavigationTransitionDirection\n\tnavigationTransitionOverrides?: NavigationTransitionBackdropColor\n}\n", "/**\n * @public\n * @deprecated Since Framer Motion 5 AnimateSharedLayout is no longer required for shared layout transitions.\n * You can use the `layoutId` prop and components will animate from one to another.\n * If you need to group components that affect each other's layout or scope shared layout animation, consider using `LayoutGroup` instead.\n */\nexport const AnimateSharedLayout = (props: any) => props.children\n", "import type { RefObject } from \"react\"\nimport type React from \"react\"\nimport { forwardRef } from \"react\"\nimport type { WithEventsProperties } from \"../../../components/hoc/WithEvents.tsx\"\nimport { WithEvents } from \"../../../components/hoc/WithEvents.tsx\"\nimport { deprecatedParentSize, useParentSize } from \"../../types/NewConstraints.tsx\"\nimport type { Size } from \"../../types/Size.ts\"\nimport type { DeprecatedCoreFrameProps } from \"./DeprecatedFrame.tsx\"\nimport { DeprecatedFrame } from \"./DeprecatedFrame.tsx\"\nimport type { FrameProps } from \"./FrameWithMotion.tsx\"\nimport { FrameWithMotion } from \"./FrameWithMotion.tsx\"\nimport { isDeprecatedFrameProps } from \"./isDeprecatedFrameProps.ts\"\n// Re-exports\nexport type { DeprecatedCoreFrameProps, DeprecatedFrameProperties } from \"./DeprecatedFrame.tsx\"\nexport type { FrameProps } from \"./FrameWithMotion.tsx\"\nexport type { BaseFrameProps, CSSTransformProperties, FrameLayoutProperties, VisualProperties } from \"./types.ts\"\n\n// Public types\n/** @public */\nexport type DeprecatedFrameWithEventsProps = DeprecatedCoreFrameProps & WithEventsProperties\n/** @public */\nexport const DeprecatedFrameWithEvents: React.ComponentClass<Partial<DeprecatedFrameWithEventsProps>> =\n\t/* @__PURE__ */\n\tWithEvents(DeprecatedFrame)\n\n// const isPreview = RenderEnvironment.target === RenderTarget.preview\n\n// We need switcher component to useContext without conditions\n// THIS SHOULD NOT BE USED DIRECTLY IN LIBRARY NOR IN VEKTER\n// Only for backwards compatibility\n/** @public */\nexport const Frame = /* @__PURE__ */ (() => {\n\tconst FrameInner = forwardRef(function FrameInner(props: Partial<FrameProps>, ref: RefObject<HTMLDivElement> | null) {\n\t\tconst parentSize = useParentSize()\n\t\tif (isDeprecatedFrameProps(props)) {\n\t\t\tconst currentParentSize: Size | null = props.parentSize || deprecatedParentSize(parentSize)\n\n\t\t\t// We use here DeprecatedFrame WithEvents for simplicity\n\t\t\t//\n\t\t\t// @ts-expect-error forwardRef must return a forwardRef component, which\n\t\t\t// DeprecatedFrameWithEvents is not. It's only here for backwards compatibility, when we\n\t\t\t// did not have the ref prop, so it should be fine to ignore this error.\n\t\t\treturn <DeprecatedFrameWithEvents {...props} parentSize={currentParentSize} />\n\t\t}\n\t\treturn <FrameWithMotion {...props} ref={ref} />\n\t})\n\n\t// NOTE: Required for performance tests, see RenderPerformance.test.ts\n\tFrameInner[\"displayName\"] = \"Frame\"\n\n\treturn FrameInner\n})()\n", "import hoistNonReactStatic from \"hoist-non-react-statics\"\nimport React from \"react\"\nimport { FramerEvent } from \"../../events/FramerEvent.ts\"\nimport { DraggingContext } from \"./WithDragging.tsx\"\n\nexport type EventHandler = (event: FramerEvent) => void\n\nexport interface WithPanHandlers {\n\tonPanStart: EventHandler\n\tonPan: EventHandler\n\tonPanEnd: EventHandler\n}\n\nexport interface WithTapHandlers {\n\tonTapStart: EventHandler\n\tonTap: EventHandler\n\tonTapEnd: EventHandler\n}\n\nexport interface WithMouseHandlers {\n\tonMouseDown: EventHandler\n\tonClick: EventHandler\n\tonMouseUp: EventHandler\n\tonMouseEnter: EventHandler\n\tonMouseLeave: EventHandler\n}\n\nexport interface WithMouseWheelHandler {\n\tonMouseWheelStart: EventHandler\n\tonMouseWheel: EventHandler\n\tonMouseWheelEnd: EventHandler\n}\n\nexport interface WithEventsProperties\n\textends WithPanHandlers, WithTapHandlers, WithMouseHandlers, WithMouseWheelHandler {}\n\nexport interface WithElement {\n\telement: HTMLElement | null\n}\n\nexport interface MayHaveStyle {\n\tstyle?: React.CSSProperties\n}\n\nconst hoverProps = {\n\tonMouseEnter: \"mouseenter\",\n\tonMouseLeave: \"mouseleave\",\n}\n\nconst hoverEventKeys = /* @__PURE__ */ Object.keys(hoverProps)\n\ntype HoverEventPropKey = keyof typeof hoverProps\n\ntype PointerEventHandler = (e: MouseEvent | TouchEvent) => void\n\nconst eventHandlerMapping = {\n\tpanstart: [\"onPanStart\"],\n\tpan: [\"onPan\"],\n\tpanend: [\"onPanEnd\"],\n\ttapstart: [\"onTapStart\", \"onMouseDown\"],\n\ttap: [\"onTap\", \"onClick\"],\n\ttapend: [\"onTapEnd\", \"onMouseUp\"],\n\tmousewheelstart: [\"onMouseWheelStart\"],\n\tmousewheel: [\"onMouseWheel\"],\n\tmousewheelend: [\"onMouseWheelEnd\"],\n} as const\n\nconst tapEventKeys = new Set([\"tapstart\", \"tap\", \"tapend\"])\n\nexport function WithEvents<\n\tT,\n\tBaseProps extends React.ClassAttributes<T> & Partial<WithEventsProperties> & MayHaveStyle,\n>(BaseComponent: React.ComponentType<BaseProps>): React.ComponentClass<BaseProps & Partial<WithEventsProperties>> {\n\ttype BaseComponentTypeRef = React.RefObject<typeof BaseComponent & WithElement & MayHaveStyle>\n\n\tconst withEvents = class WithEventsHOC extends React.Component<BaseProps> {\n\t\tstatic defaultProps = Object.assign({}, BaseComponent.defaultProps as BaseProps)\n\n\t\t// This local variable is used to track if we should ignore a tap after a drag\n\t\t// It's not in a state because we want to change it from the render function (so not cause a render)\n\t\tshouldCancelTap = false\n\n\t\tactiveEventListeners = new Map<HoverEventPropKey, PointerEventHandler>()\n\n\t\tget element() {\n\t\t\treturn this.component.current && this.component.current.element\n\t\t}\n\n\t\tprivate hasFramerEventListener: boolean = false\n\n\t\tcomponent: BaseComponentTypeRef = React.createRef()\n\n\t\toverride componentDidMount() {\n\t\t\tthis.addEventListeners()\n\t\t}\n\n\t\toverride componentDidUpdate(prevProps: BaseProps) {\n\t\t\tthis.addEventListeners(prevProps)\n\t\t}\n\n\t\toverride componentWillUnmount() {\n\t\t\tthis.removeEventListeners()\n\t\t}\n\n\t\taddEventListeners(prevProps?: BaseProps) {\n\t\t\tif (this.element && !this.hasFramerEventListener) {\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: TODO: Fix this\n\t\t\t\tthis.element.addEventListener(\"FramerEvent\", ({ detail }: any) => {\n\t\t\t\t\tconst type = detail.type as keyof typeof eventHandlerMapping\n\t\t\t\t\tconst framerEvent = detail.event as FramerEvent\n\t\t\t\t\tthis.handleEvent(type, framerEvent)\n\t\t\t\t})\n\n\t\t\t\thoverEventKeys.forEach((eventName: HoverEventPropKey) => this.addHoverEvent(eventName))\n\n\t\t\t\tthis.hasFramerEventListener = true\n\t\t\t} else if (this.element && prevProps) {\n\t\t\t\thoverEventKeys.forEach((eventName: HoverEventPropKey) => this.checkHoverEvent(eventName, prevProps))\n\t\t\t} else if (!this.element) {\n\t\t\t\tthis.hasFramerEventListener = false\n\t\t\t}\n\t\t}\n\n\t\tremoveEventListeners() {\n\t\t\thoverEventKeys.forEach((eventName: HoverEventPropKey) => this.removeHoverEvent(eventName))\n\t\t}\n\n\t\taddHoverEvent(eventName: HoverEventPropKey) {\n\t\t\tconst originalEventListener = this.props[eventName]\n\n\t\t\tif (this.element && originalEventListener) {\n\t\t\t\tconst eventListener = (e: MouseEvent | TouchEvent) => {\n\t\t\t\t\tconst framerEvent = new FramerEvent(e)\n\t\t\t\t\toriginalEventListener(framerEvent)\n\t\t\t\t}\n\n\t\t\t\tthis.activeEventListeners.set(eventName, eventListener)\n\t\t\t\tconst domEventName = hoverProps[eventName]\n\t\t\t\tthis.element.addEventListener(domEventName, eventListener)\n\t\t\t}\n\t\t}\n\n\t\tremoveHoverEvent(eventName: HoverEventPropKey) {\n\t\t\tconst eventListener = this.activeEventListeners.get(eventName)\n\n\t\t\tif (this.element && eventListener) {\n\t\t\t\tconst domEventName = hoverProps[eventName]\n\t\t\t\tthis.element.removeEventListener(domEventName, eventListener)\n\t\t\t\tthis.activeEventListeners.delete(eventName)\n\t\t\t}\n\t\t}\n\n\t\tcheckHoverEvent(eventName: HoverEventPropKey, prevProps: BaseProps) {\n\t\t\tif (prevProps[eventName] !== this.props[eventName]) {\n\t\t\t\tthis.removeHoverEvent(eventName)\n\t\t\t\tthis.addHoverEvent(eventName)\n\t\t\t}\n\t\t}\n\n\t\thandleEvent(type: keyof typeof eventHandlerMapping, framerEvent: FramerEvent) {\n\t\t\tconst eventListenerKeys = eventHandlerMapping[type]\n\t\t\tif (!eventListenerKeys) return\n\n\t\t\teventListenerKeys.forEach(eventKey => {\n\t\t\t\tconst eventListener = this.props[eventKey]\n\t\t\t\tconst cancelEvent = this.shouldCancelTap && tapEventKeys.has(eventKey)\n\n\t\t\t\tif (eventListener && !cancelEvent) {\n\t\t\t\t\teventListener(framerEvent)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\toverride render() {\n\t\t\treturn (\n\t\t\t\t<DraggingContext.Consumer>\n\t\t\t\t\t{(value: { dragging: boolean }) => {\n\t\t\t\t\t\tthis.shouldCancelTap = value.dragging\n\t\t\t\t\t\treturn <BaseComponent {...this.props} ref={this.component} />\n\t\t\t\t\t}}\n\t\t\t\t</DraggingContext.Consumer>\n\t\t\t)\n\t\t}\n\t}\n\n\thoistNonReactStatic(withEvents, BaseComponent)\n\treturn withEvents\n}\n", "import { safeWindow } from \"../utils/safeWindow.ts\"\n\ndeclare class WebKitPoint {\n\tx: number\n\ty: number\n\tconstructor(x: number, y: number)\n}\n\ndeclare global {\n\tinterface Window {\n\t\tWebKitPoint?: typeof WebKitPoint\n\t\twebkitConvertPointFromPageToNode?(node: Node, pt: WebKitPoint): WebKitPoint\n\t}\n}\n\nexport interface EventLike {\n\tpageX: number\n\tpageY: number\n\ttarget: EventTarget | null\n}\n\nexport function pointForEvent(event: EventLike, customTarget: EventTarget | null = null): { x: number; y: number } {\n\tlet target: HTMLElement | undefined\n\n\tif (customTarget instanceof HTMLElement) {\n\t\ttarget = customTarget\n\t}\n\n\tif (!target && event.target instanceof HTMLElement) {\n\t\ttarget = event.target\n\t}\n\n\tif (!target) {\n\t\treturn { x: event.pageX, y: event.pageY }\n\t}\n\n\t// Safari\n\tif (typeof safeWindow.webkitConvertPointFromPageToNode === \"function\") {\n\t\t// biome-ignore lint/style/noNonNullAssertion: it exists if the `in` check is true\n\t\tlet webkitPoint = new safeWindow.WebKitPoint!(event.pageX, event.pageY) // eslint-disable-line framer-studio/tscompat -- We check for support via the `typeof` check.\n\t\twebkitPoint = safeWindow.webkitConvertPointFromPageToNode(target, webkitPoint)\n\t\treturn { x: webkitPoint.x, y: webkitPoint.y }\n\t}\n\n\t// const t1 = performance.now()\n\n\t// All other browsers\n\t// TODO: This does not work with rotate yet\n\t// TODO: This doens't work with Chrome if the target is the Body tag.\n\tconst rect = target.getBoundingClientRect()\n\n\tconst width = parseFloat(target.style.width)\n\tconst height = parseFloat(target.style.height)\n\tconst scale = {\n\t\tx: width ? width / rect.width : 1,\n\t\ty: height ? height / rect.height : 1,\n\t}\n\n\tconst point = {\n\t\tx: scale.x * (event.pageX - rect.left - target.clientLeft + target.scrollLeft),\n\t\ty: scale.y * (event.pageY - rect.top - target.clientTop + target.scrollTop),\n\t}\n\n\treturn point\n}\n", "import { isTouch } from \"@framerjs/shared/src/environment.ts\"\nimport { MainLoop } from \"../core/Loop.ts\"\nimport { Point } from \"../render/types/Point.ts\"\nimport type { EventLike } from \"../utils/events.ts\"\nimport { pointForEvent } from \"../utils/events.ts\"\nimport type { FramerEventSession } from \"./FramerEventSession.ts\"\n\nexport type EventHandler = (event: FramerEvent) => void\n\n/**\n * @public\n */\nexport class FramerEvent {\n\t/**\n\t * @internal\n\t */\n\treadonly time = Date.now()\n\t/**\n\t * @internal\n\t */\n\treadonly loopTime = MainLoop.time\n\t/**\n\t * @internal\n\t */\n\treadonly point: Point\n\t/**\n\t * @internal\n\t */\n\treadonly devicePoint: Point\n\t/**\n\t * @internal\n\t */\n\treadonly target: EventTarget | null\n\t/**\n\t * @internal\n\t */\n\treadonly delta: Point\n\t/**\n\t * @internal\n\t */\n\tconstructor(\n\t\t/** @internal */ readonly originalEvent: MouseEvent | TouchEvent,\n\t\t/** @internal */ readonly session?: FramerEventSession,\n\t) {\n\t\tconst customTarget = (session && session.startEvent && session.startEvent.target) || originalEvent.target\n\t\tconst eventLike = FramerEvent.eventLikeFromOriginalEvent(originalEvent)\n\t\tthis.point = pointForEvent(eventLike, customTarget)\n\t\tconst deviceTarget = session && session.originElement ? session.originElement : document.body\n\t\tthis.devicePoint = pointForEvent(eventLike, deviceTarget)\n\t\tthis.target = originalEvent.target || null\n\t\tconst lastEvent = session && session.lastEvent\n\n\t\tif (originalEvent instanceof WheelEvent) {\n\t\t\tthis.delta = { x: originalEvent.deltaX, y: originalEvent.deltaY }\n\t\t} else if (lastEvent && this.devicePoint && lastEvent.devicePoint) {\n\t\t\tthis.delta = Point.subtract(this.devicePoint, lastEvent.devicePoint)\n\t\t} else {\n\t\t\tthis.delta = { x: 0, y: 0 }\n\t\t}\n\t}\n\n\tprivate static eventLikeFromOriginalEvent(originalEvent: MouseEvent | TouchEvent): EventLike {\n\t\tif (\"touches\" in originalEvent) {\n\t\t\t/* eslint-disable framer-studio/tscompat -- Safari desktop doesn't support TouchEvent. */\n\t\t\tlet touches = originalEvent.touches\n\n\t\t\tif (!touches || !touches.length) {\n\t\t\t\t// touchend events only have changed touches\n\t\t\t\tif (originalEvent.changedTouches && originalEvent.changedTouches.length) {\n\t\t\t\t\ttouches = originalEvent.changedTouches\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst firstTouch = touches[0]\n\t\t\tif (!touches || !firstTouch) {\n\t\t\t\treturn { pageX: 0, pageY: 0, target: null }\n\t\t\t}\n\t\t\t// We use the clientX first, because that one is not affected by the page's scrolling\n\t\t\t// (which influences the event position even if the body is position: fixed)\n\t\t\tconst pageX = firstTouch.clientX || firstTouch.screenX || firstTouch.pageX\n\t\t\tconst pageY = firstTouch.clientY || firstTouch.screenY || firstTouch.pageY\n\t\t\treturn {\n\t\t\t\tpageX,\n\t\t\t\tpageY,\n\t\t\t\ttarget: originalEvent.target,\n\t\t\t}\n\t\t\t/* eslint-enable framer-studio/tscompat */\n\t\t}\n\n\t\treturn originalEvent\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tvelocity(t: number) {\n\t\treturn this.session ? this.session.velocity(t) : { x: 0, y: 0 }\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tget offset() {\n\t\treturn this.session ? this.session.offset(this) : { x: 0, y: 0 }\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tget isLeftMouseClick(): boolean | undefined {\n\t\tif (isTouch()) {\n\t\t\treturn undefined\n\t\t}\n\t\tif (\"button\" in this.originalEvent && \"buttons\" in this.originalEvent && \"ctrlKey\" in this.originalEvent) {\n\t\t\treturn (this.originalEvent.button === 0 || this.originalEvent.buttons === 1) && !this.originalEvent.ctrlKey\n\t\t}\n\t\treturn false\n\t}\n}\n", "import hoistNonReactStatic from \"hoist-non-react-statics\"\nimport React from \"react\"\nimport type { Change, TransactionId } from \"../../animation/Animatable/Animatable.ts\"\nimport { Animatable, isAnimatable } from \"../../animation/Animatable/Animatable.ts\"\nimport { InertialScrollAnimator } from \"../../animation/Animators/InertialScrollAnimator.ts\"\nimport type { AnimationInterface } from \"../../animation/Drivers/AnimationDriver.ts\"\nimport { MainLoopAnimationDriver } from \"../../animation/Drivers/MainLoopDriver.ts\"\nimport type { EventHandler, FramerEvent } from \"../../events/FramerEvent.ts\"\nimport type { ConstraintPercentage } from \"../../render/types/Constraints.ts\"\nimport type { Point } from \"../../render/types/Point.ts\"\nimport { Rect } from \"../../render/types/Rect.ts\"\nimport { isFiniteNumber } from \"../../render/utils/isFiniteNumber.ts\"\nimport { asRecord } from \"../../utils/asRecord.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport { clamp } from \"../../utils/math.ts\"\nimport type { WithMouseWheelHandler, WithPanHandlers } from \"./WithEvents.tsx\"\n\nexport const DraggingContext = /* @__PURE__ */ React.createContext({ dragging: false })\n\n/**\n * @internal\n */\nexport type Axis = \"x\" | \"y\"\n\nexport type Handler = () => void\nexport type DragHandler<Draggable> = (draggable: Draggable) => void\nexport type DragEventHandler<Draggable> = (event: FramerEvent, draggable: Draggable) => void\n/**\n * @internal\n */\nexport type ScrollAnimation = MainLoopAnimationDriver<InertialScrollAnimator, number, unknown>\nexport interface DragEvents<Draggable> {\n\tonMove: (point: Point, draggable: Draggable) => void\n\t/**\n\t * @internal\n\t */\n\tonDragDirectionLockStart: (axis: Axis, draggable: Draggable) => void\n\tonDragAnimationStart: (animation: { x: AnimationInterface; y: AnimationInterface }, draggable: Draggable) => void\n\tonDragAnimationEnd: (animation: { x: AnimationInterface; y: AnimationInterface }, draggable: Draggable) => void\n\n\tonDragSessionStart: DragEventHandler<Draggable>\n\tonDragSessionMove: DragEventHandler<Draggable>\n\tonDragSessionEnd: DragEventHandler<Draggable>\n\n\tonDragStart: DragEventHandler<Draggable>\n\tonDragWillMove: DragEventHandler<Draggable>\n\tonDragDidMove: DragEventHandler<Draggable>\n\tonDragEnd: DragEventHandler<Draggable>\n}\n\nexport interface DraggableSpecificProps<Draggable> extends Partial<DragEvents<Draggable>> {\n\tmomentum: boolean\n\tmomentumOptions: {\n\t\tfriction: number\n\t\ttolerance: number\n\t}\n\tmomentumVelocityMultiplier: number\n\tspeedX: number\n\tspeedY: number\n\tbounce: boolean\n\tbounceOptions: {\n\t\tfriction: number\n\t\ttension: number\n\t\ttolerance: number\n\t}\n\tdirectionLock: boolean\n\tdirectionLockThreshold: {\n\t\tx: number\n\t\ty: number\n\t}\n\toverdrag: boolean\n\toverdragScale: number\n\tpixelAlign: boolean\n\tvelocityTimeout: number\n\tvelocityScale: number\n\thorizontal: boolean\n\tvertical: boolean\n\tconstraints: Partial<Rect>\n\tmouseWheel: boolean\n}\n\nexport interface DraggableProps<Draggable> extends DraggableSpecificProps<Draggable> {\n\tenabled: boolean\n}\n\nexport interface WithDraggingComponentTypeConstraints extends WithPanHandlers, WithMouseWheelHandler {\n\tleft: number | Animatable<number> | null\n\ttop: number | Animatable<number> | null\n\twidth: number | ConstraintPercentage | Animatable<number>\n\theight: number | ConstraintPercentage | Animatable<number>\n}\n\ninterface DraggingState {\n\tisDragging: boolean\n}\n\nexport function WithDragging<TOriginalProps extends Partial<WithDraggingComponentTypeConstraints>>(\n\tComponent: React.ComponentType<TOriginalProps & Partial<DraggableProps<unknown>>>,\n): React.ComponentClass<TOriginalProps & Partial<DraggableProps<unknown>>> {\n\tclass WithDraggingHOC extends React.Component<Partial<DraggableProps<WithDraggingHOC>>, DraggingState> {\n\t\tstatic draggingDefaultProps: DraggableProps<WithDraggingHOC> = {\n\t\t\tmomentum: true,\n\t\t\tmomentumOptions: { friction: 2.1, tolerance: 1 },\n\t\t\tmomentumVelocityMultiplier: 800,\n\t\t\tspeedX: 1,\n\t\t\tspeedY: 1,\n\t\t\tbounce: true,\n\t\t\tbounceOptions: { friction: 40, tension: 200, tolerance: 1 },\n\t\t\tdirectionLock: false,\n\t\t\tdirectionLockThreshold: { x: 10, y: 10 },\n\t\t\toverdrag: true,\n\t\t\toverdragScale: 0.5,\n\t\t\tpixelAlign: true,\n\t\t\tvelocityTimeout: 100,\n\t\t\tvelocityScale: 890,\n\t\t\thorizontal: true,\n\t\t\tvertical: true,\n\t\t\tenabled: true,\n\t\t\tconstraints: {},\n\t\t\tmouseWheel: false,\n\t\t}\n\n\t\tstatic defaultProps: Partial<TOriginalProps> & DraggableProps<WithDraggingHOC> = Object.assign(\n\t\t\t{},\n\t\t\tComponent.defaultProps,\n\t\t\tWithDraggingHOC.draggingDefaultProps,\n\t\t)\n\n\t\toverride state: DraggingState = {\n\t\t\tisDragging: false,\n\t\t}\n\n\t\tx = Animatable(0)\n\t\ty = Animatable(0)\n\n\t\tdeclare props: TOriginalProps & DraggableProps<WithDraggingHOC>\n\n\t\tconstructor(props: Partial<DraggableProps<WithDraggingHOC>>, defaultProps: DraggableProps<WithDraggingHOC>) {\n\t\t\tsuper(props, defaultProps)\n\t\t\tconst x: number | Animatable<number> | null | undefined = this.props.left\n\t\t\tconst y: number | Animatable<number> | null | undefined = this.props.top\n\t\t\tif (!x) {\n\t\t\t\t// TODO: 0 should come from Component.defaultProps\n\t\t\t\tthis.x = Animatable(0)\n\t\t\t} else if (isAnimatable(x)) {\n\t\t\t\tthis.x = x\n\t\t\t} else {\n\t\t\t\tthis.x = Animatable(x)\n\t\t\t}\n\t\t\tif (!y) {\n\t\t\t\t// TODO: 0 should come from Component.defaultProps\n\t\t\t\tthis.y = Animatable(0)\n\t\t\t} else if (isAnimatable(y)) {\n\t\t\t\tthis.y = y\n\t\t\t} else {\n\t\t\t\tthis.y = Animatable(y)\n\t\t\t}\n\t\t\tthis.x.onUpdate(this.onChangePosition)\n\t\t\tthis.y.onUpdate(this.onChangePosition)\n\t\t\tconst constraints: Partial<Rect> | undefined = this.props.constraints\n\t\t\tif (constraints) {\n\t\t\t\tthis.constraints = constraints\n\t\t\t}\n\t\t}\n\n\t\toverride UNSAFE_componentWillReceiveProps(props: TOriginalProps & Partial<DraggableProps<WithDraggingHOC>>) {\n\t\t\tif (this.props.left !== props.left && isFiniteNumber(props.left)) {\n\t\t\t\tthis.x.set(props.left)\n\t\t\t}\n\t\t\tif (this.props.top !== props.top && isFiniteNumber(props.top)) {\n\t\t\t\tthis.y.set(props.top)\n\t\t\t}\n\t\t\tconst constraints: Partial<Rect> | undefined = props.constraints\n\t\t\tif (constraints) {\n\t\t\t\tthis.constraints = constraints\n\t\t\t}\n\t\t}\n\n\t\tonChangePosition = (change: Change<number>, transaction: TransactionId) => {\n\t\t\tif (change.value === change.oldValue) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.props.onMove) {\n\t\t\t\tthis.props.onMove(this.point, this)\n\t\t\t}\n\t\t}\n\n\t\tprivate get point(): Point {\n\t\t\treturn { x: this.x.get(), y: this.y.get() }\n\t\t}\n\n\t\tprivate setPoint(point: Point, axis: Axis | null = null) {\n\t\t\tswitch (axis) {\n\t\t\t\tcase \"x\":\n\t\t\t\t\tthis.x.set(point.x)\n\t\t\t\t\tbreak\n\t\t\t\tcase \"y\":\n\t\t\t\t\tthis.y.set(point.y)\n\t\t\t\t\tbreak\n\t\t\t\tcase null:\n\t\t\t\t\tthis.x.set(point.x)\n\t\t\t\t\tthis.y.set(point.y)\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tprivate getValue(axis: Axis): number {\n\t\t\tswitch (axis) {\n\t\t\t\tcase \"x\":\n\t\t\t\t\treturn this.x.get()\n\t\t\t\tcase \"y\":\n\t\t\t\t\treturn this.y.get()\n\t\t\t}\n\t\t}\n\t\tprivate get width(): number {\n\t\t\tconst width: number | ConstraintPercentage | Animatable<number> | undefined = this.props.width\n\t\t\tif (!width) {\n\t\t\t\t// TODO this should come from the Dragged props' defaults\n\t\t\t\treturn 100\n\t\t\t}\n\t\t\tif (isAnimatable(width)) {\n\t\t\t\treturn width.get()\n\t\t\t}\n\t\t\tif (typeof width === \"string\") {\n\t\t\t\treturn parseFloat(width)\n\t\t\t}\n\t\t\treturn width\n\t\t}\n\n\t\tprivate get height(): number {\n\t\t\tconst height: number | ConstraintPercentage | Animatable<number> | undefined = this.props.height\n\t\t\tif (!height) {\n\t\t\t\t// TODO this should come from the Dragged props' defaults\n\t\t\t\treturn 100\n\t\t\t}\n\t\t\tif (isAnimatable(height)) {\n\t\t\t\treturn height.get()\n\t\t\t}\n\t\t\tif (typeof height === \"string\") {\n\t\t\t\treturn parseFloat(height)\n\t\t\t}\n\t\t\treturn height\n\t\t}\n\t\tisMoving = false\n\t\tprivate isAnimating = false\n\t\tprivate directionLockAxis: Axis | null = null\n\t\tprivate layerStartPoint: Point | null = null\n\t\tprivate correctedLayerStartPoint: Point | null = null\n\t\tprivate previousPoint: Point | null = null\n\t\tprivate _constraints: Rect | null = null\n\t\tprivate animation: { x: ScrollAnimation; y: ScrollAnimation } | null = null\n\t\tprivate get constraints(): Partial<Rect> | null {\n\t\t\treturn this._constraints\n\t\t}\n\t\tprivate set constraints(value: Partial<Rect> | null) {\n\t\t\tif (value !== null && typeof value === \"object\") {\n\t\t\t\tthis._constraints = {\n\t\t\t\t\tx: value.x || 0,\n\t\t\t\t\ty: value.y || 0,\n\t\t\t\t\twidth: value.width || 0,\n\t\t\t\t\theight: value.height || 0,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._constraints = null\n\t\t\t}\n\t\t\tif (this._constraints) {\n\t\t\t\tthis.updateAnimationConstraints(this._constraints)\n\t\t\t}\n\t\t}\n\n\t\tget constraintsOffset(): Point {\n\t\t\tif (!this.constraints) {\n\t\t\t\treturn { x: 0, y: 0 }\n\t\t\t}\n\t\t\tconst { minX, minY, maxX, maxY } = this.calculateConstraints(this._constraints)\n\t\t\tconst point = this.point\n\t\t\tconst constrainedPoint = { x: clamp(point.x, minX, maxX), y: clamp(point.y, minY, maxY) }\n\t\t\tconst offset = { x: point.x - constrainedPoint.x, y: point.y - constrainedPoint.y }\n\t\t\treturn offset\n\t\t}\n\n\t\tget isBeyondConstraints() {\n\t\t\tconst constraintsOffset = this.constraintsOffset\n\t\t\tif (constraintsOffset.x !== 0) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (constraintsOffset.y !== 0) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\n\t\tpanStart = (event: FramerEvent) => {\n\t\t\tif (!this.props.enabled) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// LayerDraggable._globalDidDrag = false\n\n\t\t\t// Only reset isMoving if this was not animating when we were clicking\n\t\t\t// so we can use it to detect a click versus a drag.\n\t\t\tthis.isMoving = this.isAnimating\n\n\t\t\t// Stop any animations influencing the position, but no others.\n\t\t\t// this.layer.animations().forEach(animation => {\n\t\t\t//     props = animation.props\n\t\t\t//     if (props.hasOwnProperty(\"x\") || props.hasOwnProperty(\"y\")) {\n\t\t\t//         return animation.stop()\n\t\t\t//     }\n\t\t\t// })\n\n\t\t\tthis.stopAnimation()\n\t\t\tthis.resetdirectionLock()\n\n\t\t\t// Store original layer position\n\t\t\tthis.layerStartPoint = this.point\n\t\t\tthis.correctedLayerStartPoint = this.point\n\n\t\t\t// // If we are beyond bounds, we need to correct for the scaled clamping from the last drag,\n\t\t\t// // hence the 1 / overdragScale\n\t\t\tif (this._constraints && this.props.bounce) {\n\t\t\t\tthis.correctedLayerStartPoint = this.constrainPosition(\n\t\t\t\t\tthis.correctedLayerStartPoint,\n\t\t\t\t\tthis._constraints,\n\t\t\t\t\t1 / this.props.overdragScale,\n\t\t\t\t)\n\t\t\t}\n\t\t\tthis.previousPoint = this.correctedLayerStartPoint\n\n\t\t\tif (!this.state.isDragging) {\n\t\t\t\tthis.setState({ isDragging: true })\n\t\t\t}\n\t\t\tif (this.props.onDragSessionStart) {\n\t\t\t\tthis.props.onDragSessionStart(event, this)\n\t\t\t}\n\t\t}\n\n\t\tpan = (event: FramerEvent) => {\n\t\t\tconst {\n\t\t\t\tenabled,\n\t\t\t\tspeedX,\n\t\t\t\tspeedY,\n\t\t\t\tdirectionLock,\n\t\t\t\toverdragScale,\n\t\t\t\tvertical,\n\t\t\t\thorizontal,\n\t\t\t\tpixelAlign,\n\t\t\t\tonDragStart,\n\t\t\t\tonDragWillMove,\n\t\t\t\tonDragDidMove,\n\t\t\t\tonDragSessionMove,\n\t\t\t} = this.props\n\n\t\t\tif (!enabled) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tassert(this.previousPoint !== null, \"previousPoint must be set in panStart()\")\n\t\t\tlet point = { ...this.previousPoint }\n\t\t\tpoint.x += event.delta.x * speedX\n\t\t\tpoint.y += event.delta.y * speedY\n\t\t\t// Save the point for the next update so we have the unrounded, unconstrained value\n\t\t\tthis.previousPoint = { ...point }\n\n\t\t\t// // Constraints and overdrag\n\t\t\tif (this._constraints) {\n\t\t\t\tpoint = this.constrainPosition(point, this._constraints, overdragScale)\n\t\t\t}\n\n\t\t\t// // Direction lock\n\t\t\tif (directionLock) {\n\t\t\t\tif (this.directionLockAxis === null) {\n\t\t\t\t\tconst offset = event.offset\n\t\t\t\t\toffset.x = offset.x * speedX\n\t\t\t\t\toffset.y = offset.y * speedY\n\t\t\t\t\tthis.updatedirectionLock(offset)\n\t\t\t\t\treturn\n\t\t\t\t} else {\n\t\t\t\t\tassert(this.layerStartPoint !== null, \"layerStartPoint must be set in panStart()\")\n\t\t\t\t\tif (this.directionLockAxis === \"y\") {\n\t\t\t\t\t\tpoint.x = this.layerStartPoint.x\n\t\t\t\t\t}\n\t\t\t\t\tif (this.directionLockAxis === \"x\") {\n\t\t\t\t\t\tpoint.y = this.layerStartPoint.y\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Update the dragging status\n\t\t\tif (!this.state.isDragging) {\n\t\t\t\tthis.setState({ isDragging: true })\n\t\t\t\tthis.isMoving = true\n\t\t\t\tif (onDragStart) {\n\t\t\t\t\tonDragStart(event, this)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (onDragWillMove) {\n\t\t\t\tonDragWillMove(event, this)\n\t\t\t}\n\n\t\t\t// // Align every drag to pixels\n\t\t\tif (pixelAlign) {\n\t\t\t\tpoint.x = Math.round(point.x)\n\t\t\t\tpoint.y = Math.round(point.y)\n\t\t\t}\n\t\t\tif (!horizontal && !vertical) {\n\t\t\t\t// Don't move over any axis\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlet axis: Axis | null = null\n\t\t\tif (horizontal && !vertical) {\n\t\t\t\taxis = \"x\"\n\t\t\t} else if (vertical && !horizontal) {\n\t\t\t\taxis = \"y\"\n\t\t\t}\n\t\t\tthis.setPoint(point, axis)\n\n\t\t\tif (onDragDidMove) {\n\t\t\t\tonDragDidMove(event, this)\n\t\t\t}\n\n\t\t\tif (onDragSessionMove) {\n\t\t\t\tonDragSessionMove(event, this)\n\t\t\t}\n\t\t}\n\n\t\tpanEnd = (event: FramerEvent) => {\n\t\t\tif (!this.props.enabled) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// LayerDraggable._globalDidDrag = false\n\n\t\t\t// Start the simulation prior to emitting the DragEnd event.\n\t\t\t// This way, if the user calls layer.animate on DragEnd, the simulation will\n\t\t\t// be canceled by the user's animation (if the user animates x and/or y).\n\t\t\tthis.startAnimation(event)\n\n\t\t\tconst { onDragSessionEnd, onDragEnd } = this.props\n\t\t\tif (this.state.isDragging) {\n\t\t\t\tif (onDragEnd) {\n\t\t\t\t\tonDragEnd(event, this)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (onDragSessionEnd) {\n\t\t\t\tonDragSessionEnd(event, this)\n\t\t\t}\n\n\t\t\t// Set isDragging after DragEnd is fired, so that calls to calculateVelocity()\n\t\t\t// still returns dragging velocity - both in case the user calls calculateVelocity(),\n\t\t\t// (which would return a stale value before the simulation had finished one tick)\n\t\t\t// and because @_start currently calls calculateVelocity().\n\t\t\tif (this.state.isDragging) {\n\t\t\t\tthis.setState({ isDragging: false })\n\t\t\t}\n\n\t\t\t// reset isMoving if not animating, otherwise animation start/stop will reset it\n\t\t\tthis.isMoving = this.isAnimating\n\t\t}\n\n\t\t// Mouse Wheel\n\n\t\tmouseWheelStart = (event: FramerEvent) => {\n\t\t\tthis.correctedLayerStartPoint = this.point\n\t\t\tthis.previousPoint = this.correctedLayerStartPoint\n\t\t\tthis.stopAnimation()\n\t\t}\n\n\t\tmouseWheel = (event: FramerEvent) => {\n\t\t\tconst { enabled, speedX, speedY, vertical, horizontal, pixelAlign, onDragWillMove, onDragDidMove, mouseWheel } =\n\t\t\t\tthis.props\n\n\t\t\tif (!mouseWheel || !enabled) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlet point = { ...this.point }\n\n\t\t\tpoint.x -= event.delta.x * speedX\n\t\t\tpoint.y -= event.delta.y * speedY\n\n\t\t\t// // Constraints and overdrag\n\t\t\tif (this._constraints) {\n\t\t\t\tpoint = this.constrainPosition(point, this._constraints, 0, false)\n\t\t\t}\n\n\t\t\tif (onDragWillMove) {\n\t\t\t\tonDragWillMove(event, this)\n\t\t\t}\n\n\t\t\t// // Align every drag to pixels\n\t\t\tif (pixelAlign) {\n\t\t\t\tpoint.x = Math.round(point.x)\n\t\t\t\tpoint.y = Math.round(point.y)\n\t\t\t}\n\t\t\tif (!horizontal && !vertical) {\n\t\t\t\t// Don't move over any axis\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlet axis: Axis | null = null\n\t\t\tif (horizontal && !vertical) {\n\t\t\t\taxis = \"x\"\n\t\t\t} else if (vertical && !horizontal) {\n\t\t\t\taxis = \"y\"\n\t\t\t}\n\n\t\t\tthis.setPoint(point, axis)\n\n\t\t\tif (onDragDidMove) {\n\t\t\t\tonDragDidMove(event, this)\n\t\t\t}\n\t\t}\n\n\t\tmouseWheelEnd = (event: FramerEvent) => {}\n\n\t\tprivate clampAndScale(value: number, min: number, max: number, scale: number, scaleAllowed: boolean) {\n\t\t\tif (!scaleAllowed) {\n\t\t\t\treturn clamp(value, min, max)\n\t\t\t}\n\n\t\t\tif (value < min) {\n\t\t\t\tvalue = min + (value - min) * scale\n\t\t\t}\n\t\t\tif (value > max) {\n\t\t\t\tvalue = max + (value - max) * scale\n\t\t\t}\n\t\t\treturn value\n\t\t}\n\n\t\tprivate calculateConstraints(bounds: Rect | null) {\n\t\t\tif (!bounds) {\n\t\t\t\treturn { minX: Infinity, maxX: Infinity, minY: Infinity, maxY: Infinity }\n\t\t\t}\n\n\t\t\t// Correct the constraints if the layer size exceeds the constraints\n\t\t\tif (bounds.width < this.width) {\n\t\t\t\tbounds.width = this.width\n\t\t\t}\n\t\t\tif (bounds.height < this.height) {\n\t\t\t\tbounds.height = this.height\n\t\t\t}\n\n\t\t\tconst constraints = {\n\t\t\t\tminX: Rect.minX(bounds),\n\t\t\t\tmaxX: Rect.maxX(bounds),\n\t\t\t\tminY: Rect.minY(bounds),\n\t\t\t\tmaxY: Rect.maxY(bounds),\n\t\t\t}\n\n\t\t\t// It makes sense to take the dimensions of the object into account\n\t\t\tconstraints.maxX -= this.width\n\t\t\tconstraints.maxY -= this.height\n\n\t\t\treturn constraints\n\t\t}\n\n\t\tprivate constrainPosition(proposedPoint: Point, bounds: Rect, scale: number, overdrag = this.props.overdrag) {\n\t\t\tconst { maxX, maxY, minX, minY } = this.calculateConstraints(this._constraints)\n\n\t\t\tconst point = {\n\t\t\t\tx: this.clampAndScale(proposedPoint.x, minX, maxX, scale, overdrag),\n\t\t\t\ty: this.clampAndScale(proposedPoint.y, minY, maxY, scale, overdrag),\n\t\t\t}\n\n\t\t\tif (this.props.speedX === 0 || this.props.horizontal === false) {\n\t\t\t\tpoint.x = proposedPoint.x\n\t\t\t}\n\t\t\tif (this.props.speedY === 0 || this.props.vertical === false) {\n\t\t\t\tpoint.y = proposedPoint.y\n\t\t\t}\n\n\t\t\treturn point\n\t\t}\n\n\t\t/* private */ updatedirectionLock(correctedDelta: Point) {\n\t\t\tif (Math.abs(correctedDelta.y) > this.props.directionLockThreshold.y) {\n\t\t\t\tthis.directionLockAxis = \"y\"\n\t\t\t} else if (Math.abs(correctedDelta.x) > this.props.directionLockThreshold.x) {\n\t\t\t\tthis.directionLockAxis = \"x\"\n\t\t\t}\n\n\t\t\tif (this.directionLockAxis !== null) {\n\t\t\t\tif (this.props.onDragDirectionLockStart) {\n\t\t\t\t\tthis.props.onDragDirectionLockStart(this.directionLockAxis, this)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate resetdirectionLock() {\n\t\t\tthis.directionLockAxis = null\n\t\t}\n\n\t\t// Inertial scroll animation\n\n\t\tprivate setupAnimation() {\n\t\t\tif (this.animation) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.animation = { x: this.setupAnimationForAxis(\"x\"), y: this.setupAnimationForAxis(\"y\") }\n\n\t\t\tthis.updateAnimationConstraints(this._constraints)\n\t\t}\n\n\t\tprivate setupAnimationForAxis(axis: Axis) {\n\t\t\tconst animator = new InertialScrollAnimator({\n\t\t\t\tmomentum: this.props.momentumOptions,\n\t\t\t\tbounce: this.props.bounceOptions,\n\t\t\t})\n\t\t\tconst updateCallback = (value: number) => {\n\t\t\t\tthis.onAnimationStep(axis, value)\n\t\t\t}\n\t\t\tconst doneCallback = () => {\n\t\t\t\tthis.onAnimationStop(axis)\n\t\t\t}\n\t\t\treturn new MainLoopAnimationDriver(animator, updateCallback, doneCallback)\n\t\t}\n\n\t\tprivate updateAnimationConstraints(constraints: Rect | null) {\n\t\t\t// This is where we let the animators know about our constraints\n\t\t\tif (!this.animation) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (constraints) {\n\t\t\t\tconst { minX, minY, maxX, maxY } = this.calculateConstraints(constraints)\n\t\t\t\tthis.animation.x.animator.setLimits(minX, maxX)\n\t\t\t\tthis.animation.y.animator.setLimits(minY, maxY)\n\t\t\t} else {\n\t\t\t\tthis.animation.x.animator.setLimits(-Infinity, Infinity)\n\t\t\t\tthis.animation.y.animator.setLimits(-Infinity, Infinity)\n\t\t\t}\n\t\t}\n\n\t\tprivate onAnimationStep = (axis: Axis, value: number) => {\n\t\t\tif (axis === \"x\" && this.props.horizontal === false) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (axis === \"y\" && this.props.vertical === false) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlet delta = 0\n\t\t\tif (this.constraints) {\n\t\t\t\tif (this.props.bounce) {\n\t\t\t\t\tdelta = value - this.getValue(axis)\n\t\t\t\t} else {\n\t\t\t\t\tconst { minX, minY, maxX, maxY } = this.calculateConstraints(this._constraints)\n\t\t\t\t\tif (axis === \"x\") {\n\t\t\t\t\t\tdelta = clamp(value, minX, maxX) - this.getValue(axis)\n\t\t\t\t\t}\n\t\t\t\t\tif (axis === \"y\") {\n\t\t\t\t\t\tdelta = clamp(value, minY, maxY) - this.getValue(axis)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdelta = value - this.getValue(axis)\n\t\t\t}\n\n\t\t\tconst updatePoint = this.point\n\t\t\tif (axis === \"x\") {\n\t\t\t\tupdatePoint[axis] = updatePoint[axis] + delta\n\t\t\t}\n\t\t\tif (axis === \"y\") {\n\t\t\t\tupdatePoint[axis] = updatePoint[axis] + delta\n\t\t\t}\n\t\t\tthis.setPoint(updatePoint, axis)\n\t\t}\n\n\t\tprivate onAnimationStop = (axis: Axis) => {\n\t\t\tif (axis === \"x\" && this.props.horizontal === false) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (axis === \"y\" && this.props.vertical === false) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (!this.animation) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Round the end position to whole pixels\n\t\t\tif (this.props.pixelAlign) {\n\t\t\t\tconst point = this.point\n\t\t\t\tpoint.x = Math.round(point.x)\n\t\t\t\tpoint.y = Math.round(point.y)\n\t\t\t\tthis.setPoint(point, axis)\n\t\t\t}\n\n\t\t\t// See if both animators are stopped\n\t\t\tif (this.animation.x.isFinished() && this.animation.y.isFinished()) {\n\t\t\t\treturn this.stopAnimation()\n\t\t\t}\n\t\t}\n\n\t\tprivate startAnimation(event: FramerEvent) {\n\t\t\t// The types of animation that we can have are:\n\t\t\t// 1) Momentum inside constraints\n\t\t\t// 2) Momentum inside constraints to outside constraints bounce\n\t\t\t// 3) Release outside constraints bounce\n\t\t\t// 4) Momentum without constraints\n\n\t\t\tconst { momentum, bounce, momentumVelocityMultiplier, speedX, speedY, overdrag, onDragAnimationStart } =\n\t\t\t\tthis.props\n\t\t\tif (!(momentum || bounce)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.isBeyondConstraints === false && momentum === false) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.isBeyondConstraints === false && this.state.isDragging === false) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If overdrag is disabled, we need to not have a bounce animation\n\t\t\t// when the cursor is outside of the dragging bounds for an axis.\n\t\t\tconst { minX, minY, maxX, maxY } = this.calculateConstraints(this._constraints)\n\n\t\t\tconst startAnimationX = overdrag === true || (this.point.x > minX && this.point.x < maxX)\n\t\t\tconst startAnimationY = overdrag === true || (this.point.y > minY && this.point.y < maxY)\n\n\t\t\tif (startAnimationX === startAnimationY && startAnimationY === false) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst velocity = event.velocity(0.1)\n\t\t\tlet velocityX = velocity.x * momentumVelocityMultiplier * speedX\n\t\t\tlet velocityY = velocity.y * momentumVelocityMultiplier * speedY\n\t\t\tif (this.directionLockAxis === \"x\") {\n\t\t\t\tvelocityY = 0\n\t\t\t}\n\t\t\tif (this.directionLockAxis === \"y\") {\n\t\t\t\tvelocityX = 0\n\t\t\t}\n\n\t\t\tthis.setupAnimation()\n\t\t\tthis.isAnimating = true\n\t\t\tthis.isMoving = true\n\n\t\t\tif (!this.animation) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.animation.x.animator.setState({ x: this.point.x, v: velocityX })\n\t\t\tif (startAnimationX) {\n\t\t\t\tthis.animation.x.play()\n\t\t\t}\n\n\t\t\tthis.animation.y.animator.setState({ x: this.point.y, v: velocityY })\n\t\t\tif (startAnimationY) {\n\t\t\t\tthis.animation.y.play()\n\t\t\t}\n\n\t\t\tif (onDragAnimationStart) {\n\t\t\t\tonDragAnimationStart(this.animation, this)\n\t\t\t}\n\t\t}\n\n\t\tstopAnimation = () => {\n\t\t\tthis.isAnimating = false\n\t\t\tthis.isMoving = false\n\n\t\t\tif (!this.animation) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.animation.x.cancel()\n\t\t\tthis.animation.y.cancel()\n\n\t\t\tif (this.props.onDragAnimationEnd) {\n\t\t\t\tthis.props.onDragAnimationEnd(this.animation, this)\n\t\t\t}\n\t\t\tthis.animation = null\n\t\t}\n\n\t\tprivate wrapHandler(ownHandler: EventHandler, originalHandler: EventHandler | undefined) {\n\t\t\tif (!originalHandler) {\n\t\t\t\treturn ownHandler\n\t\t\t}\n\t\t\treturn (event: FramerEvent) => {\n\t\t\t\townHandler(event)\n\t\t\t\toriginalHandler(event)\n\t\t\t}\n\t\t}\n\n\t\toverride render() {\n\t\t\tconst originalProps = { ...this.props }\n\t\t\tObject.keys(WithDraggingHOC.draggingDefaultProps).forEach(key => {\n\t\t\t\tdelete asRecord(originalProps)[key]\n\t\t\t})\n\n\t\t\toriginalProps.onPanStart = this.wrapHandler(this.panStart, originalProps.onPanStart)\n\t\t\toriginalProps.onPan = this.wrapHandler(this.pan, originalProps.onPan)\n\t\t\toriginalProps.onPanEnd = this.wrapHandler(this.panEnd, originalProps.onPanEnd)\n\t\t\toriginalProps.onMouseWheelStart = this.wrapHandler(this.mouseWheelStart, originalProps.onMouseWheelStart)\n\t\t\toriginalProps.onMouseWheel = this.wrapHandler(this.mouseWheel, originalProps.onMouseWheel)\n\t\t\toriginalProps.onMouseWheelEnd = this.wrapHandler(this.mouseWheelEnd, originalProps.onMouseWheelEnd)\n\t\t\toriginalProps.left = this.x\n\t\t\toriginalProps.top = this.y\n\n\t\t\treturn (\n\t\t\t\t<DraggingContext.Provider value={{ dragging: this.state.isDragging }}>\n\t\t\t\t\t<Component {...originalProps} />\n\t\t\t\t</DraggingContext.Provider>\n\t\t\t)\n\t\t}\n\t}\n\n\tconst withDragging: React.ComponentClass<Partial<DraggableProps<unknown>>> = WithDraggingHOC\n\n\thoistNonReactStatic(withDragging, Component)\n\t// We are casting it here, because Typescript 3.7 gave us a bunch of trouble\n\t// when trying to make the component props actually have this type. Therefor\n\t// the type of the props of the component are without TOriginalProps, and we\n\t// cast it here to include it.\n\treturn withDragging as React.ComponentClass<TOriginalProps & Partial<DraggableProps<unknown>>, unknown>\n}\n", "export const clamp = (value: number, a: number, b: number) => {\n\tconst min = Math.min(a, b)\n\tconst max = Math.max(a, b)\n\n\tif (value < min) {\n\t\tvalue = min\n\t}\n\tif (value > max) {\n\t\tvalue = max\n\t}\n\treturn value\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport React from \"react\"\nimport type { AnimatableObject, Cancel, Change } from \"../../../animation/Animatable/index.ts\"\nimport { Animatable, isAnimatable } from \"../../../animation/Animatable/index.ts\"\nimport { ObservableObject } from \"../../../data/ObservableObject.ts\"\nimport { asRecord } from \"../../../utils/asRecord.ts\"\nimport type { BorderStyle } from \"../../style/BorderComponent.tsx\"\nimport { Border } from \"../../style/BorderComponent.tsx\"\nimport { backgroundImageFromProps } from \"../../style/backgroundImageFromProps.ts\"\nimport type { DeprecatedVisualProperties } from \"../../style/collectVisualStyleFromProps.ts\"\nimport { collectVisualStyleFromProps } from \"../../style/collectVisualStyleFromProps.ts\"\nimport type { BackgroundProperties, DeprecatedBackgroundProperties } from \"../../traits/Background.ts\"\nimport type { DeprecatedTransformProperties } from \"../../traits/Transform.ts\"\nimport { collectTransformFromProps, transformDefaults } from \"../../traits/Transform.ts\"\nimport type { ImageFit } from \"../../types/BackgroundImage.ts\"\nimport { BackgroundImage } from \"../../types/BackgroundImage.ts\"\nimport { Color } from \"../../types/Color/Color.ts\"\nimport type { ConstraintProperties } from \"../../types/Constraints.ts\"\nimport { ConstraintValues, constraintDefaults, isConstraintSupportingChild } from \"../../types/Constraints.ts\"\nimport { ConstraintsContext, ParentSizeState, ProvideParentSize } from \"../../types/NewConstraints.tsx\"\nimport type { Rect } from \"../../types/Rect.ts\"\nimport { RenderEnvironment, RenderTarget } from \"../../types/RenderEnvironment.ts\"\nimport type { Size } from \"../../types/Size.ts\"\nimport { isFiniteNumber } from \"../../utils/isFiniteNumber.ts\"\nimport { countNodeRender } from \"../../utils/performanceDebugging.ts\"\nimport type { LayerProps } from \"../Layer.tsx\"\nimport { Layer } from \"../Layer.tsx\"\n\n/** @internal */\nexport function cssBackgroundSize(size: ImageFit | undefined) {\n\tswitch (size) {\n\t\tcase \"fit\":\n\t\t\treturn \"contain\"\n\t\tcase \"stretch\":\n\t\t\treturn \"100% 100%\"\n\t\tdefault:\n\t\t\treturn \"cover\"\n\t}\n}\n\nfunction collectBackgroundImageFromProps(\n\tprops: Partial<DeprecatedBackgroundProperties & BackgroundProperties>,\n\tstyle: React.CSSProperties,\n): void {\n\tconst image = backgroundImageFromProps(props)\n\n\tif (image) {\n\t\tstyle.backgroundImage = `url(\"${image.src}\")`\n\t\tstyle.backgroundSize = cssBackgroundSize(image.fit)\n\t\tstyle.backgroundRepeat = \"no-repeat\"\n\t\tstyle.backgroundPosition = \"center\"\n\t}\n}\n\n/** @public */\nexport interface DeprecatedFrameProperties\n\textends ConstraintProperties, DeprecatedTransformProperties, DeprecatedVisualProperties {\n\t/**\n\t * Determines whether the Frame is current visible. Set to `true` by default.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame visible={false} />\n\t * }\n\t * ```\n\t */\n\tvisible: boolean\n\t/**\n\t * An optional name for the Frame.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame name=\"MyFrame\" />\n\t * }\n\t * ```\n\t */\n\tname?: string\n\t/**\n\t * Set to `true` to enable backface-visibility.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame backfaceVisibility={true} />\n\t * }\n\t * ```\n\t */\n\tbackfaceVisible?: boolean | Animatable<boolean>\n\t/**\n\t * Set the perspective on the z-plane.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame perspective={100px} />\n\t * }\n\t * ```\n\t */\n\tperspective?: number | Animatable<number>\n\t/**\n\t * Set to `true` to preserve 3D.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame preserve3d={true} />\n\t * }\n\t * ```\n\t */\n\tpreserve3d?: boolean | Animatable<boolean>\n\t/**\n\t * A border width for the frame. Can be either a single number for all sides or\n\t * an object describing each side. Set to `0` by default.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame borderWidth={{top: 10, bottom: 10}} />\n\t * }\n\t * ```\n\t */\n\tborderWidth: number | Partial<{ top: number; bottom: number; left: number; right: number }>\n\t/**\n\t * A border color for the Frame. Set to `\"#222\"` by default.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame borderColor=\"red\" />\n\t * }\n\t * ```\n\t */\n\tborderColor: string\n\t/**\n\t * A border style for the Frame. One of `\"solid\", \"dashed\", \"dotted\"` or `\"double\"`. Set to `\"solid\"` by default.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame borderStyle=\"dotted\" />\n\t * }\n\t * ```\n\t */\n\tborderStyle: BorderStyle\n\t/**\n\t * Additional CSSProperties to apply to the frame. Usage is exactly the same as with the\n\t * standard React style prop.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame style={{color: \"red\", backgroundColor: \"blue\"}} />\n\t * }\n\t * ```\n\t */\n\tstyle?: React.CSSProperties\n\t/**\n\t * An optional className for the Frame.\n\t * @remarks\n\t * ```jsx\n\t * function App() {\n\t *   return <Frame className=\"my-frame\" />\n\t * }\n\t * ```\n\t */\n\tclassName?: string\n\t/** @internal */\n\t_initialStyle?: Partial<MotionStyle>\n}\n\nfunction toPixelString(value: number | string | undefined): string | undefined {\n\treturn isFiniteNumber(value) ? `${value}px` : value\n}\n\nfunction applyLayoutProp(\n\tstyle: React.CSSProperties,\n\tprops: DeprecatedCoreFrameProps,\n\tkey: keyof DeprecatedCoreFrameProps,\n) {\n\tif (props[key] !== undefined) {\n\t\tconst value = Animatable.get(props[key], undefined)\n\t\tasRecord(style)[key] = toPixelString(value as number | string)\n\t}\n}\n\ninterface DeprecatedFrameState {\n\tsize: AnimatableObject<Size> | Size | null\n}\n\n/** @public */\nexport interface DeprecatedCoreFrameProps extends DeprecatedFrameProperties, LayerProps {}\n\ndeclare class DeprecatedFrameType extends Layer<DeprecatedCoreFrameProps, DeprecatedFrameState> {\n\tcontext: React.ContextType<typeof ConstraintsContext>\n\tstatic supportsConstraints: boolean\n\tstatic defaultFrameSpecificProps: DeprecatedFrameProperties\n\tstatic readonly defaultProps: DeprecatedCoreFrameProps\n\tstatic rect(props: Partial<ConstraintProperties>): Rect\n\tget rect(): Rect\n\telement: HTMLDivElement | null\n\timageDidChange: boolean\n\tstate: DeprecatedFrameState\n\tstatic getDerivedStateFromProps(\n\t\tnextProps: Partial<DeprecatedCoreFrameProps>,\n\t\tprevState: DeprecatedFrameState,\n\t): DeprecatedFrameState | null\n\tstatic updatedSize(\n\t\tprops: Partial<DeprecatedCoreFrameProps>,\n\t\tstate: DeprecatedFrameState,\n\t): AnimatableObject<Size> | Size\n\tgetStyle(): React.CSSProperties\n\tpropsObserver?: AnimatableObject<DeprecatedCoreFrameProps>\n\tpropsObserverCancel?: Cancel\n\tsizeObserver?: AnimatableObject<Size>\n\tsizeObserverCancel?: Cancel\n\tlayoutChildren():\n\t\t| (\n\t\t\t\t| // biome-ignore lint/suspicious/noExplicitAny: deprecated code\n\t\t\t\t  React.ReactElement<any, string | React.JSXElementConstructor<any>>\n\t\t\t\t| React.FunctionComponentElement<{\n\t\t\t\t\t\t_forwardedOverrides: {\n\t\t\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated code\n\t\t\t\t\t\t\t[key: string]: any\n\t\t\t\t\t\t}\n\t\t\t\t  }>\n\t\t  )[]\n\t\t| null\n\t\t| undefined\n}\n\n/**\n * @public\n */\nexport const DeprecatedFrame: typeof DeprecatedFrameType = /* @__PURE__ */ (() => {\n\tclass DeprecatedFrameInner extends Layer<DeprecatedCoreFrameProps, DeprecatedFrameState> {\n\t\tdeclare context: React.ContextType<typeof ConstraintsContext>\n\n\t\tstatic supportsConstraints = true\n\t\tstatic defaultFrameSpecificProps: DeprecatedFrameProperties = {\n\t\t\t...constraintDefaults,\n\t\t\t...transformDefaults,\n\t\t\topacity: 1,\n\t\t\tbackground: Color(\"rgba(0, 170, 255, 0.3)\"),\n\t\t\tvisible: true,\n\t\t\tborderWidth: 0,\n\t\t\tborderColor: \"#222\",\n\t\t\tborderStyle: \"solid\",\n\t\t}\n\n\t\tstatic override readonly defaultProps: DeprecatedCoreFrameProps = {\n\t\t\t...Layer.defaultProps,\n\t\t\t...DeprecatedFrameInner.defaultFrameSpecificProps,\n\t\t}\n\n\t\tstatic rect(props: Partial<ConstraintProperties>): Rect {\n\t\t\tconst constraintValues = ConstraintValues.fromProperties(props)\n\t\t\tconst parentSizeInfo = props.parentSize\n\t\t\t\t? {\n\t\t\t\t\t\tsizing: props.parentSize,\n\t\t\t\t\t\tpositioning: props.parentSize,\n\t\t\t\t\t\tviewport: null,\n\t\t\t\t\t}\n\t\t\t\t: null\n\t\t\treturn ConstraintValues.toRect(constraintValues, parentSizeInfo, null, true)\n\t\t}\n\n\t\tget rect() {\n\t\t\treturn DeprecatedFrameInner.rect(this.props)\n\t\t}\n\n\t\telement: HTMLDivElement | null = null\n\t\timageDidChange = false\n\n\t\toverride state: DeprecatedFrameState = {\n\t\t\tsize: null,\n\t\t}\n\n\t\tstatic getDerivedStateFromProps(\n\t\t\tnextProps: Partial<DeprecatedCoreFrameProps>,\n\t\t\tprevState: DeprecatedFrameState,\n\t\t): DeprecatedFrameState | null {\n\t\t\tconst size = DeprecatedFrameInner.updatedSize(nextProps, prevState)\n\t\t\tconst { target } = RenderEnvironment\n\t\t\tconst nextBackgroundImageSrc =\n\t\t\t\tnextProps.background && BackgroundImage.isImageObject(nextProps.background) ? nextProps.background.src : null\n\t\t\tif (nextBackgroundImageSrc) {\n\t\t\t\treturn {\n\t\t\t\t\tsize: size,\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (prevState.size) {\n\t\t\t\tif (target === RenderTarget.preview) {\n\t\t\t\t\treturn null\n\t\t\t\t}\n\t\t\t\tif (prevState.size.width === size.width && prevState.size.height === size.height) {\n\t\t\t\t\treturn null\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tsize: size,\n\t\t\t}\n\t\t}\n\n\t\tstatic updatedSize(\n\t\t\tprops: Partial<DeprecatedCoreFrameProps>,\n\t\t\tstate: DeprecatedFrameState,\n\t\t): AnimatableObject<Size> | Size {\n\t\t\tconst rect = DeprecatedFrameInner.rect(props)\n\t\t\tlet size = state.size\n\t\t\tconst newSize = { width: rect.width, height: rect.height }\n\t\t\tconst { target } = RenderEnvironment\n\t\t\tif (!size) {\n\t\t\t\tif (target === RenderTarget.preview) {\n\t\t\t\t\tsize = ObservableObject(newSize, true)\n\t\t\t\t} else {\n\t\t\t\t\tsize = newSize\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (isAnimatable(size.width) && isAnimatable(size.height)) {\n\t\t\t\t\tsize.width.set(newSize.width)\n\t\t\t\t\tsize.height.set(newSize.height)\n\t\t\t\t} else {\n\t\t\t\t\tsize = newSize\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn size\n\t\t}\n\n\t\tgetStyle(): React.CSSProperties {\n\t\t\tconst rect = this.rect\n\t\t\tconst style: React.CSSProperties = {\n\t\t\t\tdisplay: \"block\",\n\t\t\t\tposition: \"absolute\",\n\t\t\t\twidth: `${rect.width}px`,\n\t\t\t\theight: `${rect.height}px`,\n\t\t\t\tpointerEvents: undefined, // TODO: this should be \"none\" for non-event consuming instances, for performance.\n\t\t\t\tuserSelect: \"none\",\n\t\t\t}\n\t\t\tlet left = Animatable.get<string | number | undefined>(this.props.left, undefined)\n\t\t\tlet top = Animatable.get<string | number | undefined>(this.props.top, undefined)\n\n\t\t\tObject.assign(style, this.props._initialStyle)\n\t\t\tconst hasParentSize = this.context.parentSize !== ParentSizeState.Disabled\n\n\t\t\tconst perspective = Animatable.get(this.props.perspective, undefined)\n\t\t\tstyle.perspective = perspective\n\t\t\tstyle.WebkitPerspective = perspective\n\n\t\t\tlet backfaceVisibility: \"visible\" | \"hidden\" | undefined = undefined\n\t\t\tconst backfaceVisible = Animatable.get(this.props.backfaceVisible, undefined)\n\n\t\t\tif (backfaceVisible === true) {\n\t\t\t\tbackfaceVisibility = \"visible\"\n\t\t\t} else if (backfaceVisible === false) {\n\t\t\t\tbackfaceVisibility = \"hidden\"\n\t\t\t}\n\t\t\tstyle.backfaceVisibility = backfaceVisibility\n\t\t\tstyle.WebkitBackfaceVisibility = backfaceVisibility\n\n\t\t\tconst preserve3d = Animatable.get(this.props.preserve3d, undefined)\n\t\t\tif (preserve3d === true) {\n\t\t\t\tstyle.transformStyle = \"preserve-3d\"\n\t\t\t} else if (preserve3d === false) {\n\t\t\t\tstyle.transformStyle = \"flat\"\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * If we don't have ParentSizeState, we can't correctly figure out x/y position based\n\t\t\t * on the parent size and this component's width/height. So we can apply right and bottom\n\t\t\t * directly and let the DOM layout figure out the rest.\n\t\t\t */\n\t\t\tif (!hasParentSize) {\n\t\t\t\tapplyLayoutProp(style, this.props, \"right\")\n\t\t\t\tapplyLayoutProp(style, this.props, \"bottom\")\n\n\t\t\t\t// If `left` and `top` have been provided here as a percentage from Vekter,\n\t\t\t\t// these percentages are calculated from the center of the div\n\t\t\t\tconst width = Animatable.get<string | number | undefined>(this.props.width, undefined)\n\t\t\t\tconst stringWidth = toPixelString(width)\n\t\t\t\tconst height = Animatable.get<string | number | undefined>(this.props.height, undefined)\n\t\t\t\tconst stringHeight = toPixelString(height)\n\t\t\t\tif (typeof left === \"string\" && left.endsWith(\"%\") && this.props.right === null) {\n\t\t\t\t\tleft = `calc(${left} - calc(${stringWidth}} / 2))`\n\t\t\t\t\tstyle.width = stringWidth\n\t\t\t\t}\n\n\t\t\t\tif (typeof top === \"string\" && top.endsWith(\"%\") && this.props.bottom === null) {\n\t\t\t\t\ttop = `calc(${top} - calc(${stringHeight} / 2))`\n\t\t\t\t\tstyle.height = stringHeight\n\t\t\t\t}\n\n\t\t\t\t// If pinned to both, reset physical dimensions\n\t\t\t\tif (top !== undefined && style.bottom !== undefined) {\n\t\t\t\t\tstyle.height = undefined\n\t\t\t\t\ttop = toPixelString(Animatable.get(this.props.top, undefined))\n\t\t\t\t} else {\n\t\t\t\t\tstyle.height = stringHeight\n\t\t\t\t}\n\t\t\t\tif (left !== undefined && style.right !== undefined) {\n\t\t\t\t\tstyle.width = undefined\n\t\t\t\t\tleft = toPixelString(Animatable.get(this.props.left, undefined))\n\t\t\t\t} else {\n\t\t\t\t\tstyle.width = stringWidth\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst transformRect: { x: string | number; y: string | number } & Size = { ...rect }\n\t\t\tif (typeof left !== \"undefined\") {\n\t\t\t\ttransformRect.x = left\n\t\t\t}\n\t\t\tif (typeof top !== \"undefined\") {\n\t\t\t\ttransformRect.y = top\n\t\t\t}\n\t\t\tcollectTransformFromProps(this.props, transformRect, style)\n\t\t\tcollectVisualStyleFromProps(this.props, style)\n\t\t\tcollectBackgroundImageFromProps(this.props, style)\n\t\t\tLayer.applyWillChange(this.props, style, false)\n\n\t\t\t// TODO disable style overrides in strict mode\n\t\t\tif (this.props.style) {\n\t\t\t\tObject.assign(style, this.props.style)\n\t\t\t}\n\n\t\t\treturn style\n\t\t}\n\n\t\tprivate updateStyle = () => {\n\t\t\tif (!this.element) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tObject.assign(this.element.style, this.getStyle())\n\t\t}\n\n\t\tprivate setElement = (element: HTMLDivElement | null) => {\n\t\t\tthis.element = element\n\t\t\tthis.setLayerElement(element)\n\t\t}\n\n\t\t// XXX internal state\n\t\tpropsObserver?: AnimatableObject<DeprecatedCoreFrameProps>\n\t\tpropsObserverCancel?: Cancel\n\n\t\tsizeObserver?: AnimatableObject<Size>\n\t\tsizeObserverCancel?: Cancel\n\n\t\toverride componentDidMount() {\n\t\t\tconst { target } = RenderEnvironment\n\t\t\tif (target === RenderTarget.preview) {\n\t\t\t\tthis.propsObserver = ObservableObject(this.props, true)\n\t\t\t\tthis.propsObserverCancel = ObservableObject.addObserver(this.propsObserver, this.onPropsChange)\n\t\t\t\tif (\n\t\t\t\t\tthis.props.parentSize &&\n\t\t\t\t\tisAnimatable(this.props.parentSize.width) &&\n\t\t\t\t\tisAnimatable(this.props.parentSize.height)\n\t\t\t\t) {\n\t\t\t\t\tthis.sizeObserver = ObservableObject(this.props.parentSize, true)\n\t\t\t\t\tthis.sizeObserverCancel = ObservableObject.addObserver(this.sizeObserver, this.onSizeChange)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\toverride componentDidUpdate() {\n\t\t\tconst { target } = RenderEnvironment\n\t\t\tthis.propsObserverCancel && this.propsObserverCancel()\n\t\t\tthis.sizeObserverCancel && this.sizeObserverCancel()\n\t\t\tif (target === RenderTarget.preview) {\n\t\t\t\tthis.propsObserver = ObservableObject(this.props, true)\n\t\t\t\tthis.propsObserverCancel = ObservableObject.addObserver(this.propsObserver, this.onPropsChange)\n\t\t\t\tif (\n\t\t\t\t\tthis.props.parentSize &&\n\t\t\t\t\tisAnimatable(this.props.parentSize.width) &&\n\t\t\t\t\tisAnimatable(this.props.parentSize.height)\n\t\t\t\t) {\n\t\t\t\t\tthis.sizeObserver = ObservableObject(this.props.parentSize, true)\n\t\t\t\t\tthis.sizeObserverCancel = ObservableObject.addObserver(this.sizeObserver, this.onSizeChange)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprotected onPropsChange = (props: Change<AnimatableObject<DeprecatedCoreFrameProps>>) => {\n\t\t\tconst rect = DeprecatedFrameInner.rect(Animatable.objectToValues(props.value))\n\t\t\tif (this.state.size && isAnimatable(this.state.size.width) && isAnimatable(props.value.width)) {\n\t\t\t\tthis.state.size.width.set(rect.width)\n\t\t\t}\n\t\t\tif (this.state.size && isAnimatable(this.state.size.height) && isAnimatable(props.value.height)) {\n\t\t\t\tthis.state.size.height.set(rect.height)\n\t\t\t}\n\t\t\tthis.updateStyle()\n\t\t}\n\n\t\tprotected onSizeChange = () => {\n\t\t\tthis.updateStyle()\n\t\t}\n\n\t\toverride componentWillUnmount() {\n\t\t\tthis.propsObserverCancel && this.propsObserverCancel()\n\t\t\tthis.propsObserverCancel = undefined\n\t\t\tthis.sizeObserverCancel && this.sizeObserverCancel()\n\t\t\tthis.sizeObserverCancel = undefined\n\t\t}\n\n\t\toverride render() {\n\t\t\tcountNodeRender()\n\t\t\tconst { visible, id, className } = this.props\n\t\t\tif (!visible) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst style = this.getStyle()\n\t\t\tconst rect = this.rect\n\t\t\tconst parentSize = { width: rect.width, height: rect.height }\n\n\t\t\treturn (\n\t\t\t\t<div id={id} style={style} ref={this.setElement} className={className}>\n\t\t\t\t\t<ProvideParentSize parentSize={parentSize}>{this.layoutChildren()}</ProvideParentSize>\n\t\t\t\t\t<Border {...this.props} />\n\t\t\t\t</div>\n\t\t\t)\n\t\t}\n\n\t\tlayoutChildren() {\n\t\t\tconst _forwardedOverrides: { [key: string]: unknown } | undefined = this.props._forwardedOverrides\n\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated code\n\t\t\tlet children = React.Children.map(this.props.children, (child: React.ReactElement<any>) => {\n\t\t\t\tif (isConstraintSupportingChild(child)) {\n\t\t\t\t\treturn React.cloneElement(child, {\n\t\t\t\t\t\tparentSize: this.state.size,\n\t\t\t\t\t\t_forwardedOverrides,\n\t\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated code\n\t\t\t\t\t} as any)\n\t\t\t\t} else if (_forwardedOverrides && child) {\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated code\n\t\t\t\t\treturn React.cloneElement(child as any, { _forwardedOverrides })\n\t\t\t\t} else {\n\t\t\t\t\treturn child\n\t\t\t\t}\n\t\t\t})\n\n\t\t\t// We wrap raw strings in a default style to display\n\t\t\tif (children && children.length === 1 && typeof children[0] === \"string\") {\n\t\t\t\tchildren = [<Center key=\"0\">{children}</Center>]\n\t\t\t}\n\t\t\treturn children\n\t\t}\n\t}\n\n\tDeprecatedFrameInner.contextType = ConstraintsContext\n\n\treturn DeprecatedFrameInner\n})()\n\nexport function Center(props: { children?: React.ReactNode; style?: React.CSSProperties }) {\n\tconst style = Object.assign(\n\t\t{},\n\t\t{\n\t\t\theight: \"100%\",\n\t\t\tdisplay: \"flex\",\n\t\t\talignItems: \"center\",\n\t\t\tjustifyContent: \"center\",\n\t\t\tfontFamily: \"Helvetica\",\n\t\t},\n\t\tprops.style || {},\n\t)\n\n\treturn <div style={style}>{props.children}</div>\n}\n", "import type { AnimatableObject, Cancel, Change, TransactionId } from \"../animation/Animatable/Animatable.ts\"\nimport { Animatable, isAnimatable } from \"../animation/Animatable/Animatable.ts\"\nimport type { Observer } from \"../animation/Animatable/Observers.ts\"\nimport { Observers } from \"../animation/Animatable/Observers.ts\"\nimport { asRecord } from \"../utils/asRecord.ts\"\n\nconst hasOwnProperty = (obj: object, prop: PropertyKey) => Object.prototype.hasOwnProperty.call(obj, prop)\n\nconst $private = /* @__PURE__ */ Symbol(\"private\")\n\ntype ObservedObject<T> = object & {\n\t[$private]: {\n\t\treset: () => void\n\t\tmakeAnimatables: boolean\n\t\tobserveAnimatables: boolean\n\t\tobservers: Observers<T>\n\t\ttransactions: Set<number>\n\t}\n}\n\n/**\n * @internal\n */\nexport const ObservableObject = /* @__PURE__ */ (() => {\n\t/**\n\t * @internal\n\t */\n\tfunction ObservableObject<T extends object = object>(\n\t\tinitial: Partial<T> | object = {},\n\t\tmakeAnimatables = false,\n\t\tobserveAnimatables = true,\n\t) {\n\t\tconst unproxiedState: ObservedObject<T> = {\n\t\t\t[$private]: {\n\t\t\t\tmakeAnimatables,\n\t\t\t\tobserveAnimatables,\n\t\t\t\tobservers: new Observers<T>(),\n\t\t\t\treset() {\n\t\t\t\t\tfor (const key in state) {\n\t\t\t\t\t\tif (hasOwnProperty(state, key)) {\n\t\t\t\t\t\t\tconst value = hasOwnProperty(initial, key) ? asRecord(initial)[key] : undefined\n\t\t\t\t\t\t\tif (value !== undefined) {\n\t\t\t\t\t\t\t\tstate[key] = value\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdelete state[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\ttransactions: new Set<number>(),\n\t\t\t},\n\t\t}\n\t\tconst state = new Proxy(unproxiedState, sharedProxyHandler) as AnimatableObject<T>\n\t\tObject.assign(state, initial)\n\t\treturn state\n\t}\n\n\tObservableObject.resetObject = <T extends object>(target: T) => {\n\t\treturn (target as ObservedObject<T>)[$private].reset()\n\t}\n\n\tObservableObject.addObserver = <T extends object>(target: T, observer: Observer<T>): Cancel => {\n\t\treturn (target as ObservedObject<T>)[$private].observers.add(observer)\n\t}\n\n\treturn ObservableObject\n})()\n\nclass ObservableObjectProxyHandler<T extends ObservedObject<T>> implements ProxyHandler<T> {\n\tset = (target: T, key: PropertyKey, value: any, receiver: any): boolean => {\n\t\tif (key === $private) {\n\t\t\treturn false\n\t\t}\n\t\tconst privateObject = target[$private]\n\n\t\tlet animatable: Animatable<any> | undefined\n\t\tlet rawValue: any\n\n\t\tif (isAnimatable(value)) {\n\t\t\tanimatable = value\n\t\t\trawValue = animatable.get()\n\t\t} else {\n\t\t\trawValue = value\n\t\t}\n\n\t\t// With the animatable flag, make every value animatable\n\t\tif (privateObject.makeAnimatables && typeof value !== \"function\" && typeof value !== \"object\" && !animatable) {\n\t\t\tanimatable = Animatable(value)\n\t\t}\n\n\t\tif (privateObject.observeAnimatables && animatable) {\n\t\t\tconst transactions = privateObject.transactions\n\t\t\tanimatable.onUpdate({\n\t\t\t\tupdate: (change: Change<any>, transaction?: TransactionId) => {\n\t\t\t\t\tif (transaction) {\n\t\t\t\t\t\ttransactions.add(transaction)\n\t\t\t\t\t}\n\t\t\t\t\tprivateObject.observers.notify({ value: receiver }, transaction)\n\t\t\t\t},\n\t\t\t\tfinish: (transaction: TransactionId) => {\n\t\t\t\t\tif (transactions.delete(transaction)) {\n\t\t\t\t\t\tprivateObject.observers.finishTransaction(transaction)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\n\t\tlet result = false\n\t\tlet changed = true\n\t\tconst targetValue = asRecord(target)[key]\n\t\tif (targetValue !== undefined) {\n\t\t\t// If the key already exists handle it differently\n\t\t\tif (isAnimatable(targetValue)) {\n\t\t\t\tchanged = targetValue.get() !== rawValue\n\t\t\t\ttargetValue.set(rawValue)\n\t\t\t} else {\n\t\t\t\tchanged = targetValue !== rawValue\n\t\t\t\tasRecord(target)[key] = rawValue\n\t\t\t}\n\t\t\tconst rawValueIsObject = rawValue !== null && typeof rawValue === \"object\"\n\t\t\tif (Array.isArray(rawValue) || rawValueIsObject) changed = true\n\t\t\tresult = true\n\t\t} else {\n\t\t\t// Use the animatable value if it exists\n\t\t\tif (animatable) {\n\t\t\t\tvalue = animatable\n\t\t\t}\n\t\t\tresult = Reflect.set(target, key, value)\n\t\t}\n\t\tif (changed) {\n\t\t\tprivateObject.observers.notify({ value: receiver })\n\t\t}\n\t\treturn result\n\t}\n\n\tget = (target: T, key: PropertyKey, receiver: any) => {\n\t\tif (key === $private) {\n\t\t\treturn asRecord(target)[key]\n\t\t}\n\t\tconst value = Reflect.get(target, key, receiver)\n\t\t// Bind functions to the receiver, so we can use `this`\n\t\treturn typeof value === \"function\" ? value.bind(receiver) : value\n\t}\n\n\tdeleteProperty(target: T, key: PropertyKey) {\n\t\tconst result = Reflect.deleteProperty(target, key)\n\t\ttarget[$private].observers.notify({ value: target })\n\t\treturn result\n\t}\n\n\townKeys(target: T) {\n\t\tconst keys = Reflect.ownKeys(target)\n\t\tconst privateIndex = keys.indexOf($private)\n\t\tif (privateIndex !== -1) {\n\t\t\tkeys.splice(privateIndex, 1)\n\t\t}\n\t\treturn keys\n\t}\n\n\tgetOwnPropertyDescriptor(target: T, key: PropertyKey) {\n\t\tif (key === $private) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn Reflect.getOwnPropertyDescriptor(target, key)\n\t}\n}\n\n// Shared handler\nconst sharedProxyHandler = /* @__PURE__ */ new ObservableObjectProxyHandler()\n", "import type { MotionStyle } from \"framer-motion\"\n\n/** @public */\nexport interface BlendingProperties {\n\tblendingMode: BlendingMode\n}\n\n/** @public */\nexport type BlendingMode =\n\t| \"normal\"\n\t| \"multiply\"\n\t| \"screen\"\n\t| \"plus-lighter\"\n\t| \"overlay\"\n\t| \"darken\"\n\t| \"lighten\"\n\t| \"color-dodge\"\n\t| \"color-burn\"\n\t| \"hard-light\"\n\t| \"soft-light\"\n\t| \"difference\"\n\t| \"exclusion\"\n\t| \"hue\"\n\t| \"saturation\"\n\t| \"color\"\n\t| \"luminosity\"\n\n/** @internal */\nexport function collectBlendingFromProps(node: Partial<BlendingProperties>, style: MotionStyle) {\n\tif (!node.blendingMode || node.blendingMode === \"normal\") return\n\tstyle.mixBlendMode = node.blendingMode\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { Animatable } from \"../../animation/Animatable/Animatable.ts\"\n\n/** @public */\nexport interface WithOpacity {\n\topacity: number | Animatable<number>\n}\n\nconst key: keyof WithOpacity = \"opacity\"\n\n/** @internal */\nexport function withOpacity(target: any): target is WithOpacity {\n\treturn key in target\n}\n\n/** @internal */\nexport function collectOpacityFromProps(props: Partial<WithOpacity>, style: MotionStyle) {\n\tif (!withOpacity(props)) return\n\tconst opacity = Animatable.getNumber(props.opacity)\n\tif (opacity === 1) return\n\tstyle.opacity = opacity\n}\n", "import type { MotionStyle } from \"framer-motion\"\n\nexport type Overflow = \"visible\" | \"hidden\" | \"clip\" | \"scroll\" | \"auto\"\n\nexport interface OverflowProperties {\n\toverflow: Overflow\n}\n\nexport function collectOverflowFromProps(props: Partial<OverflowProperties>, style: MotionStyle) {\n\tif (props.overflow) {\n\t\tstyle.overflow = props.overflow\n\t}\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { Animatable, isAnimatable } from \"../../animation/Animatable/Animatable.ts\"\nimport { isFiniteNumber } from \"../utils/isFiniteNumber.ts\"\n\nexport type RadiusValue = number | Animatable<number> | string\n\n/** @public */\nexport interface RadiusProperties {\n\tradius:\n\t\t| RadiusValue\n\t\t| Partial<{\n\t\t\t\ttopLeft: RadiusValue\n\t\t\t\ttopRight: RadiusValue\n\t\t\t\tbottomLeft: RadiusValue\n\t\t\t\tbottomRight: RadiusValue\n\t\t  }>\n}\n\nconst key: keyof RadiusProperties = \"radius\"\n\nfunction hasRadius(props: Partial<RadiusProperties>): props is RadiusProperties {\n\treturn key in props\n}\n\n/**\n * Takes a border-radius value supporting a range of types and returns\n * a string representation for use in CSS.\n * NOTE: We always return a string so that we support both React.CSSProperties\n * as well as the CSSStyleDeclaration interface.\n */\nfunction getRadiusValue(value: RadiusValue | undefined): string {\n\t// Coerce value into a number by default. This handles strings containing\n\t// numbers eg. \"123.456\" and acutal numbers.\n\tlet num: number = Number(value)\n\n\t// If value is a string and failed to coerce it's likely an alternative\n\t// representation such as \"10%\" or \"1em\" so return that immediately.\n\tif (typeof value === \"string\" && Number.isNaN(num)) {\n\t\treturn value\n\t} else if (isAnimatable(value)) {\n\t\t// Otherwise it's an animatable object, so extract the value.\n\t\tnum = Animatable.getNumber(value)\n\t}\n\n\t// Return NaN or 0 as 0 without px units to keep things clean.\n\treturn num ? `${num}px` : \"0\"\n}\n\nfunction hasRadiusValue(value: string) {\n\treturn value && value !== \"0\"\n}\n\n/**\n * We assign the borderRadius to each corner individually to make it easier to animate between\n * different frames.\n */\nexport function collectRadiusFromProps(props: Partial<RadiusProperties>, style: MotionStyle) {\n\tif (!hasRadius(props)) return\n\tconst { radius } = props\n\tif (typeof radius === \"string\" || isAnimatable(radius) || isFiniteNumber(radius)) {\n\t\tconst radiusValue = getRadiusValue(radius)\n\t\tif (hasRadiusValue(radiusValue)) {\n\t\t\tstyle.borderTopLeftRadius =\n\t\t\t\tstyle.borderTopRightRadius =\n\t\t\t\tstyle.borderBottomRightRadius =\n\t\t\t\tstyle.borderBottomLeftRadius =\n\t\t\t\t\tradiusValue\n\t\t}\n\t} else if (radius) {\n\t\tconst topLeft = getRadiusValue(radius.topLeft)\n\t\tconst topRight = getRadiusValue(radius.topRight)\n\t\tconst bottomRight = getRadiusValue(radius.bottomRight)\n\t\tconst bottomLeft = getRadiusValue(radius.bottomLeft)\n\t\tif (\n\t\t\thasRadiusValue(topLeft) ||\n\t\t\thasRadiusValue(topRight) ||\n\t\t\thasRadiusValue(bottomRight) ||\n\t\t\thasRadiusValue(bottomLeft)\n\t\t) {\n\t\t\tstyle.borderTopLeftRadius = topLeft\n\t\t\tstyle.borderTopRightRadius = topRight\n\t\t\tstyle.borderBottomRightRadius = bottomRight\n\t\t\tstyle.borderBottomLeftRadius = bottomLeft\n\t\t}\n\t}\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { Color } from \"../types/Color/Color.ts\"\n\n/** @public */\nexport interface TextColorProperties {\n\tcolor: Color | string\n}\n\nexport function collectTextColorFromProps(props: Partial<TextColorProperties>, style: MotionStyle) {\n\tconst { color } = props\n\tif (typeof color === \"string\") {\n\t\tstyle.color = color\n\t} else if (Color.isColorObject(color)) {\n\t\tstyle.color = color.initialValue || Color.toRgbString(color)\n\t}\n}\n", "/** @public */\nexport interface Shadow {\n\tcolor: string\n\tx: number\n\ty: number\n\tblur: number\n}\n\nexport const shadowKeys: (keyof Shadow)[] = [\"color\", \"x\", \"y\", \"blur\"]\n\n/** @public */\nexport const Shadow = {\n\tis: (shadow: any): shadow is Shadow => {\n\t\treturn shadow && shadowKeys.every(key => key in shadow)\n\t},\n}\n\nexport interface RealisticShadow {\n\ttype: \"realistic\"\n\tdiffusion: number\n\tfocus: number\n}\n\n/** @public */\nexport interface BoxShadow {\n\ttype?: \"box\" | \"realistic\"\n\tinset: boolean\n\tcolor: string\n\tx: number\n\ty: number\n\tblur: number\n\tspread: number\n\tdiffusion: number\n\tfocus: number\n}\n\nexport const boxShadowKeys: (keyof BoxShadow)[] = [\"x\", \"y\", \"color\", \"inset\", \"blur\", \"spread\"]\n\n/** @public */\nexport const BoxShadow = {\n\tis: (shadow: any): shadow is BoxShadow => {\n\t\treturn shadow && boxShadowKeys.every(key => key in shadow)\n\t},\n\n\ttoCSS: (shadow: BoxShadow) => {\n\t\tconst inset = shadow.inset ? \"inset \" : \"\"\n\t\treturn `${inset}${shadow.x}px ${shadow.y}px ${shadow.blur}px ${shadow.spread}px ${shadow.color}`\n\t},\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { distance, interpolate, mix } from \"framer-motion\"\nimport type React from \"react\"\nimport { asRecord } from \"../../utils/asRecord.ts\"\nimport type { InternalID } from \"../../utils/internalId.ts\"\nimport type { BoxShadowProperties, TextShadowProperties } from \"../traits/Shadow.ts\"\nimport { Rect } from \"../types/Rect.ts\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport type { Shadow } from \"../types/Shadow.ts\"\nimport { BoxShadow } from \"../types/Shadow.ts\"\nimport { isFiniteNumber } from \"../utils/isFiniteNumber.ts\"\n\nexport function shadowsAsFilter(shadows: readonly Shadow[]): string[] {\n\tconst filters: string[] = []\n\tif (shadows && shadows.length) {\n\t\tconst dropShadows = shadows.map((shadowItem: Shadow): string => {\n\t\t\treturn `drop-shadow(${shadowItem.x}px ${shadowItem.y}px ${shadowItem.blur}px ${shadowItem.color})`\n\t\t})\n\t\tfilters.push(...dropShadows)\n\t}\n\treturn filters\n}\n\nexport function collectTextShadowsForProps(props: Partial<TextShadowProperties>, style: MotionStyle) {\n\tif (!props.shadows || props.shadows.length === 0) return\n\tconst textShadow = props.shadows\n\t\t.map((shadow: Shadow) => {\n\t\t\treturn `${shadow.x}px ${shadow.y}px ${shadow.blur}px ${shadow.color}`\n\t\t})\n\t\t.join(\", \")\n\tif (!textShadow) return\n\tstyle.textShadow = textShadow\n}\n\nexport function collectBoxShadowsForProps(props: Partial<BoxShadowProperties>, style: MotionStyle) {\n\tif (!props.shadows || props.shadows.length === 0) return\n\tconst boxShadow = props.shadows.map((shadowItem: BoxShadow) => BoxShadow.toCSS(shadowItem)).join(\", \")\n\tif (!boxShadow) return\n\tstyle.boxShadow = boxShadow\n}\n\n/** @internal */\nexport function shadowForShape(\n\tboxShadows: BoxShadow[],\n\trect: Rect,\n\tshapeId: InternalID,\n\tfillEnabled: boolean,\n\tstrokeEnabled: boolean,\n\tstrokeWidth: number | undefined,\n\tstrokeClipId: InternalID,\n\tsvgStrokeAttributes: React.SVGAttributes<SVGElement>,\n) {\n\tconst definition: JSX.Element[] = []\n\tlet outsetElement: JSX.Element | null = null\n\tlet insetElement: JSX.Element | null = null\n\tlet maskElement: JSX.Element | null = null\n\tconst needsStrokeClip = false\n\tconst shadows: BoxShadow[] = []\n\tconst insetShadows: BoxShadow[] = []\n\n\t// The canvas renderer relies on setting this class to show / hide shadows at different zoom levels\n\tconst svgShadowClass = \"svg-shadow\"\n\tconst svgShadowProps = RenderTarget.current() === RenderTarget.canvas ? { className: svgShadowClass } : {}\n\n\tfor (const shadow of boxShadows) {\n\t\tshadow.inset ? insetShadows.push(shadow) : shadows.push(shadow)\n\t}\n\n\tif (shadows.length > 0) {\n\t\tshadows.reverse()\n\t\tconst outsideShadowId = shapeId.add(\"_shadow_out\")\n\n\t\tconst normalizedFrame = Rect.atOrigin(rect)\n\t\tconst shadowRects: Rect[] = [normalizedFrame]\n\n\t\tfor (const shadow of shadows) {\n\t\t\tconst shadowFrame = localShadowFrame(shadow, normalizedFrame, true)\n\t\t\tif (shadowFrame === null) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tshadowRects.push(shadowFrame)\n\t\t}\n\n\t\tlet maxBlur = 0\n\t\tconst filterElements: JSX.Element[] = []\n\t\tconst mergeElements: JSX.Element[] = []\n\t\tfor (let i = 0, il = shadows.length; i < il; i++) {\n\t\t\tconst shadow = shadows[i]\n\t\t\tif (!shadow) continue\n\t\t\tconst shadowElements = outerShadowElements(shapeId, shadow, i)\n\t\t\tmaxBlur = Math.max(maxBlur, shadow.blur)\n\t\t\tfilterElements.push(shadowElements.filterElements)\n\t\t\tmergeElements.push(shadowElements.mergeElement)\n\t\t}\n\n\t\tlet expandStrokeWidth = strokeWidth\n\t\tif (!isFiniteNumber(expandStrokeWidth)) expandStrokeWidth = 0\n\t\tlet miter = svgStrokeAttributes.strokeMiterlimit\n\t\tif (!isFiniteNumber(miter)) miter = 4\n\n\t\tlet shadowRect = Rect.merge(...shadowRects)\n\t\tshadowRect = Rect.inflate(shadowRect, ((expandStrokeWidth * miter) / 2 + maxBlur) * 1.1)\n\n\t\t// calculate percentage of shadow frame compared to node frame\n\t\tconst width = rect.width + (strokeWidth ? strokeWidth / 2 : 0)\n\t\tconst height = rect.height + (strokeWidth ? strokeWidth / 2 : 0)\n\t\tconst filterX = (shadowRect.x / width) * 100\n\t\tconst filterY = (shadowRect.y / height) * 100\n\t\tconst filterWidth = (shadowRect.width / width) * 100\n\t\tconst filterHeight = (shadowRect.height / height) * 100\n\n\t\tconst svgRect = {\n\t\t\tx: `${filterX.toFixed(1)}%`,\n\t\t\ty: `${filterY.toFixed(1)}%`,\n\t\t\twidth: `${filterWidth.toFixed(1)}%`,\n\t\t\theight: `${filterHeight.toFixed(1)}%`,\n\t\t}\n\t\tdefinition.push(\n\t\t\t<filter\n\t\t\t\tkey={outsideShadowId.id}\n\t\t\t\tid={outsideShadowId.id}\n\t\t\t\tfilterUnits=\"objectBoundingBox\"\n\t\t\t\t{...svgRect}\n\t\t\t\t{...svgShadowProps}\n\t\t\t>\n\t\t\t\t{filterElements}\n\t\t\t\t{shadows.length > 1 ? <feMerge>{mergeElements}</feMerge> : null}\n\t\t\t</filter>,\n\t\t)\n\n\t\tconst maskId = shapeId.add(\"mask\")\n\n\t\tmaskElement = (\n\t\t\t<mask id={maskId.id} {...svgRect}>\n\t\t\t\t<rect {...svgRect} fill=\"white\" />\n\t\t\t\t<use href={shapeId.link} fill=\"black\" fillOpacity={fillEnabled ? undefined : 0} />\n\t\t\t</mask>\n\t\t)\n\n\t\toutsetElement = (\n\t\t\t<g filter={outsideShadowId.urlLink} {...svgShadowProps} mask={maskId.urlLink}>\n\t\t\t\t<use\n\t\t\t\t\t{...svgStrokeAttributes}\n\t\t\t\t\tfill=\"black\"\n\t\t\t\t\tfillOpacity={fillEnabled ? undefined : 0}\n\t\t\t\t\tstroke=\"black\"\n\t\t\t\t\tstrokeOpacity={strokeEnabled ? undefined : 0}\n\t\t\t\t\tstrokeWidth={strokeEnabled ? strokeWidth : 0}\n\t\t\t\t\txlinkHref={shapeId.link}\n\t\t\t\t\tclipPath={strokeClipId.urlLink}\n\t\t\t\t/>\n\t\t\t</g>\n\t\t)\n\t}\n\n\tif (insetShadows.length) {\n\t\tinsetShadows.reverse()\n\t\tconst insideShadowId = shapeId.add(\"_shadow_inside\")\n\n\t\tconst normalizedFrame = Rect.atOrigin(rect)\n\t\tconst shadowFrames: Rect[] = [normalizedFrame]\n\n\t\tfor (const shadow of insetShadows) {\n\t\t\tconst shadowFrame = localShadowFrame(shadow, normalizedFrame, true)\n\n\t\t\tif (shadowFrame === null) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tshadowFrames.push(shadowFrame)\n\t\t}\n\n\t\tconst shadowRect = Rect.merge(...shadowFrames)\n\n\t\t// calculate percentage of shadow frame compared to node frame\n\t\tconst width = rect.width + (strokeWidth ? strokeWidth / 2 : 0.1)\n\t\tconst height = rect.height + (strokeWidth ? strokeWidth / 2 : 0.1)\n\t\tconst filterX = (shadowRect.x / width) * 100\n\t\tconst filterY = (shadowRect.y / height) * 100\n\t\tconst filterWidth = (shadowRect.width / width) * 100\n\t\tconst filterHeight = (shadowRect.height / height) * 100\n\n\t\tconst filterElements: JSX.Element[] = []\n\t\tconst mergeElements: JSX.Element[] = []\n\n\t\tfor (let i = 0, il = insetShadows.length; i < il; i++) {\n\t\t\tconst shadow = insetShadows[i]\n\t\t\tif (!shadow) continue\n\t\t\tconst shadowElements = innerShadowElements(shapeId, shadow, i)\n\t\t\tfilterElements.push(shadowElements.filterElements)\n\t\t\tmergeElements.push(shadowElements.mergeElement)\n\t\t}\n\n\t\tdefinition.push(\n\t\t\t<filter\n\t\t\t\tkey={insideShadowId.id}\n\t\t\t\tid={insideShadowId.id}\n\t\t\t\tx={`${filterX.toFixed(1)}%`}\n\t\t\t\ty={`${filterY.toFixed(1)}%`}\n\t\t\t\twidth={`${filterWidth.toFixed(1)}%`}\n\t\t\t\theight={`${filterHeight.toFixed(1)}%`}\n\t\t\t\tfilterUnits=\"objectBoundingBox\"\n\t\t\t\t{...svgShadowProps}\n\t\t\t>\n\t\t\t\t{filterElements}\n\t\t\t\t{insetShadows.length > 1 ? <feMerge>{mergeElements}</feMerge> : null}\n\t\t\t</filter>,\n\t\t)\n\n\t\t// if we rendered at lower resolution, we need a clip path ...\n\t\tlet clipPath: string | undefined\n\t\tif (needsStrokeClip) {\n\t\t\tclipPath = strokeClipId.urlLink\n\t\t}\n\n\t\tinsetElement = (\n\t\t\t<use\n\t\t\t\tfill=\"black\"\n\t\t\t\tfillOpacity=\"1\"\n\t\t\t\tfilter={insideShadowId.urlLink}\n\t\t\t\txlinkHref={shapeId.link}\n\t\t\t\tclipPath={clipPath}\n\t\t\t\t{...svgShadowProps}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn { definition, outsetElement, insetElement, needsStrokeClip, maskElement }\n}\n\nfunction outerShadowElements(shapeID: InternalID, shadow: BoxShadow, index: number) {\n\tconst shadowKey = shapeID.add(\"_outer_shadow\" + index)\n\n\tconst filterElements = (\n\t\t<OuterShadowFilterElements key={shadowKey.id + \"-filters\"} shadow={shadow} shadowKey={shadowKey} />\n\t)\n\n\tconst mergeElement = <feMergeNode key={shadowKey.id + \"-merge\"} in={shadowKey.id} />\n\treturn { filterElements, mergeElement }\n}\n\n// Matching rendering with code-generated shadows: https://bit.ly/4dkxNy0\nconst OuterShadowFilterElements: React.FunctionComponent<{\n\tshadow: BoxShadow\n\tshadowKey: InternalID\n}> = props => {\n\tconst { shadow, shadowKey } = props\n\n\tconst offsetId = shadowKey.add(\"offset\").id\n\tconst blurId = shadowKey.add(\"blur\").id\n\tconst floodId = shadowKey.add(\"flood\").id\n\n\treturn (\n\t\t<>\n\t\t\t<feOffset dx={shadow.x} dy={shadow.y} in=\"SourceAlpha\" result={offsetId} />\n\t\t\t<feGaussianBlur stdDeviation={shadow.blur / 2} in={offsetId} result={blurId} />\n\t\t\t<feFlood floodColor={shadow.color} result={floodId} />\n\t\t\t<feComposite in={floodId} in2={blurId} operator=\"in\" result={shadowKey.id} />\n\t\t</>\n\t)\n}\n\nfunction innerShadowElements(shapeID: InternalID, shadow: BoxShadow, index: number) {\n\tconst shadowKey = shapeID.add(\"_inside_shadow\" + index)\n\n\tconst filterElements = (\n\t\t<InnerShadowFilterElements key={shadowKey.id + \"-filters\"} shadow={shadow} shadowKey={shadowKey} />\n\t)\n\tconst mergeElement = <feMergeNode key={shadowKey.id + \"-merge\"} in={shadowKey.id} />\n\treturn { filterElements, mergeElement }\n}\n\nconst InnerShadowFilterElements: React.FunctionComponent<{\n\tshadow: BoxShadow\n\tshadowKey: InternalID\n}> = props => {\n\tconst { shadow, shadowKey } = props\n\tconst blurId = shadowKey.add(\"blur\").id\n\tconst offsetId = shadowKey.add(\"offset\").id\n\tconst compositeId = shadowKey.add(\"composite\").id\n\tconst floodId = shadowKey.add(\"flood\").id\n\n\treturn (\n\t\t<>\n\t\t\t<feGaussianBlur stdDeviation={shadow.blur / 2} in=\"SourceAlpha\" result={blurId} />\n\t\t\t<feOffset dx={shadow.x} dy={shadow.y} in={blurId} result={offsetId} />\n\t\t\t<feComposite in={offsetId} in2=\"SourceAlpha\" operator=\"arithmetic\" k2=\"-1\" k3=\"1\" result={compositeId} />\n\t\t\t<feFlood floodColor={shadow.color} result={floodId} />\n\t\t\t<feComposite in={floodId} in2={compositeId} operator=\"in\" result={shadowKey.id} />\n\t\t</>\n\t)\n}\n\nexport function calcMaxRealisticShadowBlur(distance: number, focus: number) {\n\treturn interpolate([0, 0.5, 1], [distance * 5, distance, 0])(focus)\n}\n\nconst maxSpread = 5\nexport function calcRealisticShadowSpread(diffusion: number) {\n\treturn mix(-maxSpread, 0, diffusion)\n}\n\n/** @internal */\nexport function localShadowFrame(shadow: BoxShadow | Shadow, frame: Rect, isSVG: boolean = false) {\n\tif (!isSVG && asRecord(shadow)[\"inset\"]) return null\n\n\tlet growth = shadow.blur\n\n\tlet minX: number\n\tlet maxX: number\n\tlet minY: number\n\tlet maxY: number\n\n\tif (isSVG) {\n\t\tminX = -Math.abs(shadow.x) - growth\n\t\tmaxX = Math.abs(shadow.x) + frame.width + growth\n\t\tminY = -Math.abs(shadow.y) - growth\n\t\tmaxY = Math.abs(shadow.y) + frame.height + growth\n\t} else if (BoxShadow.is(shadow) && shadow.type === \"realistic\") {\n\t\tgrowth =\n\t\t\t\"focus\" in shadow && \"diffusion\" in shadow\n\t\t\t\t? calcMaxRealisticShadowBlur(distance(shadow.x, shadow.y), shadow.focus) +\n\t\t\t\t\tcalcRealisticShadowSpread(shadow.diffusion)\n\t\t\t\t: 0\n\n\t\tif (shadow.x >= 0) {\n\t\t\tminX = 0 - growth\n\t\t\tmaxX = shadow.x + frame.width + growth\n\t\t} else {\n\t\t\tminX = shadow.x - growth\n\t\t\tmaxX = frame.width + growth\n\t\t}\n\n\t\tif (shadow.y >= 0) {\n\t\t\tminY = 0 - growth\n\t\t\tmaxY = shadow.y + frame.height + growth\n\t\t} else {\n\t\t\tminY = shadow.y - growth\n\t\t\tmaxY = frame.height + growth\n\t\t}\n\t} else {\n\t\tif (\"spread\" in shadow) {\n\t\t\tgrowth += shadow.spread\n\t\t}\n\t\tminX = shadow.x - growth\n\t\tmaxX = shadow.x + frame.width + growth\n\t\tminY = shadow.y - growth\n\t\tmaxY = shadow.y + frame.height + growth\n\t}\n\tif (maxX <= minX || maxY <= minY) return null\n\treturn { x: minX, y: minY, width: maxX - minX, height: maxY - minY }\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { shadowsAsFilter } from \"../style/shadow.tsx\"\nimport type { BackgroundFilterProperties } from \"../traits/BackdropFilters.ts\"\nimport type { FilterProperties } from \"../traits/Filters.ts\"\nimport { isFiniteNumber } from \"./isFiniteNumber.ts\"\n\nexport function collectLayerFilters(props: Partial<FilterProperties>, style: MotionStyle) {\n\tconst filters: string[] = []\n\n\t/**\n\t * number-percentage types are set as numbers, as when filters are read from the DOM\n\t * they are returned as numbers rather than percetages. This makes it simpler for Motion\n\t * to animate from filters read from the DOM.\n\t */\n\tif (isFiniteNumber(props.brightness)) {\n\t\tfilters.push(`brightness(${props.brightness / 100})`)\n\t}\n\tif (isFiniteNumber(props.contrast)) {\n\t\tfilters.push(`contrast(${props.contrast / 100})`)\n\t}\n\tif (isFiniteNumber(props.grayscale)) {\n\t\tfilters.push(`grayscale(${props.grayscale / 100})`)\n\t}\n\tif (isFiniteNumber(props.hueRotate)) {\n\t\tfilters.push(`hue-rotate(${props.hueRotate}deg)`)\n\t}\n\tif (isFiniteNumber(props.invert)) {\n\t\tfilters.push(`invert(${props.invert / 100})`)\n\t}\n\tif (isFiniteNumber(props.saturate)) {\n\t\tfilters.push(`saturate(${props.saturate / 100})`)\n\t}\n\tif (isFiniteNumber(props.sepia)) {\n\t\tfilters.push(`sepia(${props.sepia / 100})`)\n\t}\n\tif (isFiniteNumber(props.blur)) {\n\t\tfilters.push(`blur(${props.blur}px)`)\n\t}\n\tif (props.dropShadows) {\n\t\tfilters.push(...shadowsAsFilter(props.dropShadows))\n\t}\n\n\tif (filters.length === 0) return\n\tstyle.filter = style.WebkitFilter = filters.join(\" \")\n}\n\nexport function collectBackgroundFilters(props: Partial<BackgroundFilterProperties>, style: MotionStyle) {\n\tif (isFiniteNumber(props.backgroundBlur)) {\n\t\tstyle.backdropFilter = style.WebkitBackdropFilter = `blur(${props.backgroundBlur}px)`\n\t}\n}\n\n/** @internal */\nexport function collectFiltersFromProps(\n\tprops: Partial<FilterProperties & BackgroundFilterProperties>,\n\tstyle: MotionStyle,\n): void {\n\tcollectBackgroundFilters(props, style)\n\tcollectLayerFilters(props, style)\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport type React from \"react\"\nimport type { BackgroundFilterProperties } from \"../traits/BackdropFilters.ts\"\nimport type { BackgroundProperties } from \"../traits/Background.ts\"\nimport { collectBackgroundFromProps } from \"../traits/Background.ts\"\nimport type { BlendingProperties } from \"../traits/Blending.ts\"\nimport { collectBlendingFromProps } from \"../traits/Blending.ts\"\nimport type { FilterProperties } from \"../traits/Filters.ts\"\nimport type { WithOpacity } from \"../traits/Opacity.ts\"\nimport { collectOpacityFromProps } from \"../traits/Opacity.ts\"\nimport type { OverflowProperties } from \"../traits/Overflow.ts\"\nimport { collectOverflowFromProps } from \"../traits/Overflow.ts\"\nimport type { RadiusProperties } from \"../traits/Radius.ts\"\nimport { collectRadiusFromProps } from \"../traits/Radius.ts\"\nimport type { BoxShadowProperties } from \"../traits/Shadow.ts\"\nimport type { TextColorProperties } from \"../traits/TextColor.ts\"\nimport { collectTextColorFromProps } from \"../traits/TextColor.ts\"\nimport { collectFiltersFromProps } from \"../utils/filtersForNode.ts\"\nimport { collectBoxShadowsForProps, collectTextShadowsForProps } from \"./shadow.tsx\"\n\n/** @public */\nexport type DeprecatedVisualProperties = Partial<\n\tBackgroundProperties &\n\t\tRadiusProperties &\n\t\tFilterProperties &\n\t\tBackgroundFilterProperties &\n\t\tBlendingProperties &\n\t\tOverflowProperties &\n\t\tBoxShadowProperties &\n\t\tWithOpacity &\n\t\tTextColorProperties\n>\n\n/** @internal */\nexport function collectVisualStyleFromProps(\n\tprops: DeprecatedVisualProperties,\n\tstyle: React.CSSProperties | MotionStyle,\n\tisTextNode: boolean = false,\n) {\n\tcollectBackgroundFromProps(props, style)\n\tcollectRadiusFromProps(props, style)\n\tcollectFiltersFromProps(props, style)\n\tcollectBlendingFromProps(props, style)\n\tcollectOverflowFromProps(props, style)\n\tcollectOpacityFromProps(props, style)\n\tcollectTextColorFromProps(props, style)\n\tif (isTextNode) {\n\t\tcollectTextShadowsForProps(props, style)\n\t} else {\n\t\tcollectBoxShadowsForProps(props, style)\n\t}\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { resolveMotionValue } from \"framer-motion\"\nimport type React from \"react\"\nimport { Animatable } from \"../../animation/Animatable/Animatable.ts\"\nimport type { Size } from \"../../render/types/Size.ts\"\nimport { isFiniteNumber } from \"../../render/utils/isFiniteNumber.ts\"\nimport { RenderEnvironment, RenderTarget } from \"../types/RenderEnvironment.ts\"\n\nconst getNumber = /* @__PURE__ */ (() => Animatable.getNumber)()\n\nexport interface DeprecatedTransformProperties {\n\tz: Animatable<number> | number\n\trotation: Animatable<number> | number\n\trotationX: Animatable<number> | number\n\trotationY: Animatable<number> | number\n\trotationZ: Animatable<number> | number\n\tscale: Animatable<number> | number\n\tscaleX: Animatable<number> | number\n\tscaleY: Animatable<number> | number\n\tscaleZ: Animatable<number> | number\n\tskew: Animatable<number> | number\n\tskewX: Animatable<number> | number\n\tskewY: Animatable<number> | number\n\toriginX: Animatable<number> | number\n\toriginY: Animatable<number> | number\n\toriginZ: Animatable<number> | number\n}\n\nexport const transformDefaults: DeprecatedTransformProperties = {\n\tz: 0,\n\trotation: 0,\n\trotationX: 0,\n\trotationY: 0,\n\trotationZ: 0,\n\tscale: 1,\n\tscaleX: 1,\n\tscaleY: 1,\n\tscaleZ: 1,\n\tskew: 0,\n\tskewX: 0,\n\tskewY: 0,\n\toriginX: 0.5,\n\toriginY: 0.5,\n\toriginZ: 0,\n}\n\nfunction getRotation(rotation: number | Animatable<number>, rotate: number | string): number {\n\tif (typeof rotate === \"string\") {\n\t\trotate = parseFloat(rotate)\n\t}\n\treturn isFiniteNumber(rotate) ? rotate : getNumber(rotation)\n}\n\nexport function collectTransformFromProps(\n\tprops: DeprecatedTransformProperties,\n\trect: { x: number | string; y: number | string } & Size,\n\tstyle: React.CSSProperties,\n) {\n\tconst motionStyle = style as MotionStyle\n\t// 3d properties\n\tconst x = typeof rect.x === \"number\" ? `${rect.x}px` : rect.x\n\tconst y = typeof rect.y === \"number\" ? `${rect.y}px` : rect.y\n\tconst z = getNumber(props.z)\n\tconst scaleZ = getNumber(props.scaleZ)\n\tconst originZ = getNumber(props.originZ)\n\tconst rotationZ = getRotation(props.rotationZ, resolveMotionValue(motionStyle.rotateZ))\n\tconst rotationX = getRotation(props.rotationX, resolveMotionValue(motionStyle.rotateX))\n\tconst rotationY = getRotation(props.rotationY, resolveMotionValue(motionStyle.rotateY))\n\tconst scale = getNumber(props.scale)\n\tconst scaleX = getNumber(props.scaleX)\n\tconst scaleY = getNumber(props.scaleY)\n\tconst skew = getNumber(props.skew)\n\tconst skewX = getNumber(props.skewX)\n\tconst skewY = getNumber(props.skewY)\n\tconst rotation = getRotation(props.rotation, resolveMotionValue(motionStyle.rotate))\n\n\t// while exporting, using 3d transforms reduces artefacts in filters\n\tconst force3d = RenderEnvironment.target === RenderTarget.export\n\n\tif (force3d || z !== 0 || scaleZ !== 1 || originZ !== 0 || rotationZ !== 0 || rotationX !== 0 || rotationY !== 0) {\n\t\tstyle.transform = `\n            ${`translate3d(${x}, ${y}, ${z}px)`}\n            scale3d(${scaleX * scale}, ${scaleY * scale}, ${scaleZ})\n            skew(${skew}deg,${skew}deg)\n            skewX(${skewX}deg)\n            skewY(${skewY}deg)\n            translateZ(${originZ}px)\n            rotateX(${rotationX}deg)\n            rotateY(${rotationY}deg)\n            rotateZ(${(rotation + rotationZ).toFixed(4)}deg)\n            translateZ(${-originZ}px)`\n\t} else {\n\t\tstyle.transform = `\n            ${`translate(${x}, ${y})`}\n            scale(${scaleX * scale}, ${scaleY * scale})\n            skew(${skew}deg,${skew}deg)\n            skewX(${skewX}deg)\n            skewY(${skewY}deg)\n            rotate(${rotation.toFixed(4)}deg)`\n\t}\n\n\tconst transformOrigin = `${getNumber(props.originX) * 100}% ${getNumber(props.originY) * 100}%`\n\tstyle.transformOrigin = transformOrigin\n\tstyle.WebkitTransformOrigin = transformOrigin\n}\n", "import { isAnimatable } from \"../../../animation/Animatable/Animatable.ts\"\nimport type { FrameProps } from \"./FrameWithMotion.tsx\"\nimport type { DeprecatedFrameWithEventsProps } from \"./types.ts\"\n\ntype FrameWithMotionPropsKey = keyof FrameProps\ntype Diff<T, U> = T extends U ? never : T\ntype FrameWithMotionOnlyKeys = Diff<FrameWithMotionPropsKey, keyof DeprecatedFrameWithEventsProps>\n\n// Complete list of FrameWithMotion props keys\nconst frameWithMotionPropsFields: FrameWithMotionOnlyKeys[] = [\n\t\"_border\",\n\t\"_constraints\",\n\t\"animate\",\n\t\"initial\",\n\t\"variants\",\n\t\"transition\",\n\t\"inherit\",\n\t\"center\",\n\t\"initial\",\n\t\"transformTemplate\",\n\t\"animate\",\n\t\"variants\",\n\t\"transition\",\n\t\"onUpdate\",\n\t\"onAnimationComplete\",\n\t\"onPanSessionStart\",\n\t\"onTapCancel\",\n\t\"whileTap\",\n\t\"whileHover\",\n\t\"onHoverStart\",\n\t\"onHoverEnd\",\n\t\"drag\",\n\t\"dragDirectionLock\",\n\t\"dragPropagation\",\n\t\"dragConstraints\",\n\t\"dragElastic\",\n\t\"dragMomentum\",\n\t\"dragTransition\",\n\t\"onDragStart\",\n\t\"onDragEnd\",\n\t\"onDrag\",\n\t\"onDirectionLock\",\n\t\"onDragTransitionEnd\",\n\t\"x\",\n\t\"y\",\n\t\"rotate\",\n\t\"rotateX\",\n\t\"rotateY\",\n\t\"rotateZ\",\n\t\"position\",\n\t\"border\",\n\t\"borderRadius\",\n\t\"cornerShape\",\n\t\"shadow\",\n\t\"size\",\n]\n\ntype DeprecatedFramePropsKey = keyof DeprecatedFrameWithEventsProps\nconst deprecatedFramePropsFields: DeprecatedFramePropsKey[] = [\n\t\"autoSize\",\n\t\"aspectRatio\",\n\t\"borderWidth\",\n\t\"borderStyle\",\n\t\"borderColor\",\n\t\"centerX\",\n\t\"centerY\",\n]\n\n/**\n * This function guard will define is props meant to be used with old frame or with new one\n * @param props Old or new props for the frame\n */\nexport function isDeprecatedFrameProps(\n\tprops: Record<string, unknown>,\n): props is Partial<DeprecatedFrameWithEventsProps> {\n\t// If we are using animatables, definitely use a DeprecatedFrame\n\tfor (const propKey in props) {\n\t\tif (isAnimatable(props[propKey])) return true\n\t}\n\n\t// It is a new frame API props\n\tfor (const field of frameWithMotionPropsFields) {\n\t\t// biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>\n\t\tif (props.hasOwnProperty(field)) return false\n\t}\n\n\t// It is definitely an old API\n\tfor (const field of deprecatedFramePropsFields) {\n\t\t// biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>\n\t\tif (props.hasOwnProperty(field)) return true\n\t}\n\n\t// Fallback to new Frame API\n\treturn false\n}\n", "import type React from \"react\"\nimport type { DeprecatedFrameWithEventsProps } from \"../render/presentation/Frame/index.tsx\"\nimport { DeprecatedFrameWithEvents } from \"../render/presentation/Frame/index.tsx\"\nimport type { DraggableProps } from \"./hoc/WithDragging.tsx\"\nimport { WithDragging } from \"./hoc/WithDragging.tsx\"\n\n/** @public */\nexport const Draggable: React.ComponentClass<\n\tPartial<DeprecatedFrameWithEventsProps> & Partial<DraggableProps<typeof DeprecatedFrameWithEvents>>\n> = /* @__PURE__ */ WithDragging(DeprecatedFrameWithEvents)\n", "import { frame } from \"framer-motion\"\nimport React, { useEffect, useRef } from \"react\"\nimport { useSharedIntersectionObserver } from \"../../modules/useSharedIntersectionObserver.ts\"\nimport type { PaginationInfo } from \"../../router/types.ts\"\nimport { type MutableRefCallback, useObserverRef } from \"../utils/refHelper.ts\"\n\nexport interface UseInfiniteScrollProps {\n\tref: MutableRefCallback<HTMLElement | null>\n\tloadMore: () => void\n\trootMargin?: string\n\tthreshold?: number | number[]\n\tpaginationInfo: PaginationInfo\n}\n\nfunction useInfiniteScroll({ ref: observerRef, loadMore, rootMargin = \"0px\", paginationInfo }: UseInfiniteScrollProps) {\n\tconst isVisibleRef = useRef(false)\n\tconst callback = React.useCallback(\n\t\t(entry: IntersectionObserverEntry) => {\n\t\t\tif (!entry.isIntersecting) {\n\t\t\t\tisVisibleRef.current = false\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tisVisibleRef.current = true\n\t\t\tloadMore()\n\t\t\treturn\n\t\t},\n\t\t[loadMore],\n\t)\n\n\t// The IO doesn't fire again if the spinner is still visible, so whenever we change the page,\n\t// we need to check if the element is still visible.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: see above\n\tuseEffect(() => {\n\t\t// the IntersectionObserver fires with low prio, so let's wait 2 frames to make sure the\n\t\t// visibility status is correct.\n\t\tframe.postRender(() => {\n\t\t\tframe.render(() => {\n\t\t\t\tif (isVisibleRef.current) {\n\t\t\t\t\tloadMore()\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\t}, [paginationInfo.currentPage, loadMore])\n\n\tuseSharedIntersectionObserver(observerRef, callback, {\n\t\trootMargin,\n\t\tenabled: paginationInfo.currentPage < paginationInfo.totalPages,\n\t})\n}\n\ntype WithInfiniteScrollProps<P> = P & {\n\t__paginationInfo: PaginationInfo\n\t__loadMore: () => void\n}\n\n/** @public */\nexport function withInfiniteScroll<P>(Component: React.ComponentType<P>) {\n\treturn React.forwardRef(\n\t\t(\n\t\t\t{ __paginationInfo, __loadMore, ...props }: WithInfiniteScrollProps<P>,\n\t\t\tref: React.MutableRefObject<HTMLElement>,\n\t\t) => {\n\t\t\tconst infiniteScrollRef = useObserverRef(ref)\n\n\t\t\tuseInfiniteScroll({\n\t\t\t\trootMargin: \"500px\",\n\t\t\t\tloadMore: __loadMore,\n\t\t\t\tref: infiniteScrollRef,\n\t\t\t\tpaginationInfo: __paginationInfo,\n\t\t\t})\n\n\t\t\treturn <Component {...(props as P)} ref={infiniteScrollRef} />\n\t\t},\n\t)\n}\n", "import { isTest } from \"@framerjs/shared/src/environment.ts\"\nimport type { MotionValue, PanInfo } from \"framer-motion\"\nimport { animate, animateValue, motionValue, useMotionValue } from \"framer-motion\"\nimport React, { startTransition } from \"react\"\nimport type { FrameProps } from \"../../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { FrameWithMotion } from \"../../render/presentation/Frame/FrameWithMotion.tsx\"\nimport type { Rect } from \"../../render/types/Rect.ts\"\nimport { RenderTarget } from \"../../render/types/RenderEnvironment.ts\"\nimport type { Size } from \"../../render/types/Size.ts\"\nimport { withLibraryCSS } from \"../../render/utils/injectComponentCSSRules.ts\"\nimport { isFiniteNumber } from \"../../render/utils/isFiniteNumber.ts\"\nimport { isMotionValue } from \"../../render/utils/isMotionValue.ts\"\nimport { useLayoutId } from \"../../render/utils/useLayoutId.ts\"\nimport { useIsomorphicLayoutEffect } from \"../../useIsomorphicLayoutEffect.ts\"\nimport { isReactChild, isReactElement } from \"../../utils/type-guards.ts\"\nimport { warnOnce } from \"../../utils/warnOnce.ts\"\nimport { EmptyState } from \"../EmptyState.tsx\"\nimport { useWheelScroll } from \"../Scroll/useWheelScroll.ts\"\nimport type { PaddingProps } from \"../utils/paddingFromProps.ts\"\nimport { makePaddingString, paddingFromProps } from \"../utils/paddingFromProps.ts\"\nimport { PageContainer, pageContentWrapperType } from \"./PageContainer.tsx\"\nimport type {\n\tCustomPageEffect,\n\tPageDirection,\n\tPageEffect,\n\tPageEffectInfo,\n\tPageEffectValues,\n\tPageProperties,\n\tPageProps,\n} from \"./types.ts\"\n\n/**\n * The Page component allows you to create horizontally or vertically swipeable areas. It can be\n * imported from the Framer Library and used in code components. Add children to create pages to\n * swipe between. These children will be stretched to the size of the page component by default,\n * but can also be set to auto to maintain their original size.\n *\n * @remarks\n * ```jsx\n * import React from \"react\"\n * import { Frame, Page } from \"framer\"\n * export class Page extends React.Component {\n *   render() {\n *     return (\n *       <Page>\n *         <Frame />\n *       </Page>\n *     )\n *   }\n * }\n * ```\n * @public\n * @deprecated The option to add those to \"Canvas\" pages has been removed as of May 2025, but pages using this might exist in the wild.\n */\nconst PageInner = /* @__PURE__ */ React.forwardRef<HTMLDivElement, Partial<PageProps>>(function Page(\n\tprops,\n\tforwardedRef: React.RefObject<HTMLDivElement> | null,\n) {\n\tconst {\n\t\tdirection = \"horizontal\",\n\t\tcontentWidth = \"stretch\",\n\t\tcontentHeight = \"stretch\",\n\t\talignment = \"start\",\n\t\tcurrentPage = 0,\n\t\tanimateCurrentPageUpdate = true,\n\t\tgap: gapValue = 10,\n\t\tpadding: _padding = 0,\n\t\tmomentum = false,\n\t\tdragEnabled = true,\n\t\tdefaultEffect: _defaultEffect = \"none\",\n\t\tbackground = \"transparent\",\n\t\toverflow = \"hidden\",\n\t\t__fromCodeComponentNode,\n\t\teffect: _effect,\n\t\tchildren,\n\t\tcontentOffsetX,\n\t\tcontentOffsetY,\n\t\tonChangePage,\n\t\tonScrollStart,\n\t\tonScroll,\n\t\tonDragStart,\n\t\tonDrag,\n\t\tonDragEnd,\n\t\tdirectionLock,\n\t\tonScrollEnd,\n\t\tonDirectionLock: _onDirectionLock,\n\t\tonUpdate: _onUpdate,\n\t\twheelEnabled = false,\n\t\tlayoutId: specificLayoutId,\n\t\t...rest\n\t} = props\n\n\tconst layoutId = useLayoutId(props, { specificLayoutId, postfix: \"page\" })\n\tconst containerProps = { ...rest, background }\n\tconst hasMountedRef = React.useRef(false)\n\n\tconst hasFixedSize =\n\t\tRenderTarget.hasRestrictions() &&\n\t\tprops.__fromCodeComponentNode &&\n\t\tisFiniteNumber(containerProps.width) &&\n\t\tisFiniteNumber(containerProps.height)\n\n\tif (!hasFixedSize && __fromCodeComponentNode && !containerProps.__fromCanvasComponent) {\n\t\tcontainerProps.width = \"100%\"\n\t\tcontainerProps.height = \"100%\"\n\t\tcontainerProps._constraints = { enabled: true }\n\t}\n\n\tconst { initial, prev } = React.useRef({\n\t\tinitial: { x: 0, y: 0 },\n\t\tprev: { x: 0, y: 0 },\n\t}).current\n\n\tconst isHorizontal = direction === \"horizontal\"\n\tlet gap = gapValue\n\tif (gap < 0) {\n\t\twarnOnce(`The 'gap' property of Page component can not be negative, but is ${gapValue}.`)\n\t\tgap = 0\n\t}\n\n\tconst pageCount = React.Children.count(children)\n\n\tconst maxOffsetRef = React.useRef(0)\n\tconst constraints = React.useRef({ top: 0, left: 0, right: 0, bottom: 0 })\n\n\tconst fallbackContainerRef = React.useRef<HTMLDivElement>(null)\n\tconst containerRef = forwardedRef || fallbackContainerRef\n\n\tconst scrollableRef = React.useRef<HTMLDivElement>(null)\n\n\tconst pageEffectValuesRef = React.useRef<({ [key: string]: MotionValue } | undefined)[]>([])\n\tconst pageRectsRef = React.useRef<Rect[]>([])\n\n\t// On the Framer Canvas we need to use `useMotionValue` because it falls\n\t// back to a React state update in static mode, allowing the component to\n\t// update. Since you cannot conditionally render a hook, we use 0 as the\n\t// default value if the React prop is **already** a motion value, and then\n\t// simply do not use the returned motion value.\n\tconst internalX = useMotionValue(isMotionValue(contentOffsetX) ? 0 : (contentOffsetX ?? 0))\n\tconst internalY = useMotionValue(isMotionValue(contentOffsetY) ? 0 : (contentOffsetY ?? 0))\n\n\tconst contentOffsetRef = React.useRef<{ x: MotionValue<number>; y: MotionValue<number> }>({\n\t\tx: isMotionValue(contentOffsetX) ? contentOffsetX : internalX,\n\t\ty: isMotionValue(contentOffsetY) ? contentOffsetY : internalY,\n\t})\n\tconst currentContentPageRef = React.useRef<number>(currentPage)\n\tconst propsBoundedCurrentPageRef = React.useRef(currentPage) // Bounded version of props.currentPage\n\tconst latestPropsRef = React.useRef(props)\n\tlatestPropsRef.current = props\n\n\tconst lastDirectionRef = React.useRef(props.direction)\n\n\tconst snapToPage = useSnapToPage(currentContentPageRef, contentOffsetRef, isHorizontal)\n\n\tconst [_, setForceUpdateCount] = React.useState(0)\n\n\tconst containerSizeRef = React.useRef({ width: 200, height: 200 })\n\n\tif (hasFixedSize && isFiniteNumber(containerProps.width) && isFiniteNumber(containerProps.height)) {\n\t\tcontainerSizeRef.current.width = containerProps.width\n\t\tcontainerSizeRef.current.height = containerProps.height\n\t}\n\n\tconst updateOnResize = React.useCallback(() => {\n\t\tif (!hasFixedSize) startTransition(() => setForceUpdateCount(v => v + 1))\n\t}, [hasFixedSize])\n\n\t// Setup a listener on the window's size. If it changes, and we are in\n\t// preview, we may need to render to trigger motion's onLayoutMeasure to\n\t// update the constraints.\n\tReact.useEffect(() => {\n\t\tif (RenderTarget.current() !== RenderTarget.preview) return\n\n\t\tglobalThis.addEventListener(\"resize\", updateOnResize)\n\n\t\treturn () => {\n\t\t\tglobalThis.removeEventListener(\"resize\", updateOnResize)\n\t\t}\n\t}, [updateOnResize])\n\n\tconst applyEffects = () => {\n\t\tpageEffectValuesRef.current.forEach((effectDictionary, index) => {\n\t\t\tconst values = effectValues(index, latestPropsRef, pageRectsRef, contentOffsetRef, maxOffsetRef)\n\t\t\tif (!effectDictionary || !values) return\n\t\t\tfor (const [key, value] of Object.entries(values)) {\n\t\t\t\tconst effectValue = effectDictionary[key]\n\t\t\t\tif (isMotionValue(effectValue)) {\n\t\t\t\t\t// Because these are the actual Animatable values passed to the Frame\n\t\t\t\t\t// Updating their value will modify the Frame\n\t\t\t\t\teffectValue.set(value)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\tconst updateMaxOffsetFromPageContents = (containerSize: Size) => {\n\t\tconst newPageContentRects = getPageContentRects(containerRef, containerSize, direction, gap)\n\t\tif (newPageContentRects) pageRectsRef.current = newPageContentRects\n\t\tconst newMaxOffset = getMaxOffset(containerSizeRef.current, pageRectsRef.current, direction, latestPropsRef.current)\n\n\t\tif (newMaxOffset !== maxOffsetRef.current) {\n\t\t\tmaxOffsetRef.current = newMaxOffset\n\n\t\t\tconstraints.current.top = -newMaxOffset\n\t\t\tconstraints.current.left = -newMaxOffset\n\n\t\t\t/**\n\t\t\t * @FIXME Without this forced render, if you resize Page on the\n\t\t\t * canvas when it's current page is not 0, you will see flashes of\n\t\t\t * the previous page. This happens when the MotionValue for the x or\n\t\t\t * y offset is out of sync with the size of the Page and the Page\n\t\t\t * contents, which manifests as the current page not being\n\t\t\t * transformed far enough from the start point.\n\t\t\t *\n\t\t\t * Unfortunately, it's not 100% clear why this force render is\n\t\t\t * required.\n\t\t\t *\n\t\t\t * Since the offset is a Motion Value, its updates are not tied to\n\t\t\t * React renders, so it stays up to date based on a 60fps render\n\t\t\t * cycle run by framer-motion. However, this setState is called\n\t\t\t * inside a useLayoutEffect hook. If an update is scheduled during a\n\t\t\t * useLayoutEffect hook, painting is deferred until no more updates\n\t\t\t * are scheduled. In the case of this function, the first\n\t\t\t * useLayoutEffect after a resize will trigger this React render,\n\t\t\t * painting will be deferred, and the same useLayoutEffect will run\n\t\t\t * a second time, finally calling this function a second time. On\n\t\t\t * the second invocation of this function, since we cache the\n\t\t\t * previous maxOffset to a ref, this state update will not get\n\t\t\t * called. Since no updates are scheduled in the second render,\n\t\t\t * React will finally paint the update.\n\t\t\t *\n\t\t\t * Since this bug only happens in Safari in some circumstances when\n\t\t\t * resizing on the canvas at 60fps, it's possible that there is a\n\t\t\t * case where when we do not defer painting in the first\n\t\t\t * useLayoutEffect, the React render and the MotionValue update are\n\t\t\t * not in sync, causing a brief flash.\n\t\t\t *\n\t\t\t * However, if we can figure out a way to ensure those updates\n\t\t\t * happen in sync, we should remove this React render as it is\n\t\t\t * unnecessary and will only hinder performance when used elsewhere,\n\t\t\t * such as generated components where you can resize a Page while\n\t\t\t * performing a page transition.\n\t\t\t */\n\n\t\t\t// This may need startTransition to avoid synchronous, blocking re-renders.\n\t\t\t// However, this component is deprecated. Let's not modify the behavior.\n\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition -- deprecated component + this is for canvas only\n\t\t\tif (RenderTarget.current() === RenderTarget.canvas) setForceUpdateCount(v => v + 1)\n\t\t}\n\t}\n\n\t// Measure the container size, and return the size if it has changed.\n\tconst measureContainerSize = (): Size | null => {\n\t\tconst element = containerRef.current\n\t\tif (!element) return null\n\n\t\tconst { offsetWidth, offsetHeight } = element\n\n\t\tconst currentSize = containerSizeRef.current\n\t\tif (offsetWidth !== currentSize.width || offsetHeight !== currentSize.height) {\n\t\t\tcontainerSizeRef.current = {\n\t\t\t\twidth: offsetWidth,\n\t\t\t\theight: offsetHeight,\n\t\t\t}\n\t\t\treturn containerSizeRef.current\n\t\t}\n\n\t\treturn null\n\t}\n\n\tconst updateAndSnapToPage = (newPage: number, mount: boolean = false) => {\n\t\tconst newBoundedCurrentPage = getBoundedCurrentPage(newPage, pageCount)\n\t\tconst boundedCurrentPageDidChange = newBoundedCurrentPage !== propsBoundedCurrentPageRef.current\n\n\t\tif (boundedCurrentPageDidChange) {\n\t\t\tpropsBoundedCurrentPageRef.current = newBoundedCurrentPage\n\t\t\tupdateCurrentPage(newBoundedCurrentPage, currentContentPageRef, !mount ? onChangePage : undefined)\n\t\t}\n\n\t\t// Finally, even if the current page did not change, the offset may\n\t\t// have. Snap the current page to the latest offset.\n\t\tconst offset = offsetForPage(newBoundedCurrentPage, pageCount, pageRectsRef, isHorizontal, maxOffsetRef)\n\t\tconst animated = animateCurrentPageUpdate && RenderTarget.current() !== RenderTarget.canvas && !mount\n\t\tsnapToPage(newBoundedCurrentPage, offset, { animated })\n\t}\n\n\t// Handle setting up MotionValue handlers, performing initial measurements,\n\t// and setting the initial dragConstraints on mount. Finally snap to the\n\t// current page without an animation. Mount does not trigger motion's\n\t// onLayoutMeasure handler.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: Has always been like this\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (hasMountedRef.current) return\n\n\t\t/**\n\t\t * Defer the measurement of drag constraints until the next animation frame.\n\t\t * When the preview is closed and reopened, it's switched from display: none\n\t\t * to display: block. When an element is the child of display: none its measurements\n\t\t * return `0`. When this layout effect fires, the preview iframe *is* set to\n\t\t * display: block but in a twist of browser render scheduling this hasn't yet\n\t\t * affected the iframe contents. So by deferring to the following animation frame\n\t\t * we allow the iframe contents to take on dimension again.\n\t\t * Fixes: https://github.com/framer/company/issues/23200\n\t\t */\n\t\trequestAnimationFrame(() => {\n\t\t\t// If the Page has been mounted with a non-default current page, update\n\t\t\t// the ref on mount so that the useEffect that watches changes to the\n\t\t\t// currentPage prop doesn't fire incorrectly on subsequent renders.\n\t\t\tcurrentContentPageRef.current = currentPage\n\n\t\t\tconst contentOffset = contentOffsetRef.current\n\n\t\t\tcontentOffset.x.on(\"change\", applyEffects)\n\t\t\tcontentOffset.y.on(\"change\", applyEffects)\n\n\t\t\tapplyEffects()\n\n\t\t\thasMountedRef.current = true\n\n\t\t\tconst containerSize = measureContainerSize() ?? containerSizeRef.current\n\n\t\t\tupdateMaxOffsetFromPageContents(containerSize)\n\n\t\t\tupdateAndSnapToPage(currentContentPageRef.current, true)\n\t\t})\n\t}, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n\t// Handle user update to the currentPage from React props. This runs after\n\t// onLayoutMeasure, so the current offsets will already be set based on any\n\t// updates to the children or container sizes. Must only fire when\n\t// currentPage changes.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: Has always been like this\n\tReact.useEffect(() => {\n\t\tif (currentPage !== currentContentPageRef.current) updateAndSnapToPage(currentPage)\n\t}, [currentPage]) // eslint-disable-line react-hooks/exhaustive-deps\n\n\t// Measure the container size, and measure the children sizes when motion\n\t// flags that it's performing a measure with any transforms removed.\n\tconst handleMeasureLifecycle = () => {\n\t\t// Measure the container, update the ref, and return the Size if it has changed.\n\t\tconst newContainerSize = measureContainerSize()\n\n\t\t// Get the rects of each PageContainer, and calculate and update drag\n\t\t// constraints based on the current container size.\n\t\tupdateMaxOffsetFromPageContents(newContainerSize ?? containerSizeRef.current)\n\n\t\t// Calculate if the Page's offset transform needs to be updated\n\t\t// to either keep the current page centered, or snap to a new page.\n\t\tupdateAndSnapToPage(currentContentPageRef.current)\n\n\t\t// Finally, if the measured size or direction has changed, ensure that the offset for the\n\t\t// opposite direction is reset to 0. E.g. if the direction is\n\t\t// horizontal, reset the vertical scroll to 0.\n\t\tif (newContainerSize || direction !== lastDirectionRef.current) {\n\t\t\tif (direction === \"horizontal\") {\n\t\t\t\tcontentOffsetRef.current.y.set(0)\n\t\t\t} else {\n\t\t\t\tcontentOffsetRef.current.x.set(0)\n\t\t\t}\n\n\t\t\tlastDirectionRef.current = direction\n\t\t}\n\t}\n\n\t// Motion's onLayoutMeasure is not called on the canvas, so if we are on\n\t// the canvas, we trigger the same callback we pass to onLayoutMeasure here\n\t// in a useLayoutEffect. This is fine because we don't have to worry about\n\t// un-setting parent transforms for measurements on the canvas.\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (RenderTarget.current() !== RenderTarget.canvas) return\n\t\thandleMeasureLifecycle()\n\t})\n\n\tconst onDragStartHandler = (event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {\n\t\tif (onScrollStart) onScrollStart(info)\n\t\tif (onDragStart) onDragStart(event, info)\n\t\tprev.x = initial.x = info.point.x\n\t\tprev.y = initial.y = info.point.y\n\t}\n\n\tconst onDragHandler = (event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {\n\t\tif (onScroll) onScroll(info)\n\t\tif (onDrag) onDrag(event, info)\n\t\tprev.x = info.point.x\n\t\tprev.y = info.point.y\n\t}\n\n\tconst onDragTransitionEnd = () => {\n\t\tif (props.onDragTransitionEnd) props.onDragTransitionEnd()\n\t\tif (onScrollEnd) {\n\t\t\tconst { x, y } = contentOffsetRef.current\n\t\t\tconst point = { x: x.get(), y: y.get() }\n\t\t\tonScrollEnd({\n\t\t\t\tpoint,\n\t\t\t\tvelocity: { x: x.getVelocity(), y: y.getVelocity() },\n\t\t\t\toffset: { x: point.x - initial.x, y: point.y - initial.y },\n\t\t\t\tdelta: { x: point.x - prev.x, y: point.y - prev.y },\n\t\t\t})\n\t\t}\n\t}\n\n\tconst onDragEndHandler = async (event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {\n\t\tconst contentOffset = isHorizontal ? contentOffsetRef.current.x : contentOffsetRef.current.y\n\t\tcontentOffset.stop()\n\n\t\tconst startPosition = contentOffset.get()\n\t\tconst axis = isHorizontal ? \"x\" : \"y\"\n\t\tconst velocity = info.velocity[axis]\n\t\tlet index = nearestPageIndex(pageRectsRef.current, startPosition, startPosition, isHorizontal, momentum)\n\n\t\tif (velocity) {\n\t\t\t/**\n\t\t\t * TODO: This is a bit hacky. We're hijacking the inertia animation for the modifyTarget functionality. Maybe this is information we can\n\t\t\t * pass through the `onDragEnd` event handler if `dragMomentum` is `true`.\n\t\t\t */\n\t\t\tanimateValue({\n\t\t\t\ttype: \"inertia\",\n\t\t\t\tkeyframes: [startPosition],\n\t\t\t\tvelocity,\n\t\t\t\tmodifyTarget: (endPosition: number) => {\n\t\t\t\t\tindex = nearestPageIndex(pageRectsRef.current, startPosition, endPosition, isHorizontal, momentum)\n\t\t\t\t\treturn endPosition\n\t\t\t\t},\n\t\t\t}).stop()\n\t\t}\n\n\t\tupdateCurrentPage(index, currentContentPageRef, onChangePage)\n\n\t\tconst offset = offsetForPage(index, pageCount, pageRectsRef, isHorizontal, maxOffsetRef)\n\t\tif (onDragEnd) onDragEnd(event, info)\n\t\tconst handler = contentOffsetRef.current[axis]\n\n\t\thandler.set(startPosition)\n\t\t// @TODO: Ignored for now, but should re-check later.\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tanimate(handler, offset, {\n\t\t\ttype: \"spring\",\n\t\t\tvelocity,\n\t\t\tstiffness: 500,\n\t\t\tdamping: 50,\n\t\t\tonComplete: onDragTransitionEnd,\n\t\t})\n\t}\n\n\tpageEffectValuesRef.current = []\n\n\tconst childComponents = React.Children.map(children, (child: React.ReactElement<Partial<FrameProps>>, index) => {\n\t\tif (!isReactChild(child) || !isReactElement(child)) {\n\t\t\treturn child\n\t\t}\n\n\t\t// biome-ignore lint/suspicious/noExplicitAny: needed to match `cloneElement`\n\t\tconst update: { [key: string]: any } = {\n\t\t\tright: undefined,\n\t\t\tbottom: undefined,\n\t\t\ttop: undefined,\n\t\t\tleft: undefined,\n\t\t\t_constraints: {\n\t\t\t\tenabled: false,\n\t\t\t},\n\t\t\tstyle: undefined,\n\t\t}\n\n\t\tif (containerProps.__fromCanvasComponent) {\n\t\t\tupdate.style = child.props.style ?? {}\n\t\t\tif (contentWidth === \"stretch\") update.style.width = \"100%\"\n\t\t\tif (contentHeight === \"stretch\") update.style.height = \"100%\"\n\t\t} else {\n\t\t\tif (contentWidth === \"stretch\") update.width = \"100%\"\n\t\t\tif (contentHeight === \"stretch\") update.height = \"100%\"\n\t\t}\n\n\t\tlet effectDictionary: { [key: string]: MotionValue } | undefined\n\n\t\tconst values = effectValues(index, latestPropsRef, pageRectsRef, contentOffsetRef, maxOffsetRef)\n\n\t\tif (values) {\n\t\t\t// We use motion values so we can set them in the onMove function\n\t\t\teffectDictionary = {}\n\t\t\tfor (const key in values) {\n\t\t\t\teffectDictionary[key] = motionValue(values[key])\n\t\t\t}\n\t\t}\n\n\t\tpageEffectValuesRef.current.push(effectDictionary)\n\n\t\treturn (\n\t\t\t<PageContainer\n\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: has always been like this\n\t\t\t\tkey={index}\n\t\t\t\teffect={effectDictionary}\n\t\t\t\tdragEnabled={dragEnabled}\n\t\t\t\tdirection={direction}\n\t\t\t\tcontentHeight={contentHeight}\n\t\t\t\tcontentWidth={contentWidth}\n\t\t\t\talignment={alignment}\n\t\t\t\tgap={gap}\n\t\t\t\tisLastPage={index === pageCount - 1}\n\t\t\t\tcontentOffsetRef={contentOffsetRef}\n\t\t\t\tconstraintsRef={constraints}\n\t\t\t\tdirectionLock={directionLock}\n\t\t\t\tonDragStart={onDragStartHandler}\n\t\t\t\tonDrag={onDragHandler}\n\t\t\t\tonDragEnd={onDragEndHandler}\n\t\t\t\tlayoutId={layoutId ? `${layoutId}-${index}` : undefined}\n\t\t\t>\n\t\t\t\t{React.cloneElement(child, update)}\n\t\t\t</PageContainer>\n\t\t)\n\t})\n\n\tuseWheelScroll(scrollableRef, {\n\t\tenabled: wheelEnabled,\n\t\tinitial,\n\t\tprev,\n\t\tdirection,\n\t\tconstraints,\n\t\toffsetX: contentOffsetRef.current.x,\n\t\toffsetY: contentOffsetRef.current.y,\n\t\tonScrollStart,\n\t\tonScroll,\n\t\tonScrollEnd,\n\t})\n\n\treturn (\n\t\t<FrameWithMotion\n\t\t\tdata-framer-component-type=\"PageWrapper\"\n\t\t\tpreserve3d={false}\n\t\t\tperspective={hasEffect(props) ? 1200 : undefined}\n\t\t\t{...containerProps}\n\t\t\t// Overflow is managed via a property control.\n\t\t\tstyle={{ pointerEvents: undefined, ...containerProps.style, overflow: overflow }}\n\t\t\tlayoutId={layoutId}\n\t\t\tref={containerRef}\n\t\t\tonLayoutMeasure={handleMeasureLifecycle}\n\t\t>\n\t\t\t<FrameWithMotion\n\t\t\t\tdata-framer-component-type=\"Page\"\n\t\t\t\tref={scrollableRef}\n\t\t\t\tbackground={null}\n\t\t\t\tx={contentOffsetRef.current.x}\n\t\t\t\ty={contentOffsetRef.current.y}\n\t\t\t\twidth=\"100%\"\n\t\t\t\theight=\"100%\"\n\t\t\t\tpreserve3d\n\t\t\t\tlayout\n\t\t\t\tlayoutId={layoutId !== undefined ? layoutId + \"-page\" : undefined}\n\t\t\t\tstyle={{\n\t\t\t\t\tpadding: makePaddingString(paddingFromProps(props)),\n\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\tflexDirection: isHorizontal ? \"row\" : \"column\",\n\t\t\t\t\tpointerEvents: props.style?.pointerEvents,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<EmptyState\n\t\t\t\t\ttitle=\"Page\"\n\t\t\t\t\tdescription=\"Click and drag the connector to any frame on the canvas \u2192\"\n\t\t\t\t\tsize={containerSizeRef.current}\n\t\t\t\t\tinsideUserCodeComponent={!__fromCodeComponentNode}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</EmptyState>\n\t\t\t\t{childComponents}\n\t\t\t</FrameWithMotion>\n\t\t</FrameWithMotion>\n\t)\n})\n\nexport const Page = /* @__PURE__ */ withLibraryCSS(PageInner)\n\n// Effects\n\nfunction cubeEffect(info: PageEffectInfo) {\n\tconst { normalizedOffset, direction } = info\n\tconst isHorizontal = direction === \"horizontal\"\n\n\treturn {\n\t\toriginX: normalizedOffset < 0 ? 1 : 0,\n\t\toriginY: normalizedOffset < 0 ? 1 : 0,\n\t\trotateY: isHorizontal ? Math.min(Math.max(-90, normalizedOffset * 90), 90) : 0,\n\t\trotateX: isHorizontal ? 0 : Math.min(Math.max(-90, normalizedOffset * -90), 90),\n\t\tbackfaceVisibility: \"hidden\",\n\t\tWebkitBackfaceVisibility: \"hidden\",\n\t}\n}\n\nfunction coverflowEffect(info: PageEffectInfo) {\n\tconst { normalizedOffset, direction } = info\n\tconst isHorizontal = direction === \"horizontal\"\n\n\treturn {\n\t\trotateY: isHorizontal ? Math.min(45, Math.max(-45, normalizedOffset * -45)) : 0,\n\t\trotateX: isHorizontal ? 0 : Math.min(45, Math.max(-45, normalizedOffset * 45)),\n\t\toriginX: isHorizontal ? (normalizedOffset < 0 ? 0 : 1) : 0.5,\n\t\toriginY: isHorizontal ? 0.5 : normalizedOffset < 0 ? 0 : 1,\n\t\tx: isHorizontal ? `${normalizedOffset * -25}%` : 0,\n\t\ty: isHorizontal ? 0 : `${normalizedOffset * -25}%`,\n\t\tz: -Math.abs(normalizedOffset),\n\t\tscale: 1 - Math.abs(normalizedOffset / 10),\n\t}\n}\n\nfunction calcPileAxisOffset(offset: number, length: number) {\n\treturn offset * length - offset * 8\n}\n\nfunction pileEffect(info: PageEffectInfo) {\n\tconst { normalizedOffset, direction, size } = info\n\tconst isHorizontal = direction === \"horizontal\"\n\tconst absoluteOffset = Math.abs(normalizedOffset)\n\n\treturn {\n\t\tx: normalizedOffset < 0 && isHorizontal ? calcPileAxisOffset(absoluteOffset, size.width) : 0,\n\t\ty: normalizedOffset < 0 && !isHorizontal ? calcPileAxisOffset(absoluteOffset, size.height) : 0,\n\t\tscale: normalizedOffset < 0 ? 1 - absoluteOffset / 50 : 1,\n\t}\n}\n\nfunction wheelEffect(info: PageEffectInfo) {\n\tconst { normalizedOffset, direction, size } = info\n\tconst isHorizontal = direction === \"horizontal\"\n\n\tconst originZ = ((isHorizontal ? size.width : size.height) * 18) / (2 * Math.PI)\n\tconst rotateX = isHorizontal ? 0 : normalizedOffset * -20\n\tconst rotateY = isHorizontal ? normalizedOffset * 20 : 0\n\tconst y = isHorizontal ? 0 : normalizedOffset * -size.height\n\tconst x = isHorizontal ? normalizedOffset * -size.width : 0\n\n\treturn {\n\t\topacity: 1 - Math.abs(normalizedOffset) / 4,\n\t\ttransform: `translate(${x}px, ${y}px) translateZ(-${originZ}px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) translateZ(${originZ}px)`,\n\t}\n}\n\nfunction getDefaultEffect(type: PageEffect | undefined): CustomPageEffect | null {\n\tswitch (type) {\n\t\tcase \"cube\":\n\t\t\treturn cubeEffect\n\t\tcase \"coverflow\":\n\t\t\treturn coverflowEffect\n\t\tcase \"pile\":\n\t\t\treturn pileEffect\n\t\tcase \"wheel\":\n\t\t\treturn wheelEffect\n\t\tdefault:\n\t\t\treturn null\n\t}\n}\n\nfunction nearestPageIndex(\n\tpageRects: Rect[],\n\tstartPosition: number,\n\tendPosition: number,\n\tisHorizontalDirection: boolean,\n\tallowSkippingPages: boolean,\n): number {\n\tconst distanceToStart = function (rect: Rect): number {\n\t\tconst rectPosition = isHorizontalDirection ? rect.x : rect.y\n\t\treturn Math.abs(rectPosition + startPosition)\n\t}\n\n\tconst distanceToEnd = function (rect: Rect): number {\n\t\tconst rectPosition = isHorizontalDirection ? rect.x : rect.y\n\t\treturn Math.abs(rectPosition + endPosition)\n\t}\n\n\tif (allowSkippingPages) {\n\t\tconst closestPages = [...pageRects].sort((a, b) => distanceToEnd(a) - distanceToEnd(b))\n\t\tif (!closestPages[0]) return -1\n\t\treturn pageRects.indexOf(closestPages[0])\n\t} else {\n\t\tconst closestToStart = [...pageRects].sort((a, b) => distanceToStart(a) - distanceToStart(b))\n\t\tif (closestToStart.length === 1 && closestToStart[0]) return pageRects.indexOf(closestToStart[0])\n\n\t\tconst pageA = closestToStart[0]\n\t\tconst pageB = closestToStart[1]\n\t\tif (!pageA || !pageB) return -1\n\n\t\tconst closestPages = [pageA, pageB].sort((a, b) => distanceToEnd(a) - distanceToEnd(b))\n\t\tif (!closestPages[0]) return -1\n\t\treturn pageRects.indexOf(closestPages[0])\n\t}\n}\n\nfunction getPageContentRects(\n\tcontainerRef: React.RefObject<HTMLDivElement>,\n\tcontainerSize: Size,\n\tdirection: PageDirection,\n\tgap: number,\n): Rect[] | undefined {\n\tconst containerElement = containerRef.current\n\tif (!containerElement) return\n\n\tconst contentWrappers: HTMLElement[] = []\n\n\tcontainerElement.firstChild?.childNodes.forEach(node => {\n\t\tconst childNode = node.firstChild\n\t\tif (!(childNode instanceof HTMLElement)) return\n\t\tconst componentType = childNode.getAttribute(\"data-framer-component-type\")\n\t\tif (componentType === pageContentWrapperType) {\n\t\t\tcontentWrappers.push(childNode)\n\t\t}\n\t})\n\n\tconst sizes: (Size | null)[] = []\n\tcontentWrappers.forEach(contentWrapper => {\n\t\tif (contentWrapper instanceof HTMLElement && contentWrapper.firstChild instanceof HTMLElement) {\n\t\t\tlet width = contentWrapper.firstChild.offsetWidth\n\t\t\tlet height = contentWrapper.firstChild.offsetHeight\n\t\t\tif (isTest()) {\n\t\t\t\twidth = 100\n\t\t\t\theight = 100\n\t\t\t}\n\t\t\tsizes.push({ width, height })\n\t\t} else {\n\t\t\tsizes.push(null)\n\t\t}\n\t})\n\n\tlet maxX = 0\n\tlet maxY = 0\n\n\tconst isHorizontal = direction === \"horizontal\"\n\n\treturn sizes.map(queriedSize => {\n\t\tconst size = queriedSize || containerSize\n\t\tconst x = maxX\n\t\tconst y = maxY\n\t\tif (isHorizontal) {\n\t\t\tmaxX += size.width + gap\n\t\t} else {\n\t\t\tmaxY += size.height + gap\n\t\t}\n\t\treturn { ...size, x, y }\n\t})\n}\n\nfunction getMaxOffset(\n\tcontainerSize: Size,\n\tpageContentRects: Rect[],\n\tdirection: PageDirection,\n\tpaddingProps: PaddingProps,\n): number {\n\tconst lastPageRect = pageContentRects[pageContentRects.length - 1]\n\tif (!lastPageRect) return 0\n\n\tconst paddingSides = paddingFromProps(paddingProps)\n\tconst isHorizontal = direction === \"horizontal\"\n\tconst paddingStart = isHorizontal ? paddingSides.left : paddingSides.top\n\tconst paddingEnd = isHorizontal ? paddingSides.right : paddingSides.bottom\n\tconst pageWidth = isHorizontal ? lastPageRect.width : lastPageRect.height\n\tconst containerWidth = isHorizontal ? containerSize.width : containerSize.height\n\tconst freeSpace = containerWidth - paddingStart - paddingEnd - pageWidth\n\tconst target = isHorizontal ? lastPageRect.x : lastPageRect.y\n\t// Scroll offset can't be negative, if it is accidentally negative, it will incorrectly offset the page contents from the starting point.\n\tif (freeSpace <= 0) return Math.max(target, 0)\n\treturn Math.max(target - freeSpace, 0)\n}\n\nfunction offsetForPage(\n\tindex: number,\n\tpageCount: number,\n\tpageRectsRef: React.MutableRefObject<Rect[]>,\n\tisHorizontal: boolean,\n\tmaxOffsetRef: React.MutableRefObject<number>,\n) {\n\tconst pageIndex = Math.max(0, Math.min(pageCount - 1, index))\n\tconst currentPageRect = pageRectsRef.current[pageIndex]\n\n\tif (!currentPageRect) {\n\t\treturn 0\n\t}\n\tif (isHorizontal) {\n\t\treturn -Math.min(currentPageRect.x, maxOffsetRef.current)\n\t} else {\n\t\treturn -Math.min(currentPageRect.y, maxOffsetRef.current)\n\t}\n}\n\nfunction useSnapToPage(\n\tcurrentContentPageRef: React.MutableRefObject<number>,\n\tcontentOffsetRef: React.MutableRefObject<{ x: MotionValue<number>; y: MotionValue<number> }>,\n\tisHorizontal: boolean,\n) {\n\treturn (pageIndex: number, offset: number, options?: { animated: boolean }) => {\n\t\tcurrentContentPageRef.current = pageIndex\n\t\tconst contentOffset = isHorizontal ? contentOffsetRef.current.x : contentOffsetRef.current.y\n\n\t\tif (!options || !options.animated) {\n\t\t\tcontentOffset.set(offset)\n\t\t\treturn\n\t\t} // else\n\n\t\tconst axis = isHorizontal ? \"x\" : \"y\"\n\n\t\tconst value = contentOffsetRef.current[axis]\n\t\tvalue.set(contentOffset.get())\n\t\t// @TODO: Ignored for now, but should re-check later.\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tanimate(value, offset, {\n\t\t\ttype: \"spring\",\n\t\t\tvelocity: contentOffset.getVelocity(),\n\t\t\tstiffness: 500,\n\t\t\tdamping: 50,\n\t\t})\n\t}\n}\n\n// The current page property is capped to the number of children when positive, and cycles from last when negative\nfunction getBoundedCurrentPage(pageIndex: number, pageCount: number) {\n\treturn pageIndex >= 0 ? Math.min(pageIndex, pageCount - 1) : ((pageIndex % pageCount) + pageCount) % pageCount\n}\n\nfunction effectValues(\n\tindex: number,\n\tlatestPropsRef: React.MutableRefObject<Partial<PageProps>>,\n\tpageRectsRef: React.MutableRefObject<Rect[]>,\n\tcontentOffsetRef: React.MutableRefObject<{ x: MotionValue<number>; y: MotionValue<number> }>,\n\tmaxOffsetRef: React.MutableRefObject<number>,\n): PageEffectValues | null {\n\tconst {\n\t\tdirection: latestDirection = \"horizontal\",\n\t\tdefaultEffect: latestDefaultEffect,\n\t\teffect: latestEffect,\n\t\tgap: latestGap = 10,\n\t} = latestPropsRef.current\n\tconst latestIsHorizontal = latestDirection === \"horizontal\"\n\n\tconst pageRect: {\n\t\tx: number\n\t\ty: number\n\t\twidth: number\n\t\theight: number\n\t} = pageRectsRef.current[index] || {\n\t\tx: latestIsHorizontal ? index * 200 + latestGap : 0,\n\t\ty: latestIsHorizontal ? 0 : index * 200 + latestGap,\n\t\twidth: 200,\n\t\theight: 200,\n\t}\n\n\tconst effectFunction = latestEffect || getDefaultEffect(latestDefaultEffect)\n\tif (!effectFunction) return null\n\n\tlet offset: number\n\tlet normalizedOffset: number\n\tconst contentOffset = contentOffsetRef.current\n\tconst maxScrollOffset = maxOffsetRef.current\n\tif (latestIsHorizontal) {\n\t\toffset = Math.min(pageRect.x, maxScrollOffset) + (contentOffset ? contentOffset.x.get() : 0)\n\t\tnormalizedOffset = offset / (pageRect.width + latestGap)\n\t} else {\n\t\toffset = Math.min(pageRect.y, maxScrollOffset) + (contentOffset ? contentOffset.y.get() : 0)\n\t\tnormalizedOffset = offset / (pageRect.height + latestGap)\n\t}\n\n\tconst size = { width: pageRect.width, height: pageRect.height }\n\n\treturn effectFunction({\n\t\toffset,\n\t\tnormalizedOffset,\n\t\tsize,\n\t\tindex,\n\t\tdirection: latestDirection,\n\t\tgap: latestGap,\n\t\tpageCount: pageRectsRef.current.length,\n\t})\n}\n\nfunction hasEffect(props: Partial<PageProperties>) {\n\treturn !!props.effect || !!getDefaultEffect(props.defaultEffect)\n}\n\nfunction updateCurrentPage(\n\tnewPageIndex: number,\n\tcurrentContentPageRef: React.MutableRefObject<number>,\n\tonChangePage: ((currentIndex: number, previousIndex: number) => void) | undefined,\n) {\n\tif (currentContentPageRef.current === newPageIndex) return\n\tif (onChangePage) onChangePage(newPageIndex, currentContentPageRef.current)\n\tcurrentContentPageRef.current = newPageIndex\n}\n", "import type { MotionValue, PanInfo, Point } from \"framer-motion\"\nimport { useDomEvent } from \"framer-motion\"\nimport type { RefObject } from \"react\"\nimport { useCallback, useRef } from \"react\"\nimport { debounce } from \"../../render/utils/debounce.ts\"\nimport { clamp } from \"../../utils/math.ts\"\n\ninterface WheelScrollOptions {\n\tenabled: boolean\n\tinitial: Point\n\tprev: Point\n\tdirection: \"horizontal\" | \"vertical\" | \"both\"\n\tconstraints: RefObject<{ top: number; right: number; bottom: number; left: number }>\n\toffsetX: MotionValue<number>\n\toffsetY: MotionValue<number>\n\tonScrollStart: ((info: PanInfo) => void) | undefined\n\tonScroll: ((info: PanInfo) => void) | undefined\n\tonScrollEnd: ((info: PanInfo) => void) | undefined\n}\n\nexport function useWheelScroll(\n\tref: RefObject<Element>,\n\t{\n\t\tenabled,\n\t\tinitial,\n\t\tprev,\n\t\tdirection,\n\t\tconstraints,\n\t\toffsetX,\n\t\toffsetY,\n\t\tonScrollStart,\n\t\tonScroll,\n\t\tonScrollEnd,\n\t}: WheelScrollOptions,\n) {\n\tconst isWheelScrollActive = useRef(false)\n\n\tconst getPointData = useCallback(() => {\n\t\tconst point = getPoint(offsetX, offsetY)\n\n\t\tconst data = {\n\t\t\tpoint,\n\t\t\tvelocity: { x: offsetX.getVelocity(), y: offsetY.getVelocity() },\n\t\t\toffset: { x: point.x - initial.x, y: point.y - initial.y },\n\t\t\tdelta: { x: point.x - prev.x, y: point.y - prev.y },\n\t\t}\n\n\t\tprev.x = point.x\n\t\tprev.y = point.y\n\n\t\treturn data\n\t}, [])\n\n\tlet handler: EventListener | undefined\n\tif (enabled) {\n\t\tfunction clampX(v: number) {\n\t\t\treturn constraints.current === null ? v : clamp(v, constraints.current.left, constraints.current.right)\n\t\t}\n\n\t\tfunction clampY(v: number) {\n\t\t\treturn constraints.current === null ? v : clamp(v, constraints.current.top, constraints.current.bottom)\n\t\t}\n\n\t\tfunction updateX(delta: number) {\n\t\t\toffsetX.stop()\n\t\t\toffsetX.set(clampX(offsetX.get() - delta))\n\t\t}\n\n\t\tfunction updateY(delta: number) {\n\t\t\toffsetY.stop()\n\t\t\toffsetY.set(clampY(offsetY.get() - delta))\n\t\t}\n\n\t\tconst debouncedOnScrollEnd = debounce(() => {\n\t\t\tonScrollEnd && onScrollEnd(getPointData())\n\t\t\tisWheelScrollActive.current = false\n\t\t}, 200)\n\n\t\thandler = (e: WheelEvent) => {\n\t\t\te.preventDefault()\n\n\t\t\tif (!isWheelScrollActive.current) {\n\t\t\t\tconst x = offsetX.get()\n\t\t\t\tconst y = offsetY.get()\n\t\t\t\tinitial.x = x\n\t\t\t\tinitial.y = y\n\t\t\t\tprev.x = x\n\t\t\t\tprev.y = y\n\t\t\t\tonScrollStart && onScrollStart(getPointData())\n\t\t\t\tisWheelScrollActive.current = true\n\t\t\t}\n\n\t\t\tswitch (direction) {\n\t\t\t\tcase \"horizontal\":\n\t\t\t\t\tupdateX(e.deltaX)\n\t\t\t\t\tbreak\n\t\t\t\tcase \"vertical\":\n\t\t\t\t\tupdateY(e.deltaY)\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tupdateX(e.deltaX)\n\t\t\t\t\tupdateY(e.deltaY)\n\t\t\t}\n\n\t\t\tonScroll && onScroll(getPointData())\n\t\t\tdebouncedOnScrollEnd()\n\t\t}\n\t}\n\n\t// Appending event directly to DOM as React doesn't have an API for non-passive wheel events.\n\tuseDomEvent(ref, \"wheel\", handler, { passive: false })\n}\n\nfunction getPoint(x: MotionValue<number>, y: MotionValue<number>): Point {\n\treturn { x: x.get(), y: y.get() }\n}\n", "import { safeWindow } from \"../../utils/safeWindow.ts\"\n\ninterface DebouncedFunction<T extends any[]> {\n\t(...args: T): void\n\tcancel: () => void\n}\n\n/** @internal */\nexport function debounce<T extends any[]>(fn: (...args: T) => void, time: number): DebouncedFunction<T> {\n\tlet timeout: number | undefined\n\tconst debounced = (...args: T) => {\n\t\tsafeWindow.clearTimeout(timeout)\n\t\ttimeout = safeWindow.setTimeout(fn, time, ...args)\n\t}\n\n\tconst cancel = () => {\n\t\tsafeWindow.clearTimeout(timeout)\n\t}\n\n\tdebounced.cancel = cancel\n\treturn debounced\n}\n", "export function parseNumberRounded(value: unknown, precision: number = 2): number | undefined {\n\tlet number = 0\n\tif (typeof value === \"number\") {\n\t\tnumber = value\n\t} else if (typeof value === \"string\") {\n\t\tnumber = parseFloat(value)\n\t} else {\n\t\treturn undefined\n\t}\n\n\tif (Number.isInteger(number)) return number\n\n\tlet multiplier = 1\n\t// This looks like a potentially useless optimization, but after benchmarking,\n\t// the code below is ~2x faster in Chrome (as of Sep, 2020) compared to\n\t// using Math.pow.\n\twhile (precision-- > 0) multiplier *= 10\n\tif (number < 0) multiplier *= -1\n\treturn Math.round(number * multiplier) / multiplier\n}\n", "import { parseNumberRounded } from \"@framerjs/shared/src/parseNumberRounded.ts\"\nimport { isFiniteNumber } from \"../../render/utils/isFiniteNumber.ts\"\n\nexport interface PaddingProps {\n\tpadding?: number\n\tpaddingPerSide?: boolean\n\tpaddingTop?: number\n\tpaddingRight?: number\n\tpaddingBottom?: number\n\tpaddingLeft?: number\n}\n\n/**\n * @internal\n */\nexport function hasPaddingPerSide(props: Partial<PaddingProps>) {\n\tconst { paddingPerSide, paddingTop, paddingBottom, paddingLeft, paddingRight } = props\n\treturn (\n\t\tpaddingPerSide !== false &&\n\t\t(paddingTop !== undefined || paddingBottom !== undefined || paddingLeft !== undefined || paddingRight !== undefined)\n\t)\n}\n\n/**\n * @internal\n */\nexport function paddingFromProps(props: Partial<PaddingProps>) {\n\tconst { padding = 0, paddingTop, paddingBottom, paddingLeft, paddingRight } = props\n\tif (hasPaddingPerSide(props)) {\n\t\treturn {\n\t\t\ttop: paddingTop !== undefined ? paddingTop : padding,\n\t\t\tbottom: paddingBottom !== undefined ? paddingBottom : padding,\n\t\t\tleft: paddingLeft !== undefined ? paddingLeft : padding,\n\t\t\tright: paddingRight !== undefined ? paddingRight : padding,\n\t\t}\n\t}\n\treturn {\n\t\ttop: padding,\n\t\tbottom: padding,\n\t\tleft: padding,\n\t\tright: padding,\n\t}\n}\n\n/**\n * @internal\n */\nexport function makePaddingString({\n\ttop,\n\tleft,\n\tbottom,\n\tright,\n}: {\n\tleft: number\n\ttop: number\n\tbottom: number\n\tright: number\n}) {\n\t// If all sides are the same, return a single value\n\tif (top === right && right === bottom && bottom === left) {\n\t\treturn `${top}px`\n\t}\n\treturn `${top}px ${right}px ${bottom}px ${left}px`\n}\n\n/**\n * Accepts a string (like \"5px 10px 15px 20px\" or \"5px 0 5px\" or \"none\" or similar). Returns parsed\n * top, right, bottom, left values. Intended as a (slightly more flexible) reverse of `makePaddingString`.\n * @internal\n */\nexport function parsePaddingString(\n\tpadding: string,\n): { top: number; right: number; bottom: number; left: number } | null {\n\tif (padding === \"none\") return null\n\n\tconst parts = padding\n\t\t.trim()\n\t\t.split(/\\s+/)\n\t\t.map(v => parseNumberRounded(v))\n\n\tconst [part1, part2, part3, part4] = parts\n\n\tswitch (parts.length) {\n\t\tcase 1:\n\t\t\tif (!isFiniteNumber(part1)) return null\n\t\t\treturn { top: part1, right: part1, bottom: part1, left: part1 }\n\t\tcase 2:\n\t\t\tif (!isFiniteNumber(part1) || !isFiniteNumber(part2)) return null\n\t\t\treturn { top: part1, right: part2, bottom: part1, left: part2 }\n\t\tcase 3:\n\t\t\tif (!isFiniteNumber(part1) || !isFiniteNumber(part2) || !isFiniteNumber(part3)) return null\n\t\t\treturn { top: part1, right: part2, bottom: part3, left: part2 }\n\t\tcase 4:\n\t\t\tif (!isFiniteNumber(part1) || !isFiniteNumber(part2) || !isFiniteNumber(part3) || !isFiniteNumber(part4)) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn { top: part1, right: part2, bottom: part3, left: part4 }\n\t\tdefault:\n\t\t\treturn null\n\t}\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { motion } from \"framer-motion\"\nimport React from \"react\"\nimport type { FrameProps } from \"../../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { FrameWithMotion, unwrapFrameProps } from \"../../render/presentation/Frame/FrameWithMotion.tsx\"\nimport type { WillChangeTransformProp } from \"../../render/presentation/Layer.tsx\"\nimport { Layer } from \"../../render/presentation/Layer.tsx\"\nimport { DimensionType } from \"../../render/types/Constraints.ts\"\nimport type { ParentSize } from \"../../render/types/NewConstraints.tsx\"\nimport { ParentSizeState, constraintsEnabled, useProvideParentSize } from \"../../render/types/NewConstraints.tsx\"\nimport { ControlType } from \"../../render/types/PropertyControls.ts\"\nimport { isFiniteNumber } from \"../../render/utils/isFiniteNumber.ts\"\nimport { processOverrideForwarding } from \"../../render/utils/processOverrideForwarding.ts\"\nimport { useLayoutId } from \"../../render/utils/useLayoutId.ts\"\nimport { addPropertyControls } from \"../../utils/addPropertyControls.ts\"\nimport { asRecord } from \"../../utils/asRecord.ts\"\nimport { isReactChild, isReactElement } from \"../../utils/type-guards.ts\"\nimport { hasPaddingPerSide, makePaddingString, paddingFromProps } from \"../utils/paddingFromProps.ts\"\nimport type { StackAlignment, StackDirection, StackDistribution, StackSpecificProps } from \"./types.ts\"\n\n/**\n * The Stack component will automatically distribute its contents based on its\n * properties. The Stack component takes the same props as the {@link Frame} component\n * as well as a few additional interface defined below.\n *\n * @remarks\n * ```jsx\n * function MyComponent() {\n *   return (\n *     <Stack>\n *       <Frame />\n *       <Frame />\n *       <Frame />\n *     </Stack>\n *   )\n * }\n * ```\n * @public\n * @deprecated\n */\nexport interface StackProperties extends StackSpecificProps, FrameProps, WillChangeTransformProp {\n\tas?: keyof HTMLElementTagNameMap\n\tchildren?: React.ReactNode\n\t/** @internal */\n\tparentSize?: ParentSize\n\tclassName?: string\n\t/* If useFlexboxGap is set to true, Stack will try to use the native flexbox `gap` property for the gaps, otherwise it will fallback to using margins. Defaults to true. */\n\tuseFlexboxGap?: boolean\n}\n\ntype FlexDirection = \"column\" | \"row\" | \"column-reverse\" | \"row-reverse\"\n\n/**\n * @public\n * @deprecated The `Stack` component is being deprecated and will no longer be maintained in future releases. We recommend using flexbox instead for layout needs: {@link https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox}\n */\nexport const Stack: React.ForwardRefExoticComponent<Partial<StackProperties> & React.RefAttributes<HTMLDivElement>> =\n\t/* @__PURE__ */ (() => {\n\t\tconst StackInner = React.forwardRef<HTMLDivElement, Partial<StackProperties>>(\n\t\t\tfunction StackInner(stackProps, forwardedRef) {\n\t\t\t\tconst {\n\t\t\t\t\tas = \"div\",\n\t\t\t\t\tdirection = \"vertical\",\n\t\t\t\t\tdistribution = \"start\",\n\t\t\t\t\talignment = \"center\",\n\t\t\t\t\tgap = 10,\n\t\t\t\t\twrap = false,\n\t\t\t\t\tuseFlexboxGap: externalUseFlexboxGap = true,\n\t\t\t\t\tchildren,\n\t\t\t\t\tstyle: styleProp,\n\t\t\t\t\tclassName,\n\t\t\t\t\twillChangeTransform,\n\t\t\t\t\t__fromCodeComponentNode,\n\t\t\t\t\tparentSize,\n\t\t\t\t\t__contentWrapperStyle,\n\t\t\t\t\t...containerProps\n\t\t\t\t} = stackProps\n\n\t\t\t\t// Only the native gap implementation works correctly with flexbox wrap\n\t\t\t\tconst useFlexboxGap = externalUseFlexboxGap || wrap\n\n\t\t\t\t/**\n\t\t\t\t * As of Safari 15.1, Webkit does not redraw the gaps correctly when the\n\t\t\t\t * value updates, a forced reflow is needed as a workaround.\n\t\t\t\t * For layout transition, we try to trigger the reflow in the\n\t\t\t\t * onBeforeMeasureLayout lifecycle, so that motion could capture the\n\t\t\t\t * forced layout change when it measures the new layout.\n\t\t\t\t * Besides, we still need a layout effect to trigger the reflow, in case\n\t\t\t\t * onBeforeMeasureLayout isn't called (e.g. updating gap on the canvas).\n\t\t\t\t * https://bugs.webkit.org/show_bug.cgi?id=233252\n\t\t\t\t */\n\t\t\t\tconst stackRef = React.useRef<HTMLElement | HTMLDivElement>(null)\n\n\t\t\t\tconst flexDirection = toFlexDirection(direction)\n\t\t\t\tconst isReverse = isReverseDirection(flexDirection)\n\t\t\t\tconst justifyContent = toJustifyOrAlignment(distribution)\n\t\t\t\tconst padding =\n\t\t\t\t\thasPaddingPerSide(containerProps) || containerProps.padding\n\t\t\t\t\t\t? makePaddingString(paddingFromProps(containerProps))\n\t\t\t\t\t\t: undefined\n\n\t\t\t\tconst style: MotionStyle = { ...styleProp }\n\t\t\t\tLayer.applyWillChange({ willChangeTransform }, style, true)\n\n\t\t\t\tif (__fromCodeComponentNode && !constraintsEnabled(unwrapFrameProps(containerProps))) {\n\t\t\t\t\tcontainerProps.width = \"100%\"\n\t\t\t\t\tcontainerProps.height = \"100%\"\n\t\t\t\t\tcontainerProps._constraints = { enabled: true }\n\t\t\t\t}\n\n\t\t\t\tconst layoutId = useLayoutId(stackProps)\n\n\t\t\t\tconst { children: _children, props } = processOverrideForwarding(containerProps, children)\n\n\t\t\t\tconst widthType =\n\t\t\t\t\tcontainerProps.widthType ?? (containerProps.width === \"auto\" ? DimensionType.Auto : DimensionType.FixedNumber)\n\t\t\t\tconst heightType =\n\t\t\t\t\tcontainerProps.heightType ??\n\t\t\t\t\t(containerProps.height === \"auto\" ? DimensionType.Auto : DimensionType.FixedNumber)\n\n\t\t\t\tconst fractionChildren = handleFraction(_children, direction, widthType, heightType)\n\t\t\t\tconst gapChildren = wrapInGapElementForLegacyGap(\n\t\t\t\t\tfractionChildren,\n\t\t\t\t\tgap,\n\t\t\t\t\tflexDirection,\n\t\t\t\t\tjustifyContent,\n\t\t\t\t\tuseFlexboxGap,\n\t\t\t\t\twrap,\n\t\t\t\t)\n\t\t\t\t// Stack children should ignore the viewport size\n\t\t\t\tconst content = useProvideParentSize(gapChildren, parentSize ?? ParentSizeState.Disabled)\n\n\t\t\t\tconst attributes: Record<string, unknown> = {\n\t\t\t\t\t\"data-framer-component-type\": \"Stack\",\n\t\t\t\t}\n\n\t\t\t\tconst fromCanvasComponent = containerProps.__fromCanvasComponent\n\t\t\t\tif (fromCanvasComponent) attributes[\"data-framer-generated\"] = true\n\n\t\t\t\t// When auto-sized, Stacks will use `width/height: min-content`, instead\n\t\t\t\t// of `width/height: auto`, so text children are sufficiently\n\t\t\t\t// constrained in width when using \"Fill Parent\" sizing. WebKit, however\n\t\t\t\t// (as of March, 2021) has buggy support for `min-content` and will stop\n\t\t\t\t// respecting `border-box` box-sizing when min-content is applied to an\n\t\t\t\t// absolutely positioned element (see\n\t\t\t\t// https://bugs.webkit.org/show_bug.cgi?id=219944). This is a problem,\n\t\t\t\t// because stacks have padding, so ignoring the correct box-sizing would\n\t\t\t\t// also lead to unexpected element sizes. To work around this, we wrap\n\t\t\t\t// the stack's content in a separate element, which will stretch to the\n\t\t\t\t// full size of the stack and leave the outer element's padding at its\n\t\t\t\t// default (0).\n\t\t\t\t//\n\t\t\t\t// There's an edge case that results from the use of a `min-content`\n\t\t\t\t// wrapper around an `align-self: stretch` text node. The text node will\n\t\t\t\t// not be able to shrink beyond the width of its first character, which\n\t\t\t\t// means that there's an implicit min-width of the entire container\n\t\t\t\t// that's set by the width of the first character. The real-world\n\t\t\t\t// implications of this seem relatively small, so we don't do any\n\t\t\t\t// special handling for that case.\n\t\t\t\t//\n\t\t\t\t// As of November 2021, this issue is still outstanding in Safari.\n\t\t\t\t// Unfortunately however, there has not been an open ticket since\n\t\t\t\t// December 16, 2020. A new ticket with this specific reproduction has\n\t\t\t\t// been opened at: https://bugs.webkit.org/show_bug.cgi?id=232816\n\n\t\t\t\tconst alignItems = toJustifyOrAlignment(alignment)\n\n\t\t\t\tconst contentWrapperStyle: MotionStyle = {\n\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\tflexDirection,\n\t\t\t\t\tflexWrap: wrap ? \"wrap\" : \"nowrap\",\n\t\t\t\t\tjustifyContent: justifyContent,\n\t\t\t\t\talignItems,\n\t\t\t\t\talignContent: alignItems,\n\t\t\t\t\tpadding,\n\t\t\t\t\t...__contentWrapperStyle,\n\t\t\t\t}\n\n\t\t\t\t// The actual gap property is added in the injected component CSS rules,\n\t\t\t\t// that way we can also unset it if the user agent does not support gap\n\t\t\t\t// and the fallback styles are used.\n\t\t\t\tconst gapEnabled = isGapEnabled(gap, justifyContent, wrap)\n\t\t\t\tif (useFlexboxGap && gapEnabled) {\n\t\t\t\t\tconst gapSupportedInMainAxis = isGapSupportedInMainAxis(justifyContent)\n\t\t\t\t\tif (gapSupportedInMainAxis || direction !== \"horizontal\") {\n\t\t\t\t\t\tasRecord(contentWrapperStyle)[\"--stack-native-column-gap\"] = `${gap}px`\n\t\t\t\t\t}\n\t\t\t\t\tif (gapSupportedInMainAxis || direction !== \"vertical\") {\n\t\t\t\t\t\tasRecord(contentWrapperStyle)[\"--stack-native-row-gap\"] = `${gap}px`\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (contentWrapperStyle.width === undefined) {\n\t\t\t\t\tcontentWrapperStyle.width = widthType === DimensionType.Auto ? \"min-content\" : \"100%\"\n\t\t\t\t}\n\t\t\t\tif (contentWrapperStyle.height === undefined) {\n\t\t\t\t\tcontentWrapperStyle.height = heightType === DimensionType.Auto ? \"min-content\" : \"100%\"\n\t\t\t\t}\n\t\t\t\tif (fromCanvasComponent) {\n\t\t\t\t\tif (styleProp?.width) contentWrapperStyle.width = styleProp?.width\n\t\t\t\t\tif (styleProp?.height) contentWrapperStyle.height = styleProp?.height\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<FrameWithMotion\n\t\t\t\t\t\tas={as}\n\t\t\t\t\t\tbackground={fromCanvasComponent ? undefined : \"none\"}\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t\tlayoutId={layoutId}\n\t\t\t\t\t\tref={useForwardedRef(forwardedRef, stackRef)}\n\t\t\t\t\t\t{...attributes}\n\t\t\t\t\t\tstyle={style}\n\t\t\t\t\t\tclassName={className}\n\t\t\t\t\t\tlayoutScroll\n\t\t\t\t\t>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tdata-framer-stack-content-wrapper\n\t\t\t\t\t\t\tdata-framer-stack-direction-reverse={isReverse}\n\t\t\t\t\t\t\tdata-framer-stack-gap-enabled={gapEnabled}\n\t\t\t\t\t\t\tstyle={contentWrapperStyle}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{content}\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t</FrameWithMotion>\n\t\t\t\t)\n\t\t\t},\n\t\t)\n\n\t\tStackInner.defaultProps = {\n\t\t\tdistribution: \"start\",\n\t\t}\n\n\t\tStackInner.displayName = \"Stack\"\n\n\t\taddPropertyControls(StackInner, {\n\t\t\tdirection: {\n\t\t\t\ttype: ControlType.SegmentedEnum,\n\t\t\t\toptions: [\"horizontal\", \"vertical\"],\n\t\t\t\ttitle: \"Direction\",\n\t\t\t\tdefaultValue: \"vertical\",\n\t\t\t},\n\t\t\tdistribution: {\n\t\t\t\ttype: ControlType.Enum,\n\t\t\t\toptions: [\"start\", \"center\", \"end\", \"space-between\", \"space-around\", \"space-evenly\"],\n\t\t\t\toptionTitles: [\"Start\", \"Center\", \"End\", \"Space Between\", \"Space Around\", \"Space Evenly\"],\n\t\t\t\ttitle: \"Distribute\",\n\t\t\t\tdefaultValue: \"space-around\",\n\t\t\t},\n\t\t\talignment: {\n\t\t\t\ttype: ControlType.SegmentedEnum,\n\t\t\t\toptions: [\"start\", \"center\", \"end\"],\n\t\t\t\ttitle: \"Align\",\n\t\t\t\tdefaultValue: \"center\",\n\t\t\t},\n\t\t\tgap: {\n\t\t\t\ttype: ControlType.Number,\n\t\t\t\tmin: 0,\n\t\t\t\ttitle: \"Gap\",\n\t\t\t\thidden: props => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tprops.distribution !== undefined &&\n\t\t\t\t\t\t[\"space-between\", \"space-around\", \"space-evenly\"].includes(props.distribution)\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t\tdefaultValue: 10,\n\t\t\t},\n\t\t\tpadding: {\n\t\t\t\ttype: ControlType.FusedNumber,\n\t\t\t\ttoggleKey: \"paddingPerSide\",\n\t\t\t\ttoggleTitles: [\"Padding\", \"Padding per side\"],\n\t\t\t\tvalueKeys: [\"paddingTop\", \"paddingRight\", \"paddingBottom\", \"paddingLeft\"],\n\t\t\t\tvalueLabels: [\"t\", \"r\", \"b\", \"l\"],\n\t\t\t\tmin: 0,\n\t\t\t\ttitle: \"Padding\",\n\t\t\t\tdefaultValue: 0,\n\t\t\t},\n\t\t})\n\n\t\treturn StackInner\n\t})()\n\n/**\n * @internal\n */\nexport function isFractionDimension(dimension: unknown): dimension is string {\n\treturn typeof dimension === \"string\" && dimension.endsWith(\"fr\")\n}\n\n/**\n * @internal\n */\nexport function fraction(dimension: string) {\n\tconst value = parseFloat(dimension)\n\treturn isFiniteNumber(value) ? value : 0\n}\n\nfunction handleFraction(\n\tchildren: React.ReactNode,\n\tdirection: StackDirection,\n\twidthType: DimensionType,\n\theightType: DimensionType,\n) {\n\treturn React.Children.map(children, child => {\n\t\tif (!isReactChild(child) || !isReactElement(child)) return\n\t\tconst isVertical = direction === \"vertical\"\n\t\tconst style: MotionStyle = {}\n\t\tlet hasFraction = false\n\t\tconst { style: propsStyle, size } = child.props as Partial<{\n\t\t\tstyle?: MotionStyle\n\t\t\tsize?: number | string\n\t\t}>\n\t\tlet { width, height } = child.props as Partial<{\n\t\t\twidth?: number | string\n\t\t\theight?: number | string\n\t\t}>\n\n\t\t// convert size to width and height if they are not set already\n\t\tif (size !== undefined) {\n\t\t\tif (width === undefined) width = size\n\t\t\tif (height === undefined) height = size\n\t\t}\n\n\t\tlet newWidth = width\n\t\tlet newHeight = height\n\t\tif (isFractionDimension(width)) {\n\t\t\thasFraction = true\n\t\t\thasFraction = true\n\t\t\tif (isVertical) {\n\t\t\t\t// \"Fill parent\" on an auto-sized axis\n\t\t\t\tif (widthType === DimensionType.Auto) {\n\t\t\t\t\tstyle.alignSelf = \"stretch\"\n\t\t\t\t\tnewWidth = \"auto\"\n\t\t\t\t} else {\n\t\t\t\t\tnewWidth = `${fraction(width) * 100}%`\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnewWidth = 1\n\t\t\t\tstyle.flexGrow = fraction(width)\n\t\t\t\tstyle.flexBasis = 0\n\t\t\t}\n\t\t\tstyle.width = newWidth\n\t\t}\n\n\t\tif (isFractionDimension(height)) {\n\t\t\thasFraction = true\n\t\t\tif (isVertical) {\n\t\t\t\tnewHeight = 1\n\t\t\t\tstyle.flexGrow = fraction(height)\n\t\t\t\tstyle.flexBasis = 0\n\t\t\t} else {\n\t\t\t\t// \"Fill parent\" on an auto-sized axis\n\t\t\t\tif (heightType === DimensionType.Auto) {\n\t\t\t\t\tstyle.alignSelf = \"stretch\"\n\t\t\t\t\tnewHeight = \"auto\"\n\t\t\t\t} else {\n\t\t\t\t\tnewHeight = `${fraction(height) * 100}%`\n\t\t\t\t}\n\t\t\t}\n\t\t\tstyle.height = newHeight\n\t\t}\n\n\t\tif (!hasFraction) return child\n\n\t\tconst nextStyle = { ...propsStyle, ...style }\n\t\treturn React.cloneElement(child, {\n\t\t\twidth: newWidth,\n\t\t\theight: newHeight,\n\t\t\tstyle: nextStyle,\n\t\t} as React.BaseHTMLAttributes<HTMLDivElement>)\n\t})\n}\n\nfunction isGapSupportedInMainAxis(justifyContent: React.CSSProperties[\"justifyContent\"]): boolean {\n\tif (!justifyContent) return false\n\treturn ![\"space-between\", \"space-around\", \"space-evenly\", \"stretch\"].includes(justifyContent)\n}\n\n/**\n * @internal\n */\nexport function isGapEnabled(\n\tgap: number | undefined,\n\tjustifyContent: React.CSSProperties[\"justifyContent\"],\n\twrap: boolean,\n): boolean {\n\tif (!gap) {\n\t\treturn false\n\t}\n\tif (!wrap && !isGapSupportedInMainAxis(justifyContent)) {\n\t\treturn false\n\t}\n\treturn true\n}\n\nfunction wrapInGapElementForLegacyGap(\n\tchildren: React.ReactNode,\n\tgap: number | undefined,\n\tdirection: FlexDirection,\n\tjustifyContent: React.CSSProperties[\"justifyContent\"],\n\tuseFlexboxGap: boolean,\n\twrap: boolean,\n) {\n\tconst gapStyle: React.CSSProperties = {\n\t\t// We need the wrapper to have `display: contents` to prevent the child\n\t\t// margins from collapsing when using the fallback gap solution.\n\t\t// https://codesandbox.io/s/dreamy-haslett-01ie5?file=/src/styles.css\n\t\tdisplay: \"contents\",\n\t}\n\n\tconst gapEnabled = isGapEnabled(gap, justifyContent, wrap)\n\tif (gapEnabled) {\n\t\tconst isVertical = isVerticalDirection(direction)\n\t\tasRecord(gapStyle)[\"--stack-gap-x\"] = `${isVertical ? 0 : gap}px`\n\t\tasRecord(gapStyle)[\"--stack-gap-y\"] = `${isVertical ? gap : 0}px`\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tdata-framer-legacy-stack-gap-enabled={gapEnabled}\n\t\t\tdata-framer-stack-flexbox-gap={useFlexboxGap}\n\t\t\tstyle={gapStyle}\n\t\t>\n\t\t\t{children}\n\t\t</div>\n\t)\n}\n\n/**\n * @internal\n */\nexport function toFlexDirection(direction: StackDirection): FlexDirection {\n\tswitch (direction) {\n\t\tcase \"vertical\":\n\t\t\treturn \"column\"\n\t\tcase \"horizontal\":\n\t\t\treturn \"row\"\n\t\tdefault:\n\t\t\treturn direction\n\t}\n}\n\nfunction isVerticalDirection(direction: FlexDirection) {\n\treturn direction === \"column\" || direction === \"column-reverse\"\n}\n\nfunction isReverseDirection(direction: FlexDirection) {\n\tswitch (direction) {\n\t\tcase \"column-reverse\":\n\t\tcase \"row-reverse\":\n\t\t\treturn true\n\t\tdefault:\n\t\t\treturn false\n\t}\n}\n\n/** @internal */\nexport function toJustifyOrAlignment(distribution: StackDistribution | StackAlignment) {\n\tswitch (distribution) {\n\t\tcase \"start\":\n\t\t\treturn \"flex-start\"\n\t\tcase \"end\":\n\t\t\treturn \"flex-end\"\n\t\tdefault:\n\t\t\treturn distribution\n\t}\n}\n\n/**\n * Utils\n */\n\n// Assign the element to both the forwardedRef and an inner ref.\nfunction useForwardedRef<T>(forwardedRef: React.ForwardedRef<T>, innerRef: React.MutableRefObject<T>) {\n\treturn (element: T) => {\n\t\tinnerRef.current = element\n\n\t\tif (typeof forwardedRef === \"function\") {\n\t\t\tforwardedRef(element)\n\t\t} else if (forwardedRef) {\n\t\t\tforwardedRef.current = element\n\t\t}\n\t}\n}\n", "import type { MotionValue, PanInfo } from \"framer-motion\"\nimport type React from \"react\"\nimport { FrameWithMotion } from \"../../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { toJustifyOrAlignment } from \"../Stack/Stack.tsx\"\nimport type { PageAlignment, PageContentDimension } from \"./types.ts\"\n\ninterface PageContainerProps {\n\teffect: { [key: string]: MotionValue } | undefined\n\tchildren?: React.ReactNode\n\tdragEnabled: boolean\n\tdirection: \"horizontal\" | \"vertical\"\n\tcontentWidth: PageContentDimension | number\n\tcontentHeight: PageContentDimension | number\n\talignment?: PageAlignment\n\tgap: number\n\tisLastPage: boolean\n\tcontentOffsetRef: React.MutableRefObject<{ x: MotionValue<number>; y: MotionValue<number> }>\n\tconstraintsRef: React.MutableRefObject<{ top: number; left: number; right: number; bottom: number }>\n\tdirectionLock: boolean | undefined\n\tlayoutId: string | undefined\n\tonDragStart: (event: MouseEvent | TouchEvent, info: PanInfo) => void\n\tonDrag: (event: MouseEvent | TouchEvent, info: PanInfo) => void\n\tonDragEnd: (event: MouseEvent | TouchEvent, info: PanInfo) => void\n}\n\nexport const pageContentWrapperType = \"PageContentWrapper\"\n\nexport function PageContainer({\n\tchildren,\n\teffect,\n\tdragEnabled,\n\tdirection,\n\tcontentHeight,\n\tcontentWidth,\n\talignment,\n\tgap,\n\tisLastPage,\n\tcontentOffsetRef,\n\tconstraintsRef,\n\tdirectionLock,\n\tonDragStart,\n\tonDrag,\n\tonDragEnd,\n\tlayoutId,\n}: PageContainerProps) {\n\tconst isHorizontalDirection = direction === \"horizontal\"\n\tconst dragAxis = isHorizontalDirection ? \"x\" : \"y\"\n\tconst hasHorizontalGap = isHorizontalDirection && !isLastPage && gap\n\tconst hasVerticalGap = !isHorizontalDirection && !isLastPage && gap\n\tconst hasAutoWidth = contentWidth !== \"stretch\" && isHorizontalDirection\n\tconst hasAutoHeight = contentHeight !== \"stretch\" && !isHorizontalDirection\n\tconst wrapperWidth = hasAutoWidth ? \"auto\" : \"100%\"\n\tconst wrapperHeight = hasAutoHeight ? \"auto\" : \"100%\"\n\tconst containerWidth = hasHorizontalGap && wrapperWidth === \"100%\" ? `calc(100% + ${gap}px)` : wrapperWidth\n\tconst containerHeight = hasVerticalGap && wrapperHeight === \"100%\" ? `calc(100% + ${gap}px)` : wrapperHeight\n\n\treturn (\n\t\t<FrameWithMotion\n\t\t\tposition=\"relative\"\n\t\t\tdata-framer-component-type=\"PageContainer\"\n\t\t\twidth={containerWidth}\n\t\t\theight={containerHeight}\n\t\t\tlayoutId={layoutId ? `${layoutId}-container` : undefined}\n\t\t\tbackgroundColor=\"transparent\"\n\t\t\tdrag={dragEnabled ? dragAxis : false}\n\t\t\tdragDirectionLock={directionLock}\n\t\t\t_dragX={contentOffsetRef.current.x}\n\t\t\t_dragY={contentOffsetRef.current.y}\n\t\t\tdragConstraints={constraintsRef.current}\n\t\t\tonDrag={onDrag}\n\t\t\tonDragStart={onDragStart}\n\t\t\tonDragEnd={onDragEnd}\n\t\t\tpreserve3d\n\t\t\tstyle={{\n\t\t\t\tpointerEvents: undefined,\n\t\t\t\tpaddingRight: hasHorizontalGap ? gap : 0,\n\t\t\t\tpaddingBottom: hasVerticalGap ? gap : 0,\n\t\t\t}}\n\t\t>\n\t\t\t<FrameWithMotion\n\t\t\t\tposition=\"relative\"\n\t\t\t\tdata-framer-component-type={pageContentWrapperType}\n\t\t\t\twidth={wrapperWidth}\n\t\t\t\theight={wrapperHeight}\n\t\t\t\tpreserve3d={false}\n\t\t\t\tbackgroundColor=\"transparent\"\n\t\t\t\tkey={effect ? Object.keys(effect).join(\"\") : \"\"}\n\t\t\t\tstyle={{\n\t\t\t\t\t...effect,\n\t\t\t\t\tpointerEvents: undefined,\n\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\tflexDirection: isHorizontalDirection ? \"row\" : \"column\",\n\t\t\t\t\talignItems: alignment && toJustifyOrAlignment(alignment),\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</FrameWithMotion>\n\t\t</FrameWithMotion>\n\t)\n}\n", "import { ControlType } from \"../../render/types/PropertyControls.ts\"\nimport { addPropertyControls } from \"../../utils/addPropertyControls.ts\"\nimport { Page as EmulatedPage } from \"./EmulatedPage.tsx\"\nimport type { PageAlignment, PageContentDimension, PageEffect } from \"./types.ts\"\n\n/**\n * @deprecated Creating new Page components in Framer is no longer supported as of July 2025.\n * Existing Page components will continue to work, but please use alternative solutions for new\n * projects.\n */\nexport const Page = /* @__PURE__ */ (() => {\n\tconst ContentDimension: { Auto: PageContentDimension; Stretch: PageContentDimension } = {\n\t\tAuto: \"auto\",\n\t\tStretch: \"stretch\",\n\t}\n\n\tconst pageContentDimensionOptions: PageContentDimension[] = [ContentDimension.Auto, ContentDimension.Stretch]\n\tconst pageContentDimensionTitles = /* @__PURE__ */ pageContentDimensionOptions.map(option => {\n\t\tswitch (option) {\n\t\t\tcase ContentDimension.Auto:\n\t\t\t\treturn \"Auto\"\n\t\t\tcase ContentDimension.Stretch:\n\t\t\t\treturn \"Stretch\"\n\t\t}\n\t}) as string[]\n\n\tconst pageEffectOptions: PageEffect[] = [\"none\", \"cube\", \"coverflow\", \"wheel\", \"pile\"]\n\tconst pageEffectTitles = /* @__PURE__ */ pageEffectOptions.map(option => {\n\t\tswitch (option) {\n\t\t\tcase \"none\":\n\t\t\t\treturn \"None\"\n\t\t\tcase \"cube\":\n\t\t\t\treturn \"Cube\"\n\t\t\tcase \"coverflow\":\n\t\t\t\treturn \"Cover Flow\"\n\t\t\tcase \"wheel\":\n\t\t\t\treturn \"Wheel\"\n\t\t\tcase \"pile\":\n\t\t\t\treturn \"Pile\"\n\t\t}\n\t})\n\n\tconst pageAlignmentOptions: PageAlignment[] = [\"start\", \"center\", \"end\"]\n\tconst genericAlignmentTitles = /* @__PURE__ */ pageAlignmentOptions.map(option => {\n\t\tswitch (option) {\n\t\t\tcase \"start\":\n\t\t\t\treturn \"Start\"\n\t\t\tcase \"center\":\n\t\t\t\treturn \"Center\"\n\t\t\tcase \"end\":\n\t\t\t\treturn \"End\"\n\t\t}\n\t})\n\n\t// These were the original defaults before we applied control defaults to defaultProps. To keep the\n\t// behavior consistent from code we are overriding the defaults that are different.\n\tEmulatedPage.defaultProps = {\n\t\tgap: 10,\n\t\tdirectionLock: false,\n\t}\n\n\taddPropertyControls(EmulatedPage, {\n\t\tdirection: {\n\t\t\ttype: ControlType.Enum,\n\t\t\toptions: [\"horizontal\", \"vertical\"],\n\t\t\ttitle: \"Direction\",\n\t\t\tdefaultValue: \"horizontal\",\n\t\t\tdisplaySegmentedControl: true,\n\t\t\toptionIcons: [\"direction-horizontal\", \"direction-vertical\"],\n\t\t},\n\t\tdirectionLock: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Lock\",\n\t\t\tenabledTitle: \"1 Axis\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\tdefaultValue: true,\n\t\t},\n\t\tcontentWidth: {\n\t\t\ttype: ControlType.Enum,\n\t\t\toptions: pageContentDimensionOptions,\n\t\t\toptionTitles: pageContentDimensionTitles,\n\t\t\ttitle: \"Width\",\n\t\t\tdefaultValue: ContentDimension.Stretch,\n\t\t\tdisplaySegmentedControl: true,\n\t\t},\n\t\tcontentHeight: {\n\t\t\ttype: ControlType.Enum,\n\t\t\toptions: pageContentDimensionOptions,\n\t\t\toptionTitles: pageContentDimensionTitles,\n\t\t\ttitle: \"Height\",\n\t\t\tdefaultValue: ContentDimension.Stretch,\n\t\t\tdisplaySegmentedControl: true,\n\t\t},\n\t\talignment: {\n\t\t\ttype: ControlType.Enum,\n\t\t\toptions: pageAlignmentOptions,\n\t\t\toptionTitles: genericAlignmentTitles,\n\t\t\ttitle: \"Align\",\n\t\t\thidden(props) {\n\t\t\t\tconst { direction, contentWidth, contentHeight } = props\n\t\t\t\tconst isHorizontalDirection = direction === \"horizontal\"\n\t\t\t\tconst crossDimension = isHorizontalDirection ? contentHeight : contentWidth\n\t\t\t\treturn crossDimension === ContentDimension.Stretch\n\t\t\t},\n\t\t\tdefaultValue: \"start\",\n\t\t\tdisplaySegmentedControl: true,\n\t\t\toptionIcons: {\n\t\t\t\tdirection: {\n\t\t\t\t\thorizontal: [\"align-top\", \"align-middle\", \"align-bottom\"],\n\t\t\t\t\tvertical: [\"align-left\", \"align-center\", \"align-right\"],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tgap: {\n\t\t\ttype: ControlType.Number,\n\t\t\tmin: 0,\n\t\t\ttitle: \"Gap\",\n\t\t\tdefaultValue: 0,\n\t\t},\n\t\tpadding: {\n\t\t\ttype: ControlType.FusedNumber,\n\t\t\ttoggleKey: \"paddingPerSide\",\n\t\t\ttoggleTitles: [\"Padding\", \"Padding per side\"],\n\t\t\tvalueKeys: [\"paddingTop\", \"paddingRight\", \"paddingBottom\", \"paddingLeft\"],\n\t\t\tvalueLabels: [\"T\", \"R\", \"B\", \"L\"],\n\t\t\tmin: 0,\n\t\t\ttitle: \"Padding\",\n\t\t\tdefaultValue: 0,\n\t\t},\n\t\toverflow: {\n\t\t\ttype: ControlType.Enum,\n\t\t\ttitle: \"Overflow\",\n\t\t\tdefaultValue: \"hidden\",\n\t\t\toptions: [\"visible\", \"hidden\"],\n\t\t\toptionTitles: [\"Visible\", \"Hidden\"],\n\t\t\tdisplaySegmentedControl: true,\n\t\t},\n\t\tcurrentPage: {\n\t\t\ttype: ControlType.Number,\n\t\t\tmin: 0,\n\t\t\ttitle: \"Current\",\n\t\t\tdisplayStepper: true,\n\t\t\tdefaultValue: 0,\n\t\t},\n\t\tmomentum: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tenabledTitle: \"On\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\ttitle: \"Momentum\",\n\t\t\tdefaultValue: false,\n\t\t},\n\t\tdragEnabled: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Drag\",\n\t\t\tenabledTitle: \"On\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\tdefaultValue: true,\n\t\t},\n\t\twheelEnabled: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Wheel\",\n\t\t\tenabledTitle: \"On\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\tdefaultValue: false,\n\t\t},\n\t\tdefaultEffect: {\n\t\t\ttype: ControlType.Enum,\n\t\t\toptions: pageEffectOptions,\n\t\t\toptionTitles: pageEffectTitles,\n\t\t\ttitle: \"Effect\",\n\t\t\tdefaultValue: \"none\",\n\t\t},\n\t\tchildren: {\n\t\t\ttype: ControlType.Array,\n\t\t\ttitle: \"Content\",\n\t\t\tcontrol: { type: ControlType.ComponentInstance, title: \"Page\" },\n\t\t},\n\t})\n\t// @ts-expect-error Property supportsConstraints does not exist on type\n\tEmulatedPage.supportsConstraints = true\n\n\treturn EmulatedPage\n})()\n", "import React, { Component } from \"react\"\nimport { FramerEventSession } from \"../events/FramerEventSession.ts\"\nimport type { FramerEvent } from \"../events/index.ts\"\nimport { FramerEventListener } from \"../events/index.ts\"\nimport { FrameWithMotion } from \"../render/presentation/Frame/FrameWithMotion.tsx\"\n\nexport interface ScreenProperties {\n\twidth: number\n\theight: number\n\tscale?: number\n\tcolor?: string\n}\n\n/** @internal */\nexport class Screen extends Component<ScreenProperties & { children?: React.ReactNode }> {\n\tsession = new FramerEventSession(this.dispatcher)\n\tprivate elementRef = React.createRef<HTMLDivElement>()\n\n\toverride componentDidMount() {\n\t\tif (this.elementRef.current) {\n\t\t\tthis.session.originElement = this.elementRef.current\n\t\t}\n\t}\n\n\toverride render() {\n\t\tconst { width, height, scale, color = \"none\", children } = this.props\n\n\t\tconst frame = (\n\t\t\t<FrameWithMotion\n\t\t\t\tref={this.elementRef}\n\t\t\t\twidth={width}\n\t\t\t\theight={height}\n\t\t\t\tstyle={{ originX: 0, originY: 0, scale, backgroundColor: color }}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</FrameWithMotion>\n\t\t)\n\n\t\treturn <FramerEventListener session={this.session}>{frame}</FramerEventListener>\n\t}\n\n\tprivate dispatcher(type: string, event: FramerEvent, target: EventTarget) {\n\t\ttarget.dispatchEvent(new CustomEvent(\"FramerEvent\", { bubbles: true, detail: { type: type, event: event } }))\n\t}\n}\n", "import type { FramerEvent } from \"../FramerEvent.ts\"\nimport type { FramerEventSession } from \"../FramerEventSession.ts\"\n\n/**\n * @internal\n */\nexport enum State {\n\tPossible = 1 << 1, // 2\n\tBegan = 1 << 2, // 4\n\tChanged = 1 << 3, // 8\n\tEnded = 1 << 4, // 16\n\tFailed = 1 << 5, // 32\n\tCancelled = 1 << 6, // 64\n\tRecognized = 1 << 7, // 128\n}\n\nfunction stateName(state: State): string {\n\tswitch (state) {\n\t\tcase State.Possible:\n\t\t\treturn \"Possible\"\n\t\tcase State.Began:\n\t\t\treturn \"Began\"\n\t\tcase State.Changed:\n\t\t\treturn \"Changed\"\n\t\tcase State.Ended:\n\t\t\treturn \"Ended\"\n\t\tcase State.Failed:\n\t\t\treturn \"Failed\"\n\t\tcase State.Cancelled:\n\t\t\treturn \"Cancelled\"\n\t\tcase State.Recognized:\n\t\t\treturn \"Recognized\"\n\t\tdefault:\n\t\t\treturn \"Unknown\"\n\t}\n}\n\nfunction containsBitmask(value: number, bitmask: number): boolean {\n\treturn (value & bitmask) !== 0\n}\n\n/**\n * @internal\n */\nexport abstract class GestureRecognizer {\n\tprivate _state: State = State.Possible\n\n\tget state(): State {\n\t\treturn this._state\n\t}\n\tprivate setState(state: State) {\n\t\tthis._state = state\n\t}\n\thandler: GestureHandler | null = null\n\tpreventers: GestureRecognizer[] = []\n\tget isPrevented(): boolean {\n\t\tlet prevented = false\n\t\tfor (const recognizer of this.preventers) {\n\t\t\tif (recognizer.state & (State.Began | State.Changed | State.Ended)) {\n\t\t\t\tprevented = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn prevented\n\t}\n\n\tabstract pointerSessionBegan(session: FramerEventSession, event: FramerEvent): void\n\tabstract pointerSessionMoved(session: FramerEventSession, event: FramerEvent): void\n\tabstract pointerSessionEnded(session: FramerEventSession, event: FramerEvent): void\n\n\tcanBePreventedBy(recognizer: GestureRecognizer) {\n\t\tthis.preventers.push(recognizer)\n\t}\n\n\thasState(bitmask: State) {\n\t\treturn containsBitmask(this.state, bitmask)\n\t}\n\n\tstateSwitch(newState: State) {\n\t\tlet allowedStates: State | 0\n\t\tswitch (this.state) {\n\t\t\tcase State.Possible:\n\t\t\t\tallowedStates = State.Began | State.Recognized | State.Failed\n\t\t\t\tbreak\n\t\t\tcase State.Began:\n\t\t\t\tallowedStates = State.Changed | State.Cancelled | State.Ended\n\t\t\t\tbreak\n\t\t\tcase State.Changed:\n\t\t\t\tallowedStates = State.Changed | State.Cancelled | State.Ended\n\t\t\t\tbreak\n\t\t\tcase State.Recognized:\n\t\t\tcase State.Ended:\n\t\t\tcase State.Cancelled:\n\t\t\tcase State.Failed:\n\t\t\t\tallowedStates = State.Possible\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tallowedStates = 0\n\t\t}\n\t\tif (!containsBitmask(newState, allowedStates)) {\n\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\tconsole.warn(`Unallowed state change from ${stateName(this.state)} to ${stateName(newState)}`)\n\t\t\treturn\n\t\t}\n\t\tthis.setState(newState)\n\t}\n\n\tcancel() {\n\t\tif (this.hasState(State.Began | State.Changed)) {\n\t\t\tthis.setState(State.Cancelled)\n\t\t}\n\t\tthis.reset()\n\t}\n\n\treset() {\n\t\tif (!this.hasState(State.Possible)) {\n\t\t\tthis.stateSwitch(State.Possible)\n\t\t}\n\t}\n}\n\n/**\n * @internal\n */\nexport interface GestureHandler {\n\tgestureBegan: (type: string, event: FramerEvent, target: EventTarget | null) => void\n\tgestureChanged: (type: string, event: FramerEvent, target: EventTarget | null) => void\n\tgestureEnded: (type: string, event: FramerEvent, target: EventTarget | null) => void\n}\n", "import { debounce } from \"../../render/utils/debounce.ts\"\nimport type { FramerEvent } from \"../FramerEvent.ts\"\nimport type { FramerEventSession } from \"../FramerEventSession.ts\"\nimport { GestureRecognizer, State } from \"./GestureRecognizer.ts\"\n\n/**\n * @internal\n */\nexport class MouseWheelGestureRecognizer extends GestureRecognizer {\n\tprivate startEvent: FramerEvent | null = null\n\treadonly eventType = \"mousewheel\"\n\n\tpointerSessionBegan(session: FramerEventSession, event: FramerEvent) {}\n\tpointerSessionMoved(session: FramerEventSession, event: FramerEvent) {}\n\tpointerSessionEnded(session: FramerEventSession, event: FramerEvent) {}\n\n\tmouseWheel(session: FramerEventSession, event: FramerEvent) {\n\t\tif (!this.handler) return\n\n\t\tif (this.hasState(State.Possible)) {\n\t\t\tthis.startEvent = event\n\t\t\tthis.stateSwitch(State.Began)\n\t\t\tthis.handler.gestureBegan(this.eventType, event, this.startEvent.target)\n\t\t\treturn\n\t\t}\n\n\t\tif (this.hasState(State.Began | State.Changed) && this.startEvent) {\n\t\t\tthis.stateSwitch(State.Changed)\n\t\t\tthis.handler.gestureChanged(this.eventType, event, this.startEvent.target)\n\t\t}\n\t\tthis.onMouseWheelEnd(event)\n\t}\n\n\tprivate onMouseWheelEnd = debounce((event: FramerEvent) => {\n\t\tif (this.handler && this.startEvent) {\n\t\t\tthis.stateSwitch(State.Ended)\n\t\t\tthis.handler.gestureEnded(this.eventType, event, this.startEvent.target)\n\t\t\tthis.startEvent = null\n\t\t\tthis.reset()\n\t\t}\n\t}, 300)\n}\n", "import type { FramerEvent } from \"../FramerEvent.ts\"\nimport type { FramerEventSession } from \"../FramerEventSession.ts\"\nimport { GestureRecognizer, State } from \"./GestureRecognizer.ts\"\n\n/**\n * @internal\n */\nexport class PanGestureRecognizer extends GestureRecognizer {\n\tprivate startEvent: FramerEvent | null = null\n\treadonly eventType = \"pan\"\n\n\tpointerSessionBegan(session: FramerEventSession, event: FramerEvent) {\n\t\tthis.recognize(session, event)\n\t}\n\tpointerSessionMoved(session: FramerEventSession, event: FramerEvent) {\n\t\tthis.recognize(session, event)\n\t}\n\tpointerSessionEnded(session: FramerEventSession, event: FramerEvent) {\n\t\tthis.panend(event)\n\t}\n\n\trecognize(session: FramerEventSession, event: FramerEvent) {\n\t\tif (Math.abs(event.delta.x) > 0 || Math.abs(event.delta.y) > 0) {\n\t\t\tif (this.startEvent) {\n\t\t\t\tthis.pan(event)\n\t\t\t} else {\n\t\t\t\tthis.panstart(event)\n\t\t\t}\n\t\t}\n\t}\n\n\toverride reset() {\n\t\tthis.startEvent = null\n\t\tsuper.reset()\n\t}\n\n\tpanstart(event: FramerEvent) {\n\t\tif (!this.hasState(State.Possible) || (event.isLeftMouseClick !== undefined && !event.isLeftMouseClick)) {\n\t\t\treturn\n\t\t}\n\t\tthis.stateSwitch(State.Began)\n\t\tthis.startEvent = event\n\t\tif (this.handler && this.startEvent.target) {\n\t\t\tthis.handler.gestureBegan(this.eventType, event, this.startEvent.target)\n\t\t}\n\t}\n\n\tpan(event: FramerEvent) {\n\t\tif (!this.hasState(State.Began | State.Changed)) {\n\t\t\treturn\n\t\t}\n\t\tif (!this.startEvent) {\n\t\t\treturn\n\t\t}\n\t\tthis.stateSwitch(State.Changed)\n\t\tif (this.handler && this.startEvent.target) {\n\t\t\tthis.handler.gestureChanged(this.eventType, event, this.startEvent.target)\n\t\t}\n\t}\n\n\tpanend(event: FramerEvent) {\n\t\tif (!this.hasState(State.Began | State.Changed)) {\n\t\t\treturn\n\t\t}\n\t\tif (!this.startEvent) {\n\t\t\treturn\n\t\t}\n\t\tthis.stateSwitch(State.Ended)\n\t\tif (this.handler && this.startEvent.target) {\n\t\t\tthis.handler.gestureEnded(this.eventType, event, this.startEvent.target)\n\t\t}\n\t}\n}\n", "import type { FramerEvent } from \"../FramerEvent.ts\"\nimport type { FramerEventSession } from \"../FramerEventSession.ts\"\nimport { GestureRecognizer, State } from \"./GestureRecognizer.ts\"\n\n/**\n * @internal\n */\nexport class TapGestureRecognizer extends GestureRecognizer {\n\treadonly eventType = \"tap\"\n\n\tpointerSessionBegan(session: FramerEventSession, event: FramerEvent) {\n\t\tif (this.handler && (event.isLeftMouseClick === undefined || event.isLeftMouseClick)) {\n\t\t\tthis.handler.gestureBegan(this.eventType, event, null)\n\t\t}\n\t}\n\tpointerSessionMoved(session: FramerEventSession, event: FramerEvent) {}\n\tpointerSessionEnded(session: FramerEventSession, event: FramerEvent) {\n\t\tif (this.isPrevented) {\n\t\t\tthis.stateSwitch(State.Failed)\n\t\t} else if (!session.startEvent || session.startEvent.target === event.target) {\n\t\t\tthis.stateSwitch(State.Recognized)\n\t\t\tif (this.handler) {\n\t\t\t\tthis.handler.gestureChanged(this.eventType, event, null)\n\t\t\t}\n\t\t} else {\n\t\t\tthis.stateSwitch(State.Failed)\n\t\t}\n\t\tif (this.handler) {\n\t\t\tthis.handler.gestureEnded(this.eventType, event, null)\n\t\t}\n\t}\n}\n", "import { Loop, MainLoop } from \"../core/Loop.ts\"\nimport type { Point } from \"../render/types/Point.ts\"\nimport type { FramerEvent } from \"./FramerEvent.ts\"\nimport type { GestureHandler, GestureRecognizer } from \"./recognizer/GestureRecognizer.ts\"\nimport { MouseWheelGestureRecognizer } from \"./recognizer/MouseWheelGestureRecognizer.ts\"\nimport { PanGestureRecognizer } from \"./recognizer/PanGestureRecognizer.ts\"\nimport { TapGestureRecognizer } from \"./recognizer/TapGestureRecognizer.ts\"\n\nexport type EventDispatcher = (type: string, event: FramerEvent, target: EventTarget) => void\n\nexport type NativeEvent = MouseEvent | TouchEvent\n\n/**\n * @internal\n */\nexport class FramerEventSession implements GestureHandler {\n\tprivate events: FramerEvent[] = []\n\tprivate recognizers: GestureRecognizer[] = []\n\tprivate mouseWheelRecognizer = new MouseWheelGestureRecognizer()\n\tprivate dispatcher: EventDispatcher\n\t/**\n\t * @internal\n\t */\n\toriginElement: HTMLElement\n\n\tget isStarted(): boolean {\n\t\treturn this.events.length !== 0\n\t}\n\n\tget startEvent(): FramerEvent | undefined {\n\t\treturn this.isStarted ? this.events[0] : undefined\n\t}\n\n\tget lastEvent(): FramerEvent | undefined {\n\t\treturn this.events[this.events.length - 1]\n\t}\n\n\tconstructor(dispatcher: EventDispatcher, customOrigin?: HTMLElement) {\n\t\tthis.dispatcher = dispatcher\n\t\tif (customOrigin) {\n\t\t\tthis.originElement = customOrigin\n\t\t} else {\n\t\t\tthis.originElement = document.body\n\t\t}\n\t\tconst pan = new PanGestureRecognizer()\n\t\tconst tap = new TapGestureRecognizer()\n\t\tpan.handler = this\n\t\ttap.handler = this\n\t\tthis.mouseWheelRecognizer.handler = this\n\t\tthis.recognizers = [tap, pan]\n\t}\n\n\t// Event handling\n\n\tprivate processEvent(event: FramerEvent): FramerEvent {\n\t\t// const event = new FramerEvent(originalEvent, this)\n\t\tthis.events.push(event)\n\t\treturn event\n\t}\n\n\tpointerDown(event: FramerEvent) {\n\t\tif (this.isStarted) {\n\t\t\treturn\n\t\t}\n\n\t\tthis.processEvent(event)\n\t\tthis.recognizers.map(r => {\n\t\t\tr.cancel()\n\t\t\tr.pointerSessionBegan(this, event)\n\t\t})\n\t}\n\n\tpointerMove(event: FramerEvent) {\n\t\tif (!this.isStarted) {\n\t\t\treturn\n\t\t}\n\n\t\tthis.processEvent(event)\n\t\tthis.recognizers.map(r => {\n\t\t\tr.pointerSessionMoved(this, event)\n\t\t})\n\t}\n\n\tpointerUp(event: FramerEvent) {\n\t\tif (!this.isStarted) {\n\t\t\treturn\n\t\t}\n\t\tthis.processEvent(event)\n\t\tthis.recognizers.map(r => {\n\t\t\tr.pointerSessionEnded(this, event)\n\t\t})\n\t\tthis.clearEvents()\n\t\tthis.recognizers.map(r => {\n\t\t\tr.reset()\n\t\t})\n\t}\n\n\tmouseWheel(event: FramerEvent) {\n\t\tthis.processEvent(event)\n\t\tthis.mouseWheelRecognizer.mouseWheel(this, event)\n\t\tthis.clearEvents()\n\t}\n\n\tprivate clearEvents() {\n\t\tthis.events = []\n\t}\n\n\tprivate dispatch(type: string, event: FramerEvent, target: EventTarget | null = null) {\n\t\tconst dispatchTarget = target || (this.startEvent && this.startEvent.target) || event.target\n\t\tif (dispatchTarget) {\n\t\t\tthis.dispatcher(type, event, dispatchTarget)\n\t\t}\n\t}\n\n\t// Gesture Handler\n\n\tgestureBegan(type: string, event: FramerEvent, target: EventTarget | null) {\n\t\tthis.dispatch(`${type}start`, event, target)\n\t}\n\n\tgestureChanged(type: string, event: FramerEvent, target: EventTarget | null) {\n\t\tthis.dispatch(type, event, target)\n\t}\n\tgestureEnded(type: string, event: FramerEvent, target: EventTarget | null) {\n\t\tthis.dispatch(`${type}end`, event, target)\n\t}\n\n\t// Calculatinos\n\n\t/**\n\t * Average velocity over last n seconds in pixels per second.\n\t * @param n - number of events to use for calculation\n\t */\n\tvelocity(t = Loop.TimeStep * 2): Point {\n\t\tif (!this.isStarted || this.events.length < 2) {\n\t\t\treturn { x: 0, y: 0 }\n\t\t}\n\n\t\tconst events = this.events\n\t\tlet i = events.length - 1\n\t\tlet event: FramerEvent | null = null\n\n\t\twhile (i >= 0) {\n\t\t\tevent = events[i] ?? null\n\t\t\tif (!event || MainLoop.time - event.loopTime > t) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\ti--\n\t\t}\n\n\t\tif (!event) {\n\t\t\treturn { x: 0, y: 0 }\n\t\t}\n\n\t\tconst current = events[events.length - 1]\n\t\tif (!current) {\n\t\t\treturn { x: 0, y: 0 }\n\t\t}\n\n\t\tconst time = (MainLoop.time - event.loopTime) * 1000\n\t\tif (time === 0) {\n\t\t\treturn { x: 0, y: 0 }\n\t\t}\n\n\t\tconst velocity = {\n\t\t\tx: (current.devicePoint.x - event.devicePoint.x) / time,\n\t\t\ty: (current.devicePoint.y - event.devicePoint.y) / time,\n\t\t}\n\n\t\tif (velocity.x === Infinity) {\n\t\t\tvelocity.x = 0\n\t\t}\n\t\tif (velocity.y === Infinity) {\n\t\t\tvelocity.y = 0\n\t\t}\n\n\t\treturn velocity\n\t}\n\n\toffset(event: FramerEvent): Point {\n\t\tif (!this.startEvent) {\n\t\t\treturn { x: 0, y: 0 }\n\t\t}\n\n\t\t// TODO: externalize:\n\t\tconst subtract = (pointA: Point, pointB: Point): Point => {\n\t\t\treturn {\n\t\t\t\tx: pointA.x - pointB.x,\n\t\t\t\ty: pointA.y - pointB.y,\n\t\t\t}\n\t\t}\n\n\t\treturn subtract(event.devicePoint, this.startEvent.devicePoint)\n\t}\n}\n", "import type React from \"react\"\nimport { Component } from \"react\"\nimport { safeWindow } from \"../../utils/safeWindow.ts\"\nimport { FramerEvent } from \"../FramerEvent.ts\"\nimport type { FramerEventSession } from \"../FramerEventSession.ts\"\n\nexport interface MouseProps {\n\tsession: FramerEventSession\n}\n/**\n * @internal\n */\nexport class MouseEventListener extends Component<MouseProps & { children?: React.ReactNode }> {\n\t/**\n\t * @internal\n\t */\n\toverride render() {\n\t\treturn this.props.children\n\t}\n\n\t/**\n\t * @internal\n\t */\n\toverride componentDidMount() {\n\t\tsafeWindow.addEventListener(\"mousedown\", this.domMouseDown)\n\t\tsafeWindow.addEventListener(\"wheel\", this.domMouseWheel)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\toverride componentWillUnmount() {\n\t\tsafeWindow.removeEventListener(\"mousemove\", this.domMouseMove)\n\t\tsafeWindow.removeEventListener(\"mousedown\", this.domMouseDown)\n\t\tsafeWindow.removeEventListener(\"mouseup\", this.domMouseUp)\n\t\tsafeWindow.removeEventListener(\"wheel\", this.domMouseWheel)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tdomMouseDown = (originalEvent: MouseEvent) => {\n\t\tsafeWindow.addEventListener(\"mousemove\", this.domMouseMove)\n\t\tsafeWindow.addEventListener(\"mouseup\", this.domMouseUp)\n\t\tconst event = new FramerEvent(originalEvent, this.props.session)\n\t\tthis.props.session.pointerDown(event)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tdomMouseMove = (originalEvent: MouseEvent) => {\n\t\tconst leftMouseButtonOnlyDown =\n\t\t\toriginalEvent.buttons === undefined ? originalEvent.which === 1 : originalEvent.buttons === 1\n\n\t\t// mousemoves should only be registred when left mouse button is down\n\t\tif (!leftMouseButtonOnlyDown) {\n\t\t\tthis.domMouseUp(originalEvent)\n\t\t\treturn\n\t\t}\n\n\t\tconst event = new FramerEvent(originalEvent, this.props.session)\n\t\tthis.props.session.pointerMove(event)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tdomMouseUp = (originalEvent: MouseEvent) => {\n\t\tsafeWindow.removeEventListener(\"mousemove\", this.domMouseMove)\n\t\tsafeWindow.removeEventListener(\"mouseup\", this.domMouseUp)\n\t\tconst event = new FramerEvent(originalEvent, this.props.session)\n\t\tthis.props.session.pointerUp(event)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tdomMouseWheel = (originalEvent: MouseEvent) => {\n\t\tconst event = new FramerEvent(originalEvent, this.props.session)\n\t\tthis.props.session.mouseWheel(event)\n\t}\n}\n", "import type React from \"react\"\nimport { Component } from \"react\"\nimport { safeWindow } from \"../../utils/safeWindow.ts\"\nimport { FramerEvent } from \"../FramerEvent.ts\"\nimport type { FramerEventSession } from \"../FramerEventSession.ts\"\n\nexport interface Props {\n\tsession: FramerEventSession\n}\n\n/**\n * @internal\n */\nexport class TouchEventListener extends Component<Props & { children?: React.ReactNode }> {\n\t/**\n\t * @internal\n\t */\n\toverride render() {\n\t\treturn this.props.children\n\t}\n\n\t/**\n\t * @internal\n\t */\n\toverride componentDidMount() {\n\t\tsafeWindow.addEventListener(\"touchstart\", this.domTouchStart)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\toverride componentWillUnmount() {\n\t\tsafeWindow.removeEventListener(\"touchstart\", this.domTouchStart)\n\t\tsafeWindow.removeEventListener(\"touchmove\", this.domTouchMove)\n\t\tsafeWindow.removeEventListener(\"touchend\", this.domTouchEnd)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tdomTouchStart = (originalEvent: TouchEvent) => {\n\t\tsafeWindow.addEventListener(\"touchmove\", this.domTouchMove)\n\t\tsafeWindow.addEventListener(\"touchend\", this.domTouchEnd)\n\t\tconst event = new FramerEvent(originalEvent, this.props.session)\n\t\tthis.props.session.pointerDown(event)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tdomTouchMove = (originalEvent: TouchEvent) => {\n\t\tconst event = new FramerEvent(originalEvent, this.props.session)\n\t\tthis.props.session.pointerMove(event)\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tdomTouchEnd = (originalEvent: TouchEvent) => {\n\t\tsafeWindow.removeEventListener(\"touchmove\", this.domTouchMove)\n\t\tsafeWindow.removeEventListener(\"touchend\", this.domTouchEnd)\n\t\tconst event = new FramerEvent(originalEvent, this.props.session)\n\t\tthis.props.session.pointerUp(event)\n\t}\n}\n", "import { isTouch } from \"@framerjs/shared/src/environment.ts\"\nimport { MouseEventListener } from \"./recognizer/MouseEventListener.ts\"\nimport { TouchEventListener } from \"./recognizer/TouchEventListener.ts\"\n\n/** @internal */\nexport const FramerEventListener = /* @__PURE__ */ isTouch() ? TouchEventListener : MouseEventListener\n", "import React, { type ForwardRefExoticComponent, type RefAttributes } from \"react\"\nimport { ControlType } from \"../../render/types/PropertyControls.ts\"\nimport { addPropertyControls } from \"../../utils/addPropertyControls.ts\"\nimport { EmulatedScroll } from \"./EmulatedScroll.tsx\"\nimport { NativeScroll } from \"./NativeScroll.tsx\"\nimport type { EmulatedScrollProps, NativeScrollProps, ScrollProps } from \"./types.ts\"\n\n/**\n * @public\n * @deprecated Creating new Scroll components in Framer is no longer supported as of July 2025.\n * Existing Scroll components will continue to work, but please use alternative solutions for new\n * projects.\n */\nexport const Scroll = /* @__PURE__ */ ((): ForwardRefExoticComponent<\n\tOmit<EmulatedScrollProps | NativeScrollProps, \"ref\"> & RefAttributes<HTMLDivElement> // type produced by make update-editor-types is unstable if not explicit\n> => {\n\tconst ScrollInner = React.forwardRef<HTMLDivElement, ScrollProps>(function ScrollInner(props, forwardedRef) {\n\t\tif (props.native) {\n\t\t\treturn <NativeScroll ref={forwardedRef} {...props} />\n\t\t} else {\n\t\t\treturn <EmulatedScroll ref={forwardedRef} {...props} />\n\t\t}\n\t})\n\n\tScrollInner.defaultProps = {\n\t\tdirectionLock: false,\n\t}\n\n\taddPropertyControls(ScrollInner, {\n\t\tnative: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tdefaultValue: false,\n\t\t},\n\t\tdirection: {\n\t\t\ttype: ControlType.SegmentedEnum,\n\t\t\ttitle: \"Direction\",\n\t\t\toptions: [\"vertical\", \"horizontal\", \"both\"],\n\t\t\tdefaultValue: \"vertical\",\n\t\t},\n\t\tcontentOffsetX: {\n\t\t\ttype: ControlType.Number,\n\t\t\ttitle: \"Offset X\",\n\t\t\tdefaultValue: 0,\n\t\t\tmin: 0,\n\t\t\tstep: 10,\n\t\t\tdisplayStepper: true,\n\t\t\thidden: ({ direction }) => direction === \"vertical\",\n\t\t},\n\t\tcontentOffsetY: {\n\t\t\ttype: ControlType.Number,\n\t\t\ttitle: \"Offset Y\",\n\t\t\tdefaultValue: 0,\n\t\t\tmin: 0,\n\t\t\tstep: 10,\n\t\t\tdisplayStepper: true,\n\t\t\thidden: ({ direction }) => direction === \"horizontal\",\n\t\t},\n\t\tdirectionLock: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Lock\",\n\t\t\tenabledTitle: \"1 Axis\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\tdefaultValue: true,\n\t\t\thidden: ({ native }) => native === true,\n\t\t},\n\t\tdragEnabled: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Drag\",\n\t\t\tenabledTitle: \"On\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\tdefaultValue: true,\n\t\t},\n\t\toverdragEnabled: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Overdrag\",\n\t\t\tenabledTitle: \"On\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\tdefaultValue: true,\n\t\t\thidden: ({ native }) => native === true,\n\t\t},\n\t\twheelEnabled: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Wheel\",\n\t\t\tenabledTitle: \"On\",\n\t\t\tdisabledTitle: \"Off\",\n\t\t\tdefaultValue: true,\n\t\t\thidden: ({ native }) => native === true,\n\t\t},\n\t\tscrollBarVisible: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Scroll Bar\",\n\t\t\tenabledTitle: \"Visible\",\n\t\t\tdisabledTitle: \"Hidden\",\n\t\t\tdefaultValue: false,\n\t\t\thidden: ({ native }) => native === false,\n\t\t},\n\t\tresetOffset: {\n\t\t\ttype: ControlType.Boolean,\n\t\t\ttitle: \"Reset\",\n\t\t\tdefaultValue: false,\n\t\t},\n\t})\n\n\t// @ts-expect-error Property supportsConstraints does not exist on type\n\tScrollInner.supportsConstraints = true\n\n\treturn ScrollInner\n})()\n", "import type { BoundingBox, DraggableProps, MotionValue, PanInfo } from \"framer-motion\"\nimport { frame, useDragControls, useMotionValue } from \"framer-motion\"\nimport React, { useCallback, useMemo, useRef } from \"react\"\nimport { FrameWithMotion } from \"../../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { RenderTarget } from \"../../render/types/RenderEnvironment.ts\"\nimport { withLibraryCSS } from \"../../render/utils/injectComponentCSSRules.ts\"\nimport { isFiniteNumber } from \"../../render/utils/isFiniteNumber.ts\"\nimport { isMotionValue } from \"../../render/utils/isMotionValue.ts\"\nimport { useLayoutId } from \"../../render/utils/useLayoutId.ts\"\nimport { useIsomorphicLayoutEffect } from \"../../useIsomorphicLayoutEffect.ts\"\nimport { EmptyState } from \"../EmptyState.tsx\"\nimport { useIsInCurrentNavigationTarget } from \"../NavigationContainerContext.tsx\"\nimport type { EmulatedScrollProps } from \"./types.ts\"\nimport { useWheelScroll } from \"./useWheelScroll.ts\"\n\nconst directionMap: { [key: string]: DraggableProps[\"drag\"] } = {\n\thorizontal: \"x\",\n\tvertical: \"y\",\n\tboth: true,\n}\n\nfunction convertScrollDirectionToDrag(scrollDirection?: \"horizontal\" | \"vertical\" | \"both\") {\n\treturn scrollDirection ? directionMap[scrollDirection] : scrollDirection\n}\n\nconst useUpdateChildSize = ({\n\tdragDirection,\n\tchildren,\n\tfromCanvasComponent,\n}: {\n\tdragDirection: \"both\" | \"horizontal\" | \"vertical\"\n\tchildren: React.ReactNode\n\tfromCanvasComponent?: boolean\n}): React.ReactNode | React.ReactNode[] => {\n\treturn useMemo((): React.ReactNode | React.ReactChild[] => {\n\t\treturn React.Children.map(children, (child: React.ReactChild) => {\n\t\t\tif (child === null || typeof child !== \"object\" || typeof child.type === \"string\") {\n\t\t\t\treturn child\n\t\t\t}\n\n\t\t\tconst updatedSize: Partial<{ width: number | string; height: number | string }> = {}\n\t\t\tswitch (dragDirection) {\n\t\t\t\tcase \"vertical\":\n\t\t\t\t\tupdatedSize.width = \"100%\"\n\t\t\t\t\tbreak\n\t\t\t\tcase \"horizontal\":\n\t\t\t\t\tupdatedSize.height = \"100%\"\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\treturn child\n\t\t\t}\n\n\t\t\tconst update = fromCanvasComponent ? { style: Object.assign({}, child.props.style, updatedSize) } : updatedSize\n\t\t\treturn React.cloneElement(child, update)\n\t\t})\n\t}, [dragDirection, children, fromCanvasComponent])\n}\n\nconst numberFromOptionalMotionValue = (value: number | MotionValue<number>): number => {\n\treturn typeof value === \"number\" ? value : value.get()\n}\n/**\n * @private\n * @deprecated Part of canvas page components.\n */\nconst EmulatedScrollInner = /* @__PURE__ */ React.forwardRef<HTMLDivElement, EmulatedScrollProps>(\n\tfunction EmulatedScroll(props, forwardedRef: React.RefObject<HTMLDivElement> | null) {\n\t\tconst {\n\t\t\tdirection = \"vertical\",\n\t\t\tdirectionLock = false,\n\t\t\tdragEnabled = true,\n\t\t\tdragElastic,\n\t\t\tdragMomentum,\n\t\t\tdragTransition,\n\t\t\twheelEnabled = true,\n\t\t\tcontentOffsetX = 0,\n\t\t\tcontentOffsetY = 0,\n\t\t\tcontentWidth,\n\t\t\tcontentHeight,\n\t\t\tonScrollStart,\n\t\t\tonScroll,\n\t\t\tonScrollEnd,\n\t\t\tonDragStart,\n\t\t\tonDrag,\n\t\t\tonDragEnd,\n\t\t\tonUpdate,\n\t\t\tonDirectionLock,\n\t\t\tstyle,\n\t\t\tchildren,\n\t\t\tscrollAnimate,\n\t\t\tresetOffset,\n\t\t\toverdragEnabled = true,\n\t\t\tlayoutId: specificLayoutId,\n\t\t\tnative: _native,\n\t\t\t...containerProps\n\t\t} = props\n\n\t\tconst layoutId = useLayoutId(props, { specificLayoutId, postfix: \"scroll\" })\n\t\tconst defaultX = useMotionValue(typeof contentOffsetX === \"number\" ? contentOffsetX : 0)\n\t\tconst defaultY = useMotionValue(typeof contentOffsetY === \"number\" ? contentOffsetY : 0)\n\t\tconst x = isMotionValue(contentOffsetX) ? contentOffsetX : defaultX\n\t\tconst y = isMotionValue(contentOffsetY) ? contentOffsetY : defaultY\n\t\tconst measuredConstraints = useRef<null | BoundingBox>(null)\n\t\tconst dragControls = useDragControls()\n\t\tconst isInTarget = useIsInCurrentNavigationTarget()\n\t\tconst wasInTargetRef = useRef(true)\n\n\t\tfunction setMeasureDragConstraints(constraints: BoundingBox) {\n\t\t\tconstraints = offsetToZero(constraints)\n\n\t\t\tif (contentWidth !== undefined) constraints.left = -contentWidth\n\t\t\tif (contentHeight !== undefined) constraints.top = -contentHeight\n\n\t\t\treturn (measuredConstraints.current = constraints)\n\t\t}\n\n\t\tconst { initial, prev } = useRef({\n\t\t\tinitial: { x: 0, y: 0 },\n\t\t\tprev: { x: 0, y: 0 },\n\t\t}).current\n\n\t\tconst isPreview = RenderTarget.current() === RenderTarget.preview\n\n\t\tconst containerFallbackRef = useRef<HTMLDivElement>(null)\n\t\tconst containerRef = forwardedRef || containerFallbackRef\n\n\t\tconst contentRef = useRef<HTMLDivElement>(null)\n\t\tconst lastOffsetRef = useRef<{\n\t\t\tmaxXOffset: number\n\t\t\tmaxYOffset: number\n\t\t\toffsetX: number\n\t\t\toffsetY: number\n\t\t\tx: number\n\t\t\ty: number\n\t\t} | null>(null)\n\n\t\tfunction shouldResetScroll(inTarget: boolean) {\n\t\t\tconst hasEnteredTarget = inTarget && wasInTargetRef.current === false\n\t\t\treturn resetOffset && hasEnteredTarget\n\t\t}\n\n\t\tfunction measureAndUpdateScrollOffset(): void {\n\t\t\tif (!contentRef.current || !containerRef.current) return\n\n\t\t\t// If the component is flagged to reset its scroll offset to its initial\n\t\t\t// values when it appears, check if the scroll was previously not\n\t\t\t// visible, and has become visible, and if so flag that we must reset\n\t\t\t// the scroll offset.\n\t\t\tconst mustReset = shouldResetScroll(isInTarget)\n\t\t\twasInTargetRef.current = isInTarget\n\n\t\t\t// If the offset properties are not set, we don't need to measure and\n\t\t\t// update scroll offset.\n\t\t\tconst previous = lastOffsetRef.current\n\t\t\tif (previous === null && contentOffsetX === undefined && contentOffsetY === undefined) return\n\n\t\t\t// Check if the values of the offset props have changed, requiring\n\t\t\t// scroll position to be updated. We only do this when the props are\n\t\t\t// numbers, because if they are motionValues, the offset has already\n\t\t\t// been changed by the motionValues themselves.\n\t\t\tconst shouldUpdateOffset =\n\t\t\t\tprevious === null ||\n\t\t\t\t(!isMotionValue(contentOffsetX) && contentOffsetX !== previous.offsetX) ||\n\t\t\t\t(!isMotionValue(contentOffsetY) && contentOffsetY !== previous.offsetY)\n\n\t\t\t// Check if the new maximum scroll offset has changed as a result of the\n\t\t\t// container or the scrollable content resizing.\n\t\t\tconst currentMaxXOffset = contentRef.current.offsetWidth - containerRef.current.offsetWidth\n\t\t\tconst currentMaxYOffset = contentRef.current.offsetHeight - containerRef.current.offsetHeight\n\t\t\tconst hasSizeChanged = currentMaxXOffset !== previous?.maxXOffset || currentMaxYOffset !== previous?.maxYOffset\n\n\t\t\t// Check if the actual scroll offset has changed via user interaction\n\t\t\t// relative to the last offset set via this function.\n\t\t\tconst hasScrollOffsetChanged = previous?.x !== x.get() || previous?.y !== y.get()\n\n\t\t\t// If the size has changed, but the user hasn't scrolled away from the\n\t\t\t// last set scroll offset, we expect the resize not to result in an\n\t\t\t// incorrect scroll position. For instance, the maximum scrollable size\n\t\t\t// could shrink, meaning that a scroll offset that was previously\n\t\t\t// acceptable now results in undesirable overscroll. In this case we\n\t\t\t// need to reset to an acceptable offset.\n\t\t\tconst shouldStayPinned = hasSizeChanged && !hasScrollOffsetChanged\n\n\t\t\tif (mustReset || shouldUpdateOffset || shouldStayPinned) {\n\t\t\t\tconst currentOffsetX = direction !== \"vertical\" ? numberFromOptionalMotionValue(contentOffsetX) : 0\n\t\t\t\tconst currentOffsetY = direction !== \"horizontal\" ? numberFromOptionalMotionValue(contentOffsetY) : 0\n\t\t\t\tconst nextXOffset = -Math.min(currentOffsetX, currentMaxXOffset)\n\t\t\t\tconst nextYOffset = -Math.min(currentOffsetY, currentMaxYOffset)\n\n\t\t\t\tx.set(nextXOffset)\n\t\t\t\ty.set(nextYOffset)\n\n\t\t\t\tlastOffsetRef.current = {\n\t\t\t\t\tmaxXOffset: currentMaxXOffset,\n\t\t\t\t\tmaxYOffset: currentMaxYOffset,\n\t\t\t\t\toffsetX: currentOffsetX,\n\t\t\t\t\toffsetY: currentOffsetY,\n\t\t\t\t\tx: nextXOffset,\n\t\t\t\t\ty: nextYOffset,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// onBeforeLayoutMeasure is not called on the canvas, so handle updating\n\t\t// scroll offset on the canvas on any update with a layout effect.\n\t\tuseIsomorphicLayoutEffect(() => {\n\t\t\tif (RenderTarget.current() !== RenderTarget.canvas) return\n\n\t\t\tmeasureAndUpdateScrollOffset()\n\t\t})\n\n\t\t// onBeforeLayoutMeasure is not called on mount, so handle updating scroll\n\t\t// on mount in the preview.\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated component\n\t\tuseIsomorphicLayoutEffect(() => {\n\t\t\tif (RenderTarget.current() === RenderTarget.canvas) return\n\n\t\t\tmeasureAndUpdateScrollOffset()\n\t\t}, [])\n\n\t\t// isInTarget can change without motion calling measure on the element. To\n\t\t// solve that case, we run an effect when isInTarget changes, and call\n\t\t// measureAndUpdate if we need to reset. Since an effect runs after motion's\n\t\t// measurements phase, this will only run if we haven't already reset during\n\t\t// the render phase.\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated component\n\t\tReact.useEffect(() => {\n\t\t\tif (shouldResetScroll(isInTarget)) measureAndUpdateScrollOffset()\n\n\t\t\t// Always unset isInTarget to false on a change.\n\t\t\t// measureAndUpdateScrollOffset may not be called when navigating off\n\t\t\t// screen.\n\t\t\tif (isInTarget === false) wasInTargetRef.current = false\n\t\t}, [isInTarget])\n\n\t\tconst getLatestPoint = () => ({ x: x.get(), y: y.get() })\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated component\n\t\tconst resetInitialPoint = useCallback(() => {\n\t\t\tconst point = getLatestPoint()\n\t\t\tinitial.x = point.x\n\t\t\tinitial.y = point.y\n\t\t\tprev.x = point.x\n\t\t\tprev.y = point.y\n\t\t}, [])\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated component\n\t\tconst getPointData = useCallback(() => {\n\t\t\tconst point = getLatestPoint()\n\n\t\t\tconst data = {\n\t\t\t\tpoint,\n\t\t\t\tvelocity: { x: x.getVelocity(), y: y.getVelocity() },\n\t\t\t\toffset: { x: point.x - initial.x, y: point.y - initial.y },\n\t\t\t\tdelta: { x: point.x - prev.x, y: point.y - prev.y },\n\t\t\t}\n\n\t\t\tprev.x = point.x\n\t\t\tprev.y = point.y\n\n\t\t\treturn data\n\t\t}, [x, y])\n\n\t\tconst updateScrollListeners = useCallback(() => {\n\t\t\tonUpdate && onUpdate({ x: x.get(), y: y.get() })\n\t\t\tonScroll && onScroll(getPointData())\n\t\t}, [onScroll, onUpdate, getPointData, x, y])\n\n\t\tconst scheduleUpdateScrollListeners = useCallback(() => {\n\t\t\tframe.update(updateScrollListeners, false, true)\n\t\t}, [updateScrollListeners])\n\n\t\tconst onMotionDragStart = (event: MouseEvent | TouchEvent, info: PanInfo) => {\n\t\t\tresetInitialPoint()\n\t\t\tonDragStart && onDragStart(event, info)\n\t\t\tonScrollStart && onScrollStart(info)\n\t\t}\n\n\t\tconst onMotionDragTransitionEnd = () => onScrollEnd && onScrollEnd(getPointData())\n\t\tconst onWheelScrollStart = (info: PanInfo) => {\n\t\t\tonScrollStart?.(info)\n\t\t}\n\n\t\tuseWheelScroll(containerRef, {\n\t\t\tenabled: wheelEnabled,\n\t\t\tinitial,\n\t\t\tprev,\n\t\t\tdirection,\n\t\t\toffsetX: x,\n\t\t\toffsetY: y,\n\t\t\tonScrollStart: onWheelScrollStart,\n\t\t\tonScroll,\n\t\t\tonScrollEnd,\n\t\t\tconstraints: measuredConstraints,\n\t\t})\n\n\t\tconst overdragX = useMotionValue(0)\n\t\tconst overdragY = useMotionValue(0)\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated component\n\t\tuseIsomorphicLayoutEffect(() => {\n\t\t\tconst setScrollX = (xValue: number) => {\n\t\t\t\tconst element = containerRef.current\n\t\t\t\tif (!(element instanceof HTMLDivElement)) return\n\t\t\t\telement.scrollLeft = -xValue\n\n\t\t\t\tconst constraints = measuredConstraints.current\n\t\t\t\tif (constraints && overdragEnabled) {\n\t\t\t\t\tlet overdragXValue = 0\n\t\t\t\t\tif (xValue > constraints.right) overdragXValue = xValue\n\t\t\t\t\tif (xValue < constraints.left) overdragXValue = xValue - constraints.left\n\t\t\t\t\toverdragX.set(overdragXValue)\n\t\t\t\t}\n\n\t\t\t\tscheduleUpdateScrollListeners()\n\t\t\t}\n\n\t\t\tconst currentX = x.get()\n\t\t\tif (currentX !== 0) setScrollX(currentX)\n\n\t\t\treturn x.on(\"change\", setScrollX)\n\t\t}, [x, overdragX, scheduleUpdateScrollListeners, overdragEnabled])\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated component\n\t\tuseIsomorphicLayoutEffect(() => {\n\t\t\tconst setScrollY = (yValue: number) => {\n\t\t\t\tconst element = containerRef.current\n\t\t\t\tif (!(element instanceof HTMLDivElement)) return\n\n\t\t\t\telement.scrollTop = -yValue\n\n\t\t\t\tconst constraints = measuredConstraints.current\n\n\t\t\t\tif (constraints && overdragEnabled) {\n\t\t\t\t\tlet overdragYValue = 0\n\n\t\t\t\t\tif (yValue > constraints.bottom) overdragYValue = yValue\n\t\t\t\t\tif (yValue < constraints.top) overdragYValue = yValue - constraints.top\n\t\t\t\t\toverdragY.set(overdragYValue)\n\t\t\t\t}\n\n\t\t\t\tscheduleUpdateScrollListeners()\n\t\t\t}\n\n\t\t\tconst currentY = y.get()\n\t\t\tif (currentY !== 0) setScrollY(currentY)\n\n\t\t\treturn y.on(\"change\", setScrollY)\n\t\t}, [y, overdragY, scheduleUpdateScrollListeners, overdragEnabled])\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated component\n\t\tconst nativeOnScroll = React.useCallback(() => {\n\t\t\tconst element = containerRef.current\n\t\t\tif (!(element instanceof HTMLDivElement)) return\n\t\t\t// we ignore native scroll changes when we are dragging or finishing a drag animation\n\t\t\tconst xDelta = Math.abs(x.get() + element.scrollLeft)\n\t\t\tconst yDelta = Math.abs(y.get() + element.scrollTop)\n\t\t\tif (xDelta > 1) x.set(-element.scrollLeft)\n\t\t\tif (yDelta > 1) y.set(-element.scrollTop)\n\t\t}, [x, y])\n\n\t\tconst isEmpty = React.Children.count(children) === 0\n\t\tconst width = direction !== \"vertical\" && !isEmpty ? \"auto\" : \"100%\"\n\t\tconst height = direction !== \"horizontal\" && !isEmpty ? \"auto\" : \"100%\"\n\t\tconst size = !containerProps.__fromCanvasComponent\n\t\t\t? {\n\t\t\t\t\twidth: containerProps.__fromCodeComponentNode ? \"100%\" : containerProps.width,\n\t\t\t\t\theight: containerProps.__fromCodeComponentNode ? \"100%\" : containerProps.height,\n\t\t\t\t}\n\t\t\t: {}\n\n\t\treturn (\n\t\t\t<FrameWithMotion\n\t\t\t\tdata-framer-component-type=\"Scroll\"\n\t\t\t\tbackground=\"none\" // need to set here to prevent default background from Frame\n\t\t\t\t{...containerProps}\n\t\t\t\t{...size}\n\t\t\t\tstyle={{\n\t\t\t\t\t...style,\n\t\t\t\t\twillChange: isPreview ? \"transform\" : undefined, // allows the scroll content to be hardware accelerated\n\t\t\t\t\toverflow: \"hidden\",\n\t\t\t\t}}\n\t\t\t\tonScroll={nativeOnScroll}\n\t\t\t\tpreserve3d={containerProps.preserve3d}\n\t\t\t\tref={containerRef}\n\t\t\t\tlayoutId={layoutId}\n\t\t\t\tlayoutScroll\n\t\t\t\tonBeforeLayoutMeasure={measureAndUpdateScrollOffset}\n\t\t\t>\n\t\t\t\t<FrameWithMotion\n\t\t\t\t\tdata-framer-component-type=\"ScrollContentWrapper\"\n\t\t\t\t\tanimate={scrollAnimate}\n\t\t\t\t\tdrag={dragEnabled && convertScrollDirectionToDrag(direction)}\n\t\t\t\t\tdragDirectionLock={directionLock}\n\t\t\t\t\tdragElastic={dragElastic}\n\t\t\t\t\tdragMomentum={dragMomentum}\n\t\t\t\t\tdragTransition={dragTransition}\n\t\t\t\t\tdragConstraints={containerRef}\n\t\t\t\t\tdragControls={dragControls}\n\t\t\t\t\tonDragStart={onMotionDragStart}\n\t\t\t\t\tonDrag={onDrag}\n\t\t\t\t\tonDragEnd={onDragEnd}\n\t\t\t\t\tonDragTransitionEnd={onMotionDragTransitionEnd}\n\t\t\t\t\tonDirectionLock={onDirectionLock}\n\t\t\t\t\tonMeasureDragConstraints={setMeasureDragConstraints}\n\t\t\t\t\twidth={width}\n\t\t\t\t\theight={height}\n\t\t\t\t\t_dragX={x}\n\t\t\t\t\t_dragY={y}\n\t\t\t\t\tposition=\"relative\"\n\t\t\t\t\tx={overdragEnabled ? overdragX : undefined}\n\t\t\t\t\ty={overdragEnabled ? overdragY : undefined}\n\t\t\t\t\tref={contentRef}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tdisplay: isEmpty ? \"block\" : \"inline-block\",\n\t\t\t\t\t\twillChange: isPreview ? \"transform\" : undefined, // makes the scroll content hardware accelerated\n\t\t\t\t\t\tbackgroundColor: \"transparent\",\n\t\t\t\t\t\toverflow: \"visible\",\n\t\t\t\t\t\tminWidth: \"100%\",\n\t\t\t\t\t\tminHeight: \"100%\",\n\t\t\t\t\t}}\n\t\t\t\t\tpreserve3d={containerProps.preserve3d}\n\t\t\t\t>\n\t\t\t\t\t<EmptyState\n\t\t\t\t\t\tsize={{\n\t\t\t\t\t\t\twidth: isFiniteNumber(containerProps.width) ? containerProps.width : \"100%\",\n\t\t\t\t\t\t\theight: isFiniteNumber(containerProps.height) ? containerProps.height : \"100%\",\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tinsideUserCodeComponent={!containerProps.__fromCodeComponentNode}\n\t\t\t\t\t\ttitle=\"Scroll\"\n\t\t\t\t\t\tdescription=\"Click and drag the connector to any frame on the canvas \u2192\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</EmptyState>\n\t\t\t\t\t{useUpdateChildSize({\n\t\t\t\t\t\tdragDirection: direction,\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\tfromCanvasComponent: containerProps.__fromCanvasComponent,\n\t\t\t\t\t})}\n\t\t\t\t</FrameWithMotion>\n\t\t\t</FrameWithMotion>\n\t\t)\n\t},\n)\n\nexport const EmulatedScroll = /* @__PURE__ */ withLibraryCSS(EmulatedScrollInner)\n\n/**\n * Because we're overriding the usual drag x/y with scrollTop and scrollLeft\n * our constraints calculations need rebasing to 0\n */\nfunction offsetToZero({ top, left, right, bottom }: BoundingBox) {\n\tconst width = right - left\n\tconst height = bottom - top\n\n\treturn {\n\t\ttop: -height,\n\t\tleft: -width,\n\t\tright: 0,\n\t\tbottom: 0,\n\t}\n}\n", "import React from \"react\"\nimport { cx } from \"../../modules/cx.ts\"\nimport { FrameWithMotion } from \"../../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { withLibraryCSS } from \"../../render/utils/injectComponentCSSRules.ts\"\nimport { isFiniteNumber } from \"../../render/utils/isFiniteNumber.ts\"\nimport { isMotionValue } from \"../../render/utils/isMotionValue.ts\"\nimport { useLayoutId } from \"../../render/utils/useLayoutId.ts\"\nimport { useIsomorphicLayoutEffect } from \"../../useIsomorphicLayoutEffect.ts\"\nimport { EmptyState } from \"../EmptyState.tsx\"\nimport { useIsInCurrentNavigationTarget } from \"../NavigationContainerContext.tsx\"\nimport { useEmulateTouchScroll } from \"../utils/useEmulatedTouchScroll.ts\"\nimport { useUpdateScrollOffset } from \"../utils/useUpdateScrollOffset.ts\"\nimport type { NativeScrollProps } from \"./types.ts\"\n\n/**\n * @private\n */\nconst NativeScrollInner = /* @__PURE__ */ React.forwardRef<HTMLDivElement, NativeScrollProps>(function NativeScroll(\n\tprops,\n\tforwardedRef: React.RefObject<HTMLDivElement> | null,\n) {\n\tconst {\n\t\tdirection = \"vertical\",\n\t\tscrollBarVisible = false,\n\t\tdragEnabled = true,\n\t\tcontentOffsetX = 0,\n\t\tcontentOffsetY = 0,\n\t\tcontentWidth: _contentWidth,\n\t\tcontentHeight: _contentHeight,\n\t\tchildren,\n\t\tresetOffset,\n\t\tonScroll,\n\t\tclassName,\n\t\t// Not (yet) supported\n\t\tdirectionLock: _directionLock = false,\n\t\twheelEnabled: _wheelEnabled = true,\n\t\tscrollAnimate: _scrollAnimate,\n\t\tdragTransition: _dragTransition,\n\t\tdragMomentum: _dragMomentum,\n\t\tdragElastic: _dragElastic,\n\t\toverdragEnabled: _overdragEnabled = true,\n\t\tonScrollStart: _onScrollStart,\n\t\tonScrollEnd: _onScrollEnd,\n\t\tonDragStart: _onDragStart,\n\t\tonDrag: _onDrag,\n\t\tonDragEnd: _onDragEnd,\n\t\tonUpdate: _onUpdate,\n\t\tonDirectionLock: _onDirectionLock,\n\t\tlayoutId: specificLayoutId,\n\t\tnative: _native,\n\t\t// Rest\n\t\t...containerProps\n\t} = props\n\n\tconst layoutId = useLayoutId(props, { specificLayoutId, postfix: \"scroll\" })\n\n\tconst fallbackRef = React.useRef<HTMLDivElement>(null)\n\tconst ref = forwardedRef || fallbackRef\n\n\tconst { cancelEmulatedTouchScrollAnimation } = useEmulateTouchScroll(ref, direction, dragEnabled)\n\n\tconst isInTarget = useIsInCurrentNavigationTarget()\n\tconst previousIsInTargetRef = React.useRef(isInTarget)\n\n\tconst updateScrollOffsetHandler = () => {\n\t\tif (!resetOffset) return\n\t\tconst previousIsTarget = previousIsInTargetRef.current\n\t\tpreviousIsInTargetRef.current = isInTarget\n\t\tconst shouldResetOffset = isInTarget && !previousIsTarget\n\t\tif (!shouldResetOffset) return\n\t\tconst element = ref.current\n\t\tif (!element) return\n\t\tif (direction !== \"vertical\") {\n\t\t\tcancelEmulatedTouchScrollAnimation?.()\n\t\t\telement.scrollLeft = Math.abs(isMotionValue(contentOffsetX) ? contentOffsetX.get() : contentOffsetX)\n\t\t}\n\t\tif (direction !== \"horizontal\") {\n\t\t\tcancelEmulatedTouchScrollAnimation?.()\n\t\t\telement.scrollTop = Math.abs(isMotionValue(contentOffsetY) ? contentOffsetY.get() : contentOffsetY)\n\t\t}\n\t}\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: We only want to update the scroll offset when isInTarget changes\n\tuseIsomorphicLayoutEffect(updateScrollOffsetHandler, [isInTarget])\n\n\tuseUpdateScrollOffset(ref, \"scrollLeft\", contentOffsetX, cancelEmulatedTouchScrollAnimation)\n\tuseUpdateScrollOffset(ref, \"scrollTop\", contentOffsetY, cancelEmulatedTouchScrollAnimation)\n\n\tconst size = !containerProps.__fromCanvasComponent\n\t\t? {\n\t\t\t\twidth: containerProps.__fromCodeComponentNode ? \"100%\" : containerProps.width,\n\t\t\t\theight: containerProps.__fromCodeComponentNode ? \"100%\" : containerProps.height,\n\t\t\t}\n\t\t: {}\n\n\treturn (\n\t\t<FrameWithMotion\n\t\t\tref={ref}\n\t\t\tdata-framer-component-type=\"NativeScroll\"\n\t\t\tbackground=\"none\" // need to set here to prevent default background from Frame\n\t\t\t{...containerProps}\n\t\t\t{...size}\n\t\t\tonScroll={onScroll}\n\t\t\tlayoutId={layoutId}\n\t\t\tonBeforeLayoutMeasure={updateScrollOffsetHandler}\n\t\t\tlayoutScroll\n\t\t\tclassName={cx(className, `direction-${direction}`, !scrollBarVisible && \"scrollbar-hidden\")}\n\t\t>\n\t\t\t<EmptyState\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: probably old component\n\t\t\t\t// biome-ignore lint/correctness/noChildrenProp: probably old component\n\t\t\t\tchildren={children}\n\t\t\t\tsize={{\n\t\t\t\t\twidth: isFiniteNumber(containerProps.width) ? containerProps.width : \"100%\",\n\t\t\t\t\theight: isFiniteNumber(containerProps.height) ? containerProps.height : \"100%\",\n\t\t\t\t}}\n\t\t\t\tinsideUserCodeComponent={!containerProps.__fromCodeComponentNode}\n\t\t\t\ttitle=\"Scroll\"\n\t\t\t\tdescription=\"Click and drag the connector to any frame on the canvas \u2192\"\n\t\t\t/>\n\t\t\t{children}\n\t\t</FrameWithMotion>\n\t)\n})\n\nexport const NativeScroll = /* @__PURE__ */ withLibraryCSS(NativeScrollInner)\n", "type ClassName = string | false | void | null | 0\n/**\n * Combine values and create a className string. Falsy values are not included.\n *\n * This helper is commonly exported by css-in-js libraries like Linaria, or\n * Emotion as cx. This is the implementation from Linaria:\n * https://github.com/callstack/linaria/blob/master/packages/core/src/cx.ts.\n *\n * We need it here so we can use it in es-modules.\n *\n * @public\n */\nexport function cx(...classNames: ClassName[]): string {\n\treturn classNames.filter(Boolean).join(\" \")\n}\n", "// We disable the rule of hooks because we early return when not in the preview\n// or on a touch device. This early return will be constistent per environment.\n/* eslint-disable react-hooks/rules-of-hooks */\n\nimport { isCommandKeyPressed, isSafari, isTouch } from \"@framerjs/shared/src/environment.ts\"\nimport React, { useEffect } from \"react\"\nimport { Point } from \"../../render/types/Point.ts\"\nimport { RenderTarget } from \"../../render/types/RenderEnvironment.ts\"\nimport { safeWindow } from \"../../utils/safeWindow.ts\"\nimport { animatePointWithInertia } from \"./animatePointWithInertia.ts\"\n\nconst scrollThreshold = 3\n\nconst isTouchDevice = /* @__PURE__ */ isTouch()\nconst isSafariBrowser = /* @__PURE__ */ isSafari()\n\ntype Direction = \"horizontal\" | \"vertical\" | \"both\"\n\nfunction getTouchAction(element: Element): string | null {\n\tif (!(element instanceof HTMLElement)) return null\n\treturn element.style.touchAction\n}\n\nfunction canPanInDirection(element: Element, direction: Direction) {\n\tswitch (direction) {\n\t\tcase \"horizontal\":\n\t\t\treturn getTouchAction(element) === \"pan-x\"\n\t\tcase \"vertical\":\n\t\t\treturn getTouchAction(element) === \"pan-y\"\n\t\tdefault:\n\t\t\treturn false\n\t}\n}\n\nfunction isInteractiveElement(element: Element): boolean {\n\tconst tag = element.tagName.toLowerCase()\n\tif (tag === \"input\") return true\n\tif (tag === \"text\") return true\n\tif (tag === \"textarea\") return true\n\treturn false\n}\n\nfunction canStartScrollFromElement(element: EventTarget | null, direction: Direction): boolean {\n\tif (!(element instanceof Element)) return false\n\tif (isInteractiveElement(element)) return false\n\n\tif (element.hasAttribute(\"draggable\")) {\n\t\tif (!canPanInDirection(element, direction)) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}\n\nfunction getEventPoint(event: MouseEvent) {\n\treturn {\n\t\tx: event.pageX,\n\t\ty: event.pageY,\n\t}\n}\n\nfunction setPointerEvents(element: HTMLElement | SVGElement, value: string) {\n\tif (element?.style) {\n\t\telement.style[\"pointerEvents\"] = value\n\t}\n}\n\nfunction getPointerEvents(element: HTMLElement | SVGElement) {\n\treturn element?.style?.[\"pointerEvents\"]\n}\n\nenum TouchScrollPhase {\n\tIdle,\n\tTouchDown,\n\tDrag,\n\tDragLocked, // Can't be dragged because of direction lock\n\tDragAnimation,\n\tInterrupted, // Touch down while a drag animation was running\n}\n\ntype PointerEventValue = string\n\nconst emptyObject = /* @__PURE__ */ Object.freeze({})\n\nexport function useEmulateTouchScroll(\n\tref: React.RefObject<HTMLDivElement>,\n\tdirection: Direction,\n\tenabled: boolean,\n): { cancelEmulatedTouchScrollAnimation?: () => void } {\n\tif (isTouchDevice) return emptyObject\n\tif (RenderTarget.current() !== RenderTarget.preview) return emptyObject\n\n\t// biome-ignore lint/correctness/useHookAtTopLevel: the return condition will never change\n\tconst scrollAnimationControlsRef = React.useRef<{ stop: () => void } | null>(null)\n\n\t// biome-ignore lint/correctness/useHookAtTopLevel: the return condition will never change\n\tuseEffect(() => {\n\t\tif (!ref.current) return\n\t\tconst element = ref.current\n\n\t\tlet phase = TouchScrollPhase.Idle\n\n\t\tlet targets: [HTMLElement | SVGElement, PointerEventValue][] | null = null\n\t\tlet downPoint: null | Point = null\n\t\tlet scrollOffsetStart: Point | null = null\n\n\t\tlet mouseMoveEvents: MouseEvent[] = []\n\n\t\tfunction onMouseMove(event: MouseEvent) {\n\t\t\tswitch (phase) {\n\t\t\t\tcase TouchScrollPhase.Idle:\n\t\t\t\tcase TouchScrollPhase.DragAnimation:\n\t\t\t\tcase TouchScrollPhase.DragLocked:\n\t\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If command is pressed we fallback to normal behavior\n\t\t\tif (isCommandKeyPressed(event)) return\n\n\t\t\tconst point = getEventPoint(event)\n\t\t\tif (!downPoint) return\n\n\t\t\t// Calculate the offset so we can use it in the callback\n\t\t\tconst offset = Point.subtract(point, downPoint)\n\n\t\t\t// If we didn't scroll before and reached the threshold\n\t\t\tif (phase === TouchScrollPhase.TouchDown || phase === TouchScrollPhase.Interrupted) {\n\t\t\t\tconst deltaX = Math.abs(offset.x)\n\t\t\t\tconst deltaY = Math.abs(offset.y)\n\t\t\t\tif ((deltaX > scrollThreshold || deltaY > scrollThreshold) && deltaX !== deltaY) {\n\t\t\t\t\tconst scrollDirection = deltaX > deltaY ? \"horizontal\" : \"vertical\"\n\t\t\t\t\tconst shouldIgnoreBecauseOfDirectionLock =\n\t\t\t\t\t\t(direction === \"horizontal\" && scrollDirection === \"vertical\") ||\n\t\t\t\t\t\t(direction === \"vertical\" && scrollDirection === \"horizontal\")\n\t\t\t\t\tif (shouldIgnoreBecauseOfDirectionLock) {\n\t\t\t\t\t\tphase = TouchScrollPhase.DragLocked\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tphase = TouchScrollPhase.Drag\n\n\t\t\t\t\t// We disable events on the clicked target so we avoid clicks if you mean to scroll\n\t\t\t\t\ttargets?.forEach(([target]) => setPointerEvents(target, \"none\"))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// We need this in Safari to avoid scroll from text selection near borders\n\t\t\t// Unfortunately we'll have to do this for all events and this could break\n\t\t\t// in subtle ways.\n\t\t\tif (isSafariBrowser) event.preventDefault()\n\n\t\t\t// Don't do anything if we didn't reach the threshold\n\t\t\tif (phase !== TouchScrollPhase.Drag) return\n\n\t\t\t// Don't start selecting text too\n\t\t\tsafeWindow.getSelection()?.empty()\n\n\t\t\tmouseMoveEvents = getRecentEvents([...mouseMoveEvents, event])\n\n\t\t\t// Update offset\n\t\t\tif (scrollOffsetStart) {\n\t\t\t\tif (direction !== \"vertical\") element.scrollLeft = scrollOffsetStart.x - offset.x\n\t\t\t\tif (direction !== \"horizontal\") element.scrollTop = scrollOffsetStart.y - offset.y\n\t\t\t}\n\t\t}\n\n\t\tfunction onMouseUp(event: MouseEvent) {\n\t\t\tsafeWindow.removeEventListener(\"mousemove\", onMouseMove, false)\n\t\t\tsafeWindow.removeEventListener(\"mouseup\", onMouseUp)\n\t\t\t// Make sure to restore events back on the element if we removed them\n\t\t\tif (phase === TouchScrollPhase.Drag && targets) {\n\t\t\t\ttargets.forEach(([target, originalPointerEventsValue]) =>\n\t\t\t\t\tsetPointerEvents(target, originalPointerEventsValue || \"auto\"),\n\t\t\t\t)\n\t\t\t}\n\t\t\ttargets = null\n\n\t\t\tconst velocity = calculateVelocity({ mouseMoveEvents, mouseUpEvent: event })\n\n\t\t\tdownPoint = null\n\n\t\t\tif (phase === TouchScrollPhase.Drag) {\n\t\t\t\t// Scroll\n\t\t\t\t// Unlike page snapping we only have to animate the scroll if we started a drag\n\t\t\t\tconst shouldAnimateY = direction !== \"horizontal\" && velocity.y !== 0\n\t\t\t\tconst shouldAnimateX = direction !== \"vertical\" && velocity.x !== 0\n\t\t\t\tif (!shouldAnimateY && !shouldAnimateX) {\n\t\t\t\t\tphase = TouchScrollPhase.Idle\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tphase = TouchScrollPhase.DragAnimation\n\n\t\t\t\tscrollAnimationControlsRef.current = animatePointWithInertia({\n\t\t\t\t\tfrom: { x: element.scrollLeft, y: element.scrollTop },\n\t\t\t\t\tvelocity: {\n\t\t\t\t\t\tx: shouldAnimateX ? velocity.x : 0,\n\t\t\t\t\t\ty: shouldAnimateY ? velocity.y : 0,\n\t\t\t\t\t},\n\t\t\t\t\tonUpdate: position => {\n\t\t\t\t\t\tif (shouldAnimateX) element.scrollLeft = position.x\n\t\t\t\t\t\tif (shouldAnimateY) element.scrollTop = position.y\n\t\t\t\t\t},\n\t\t\t\t\tonStop: () => {\n\t\t\t\t\t\tif (phase !== TouchScrollPhase.Interrupted) {\n\t\t\t\t\t\t\tphase = TouchScrollPhase.Idle\n\t\t\t\t\t\t}\n\t\t\t\t\t\tscrollAnimationControlsRef.current = null\n\t\t\t\t\t},\n\t\t\t\t\tonComplete: () => {\n\t\t\t\t\t\tif (phase !== TouchScrollPhase.DragAnimation) {\n\t\t\t\t\t\t\tthrow Error(\"On animation completion we should still be in the animation phase\")\n\t\t\t\t\t\t}\n\t\t\t\t\t\tphase = TouchScrollPhase.Idle\n\t\t\t\t\t\tscrollAnimationControlsRef.current = null\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tphase = TouchScrollPhase.Idle\n\t\t\t}\n\t\t}\n\n\t\tfunction onMouseWheel() {\n\t\t\t// Stop any running animations when using mouse wheel or trackpad\n\t\t\tscrollAnimationControlsRef.current?.stop()\n\t\t}\n\n\t\tfunction onMouseDown(event: PointerEvent) {\n\t\t\tif (!enabled) return\n\n\t\t\t// If command or control was entered we fallback to normal behavior\n\t\t\tif (isCommandKeyPressed(event)) return\n\n\t\t\tif (!canStartScrollFromElement(event.target, direction)) {\n\t\t\t\t// Stop any running scroll animation\n\t\t\t\tif (phase === TouchScrollPhase.DragAnimation) {\n\t\t\t\t\tphase = TouchScrollPhase.Idle\n\t\t\t\t\tscrollAnimationControlsRef.current?.stop()\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst previousPhase = phase\n\t\t\tphase =\n\t\t\t\tpreviousPhase === TouchScrollPhase.DragAnimation ? TouchScrollPhase.Interrupted : TouchScrollPhase.TouchDown\n\n\t\t\tdownPoint = getEventPoint(event)\n\t\t\ttargets = document\n\t\t\t\t.elementsFromPoint(downPoint.x, downPoint.y)\n\t\t\t\t.filter(\n\t\t\t\t\t(targetEl): targetEl is HTMLElement | SVGElement =>\n\t\t\t\t\t\ttargetEl instanceof HTMLElement || targetEl instanceof SVGElement,\n\t\t\t\t)\n\t\t\t\t.map(targetEl => [targetEl, getPointerEvents(targetEl)])\n\t\t\tscrollOffsetStart = { x: element.scrollLeft, y: element.scrollTop }\n\t\t\tmouseMoveEvents = []\n\n\t\t\tif (scrollAnimationControlsRef.current) {\n\t\t\t\tif (previousPhase !== TouchScrollPhase.DragAnimation) {\n\t\t\t\t\tthrow Error(\"When stopping a drag animation we need to be animating\")\n\t\t\t\t}\n\t\t\t\tscrollAnimationControlsRef.current.stop()\n\t\t\t}\n\n\t\t\tsafeWindow.addEventListener(\"mousemove\", onMouseMove)\n\t\t\tsafeWindow.addEventListener(\"mouseup\", onMouseUp)\n\t\t\telement.addEventListener(\"mousewheel\", onMouseWheel)\n\t\t}\n\n\t\t// Set up a the base handler on the scrollable element\n\t\telement.addEventListener(\"mousedown\", onMouseDown)\n\n\t\treturn () => {\n\t\t\t// Clean up all event handlers on unmount\n\t\t\telement.removeEventListener(\"mousedown\", onMouseDown)\n\t\t\telement.removeEventListener(\"mousewheel\", onMouseWheel)\n\t\t\tsafeWindow.removeEventListener(\"mousemove\", onMouseMove)\n\t\t\tsafeWindow.removeEventListener(\"mouseup\", onMouseUp)\n\n\t\t\t// Stop any running scroll animations\n\t\t\tphase = TouchScrollPhase.Interrupted\n\t\t\tscrollAnimationControlsRef.current?.stop()\n\t\t}\n\t}, [ref, direction, enabled])\n\n\t// biome-ignore lint/correctness/useHookAtTopLevel: the return condition will never change\n\treturn React.useMemo(() => {\n\t\treturn {\n\t\t\tcancelEmulatedTouchScrollAnimation: () => {\n\t\t\t\tscrollAnimationControlsRef.current?.stop()\n\t\t\t},\n\t\t}\n\t}, [])\n}\n\n// Keep events that are younger than 4 / 60 s\nconst timeDelta = /* @__PURE__ */ (() => (4 / 60) * 1000)()\n\nfunction getRecentEvents(events: MouseEvent[]) {\n\t// There is no API to get the time origin of event timestamps, as a workaround\n\t// we create a custom event and read the timestamp\n\tconst currentTime = new CustomEvent(\"getTime\").timeStamp\n\tconst maxAge = currentTime - timeDelta\n\treturn events.filter(event => event.timeStamp > maxAge)\n}\n\nconst zeroPoint: Point = { x: 0, y: 0 }\n\nexport function calculateVelocity({\n\tmouseMoveEvents,\n\tmouseUpEvent,\n}: {\n\tmouseMoveEvents: MouseEvent[]\n\tmouseUpEvent: MouseEvent\n}): Point {\n\tconst recentMouseMoveEvents = getRecentEvents(mouseMoveEvents)\n\tconst oldestMouseMoveEvent = recentMouseMoveEvents[0]\n\tif (!oldestMouseMoveEvent) return zeroPoint\n\n\tconst deltaX = mouseUpEvent.clientX - oldestMouseMoveEvent.clientX\n\tconst deltaY = mouseUpEvent.clientY - oldestMouseMoveEvent.clientY\n\tconst time = mouseUpEvent.timeStamp - oldestMouseMoveEvent.timeStamp\n\n\tif (time === 0) return zeroPoint\n\n\treturn {\n\t\tx: (deltaX / time) * 1000,\n\t\ty: (deltaY / time) * 1000,\n\t}\n}\n", "import { animateValue, frame } from \"framer-motion\"\nimport type { Point } from \"../../render/types/Point.ts\"\n\nenum AnimationPhase {\n\tNone,\n\tRunning,\n\tCompleted,\n\tCancelled,\n}\n\nfunction isRunningAnimation(...phases: AnimationPhase[]): boolean {\n\tlet runningAny = false\n\tlet cancelledAny = false\n\tphases.forEach(phase => {\n\t\trunningAny = runningAny || phase === AnimationPhase.Running\n\t\tcancelledAny = cancelledAny || phase === AnimationPhase.Cancelled\n\t})\n\n\treturn runningAny && !cancelledAny\n}\n\nfunction didFinishAnimations(...phases: AnimationPhase[]): boolean {\n\treturn phases.every(phase => phase === AnimationPhase.None || phase === AnimationPhase.Completed)\n}\n\nconst timeConstant = 400\n\nexport function animatePointWithInertia({\n\tfrom,\n\tvelocity,\n\tonUpdate,\n\tonComplete,\n\tonStop,\n}: {\n\tfrom: Point\n\tvelocity: Point\n\tonUpdate: (value: Point) => void\n\tonComplete: () => void\n\tonStop: () => void\n}): { stop: () => void } {\n\tconst latest = from\n\tlet animationPhaseX = AnimationPhase.None\n\tlet animationPhaseY = AnimationPhase.None\n\tconst animations: { stop: () => void }[] = []\n\n\tconst updateHandler = () => {\n\t\tif (isRunningAnimation(animationPhaseX, animationPhaseY)) {\n\t\t\tonUpdate(latest)\n\t\t}\n\t}\n\n\tconst completionHandler = () => {\n\t\tif (didFinishAnimations(animationPhaseX, animationPhaseY)) {\n\t\t\tonComplete()\n\t\t}\n\t}\n\n\tif (velocity.x) {\n\t\tanimationPhaseX = AnimationPhase.Running\n\t\tanimations.push(\n\t\t\tanimateValue({\n\t\t\t\tkeyframes: [from.x],\n\t\t\t\tvelocity: -velocity.x,\n\t\t\t\ttimeConstant,\n\t\t\t\tonUpdate: value => {\n\t\t\t\t\tlatest.x = value\n\t\t\t\t\tframe.update(updateHandler, false, true)\n\t\t\t\t},\n\t\t\t\tonComplete: () => {\n\t\t\t\t\tif (animationPhaseX !== AnimationPhase.Running) {\n\t\t\t\t\t\tthrow Error(\"animation x should be running when completing\")\n\t\t\t\t\t}\n\t\t\t\t\tanimationPhaseX = AnimationPhase.Completed\n\t\t\t\t\tcompletionHandler()\n\t\t\t\t},\n\t\t\t}),\n\t\t)\n\t}\n\n\tif (velocity.y) {\n\t\tanimationPhaseY = AnimationPhase.Running\n\t\tanimations.push(\n\t\t\tanimateValue({\n\t\t\t\tkeyframes: [from.y],\n\t\t\t\tvelocity: -velocity.y,\n\t\t\t\ttimeConstant,\n\t\t\t\tonUpdate: value => {\n\t\t\t\t\tlatest.y = value\n\t\t\t\t\tframe.update(updateHandler, false, true)\n\t\t\t\t},\n\t\t\t\tonComplete: () => {\n\t\t\t\t\tif (animationPhaseY !== AnimationPhase.Running) {\n\t\t\t\t\t\tthrow Error(\"animation y should be running when completing\")\n\t\t\t\t\t}\n\t\t\t\t\tanimationPhaseY = AnimationPhase.Completed\n\t\t\t\t\tcompletionHandler()\n\t\t\t\t},\n\t\t\t}),\n\t\t)\n\t}\n\n\tif (!isRunningAnimation(animationPhaseX, animationPhaseY)) {\n\t\tcompletionHandler()\n\t}\n\n\treturn {\n\t\tstop: () => {\n\t\t\tif (!isRunningAnimation(animationPhaseX, animationPhaseY)) return\n\t\t\tanimations.forEach(animation => animation.stop())\n\t\t\tanimationPhaseX = animationPhaseX === AnimationPhase.Running ? AnimationPhase.Cancelled : animationPhaseX\n\t\t\tanimationPhaseY = animationPhaseY === AnimationPhase.Running ? AnimationPhase.Cancelled : animationPhaseY\n\t\t\tonStop()\n\t\t},\n\t}\n}\n", "import type { MotionValue } from \"framer-motion\"\nimport type { RefObject } from \"react\"\nimport { isFiniteNumber } from \"../../render/utils/isFiniteNumber.ts\"\nimport { isMotionValue } from \"../../render/utils/isMotionValue.ts\"\nimport { useIsomorphicLayoutEffect } from \"../../useIsomorphicLayoutEffect.ts\"\n\nexport function useUpdateScrollOffset(\n\tref: RefObject<HTMLDivElement>,\n\tside: \"scrollTop\" | \"scrollLeft\",\n\toffset: number | MotionValue<number>,\n\tcancelEmulatedTouchScrollAnimation?: () => void,\n) {\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: We only want to update on contentOffset changes\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (isMotionValue(offset)) {\n\t\t\tconst updateScrollLeft = () => {\n\t\t\t\tcancelEmulatedTouchScrollAnimation?.()\n\t\t\t\tconst element = ref.current\n\t\t\t\tif (element) element[side] = Math.abs(offset.get())\n\t\t\t}\n\t\t\tupdateScrollLeft()\n\t\t\treturn offset.on(\"change\", updateScrollLeft)\n\t\t} else if (isFiniteNumber(offset)) {\n\t\t\tconst element = ref.current\n\t\t\tif (!element) return\n\t\t\tcancelEmulatedTouchScrollAnimation?.()\n\t\t\telement[side] = Math.abs(offset)\n\t\t}\n\t}, [offset])\n}\n", "import { useContext } from \"react\"\nimport type { NavigationInterface } from \"./Navigation.tsx\"\nimport { NavigationContext } from \"./NavigationContext.ts\"\n\n/**\n * @returns NavigationInterface {@link NavigationInterface}\n * @public\n */\nexport function useNavigation(): NavigationInterface {\n\treturn useContext(NavigationContext)\n}\n", "import type { Cancel } from \"../animation/Animatable/Animatable.ts\"\nimport type { Observer } from \"../animation/Animatable/Observers.ts\"\nimport { ObservableObject } from \"./ObservableObject.ts\"\n\n/**\n * @internal\n */\nconst data = /* @__PURE__ */ (() => {\n\t/**\n\t * Allows data to be shared between Frames using Code Overrides.\n\t * Any changes to the `Data` instance will cause the preview to update and code\n\t * overrides will re-render. In this example, we\u2019re updating the `scale` property on `press`, setting it to `0.5`.\n\t * ```jsx\n\t * import { Data, Override } from \"framer\"\n\t *\n\t * const data = Data({\n\t *    scale: 0.5,\n\t * })\n\t *\n\t * export function WhileTap(): Override {\n\t *    return {\n\t *        whileTap: {\n\t *            scale: data.scale,\n\t *        },\n\t *    }\n\t * }\n\t *\n\t * ```\n\t * @param initial - The initial value of the data to be set.\n\t * @returns the data object for use across components.\n\t * @public\n\t */\n\tfunction Data<T extends object = object>(initial: Partial<T> | object = {}): T {\n\t\t// Because of the second boolean is set to false we already know that everything will have the same type as the input\n\t\tconst _data: T = ObservableObject(initial, false, false) as any\n\t\tData.addData(_data)\n\t\treturn _data\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tData._stores = [] as object[]\n\t/** @internal */\n\tData.addData = (_data: object) => {\n\t\tData._stores.push(_data)\n\t}\n\t/** @internal */\n\tData.reset = () => {\n\t\tData._stores.forEach(target => ObservableObject.resetObject(target))\n\t}\n\t/** @internal */\n\tData.addObserver = <T extends object>(target: T, observer: Observer<T>): Cancel => {\n\t\treturn ObservableObject.addObserver(target, observer)\n\t}\n\n\treturn Data\n})()\n\nexport const Data = data\n", "import type { AnimatableObject, Cancel } from \"../animation/Animatable/Animatable.ts\"\nimport type { Observer } from \"../animation/Animatable/Observers.ts\"\nimport { deprecationWarning } from \"../utils/deprecation.ts\"\nimport { ObservableObject } from \"./ObservableObject.ts\"\n\n/**\n * @internal\n * @deprecated Use Data instead\n */\nexport const PropertyStore = /* @__PURE__ */ (() => {\n\t/**\n\t * @internal\n\t * @deprecated Use Data instead\n\t */\n\tfunction PropertyStore<T extends object = object>(\n\t\tinitial: Partial<T> | object = {},\n\t\tmakeAnimatables = false,\n\t): AnimatableObject<T> {\n\t\tdeprecationWarning(\"PropertyStore\", \"1.0.0\", \"Data() or ObservableObject()\")\n\t\treturn ObservableObject(initial, makeAnimatables)\n\t}\n\n\tPropertyStore.addObserver = <T extends object>(target: T, observer: Observer<T>): Cancel => {\n\t\treturn ObservableObject.addObserver(target, observer)\n\t}\n\n\treturn PropertyStore\n})()\n", "import { createContext, useContext, useEffect, useMemo, useState } from \"react\"\nimport { createStore } from \"./store.ts\"\nimport type { ActionMap, BoundActionMap, DataHook, SetState, Store } from \"./types.ts\"\n\nconst defaultId = /* @__PURE__ */ Symbol(\"default\")\n\n/**\n * @internal\n * @deprecated ancient (2019?) and does not seem to be used.\n */\nexport const DataContext = /* @__PURE__ */ createContext(defaultId)\n\n/**\n * Creates a hook that shares data between components.\n *\n * By default, all calls to the returned hook will call into the same data store. By\n * passing a `storeId` to the returned hook, separate instances of the store can be created.\n *\n * ```jsx\n * import { createData } from 'framer'\n *\n * const useCount = createData(0)\n *\n * // In a component\n * function MyComponent({ storeId = 'default' }) {\n *   const [count, setCount] = useCount(storeId)\n *\n *   function increment() {\n *     setCount(count + 1)\n *   }\n *\n *   return <Frame onClick={increment}>{count}</Frame>\n * }\n *\n * // In an override\n * function MyOverride({ storeId = 'default' }): Override {\n *   const [count, setCount] = useCount(storeId)\n *\n *   return {\n *     children: count,\n *     onClick: () => setCount(count + 1)\n *   }\n * }\n * ```\n *\n * @param defaultState - The default state ot use\n *\n * @internal\n * @deprecated ancient (2019?) and does not seem to be used.\n */\nexport function createData<State>(defaultState: State): DataHook<State, SetState<State>>\n/**\n * By passing an object of named functions as the second argument to `createData`, actions\n * can be created to specify specific ways in which components can update the data.\n *\n * ```jsx\n * const useCount = createData(0, {\n *   add: (state, data: number) => state + data\n * })\n *\n * function MyOverride(): Override {\n *   const [count, actions] = useCount()\n *\n *   return {\n *     children: count,\n *     onClick: () => actions.add(5)\n *   }\n * }\n * ```\n *\n * @param defaultState - The default state to use\n * @param actions - A set of actions that can be performed on the data\n *\n * @internal\n * @deprecated ancient (2019?) and does not seem to be used.\n */\n\nexport function createData<State, Actions extends ActionMap<State>>(\n\tdefaultState: State,\n\tactions: Actions,\n): DataHook<State, BoundActionMap<State, Actions>>\nexport function createData<State, Actions extends ActionMap<State>>(defaultState: State, actions?: Actions) {\n\tconst stores = new Map<symbol | string, Store<State, Actions>>()\n\n\tconst useData = (id: string | symbol, initialState?: State) => {\n\t\tconst contextId = useContext(DataContext)\n\t\tid = id || contextId\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated code\n\t\tconst store = useMemo(() => {\n\t\t\t// If no store with this ID exists, create it.\n\t\t\tif (!stores.has(id)) {\n\t\t\t\tstores.set(id, createStore(initialState || defaultState, actions))\n\t\t\t}\n\n\t\t\treturn stores.get(id) as Store<State, Actions>\n\t\t}, [id])\n\n\t\t// Just use a version number to set state rather than replicating the actual data\n\t\t// for every subscribed component.\n\t\tconst [, notifyUpdates] = useState(store.getVersion())\n\n\t\tconst storeValueAtHookCallTime = useMemo(() => store.get(), [store])\n\n\t\t// Subscribe to changes from this store.\n\t\tuseEffect(() => {\n\t\t\tconst unsubscribe = store.subscribe(notifyUpdates)\n\n\t\t\t// if the store value was updated between calling `useData` and\u2260\n\t\t\t// execution of this `useEffect` callback, e.g. in one of the other subscribers\n\t\t\t// `useEffect(() => { setStoreValue(99) }, [])`\n\t\t\t// make sure we notify the newly created subscriber about that change\n\t\t\tif (storeValueAtHookCallTime !== store.get()) {\n\t\t\t\t// This may need startTransition to avoid synchronous, blocking re-renders.\n\t\t\t\t// However, this component is ancient (2019?) and does not seem to be used. Let's not modify the behavior.\n\t\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition -- deprecated hook\n\t\t\t\tnotifyUpdates(store.getVersion())\n\t\t\t}\n\n\t\t\treturn unsubscribe\n\t\t}, [store, storeValueAtHookCallTime])\n\n\t\treturn [store.get(), store.getActions()]\n\t}\n\n\treturn useData\n}\n", "import type { ActionMap, BoundActionMap, Store, Subscriber } from \"./types.ts\"\n\n/**\n * Take the user-defined `actions` map and return a version of the same functions\n * that update the store.\n *\n * @param get - Store data getter\n * @param set - Store data setter\n * @param actions - The actions to bind to the store\n */\nfunction bindActionsToStore<State, Actions extends ActionMap<State>>(\n\tget: Store<State, Actions>[\"get\"],\n\tset: Store<State, Actions>[\"set\"],\n\tactions: Actions,\n): BoundActionMap<State, Actions> {\n\tconst boundActions: Partial<BoundActionMap<State, Actions>> = {}\n\n\tfor (const key in actions) {\n\t\tconst action = actions[key]\n\t\tif (!action) continue\n\t\tboundActions[key] = (data: any) => set(action(get(), data))\n\t}\n\n\treturn boundActions as BoundActionMap<State, Actions>\n}\n\n/**\n * A data store instance. `useData` can create and access multiple different data stores depending\n * on the `storeId` passed to it (if any).\n *\n * @param initialState - The initial state of the store.\n * @param unboundActions - Optional map of actions to make available for manipulating the data store.\n */\nexport function createStore<State, Actions extends ActionMap<State>>(\n\tinitialState: State,\n\tunboundActions?: Actions,\n): Store<State, Actions> {\n\tlet state = initialState\n\tlet version = 0\n\tconst subscribers = new Set()\n\tconst notifySubscriber = (sub: Subscriber) => sub(version)\n\n\tconst get = () => state\n\tconst set = (latestState: State) => {\n\t\tversion++\n\t\tstate = latestState\n\t\tsubscribers.forEach(notifySubscriber)\n\t}\n\n\tconst actions = unboundActions ? bindActionsToStore(get, set, unboundActions) : set\n\n\treturn {\n\t\tget,\n\t\tset,\n\t\tgetVersion: () => version,\n\t\tgetActions: () => actions,\n\t\tsubscribe: sub => {\n\t\t\tsubscribers.add(sub)\n\t\t\treturn () => subscribers.delete(sub)\n\t\t},\n\t}\n}\n", "import React, { Component } from \"react\"\nimport type { Cancel } from \"../animation/Animatable/Animatable.ts\"\nimport { MainLoop } from \"../core/Loop.ts\"\nimport { Data } from \"../data/Data.ts\"\n\n/**\n * @deprecated\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport type Props = {}\n/**\n * @deprecated\n * @internal\n */\nexport interface State {\n\tupdate: number\n}\nconst initialState = { update: 0 }\n\n/**\n * @deprecated\n * @internal\n */\nexport const DataObserverContext = /* @__PURE__ */ React.createContext({ update: NaN })\n\n/**\n * Makes the component re-render when `Data` changes\n * @returns `true` if observing succeeds (context is provided), `false` when it fails\n * @public\n */\nexport function useObserveData() {\n\tconst context = React.useContext(DataObserverContext)\n\treturn !Number.isNaN(context.update)\n}\n\n/**\n * @deprecated\n * @internal\n */\nexport class DataObserver extends Component<Props & { children?: React.ReactNode }, State> {\n\tobservers: Cancel[] = []\n\toverride state = initialState\n\n\ttaskAdded = false\n\tframeTask = () => {\n\t\t// eslint-disable-next-line @eslint-react/no-access-state-in-setstate -- deprecated component\n\t\tthis.setState({ update: this.state.update + 1 })\n\t\tthis.taskAdded = false // Set after updating state, else the component might become unresponsive\n\t}\n\n\tobserver = () => {\n\t\tif (this.taskAdded) return\n\t\tthis.taskAdded = true\n\t\tMainLoop.addFrameTask(this.frameTask)\n\t}\n\n\toverride componentWillUnmount() {\n\t\tthis.observers.map(cancel => cancel())\n\t\tData.reset()\n\t}\n\n\toverride render() {\n\t\tconst { children } = this.props\n\t\tthis.observers.map(cancel => cancel())\n\t\tthis.observers = []\n\t\tData._stores.forEach((d: object) => {\n\t\t\tconst observer = Data.addObserver(d, this.observer)\n\t\t\tthis.observers.push(observer)\n\t\t})\n\t\treturn <DataObserverContext.Provider value={{ ...this.state }}>{children}</DataObserverContext.Provider>\n\t}\n}\n", "import hoistNonReactStatic from \"hoist-non-react-statics\"\nimport type React from \"react\"\nimport { useContext } from \"react\"\nimport type { FrameProps } from \"../render/presentation/Frame/FrameWithMotion.tsx\"\nimport { DataObserverContext } from \"./DataObserver.tsx\"\nimport { convertColorProps } from \"./convertColorProps.ts\"\n\n/** @public */\nexport type OverrideObject<T extends object = any> = Partial<T>\n/** @public */\nexport type OverrideFunction<P extends object = any> = (props: P) => Partial<P>\n/** @public */\nexport type Override<T extends object = FrameProps & { [key: string]: any }> = OverrideObject<T> | OverrideFunction<T>\n\n/**\n * @deprecated No longer used by Framer because built into preview. From version ## TODO: add correct version\n * @internal\n */\nexport function WithOverride<T extends object>(\n\tComponent: React.ComponentType<T>,\n\toverride: Override<T>,\n): React.ComponentType<T> {\n\tconst useOverride =\n\t\ttypeof override === \"function\"\n\t\t\t? (props: T) => override(convertColorProps(props))\n\t\t\t: () => convertColorProps(override)\n\n\tconst ComponentWithOverride = function (props: T) {\n\t\tuseContext(DataObserverContext)\n\t\tconst overrideProps = useOverride(props)\n\t\tconst { style, ...rest } = props as any\n\t\treturn <Component {...rest} {...overrideProps} _initialStyle={style} />\n\t}\n\thoistNonReactStatic(ComponentWithOverride, Component)\n\tComponentWithOverride[\"displayName\"] = `WithOverride(${Component.displayName || Component.name})`\n\treturn ComponentWithOverride\n}\n", "import type { MotionValue } from \"framer-motion\"\nimport type { BackgroundProperties } from \"../render/traits/Background.ts\"\nimport type { TextColorProperties } from \"../render/traits/TextColor.ts\"\nimport type { BackgroundImage } from \"../render/types/BackgroundImage.ts\"\nimport { Color } from \"../render/types/Color/Color.ts\"\nimport { LinearGradient, RadialGradient } from \"../render/types/Gradient.ts\"\nimport { isMotionValue } from \"../render/utils/isMotionValue.ts\"\n\nfunction convertColorObject(\n\tprop?: string | Color | LinearGradient | RadialGradient | BackgroundImage | MotionValue<string> | null,\n) {\n\tif (typeof prop === \"string\" || isMotionValue(prop)) {\n\t\treturn prop\n\t} else if (LinearGradient.isLinearGradient(prop)) {\n\t\treturn LinearGradient.toCSS(prop)\n\t} else if (RadialGradient.isRadialGradient(prop)) {\n\t\treturn RadialGradient.toCSS(prop)\n\t} else if (Color.isColorObject(prop)) {\n\t\treturn Color.toRgbString(prop)\n\t}\n\treturn prop\n}\n\nexport function convertColorProps<T extends Partial<TextColorProperties & BackgroundProperties>>(props: T): T {\n\tif (props.background || props.color) {\n\t\tconst converted = Object.assign({}, props)\n\n\t\tif (props.background) {\n\t\t\tconverted.background = convertColorObject(props.background)\n\t\t}\n\t\tif (props.color) {\n\t\t\tconverted.color = convertColorObject(props.color) as string | Color\n\t\t}\n\n\t\treturn converted\n\t}\n\n\treturn props\n}\n", "import type { MotionProps, MotionStyle } from \"framer-motion\"\nimport { MotionValue, isMotionValue, optimizedAppearDataAttribute, useTransform } from \"framer-motion\"\nimport type { RefObject } from \"react\"\nimport React from \"react\"\nimport { useRerenderOnResize } from \"../components/hoc/withMeasuredSize.tsx\"\nimport { useObserverRef } from \"../components/utils/refHelper.ts\"\nimport { asRecord } from \"../utils/asRecord.ts\"\nimport { objectKeys } from \"../utils/objectKeys.ts\"\nimport { isNumber, isObject, isString, isUndefined } from \"../utils/utils.ts\"\nimport type { Prefixed } from \"./hocOptions.ts\"\nimport { stripPrefixFromPrefixedKey } from \"./hocOptions.ts\"\nimport { getDisabledFXPropsInStaticRenderer } from \"./optimizeAppear.tsx\"\nimport type { FXValues } from \"./useFXValues.ts\"\nimport { isFXValuesKey } from \"./useFXValues.ts\"\nimport type { LoopEffectOptions } from \"./useLoopEffect.ts\"\nimport { loopOptionsKeys, useLoop } from \"./useLoopEffect.ts\"\nimport type { ParallaxTransformOptions } from \"./useParallax.ts\"\nimport { parallaxOptionsKeys, useParallax } from \"./useParallax.ts\"\nimport type { PresenceEffectOptions } from \"./usePresenceAnimation.ts\"\nimport { presenceOptionsKeys, usePresenceAnimation } from \"./usePresenceAnimation.ts\"\nimport type { StyleAppearEffectOptions } from \"./useStyleAppearEffect.ts\"\nimport { styleAppearOptionsKeys, useStyleAppearEffect } from \"./useStyleAppearEffect.ts\"\nimport type { StyleTransformEffectOptions } from \"./useStyleTransformEffect.ts\"\nimport { styleTransformOptionsKeys, useStyleTransform } from \"./useStyleTransformEffect.ts\"\n\nconst groups = {\n\tparallax: parallaxOptionsKeys,\n\tstyleAppear: styleAppearOptionsKeys,\n\tstyleTransform: styleTransformOptionsKeys,\n\tloop: loopOptionsKeys,\n\tpresence: presenceOptionsKeys,\n} as const\n\nconst groupValues = /* @__PURE__ */ objectKeys(groups)\n\ninterface Output<T> {\n\tparallax: Partial<ParallaxTransformOptions>\n\tstyleAppear: Partial<StyleAppearEffectOptions>\n\tstyleTransform: Partial<StyleTransformEffectOptions>\n\tpresence: Partial<PresenceEffectOptions>\n\tloop: Partial<LoopEffectOptions>\n\tforwardedProps: T\n\ttargetOpacityValue?: number\n\twithPerspective?: boolean\n\tinSmartComponent?: boolean\n}\n\n// Allowing effects to be enabled or disabled was a new feature. Since code was\n// generated without this boolean, and `undefined` should be treated as `false`,\n// we must check if the key exists in the props, and if it doesn't, consider the\n// effect enabled. We also check a secondary key that historically was always\n// included with an enabled effect. If that key doesn't exist, the effect wasn't\n// enabled.\nfunction backwardsCompatibleEnabledCheck(\n\tkey: \"parallaxTransformEnabled\",\n\tsecondaryKey: keyof ParallaxTransformOptions,\n\tobject: Partial<ParallaxTransformOptions>,\n): boolean\nfunction backwardsCompatibleEnabledCheck(\n\tkey: \"styleAppearEffectEnabled\",\n\tsecondaryKey: keyof StyleAppearEffectOptions,\n\tobject: Partial<StyleAppearEffectOptions>,\n): boolean\nfunction backwardsCompatibleEnabledCheck(key: string, secondaryKey: string, object: Record<string, unknown>): boolean {\n\treturn (!(key in object) && secondaryKey in object) || object[key] === true\n}\n\ninterface FXOptions {\n\t__targetOpacity?: number\n\t__perspectiveFX?: boolean\n\t__smartComponentFX?: boolean\n}\n\n/**\n * Iterate through an object of React component props, extracting key-values\n * that are prefixed with the framer prefix set in hocOptions.ts. Depending on\n * which effect the prefixed key belongs to, store the values to a group for\n * that effect, and store the non-prefixed key values to an object of props to\n * be forwarded to the wrapped component.\n *\n * This is similar to hocOptions.ts:extractPrefixedProps().\n */\nfunction extractFXOptions<T extends {}>(\n\tprops: Partial<MotionProps> &\n\t\tPartial<Prefixed<ParallaxTransformOptions & StyleAppearEffectOptions & LoopEffectOptions>> &\n\t\tFXOptions &\n\t\tT,\n): Output<T> {\n\tconst result: Output<T> = {\n\t\tparallax: {},\n\t\tstyleAppear: {},\n\t\tstyleTransform: {},\n\t\tpresence: {\n\t\t\tanimate: props.animate,\n\t\t\tinitial: props.initial,\n\t\t\texit: props.exit,\n\t\t},\n\t\tloop: {},\n\t\tforwardedProps: {} as T,\n\t\ttargetOpacityValue: props.__targetOpacity,\n\t\twithPerspective: props.__perspectiveFX,\n\t\tinSmartComponent: props.__smartComponentFX,\n\t}\n\n\tfor (const key in props) {\n\t\tif (key === \"__targetOpacity\" || key === \"__perspectiveFX\" || key === \"__smartComponentFX\") continue\n\n\t\tconst strippedKey = stripPrefixFromPrefixedKey(key)\n\t\tif (strippedKey) {\n\t\t\tfor (const group of groupValues) {\n\t\t\t\tconst keys = groups[group]\n\n\t\t\t\t// TODO: Ugly cast but TypeScript can\u2019t figure this out\n\t\t\t\tif ((keys as Set<string> | undefined)?.has(strippedKey)) {\n\t\t\t\t\t// TODO: Still too complex for TypeScript, so casting is needed\n\t\t\t\t\t;(result[group] as Record<string, unknown>)[strippedKey] = asRecord(props)[key]\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// TODO: Get around casting here? T is arbitrary so we really don\u2019t have any info\n\t\t\t;(result.forwardedProps as Record<string, unknown>)[key] = asRecord(props)[key]\n\t\t}\n\t}\n\n\tresult.parallax.parallaxTransformEnabled = backwardsCompatibleEnabledCheck(\n\t\t\"parallaxTransformEnabled\",\n\t\t\"speed\",\n\t\tresult.parallax,\n\t)\n\n\tresult.styleAppear.styleAppearEffectEnabled = backwardsCompatibleEnabledCheck(\n\t\t\"styleAppearEffectEnabled\",\n\t\t\"animateOnce\",\n\t\tresult.styleAppear,\n\t)\n\n\treturn result\n}\n\nexport const add = (values: number[]) => values.reduce((sum, value) => (sum += value), 0)\nexport const multiply = (values: number[]) => values.reduce((sum, value) => (sum = sum * value), 1)\n\nconst reactRefObjectKey: keyof RefObject<unknown> = \"current\"\n\nfunction isReactRefObject(value: unknown): value is RefObject<unknown> {\n\treturn isObject(value) && reactRefObjectKey in value\n}\n\nfunction addMotionValueStyle(style: MotionStyle | undefined, values: Record<keyof FXValues, MotionValue[]>) {\n\tif (!style || !isObject(style)) return values\n\n\tfor (const key in style) {\n\t\tconst value = style[key as keyof MotionStyle]\n\t\tif (!isMotionValue(value) || !isFXValuesKey(key)) continue\n\t\tif (!isNumber(value.get())) continue\n\t\tvalues[key].push(value)\n\t}\n}\n\nfunction isVariantOrVariantList(value: unknown) {\n\treturn isString(value) || Array.isArray(value)\n}\n\ntype FXProps = Partial<Prefixed<ParallaxTransformOptions & StyleAppearEffectOptions & StyleTransformEffectOptions>> &\n\tPartial<MotionProps> & {\n\t\t__withFX?: boolean\n\t\t__perspectiveFX?: boolean\n\t\t__targetOpacity?: number\n\t\t__smartComponentFX?: boolean\n\t} & Record<string, unknown>\n\nexport const withFX = <T extends FXProps>(Component: React.ComponentType<T>) =>\n\tReact.forwardRef((props: T, forwardedRef: React.RefObject<HTMLElement> | null) => {\n\t\t// Legacy effects were multiple stacked HOCs. To avoid maintaining them,\n\t\t// we aliased their exports to `withFX`. Now, to prevent the effects\n\t\t// from running twice, we pass a `__withFX` from the outer HOC to the\n\t\t// inner which disables the inner withFX HOC.\n\t\t//\n\t\t// This doesn't violate the rule of hooks because it will always be\n\t\t// stable. Rule lint/correctness/useHookAtTopLevel disabled in biome.jsonc for file.\n\t\t//\n\t\tif (props.__withFX) {\n\t\t\treturn <Component {...props} animate={undefined} initial={undefined} exit={undefined} ref={forwardedRef} />\n\t\t}\n\n\t\tconst disabledProps = getDisabledFXPropsInStaticRenderer(props)\n\t\tif (disabledProps) {\n\t\t\treturn <Component {...props} {...disabledProps} ref={forwardedRef} />\n\t\t}\n\n\t\tconst {\n\t\t\tparallax = {},\n\t\t\tstyleAppear = {},\n\t\t\tstyleTransform = {},\n\t\t\tpresence = {},\n\t\t\tloop = {},\n\t\t\tforwardedProps,\n\t\t\ttargetOpacityValue,\n\t\t\twithPerspective,\n\t\t\tinSmartComponent = false,\n\t\t} = extractFXOptions(props)\n\n\t\tconst observerRef = useObserverRef(forwardedRef)\n\n\t\t// Updates motion values.\n\t\tconst { values: presenceEffectValues, style: presenceEffectStyle } = usePresenceAnimation(\n\t\t\tpresence,\n\t\t\tobserverRef,\n\t\t\tinSmartComponent,\n\t\t\tprops.style,\n\t\t\tprops[optimizedAppearDataAttribute],\n\t\t)\n\t\tconst { values: parallaxValues, style: parallaxStyle } = useParallax(parallax, observerRef, props.style?.visibility)\n\t\tconst { values: transformValues, style: scrollStyle } = useStyleTransform(styleTransform, observerRef)\n\t\tconst { values: appearEffectValues, style: scrollAppearStyle } = useStyleAppearEffect(styleAppear, observerRef)\n\t\tconst { values: loopValues, style: loopStyle } = useLoop(loop, observerRef)\n\n\t\tconst fxValues = React.useMemo(() => {\n\t\t\t// Create a new motion value for the memo to make sure the target opacity is always up to date as a motion value.\n\t\t\tconst layerOpacity = new MotionValue(targetOpacityValue ?? 1)\n\n\t\t\treturn {\n\t\t\t\tscale: [appearEffectValues.scale, loopValues.scale, presenceEffectValues.scale, transformValues.scale],\n\t\t\t\topacity: [\n\t\t\t\t\tappearEffectValues.opacity,\n\t\t\t\t\tloopValues.opacity,\n\t\t\t\t\tpresenceEffectValues.opacity,\n\t\t\t\t\tlayerOpacity,\n\t\t\t\t\ttransformValues.opacity,\n\t\t\t\t],\n\t\t\t\tx: [appearEffectValues.x, loopValues.x, presenceEffectValues.x, transformValues.x],\n\t\t\t\ty: [appearEffectValues.y, loopValues.y, parallaxValues.y, presenceEffectValues.y, transformValues.y],\n\t\t\t\trotate: [appearEffectValues.rotate, loopValues.rotate, presenceEffectValues.rotate, transformValues.rotate],\n\t\t\t\trotateX: [\n\t\t\t\t\tappearEffectValues.rotateX,\n\t\t\t\t\tloopValues.rotateX,\n\t\t\t\t\tpresenceEffectValues.rotateX,\n\t\t\t\t\ttransformValues.rotateX,\n\t\t\t\t],\n\t\t\t\trotateY: [\n\t\t\t\t\tappearEffectValues.rotateY,\n\t\t\t\t\tloopValues.rotateY,\n\t\t\t\t\tpresenceEffectValues.rotateY,\n\t\t\t\t\ttransformValues.rotateY,\n\t\t\t\t],\n\t\t\t\tskewX: [appearEffectValues.skewX, loopValues.skewX, presenceEffectValues.skewX, transformValues.skewX],\n\t\t\t\tskewY: [appearEffectValues.skewY, loopValues.skewY, presenceEffectValues.skewY, transformValues.skewY],\n\t\t\t\t/** @deprecated */\n\t\t\t\ttransformPerspective: [\n\t\t\t\t\ttransformValues.transformPerspective,\n\t\t\t\t\tappearEffectValues.transformPerspective,\n\t\t\t\t\t// We stopped animating transformPerspective with `withFX`\n\t\t\t\t\t// before introducing `useLoop` etc, so it does not have a\n\t\t\t\t\t// value here on purpose.\n\t\t\t\t],\n\t\t\t}\n\t\t}, [targetOpacityValue, transformValues, parallaxValues, appearEffectValues, loopValues, presenceEffectValues])\n\n\t\t// If a motion value is provided in style, include the value in the\n\t\t// transforms. This allows external control over any of these\n\t\t// properties.\n\t\taddMotionValueStyle(props.style, fxValues)\n\n\t\t// Scale & Opacity are multiplicative.\n\t\tconst scale = useTransform(fxValues.scale, multiply)\n\t\tconst opacity = useTransform(fxValues.opacity, multiply)\n\n\t\t// Remaining effects are additive\n\t\tconst x = useTransform(fxValues.x, add)\n\t\tconst y = useTransform(fxValues.y, add)\n\t\tconst rotate = useTransform(fxValues.rotate, add)\n\t\tconst rotateX = useTransform(fxValues.rotateX, add)\n\t\tconst rotateY = useTransform(fxValues.rotateY, add)\n\t\tconst skewX = useTransform(fxValues.skewX, add)\n\t\tconst skewY = useTransform(fxValues.skewY, add)\n\t\t/** @deprecated */\n\t\tconst transformPerspective = useTransform(fxValues.transformPerspective, add)\n\n\t\t// If a ref is being used as drag constraints for this element, rerender\n\t\t// the component if the drag constraint ref element is resized. This\n\t\t// ensures that the constraints are recalculated correctly.\n\t\tconst { drag, dragConstraints } = forwardedProps\n\t\tuseRerenderOnResize(drag && isReactRefObject(dragConstraints) ? dragConstraints : undefined)\n\t\tconst motionValueStyle: MotionStyle = {\n\t\t\topacity,\n\t\t\tscale,\n\t\t\tx,\n\t\t\ty,\n\t\t\trotate,\n\t\t\trotateX,\n\t\t\trotateY,\n\t\t\tskewX,\n\t\t\tskewY,\n\t\t}\n\n\t\t// We removed perspective from effects, instead allowing it to be\n\t\t// defined by css and included in a transform template. Old effects\n\t\t// still need a perspective added however.\n\t\tif (isUndefined(withPerspective)) motionValueStyle.transformPerspective = transformPerspective\n\n\t\t// Remove gesture handlers if we are in a smart component and not on the\n\t\t// ground node (which requires/provides initial/animate for variants).\n\t\tconst animate = isVariantOrVariantList(props.animate) ? props.animate : undefined\n\t\tconst initial = isVariantOrVariantList(props.initial) ? props.initial : undefined\n\t\tconst exit = isVariantOrVariantList(props.exit) ? props.exit : undefined\n\t\tconst motionGestures = inSmartComponent && !presence.presenceInitial ? { initial, animate, exit } : {}\n\n\t\treturn (\n\t\t\t<Component\n\t\t\t\t{...forwardedProps}\n\t\t\t\t{...motionGestures}\n\t\t\t\t__withFX\n\t\t\t\tstyle={{\n\t\t\t\t\t...props.style,\n\t\t\t\t\t...parallaxStyle,\n\t\t\t\t\t...scrollStyle,\n\t\t\t\t\t...loopStyle,\n\t\t\t\t\t...motionValueStyle,\n\t\t\t\t\t...scrollAppearStyle,\n\t\t\t\t\t...presenceEffectStyle,\n\t\t\t\t}}\n\t\t\t\tvalues={presenceEffectValues}\n\t\t\t\tref={observerRef}\n\t\t\t/>\n\t\t)\n\t})\n", "const prefix = \"__framer__\"\nconst prefixLength = /* @__PURE__ */ (() => prefix.length)()\n\nexport type Prefixed<Type extends object> = {\n\t[Property in keyof Type as `${typeof prefix}${string & Property}`]: Type[Property]\n}\n\nexport function extractPrefixedProps<Props extends object, Rest extends Record<string, unknown>>(\n\tprops: Prefixed<Props> & Rest,\n\tkeys: Set<string>,\n): [Props, Rest] {\n\tconst result: Record<string, unknown> = {}\n\tconst rest: Record<string, unknown> = {}\n\tfor (const key in props) {\n\t\tconst strippedKey = stripPrefixFromPrefixedKey(key)\n\t\tif (strippedKey && keys.has(strippedKey)) {\n\t\t\tresult[strippedKey] = props[key]\n\t\t\tcontinue\n\t\t}\n\n\t\trest[key] = props[key]\n\t}\n\t// Treat them like records, but return with the \u201Ccorrect\u201D types\n\treturn [result as Props, rest as Rest]\n}\n\nexport function stripPrefixFromPrefixedKey(key: string): string | undefined {\n\tif (key.startsWith(prefix)) {\n\t\treturn key.substr(prefixLength)\n\t}\n\n\treturn undefined\n}\n", "import { isBrowser } from \"@framerjs/shared/src/environment.ts\"\nimport type { MotionProps } from \"framer-motion\"\nimport React from \"react\"\nimport { assert } from \"../utils/assert.ts\"\nimport { isFunction, isObject, isString } from \"../utils/utils.ts\"\nimport { GeneratedComponentContext } from \"./GeneratedComponentContext.ts\"\nimport { SSRParentVariantsContext, variantHashFromClassName } from \"./PropertyOverrides.tsx\"\nimport { isStaticRenderer } from \"./useIsStaticRenderer.ts\"\n\n// The types here are duplicated in ssg/src/generateSite/animation/types.ts, please make sure the types are synced if\n// you are to make changes.\ninterface Target {\n\t[prop: string]: number\n}\n\ninterface Spring {\n\ttype: \"spring\"\n\tdelay: number\n\tstiffness: number\n\tdamping: number\n\tmass: number\n}\n\ninterface Tween {\n\ttype: \"tween\"\n\tdelay: number\n\tduration: number\n\tease: [number, number, number, number]\n}\n\ntype Transition = Spring | Tween\n\ntype TargetAndTransition = Target & {\n\ttransition: Transition\n}\ninterface Animation {\n\tinitial?: Target\n\tanimate?: TargetAndTransition\n\ttransformTemplate?: string\n\t/**\n\t * Legacy code generation has special behavior when there is a single\n\t * breakpoint which can never be active. To ensure only legacy code has this\n\t * behavior we flag it rather than try to infer it.\n\t */\n\tlegacy?: boolean\n}\nconst defaultVariantKey = \"default\"\nconst defaultVariants = new Set([defaultVariantKey])\n\ntype NodeId = string\n\ninterface GeneratedComponentInfo {\n\tprimaryVariantId: NodeId\n\tvariantClassNames: Record<NodeId, string>\n}\n\nclass AnimationCollector {\n\tprivate entries = new Map<NodeId, { [variantHash: string]: Animation | null }>()\n\n\t/** @deprecated */\n\tset(nodeId: NodeId, prop: \"initial\" | \"animate\", value: TargetAndTransition, variantHash: string | undefined): void\n\t/** @deprecated */\n\tset(nodeId: NodeId, prop: \"transformTemplate\", value: string): void\n\t/** @deprecated */\n\tset(\n\t\tnodeId: NodeId,\n\t\tprop: \"initial\" | \"animate\" | \"transformTemplate\",\n\t\tvalue: TargetAndTransition | string,\n\t\tvariantHash?: string | undefined,\n\t): void {\n\t\tswitch (prop) {\n\t\t\tcase \"transformTemplate\": {\n\t\t\t\tassert(typeof value === \"string\", `transformTemplate must be a string, received: ${value}`)\n\t\t\t\tthis.setHash(nodeId, variantHash, { transformTemplate: value, legacy: true })\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"initial\":\n\t\t\tcase \"animate\": {\n\t\t\t\tassert(typeof value === \"object\", `${prop} must be a valid object, received: ${value}`)\n\t\t\t\tthis.setHash(nodeId, variantHash, { [prop]: value, legacy: true })\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tprivate setHash(\n\t\tid: string,\n\t\tvariantHash: string | undefined = defaultVariantKey,\n\t\tvalue: Record<string, unknown> | null,\n\t) {\n\t\tconst existing = this.entries.get(id) ?? {}\n\t\tconst existingValue = existing[variantHash] ?? {}\n\t\texisting[variantHash] = value === null ? null : { ...existingValue, ...value }\n\t\tthis.entries.set(id, existing)\n\t}\n\n\t#variantHashes: Record<NodeId, string | undefined> = {}\n\tprivate variantHash(variantId: NodeId, info: GeneratedComponentInfo | undefined) {\n\t\tif (variantId === info?.primaryVariantId) return defaultVariantKey\n\t\t// Avoid splitting the same string over and over and reuse the value\n\t\t// from memory.\n\t\tconst existing = this.#variantHashes[variantId]\n\t\tif (existing) return existing\n\n\t\t// Get the class name from the context.\n\t\tconst className = info?.variantClassNames[variantId]\n\t\tif (!className) return defaultVariantKey\n\n\t\t// Split it to determine the stable hash.\n\t\treturn (this.#variantHashes[variantId] = variantHashFromClassName(className))\n\t}\n\n\tsetAll(\n\t\tid: string,\n\t\tvariants: Set<string> | undefined = defaultVariants,\n\t\tprops: Record<string, unknown> | null,\n\t\tinfo: GeneratedComponentInfo | undefined,\n\t) {\n\t\tif (props === null) {\n\t\t\tfor (const variantId of variants) {\n\t\t\t\tthis.setHash(id, this.variantHash(variantId, info), null)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tconst transformTemplate = isFunction(props.transformTemplate)\n\t\t\t? props.transformTemplate?.({}, framerAppearTransformTemplateToken)\n\t\t\t: undefined\n\n\t\tconst initial = props.__framer__presenceInitial ?? props.initial\n\t\tconst animate = props.__framer__presenceAnimate ?? props.animate\n\n\t\tconst config = {\n\t\t\tinitial: isObject(initial) ? initial : undefined,\n\t\t\tanimate: isObject(animate) ? animate : undefined,\n\t\t\ttransformTemplate: isString(transformTemplate) ? transformTemplate : undefined,\n\t\t}\n\n\t\tfor (const variantId of variants) this.setHash(id, this.variantHash(variantId, info), config)\n\t}\n\n\tclear() {\n\t\tthis.entries.clear()\n\t}\n\n\ttoObject() {\n\t\treturn Object.fromEntries(this.entries)\n\t}\n}\n\n/**\n * @internal\n */\nexport const framerAppearEffects = /* @__PURE__ */ new AnimationCollector()\n\n/**\n * @internal\n */\nexport function withOptimizedAppearEffect<T, P extends MotionProps & { optimized?: boolean | undefined }>(\n\tComponent: React.ComponentType<React.PropsWithoutRef<P> & React.RefAttributes<T>>,\n): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>> {\n\treturn React.forwardRef<T, P>(({ optimized, ...props }, ref) => {\n\t\tconst generatedComponentContext = React.useContext(GeneratedComponentContext)\n\t\tconst variants = React.useContext(SSRParentVariantsContext)?.variants\n\t\tconst id = props[framerAppearIdKey]\n\t\tif (id && !isBrowser()) {\n\t\t\tframerAppearEffects.setAll(\n\t\t\t\tid,\n\t\t\t\tvariants,\n\t\t\t\t// A layer may have an optimization id, and an `animate` prop,\n\t\t\t\t// but not require optimization. For example in the case of a\n\t\t\t\t// layer where one variant has an appear effect, and another\n\t\t\t\t// variant has a scroll appear effect, the scroll appear effect\n\t\t\t\t// should not be optimized.\n\t\t\t\toptimized ? props : null,\n\t\t\t\tgeneratedComponentContext,\n\t\t\t)\n\t\t}\n\n\t\tconst disabledProps = getDisabledFXPropsInStaticRenderer(props)\n\t\treturn <Component ref={ref} {...(props as React.PropsWithoutRef<P>)} {...disabledProps} />\n\t})\n}\n\n/**\n * @internal\n */\nexport const optimizeAppear = (\n\tprop: \"initial\" | \"animate\",\n\tid: string,\n\tanimateTargetAndTransition: TargetAndTransition,\n\tvariantHash: string,\n) => {\n\tif (!isBrowser()) {\n\t\t// Collect the appear animation settings for the SSGed page\n\t\tframerAppearEffects.set(id, prop, animateTargetAndTransition, variantHash)\n\t}\n\n\treturn animateTargetAndTransition\n}\n\n/**\n * @internal\n */\nexport const framerAppearTransformTemplateToken = \"__Appear_Animation_Transform__\"\n\n/**\n * @internal\n */\nexport const optimizeAppearTransformTemplate = (\n\tid: string,\n\tfn: (_transformProperties: unknown, generatedString: string) => string,\n) => {\n\tif (!isBrowser()) {\n\t\tconst template: string | undefined = fn?.({}, framerAppearTransformTemplateToken)\n\t\tif (template === undefined) return fn\n\t\tframerAppearEffects.set(id, \"transformTemplate\", template)\n\t}\n\n\treturn fn\n}\n\n/**\n * The dataset key we assign to every node that needs an appear animation. Its value is a unique hashed id, so the\n * appear animation script in SSG can correctly find the nodes that need to be animated, no matter how we alter the ids\n * later on in code-gen/rendering.\n * @internal\n */\nexport const framerAppearIdKey = \"data-framer-appear-id\"\n\n/**\n * The dataset key we assign to the appear animation script tag in the HTML template. SSG uses this key as a selector to\n * inject the animation script.\n * @internal\n */\nexport const framerAppearAnimationScriptKey = \"data-framer-appear-animation\"\n\ninterface DisabledAnimationProps {\n\tanimate: string | string[] | undefined\n\tinitial: string | string[] | undefined\n\texit: undefined\n}\n\n/**\n * Disable animations on the component when we're on the canvas to prevent any values from impacting\n * the design. Don't always unset `animate` or `initial` as if these are already set in a smart\n * component, we will break the active variant.\n *\n * @internal\n */\nexport const getDisabledFXPropsInStaticRenderer = <T extends Partial<MotionProps>>(\n\tprops: T,\n): DisabledAnimationProps | undefined => {\n\tconst isRenderingStaticContent = isStaticRenderer()\n\tif (!isRenderingStaticContent) return undefined\n\n\treturn {\n\t\tanimate: isVariantOrVariantList(props.animate) ? props.animate : undefined,\n\t\tinitial: isVariantOrVariantList(props.initial) ? props.initial : undefined,\n\t\texit: undefined,\n\t}\n}\n\nfunction isVariantOrVariantList(value: unknown) {\n\treturn isString(value) || Array.isArray(value)\n}\n", "import React from \"react\"\n\ntype VariantID = string\ntype NodeID = string\nexport type UnknownProps = Record<string, unknown>\n\nexport interface GeneratedComponentContextValue {\n\tprimaryVariantId: string\n\tvariantProps?: Record<VariantID, Record<NodeID, UnknownProps>>\n\tvariantClassNames: Record<string, string>\n\tactiveVariantId?: string\n\thumanReadableVariantMap?: Record<string, string>\n\t/**\n\t * Layout Template components set this to true. This allows a Web Page\n\t * component to read if they are in a Layout Template. Web Pages will set\n\t * the value back to undefined for their descendants.\n\t */\n\tisLayoutTemplate?: boolean\n}\n\n/** @internal */\nexport const GeneratedComponentContext = /* @__PURE__ */ React.createContext<\n\tGeneratedComponentContextValue | undefined\n>(undefined)\n", "import { isBrowser } from \"@framerjs/shared/src/environment.ts\"\nimport React from \"react\"\nimport { cloneChildrenWithProps } from \"../components/utils/cloneChildrenWithProps.tsx\"\nimport { useCloneChildrenWithPropsAndRef } from \"../components/utils/useCloneChildrenWithPropsAndRef.tsx\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { isEqual } from \"../render/utils/isEqual.ts\"\nimport { assert, assertNever } from \"../utils/assert.ts\"\nimport { useMemoOne } from \"../utils/useMemoOne.ts\"\nimport { noopSubscribe, returnFalse, returnTrue } from \"../utils/utils.ts\"\nimport type { UnknownProps } from \"./GeneratedComponentContext.ts\"\nimport { GeneratedComponentContext } from \"./GeneratedComponentContext.ts\"\nimport { withCSS } from \"./withCSS.tsx\"\n\nexport const SSRParentVariantsContext = /* @__PURE__ */ React.createContext<\n\t| {\n\t\t\tprimaryVariantId: string\n\t\t\tvariants: Set<string> | undefined\n\t  }\n\t| undefined\n>(undefined)\n\nconst SSRVariantClassName = \"ssr-variant\"\nconst SSRVariantGroupSeparatorClassName = \"ssr-variant-group-separator\"\n\ntype Overrides = Record<string, Record<string, unknown>>\n\nfunction renderBranchedChildrenFromPropertyOverrides(\n\toverrides: Overrides,\n\tchildren: React.ReactNode,\n\tprops: Record<string, unknown>,\n\tvariantClassNames: Record<string, string>,\n\tprimaryVariantId: string,\n\tparentVariants: Set<string> | undefined,\n\tcloneChildren: (children: unknown, props?: Record<string, unknown>) => JSX.Element,\n\tactiveVariantId: string | undefined,\n) {\n\tconst childrenArray = React.Children.toArray(children)\n\tconst child = childrenArray[0]\n\n\tif (childrenArray.length !== 1 || !React.isValidElement(child)) {\n\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\tconsole.warn(\"PropertyOverrides: expected exactly one React element for a child\", children)\n\t\treturn cloneChildren(children, props)\n\t}\n\n\tconst branches: { variants: string[]; propOverrides?: UnknownProps }[] = []\n\tconst nonOverriddenVariants: string[] = []\n\n\t// Iterate through all variants, skipping the primary variant.\n\tfor (const [variantId] of Object.entries(variantClassNames)) {\n\t\tif (variantId === primaryVariantId) continue\n\t\tconst propOverrides = overrides[variantId]\n\t\t// There may not be overrides for a specific variant, or they may be\n\t\t// effectively the same as the primary element.\n\t\tif (!propOverrides || !arePropOverridesEffectivelyDifferent(child.props, propOverrides)) {\n\t\t\tnonOverriddenVariants.push(variantId)\n\t\t\tcontinue\n\t\t}\n\n\t\tconst effectiveVariants = intersection([variantId], parentVariants)\n\t\tif (effectiveVariants.length) branches.push({ variants: effectiveVariants, propOverrides })\n\t}\n\n\tif (branches.length === 0) return cloneChildren(child, props)\n\n\tconst remainingVariants = [primaryVariantId, ...nonOverriddenVariants]\n\tconst effectiveRemainingVariants = intersection(remainingVariants, parentVariants)\n\tif (effectiveRemainingVariants.length) branches.unshift({ variants: effectiveRemainingVariants })\n\n\tconst renderedBranches: JSX.Element[] = []\n\tfor (const { variants, propOverrides } of branches) {\n\t\t// If given, we only render the active variant's branch.\n\t\tif (activeVariantId && !variants.includes(activeVariantId)) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// When rendering a single active branch (post-hydration), use a stable\n\t\t// key so that switching breakpoints updates the existing React subtree\n\t\t// in-place instead of unmounting/remounting it. This preserves DOM\n\t\t// state such as <video> playback and fullscreen.\n\t\tconst key = activeVariantId ? \"active-branch\" : variants.join(\"+\")\n\t\tlet element = (\n\t\t\t// We could omit the SSRParentVariantsContext if variants is the same as parentVariants, but that'd require\n\t\t\t// comparing arrays, so it might not really be an optimization. And since it's just a context, it doesn't\n\t\t\t// affect the size of the generated HTML.\n\t\t\t<SSRParentVariantsContext.Provider key={key} value={{ primaryVariantId, variants: new Set(variants) }}>\n\t\t\t\t{cloneChildren(child, propOverrides ? { ...props, ...propOverrides } : props)}\n\t\t\t</SSRParentVariantsContext.Provider>\n\t\t)\n\t\tconst hiddenClassNames = generateHiddenClassNames(variants, parentVariants, variantClassNames)\n\t\tif (hiddenClassNames.length) {\n\t\t\tassert(branches.length > 1, \"Must branch out when there are hiddenClassNames\")\n\t\t\telement = (\n\t\t\t\t<div\n\t\t\t\t\tkey={key}\n\t\t\t\t\tclassName={`${SSRVariantClassName} ${hiddenClassNames.join(\" \")}`}\n\t\t\t\t\t// Due to SSR variant deduping (`deduplicateSSRVariantBranches.ts`), the server version\n\t\t\t\t\t// of this branch might have fewer class names than its client-rendered version: https://github.com/framer/FramerStudio/pull/28328#discussion_r2838759641\n\t\t\t\t\t// Generally, this is not an issue:\n\t\t\t\t\t// - .hidden-* classes become no-op after hydration (see `removeHiddenBreakpointLayersV2()`)\n\t\t\t\t\t// - React 18-19 ignores attribute mismatches in production (neither patches them up\n\t\t\t\t\t//   nor restarts hydration due to them), so they won\u2019t lead to worse performance.\n\t\t\t\t\t// This comment is here only to suppress the warning that React would emit if you published\n\t\t\t\t\t// a site with dev React.\n\t\t\t\t\tsuppressHydrationWarning\n\t\t\t\t>\n\t\t\t\t\t{element}\n\t\t\t\t</div>\n\t\t\t)\n\t\t} else {\n\t\t\tassert(branches.length === 1, \"Cannot branch out when hiddenClassNames is empty\")\n\t\t}\n\t\trenderedBranches.push(element)\n\t}\n\n\tassert(\n\t\t!activeVariantId || renderedBranches.length === 1,\n\t\t\"Must render exactly one branch when activeVariantId is given\",\n\t)\n\n\t// During SSR (render-all-branches mode), mark the end of this PropertyOverrides\n\t// chain so SSG deduplication can avoid merging chains of adjacent <PropertyOverrides>.\n\tif (!activeVariantId) {\n\t\treturn [\n\t\t\t...renderedBranches,\n\t\t\t<div key=\"property-overrides-separator\" className={SSRVariantGroupSeparatorClassName} />,\n\t\t]\n\t}\n\n\treturn renderedBranches\n}\n\ninterface SSRVariantsProps extends Record<string, unknown> {\n\tid: string\n}\n\n/**\n * @deprecated\n * @internal\n */\nexport const SSRVariants = /* @__PURE__ */ React.forwardRef<HTMLElement, React.PropsWithChildren<SSRVariantsProps>>(\n\tfunction SSRVariants({ id: _nodeId, children, ...props }, ref) {\n\t\tconst cloneWithRefs = useCloneChildrenWithPropsAndRef(ref)\n\t\tif (isBrowser()) {\n\t\t\treturn cloneWithRefs(children, props)\n\t\t}\n\n\t\t// SSRVariants got deprecated and removed from code generation on May 20, 2022:\n\t\t// https://github.com/framer/FramerStudio/pull/11594\n\t\t//\n\t\t// Then on July 11, with the introduction of metadata modules, we bumped code gen version for web pages:\n\t\t// https://github.com/framer/FramerStudio/pull/12059\n\t\t//\n\t\t// Bumping code gen version forces web pages to be re-generated on the next publish, so we're guaranteed that\n\t\t// SSRVariants is no longer being used on published sites.\n\t\t//\n\t\t// Note however that SSRVariants can still be used on the canvas and in the in-app preview by old projects that\n\t\t// haven't published after July 2022, so we still need to support the isBrowser() code path above.\n\t\tthrow new Error(\"SSRVariants is no longer supported outside canvas and preview\")\n\t},\n)\n\nexport function variantHashFromClassName(className: string) {\n\treturn className.split(\"-\")[2]\n}\n\nfunction generateHiddenClassNames(\n\tshowOnlyInVariantIds: string[],\n\tparentVariants: Set<string> | undefined,\n\tvariantClassNames: Record<string, string>,\n) {\n\tconst classNames: string[] = []\n\tfor (const [variantId, variantClassName] of Object.entries(variantClassNames)) {\n\t\tconst alreadyHiddenInParent = parentVariants && !parentVariants.has(variantId)\n\t\tif (showOnlyInVariantIds.includes(variantId) || alreadyHiddenInParent) continue\n\t\tclassNames.push(`hidden-${variantHashFromClassName(variantClassName)}`)\n\t}\n\treturn classNames\n}\n\n/**\n * There's no point rendering a branch if there's no overlap between its\n * variants, and the parent variants.\n *\n * Example 1: if we're currently in a branch that's gonna be visible on mobile\n * only, there's no point rendering a branch that should be tablet-only.\n *\n * Example 2: if we're currently in a branch that's gonna be visible on desktop\n * and tablet, then we should render a branch that's gonna be visible on tablet\n * and mobile.\n *\n * In other words, we're simply looking for an intersection between the two\n * arrays.\n *\n * If we're currently at the top level (parentVariants is undefined), then we\n * need to render all the branches.\n */\nfunction intersection(variants: string[], parentVariants: Set<string> | undefined) {\n\tif (!parentVariants) return variants\n\treturn variants.filter(variant => parentVariants.has(variant))\n}\n\nfunction arePropOverridesEffectivelyDifferent(props: UnknownProps, propOverrides: UnknownProps) {\n\tfor (const key of Object.keys(propOverrides)) {\n\t\tif (!isEqual(props[key], propOverrides[key], true)) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nfunction propsForBreakpoint(variant: string | undefined, props: Record<string, unknown>, overrides?: Overrides) {\n\tif (!overrides || !variant) return props\n\treturn { ...props, ...overrides[variant] }\n}\n\ninterface Props extends Record<string, unknown> {\n\toverrides: Overrides\n\tbreakpoint: string\n}\n\nconst enum Action {\n\tPassThrough,\n\tRenderActiveBranch,\n\tRenderAllBranches,\n}\n\n/**\n * This is a wrapper for components that have some of their props overridden in different breakpoints.\n *\n * It'll make sure that the component is rendered with props appropriate for the breakpoint, i.e., taking the overrides\n * into account.\n *\n * It also handles SSR + hydration. During SSR, we'll render all the versions of the component into the HTML, with\n * appropriate `hidden-xxx` classes to make sure that on the client, only the version for the correct breakpoint is\n * being shown. Before hydration, we expect all the hidden/non-active breakpoints to be removed from the DOM, which is\n * currently being done by a small inline script injected during SSG. During hydration, we only render the active\n * breakpoint, but we keep the `hidden-xxx`/`ssr-variant` container, because we don't want the shown DOM elements to\n * move around, as that could affect our LCP scores. If we removed/unwrapped the container, the benchmarks might think\n * that the LCP has changed.\n *\n * @internal\n */\nconst PropertyOverridesWithoutCSS = /* @__PURE__ */ React.forwardRef<HTMLElement, React.PropsWithChildren<Props>>(\n\tfunction PropertyOverrides(props, ref) {\n\t\tconst cloneWithRefs = useCloneChildrenWithPropsAndRef(ref)\n\t\tconst ancestorCtx = React.useContext(SSRParentVariantsContext)\n\n\t\t// We want the \"action\" to stay constant during the life of the component, because if we started with hydration,\n\t\t// and thus are rendering the `ssr-variant` container, we don't want a re-render to remove that container, since\n\t\t// if that happened during load, it could affect LCP.\n\t\tconst isHydrationOrSSR = React.useSyncExternalStore(noopSubscribe, returnFalse, returnTrue)\n\t\tconst action = useConstant(() => {\n\t\t\tif (isHydrationOrSSR) {\n\t\t\t\tif (isBrowser()) {\n\t\t\t\t\t// Hydration\n\t\t\t\t\treturn Action.RenderActiveBranch\n\t\t\t\t} else {\n\t\t\t\t\t// SSR\n\t\t\t\t\treturn Action.RenderAllBranches\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Regular render, e.g. on navigation\n\t\t\t\treturn Action.PassThrough\n\t\t\t}\n\t\t})\n\n\t\tconst generatedComponentContext = React.useContext(GeneratedComponentContext)\n\n\t\t// The memo is needed, because of the `useSyncExternalStore` hook, which otherwise causes a synchronous re-render\n\t\t// which in turn might produce Suspense and hydration related errors, as it might synchronously update children that\n\t\t// currently are suspended and not hydrated yet.\n\t\t// As `action` is constant, the synchronous re-render will not actually do anything when paired with `useMemo`.\n\t\t// (see also comment above the `useConstant` call why this is intended)\n\t\treturn useMemoOne(() => {\n\t\t\tconst { breakpoint, overrides, children, ...restProps } = props\n\n\t\t\tif (!generatedComponentContext) {\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\t\tconsole.warn(\"PropertyOverrides is missing GeneratedComponentContext\")\n\t\t\t\treturn cloneWithRefs(children, restProps)\n\t\t\t}\n\t\t\tconst { primaryVariantId, variantClassNames } = generatedComponentContext\n\n\t\t\t// When we leave a Layout Template and enter into a Web Page, we reset the parent variants\n\t\t\t// to ensure we render all visible variants, not just the intersection with the Layout\n\t\t\t// Template variants (which will be none)\n\t\t\tconst parentVariants = ancestorCtx?.primaryVariantId === primaryVariantId ? ancestorCtx?.variants : undefined\n\n\t\t\tswitch (action) {\n\t\t\t\tcase Action.PassThrough:\n\t\t\t\t\treturn cloneWithRefs(children, propsForBreakpoint(breakpoint, restProps, overrides))\n\t\t\t\tcase Action.RenderActiveBranch:\n\t\t\t\t\treturn renderBranchedChildrenFromPropertyOverrides(\n\t\t\t\t\t\toverrides,\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\trestProps,\n\t\t\t\t\t\tvariantClassNames,\n\t\t\t\t\t\tprimaryVariantId,\n\t\t\t\t\t\tparentVariants,\n\t\t\t\t\t\tcloneWithRefs,\n\t\t\t\t\t\tbreakpoint, // only render the single, active branch\n\t\t\t\t\t)\n\t\t\t\tcase Action.RenderAllBranches:\n\t\t\t\t\treturn renderBranchedChildrenFromPropertyOverrides(\n\t\t\t\t\t\toverrides,\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t\trestProps,\n\t\t\t\t\t\tvariantClassNames,\n\t\t\t\t\t\tprimaryVariantId,\n\t\t\t\t\t\tparentVariants,\n\t\t\t\t\t\t// On the server, we use plain cloneChildrenWithProps instead of useCloneChildrenWithPropsAndRef,\n\t\t\t\t\t\t// because we can't clone one ref to multiple branched-out elements (useCloneChildrenWithPropsAndRef\n\t\t\t\t\t\t// even guards against it), but luckily, refs mean nothing on the server anyway.\n\t\t\t\t\t\tcloneChildrenWithProps,\n\t\t\t\t\t\tundefined, // render all branches\n\t\t\t\t\t)\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(action)\n\t\t\t}\n\t\t}, [generatedComponentContext, ancestorCtx, cloneWithRefs, props])\n\t},\n)\n\nexport const PropertyOverrides = /* @__PURE__ */ (() =>\n\twithCSS(PropertyOverridesWithoutCSS, `.${SSRVariantClassName} { display: contents }`, \"PropertyOverrides\"))()\n", "import * as React from \"react\"\n\n/**\n * Clone children and add props to them and wrap them with Fragment making it easier to use.\n * */\nexport function cloneChildrenWithProps(children: React.ReactNode, props: Record<string, unknown>): JSX.Element\n\n/**\n * Returns the cloned children with the props added to them as a real type of React.Children.map\n * */\nexport function cloneChildrenWithProps<T, C>(\n\tchildren: T,\n\tprops: Record<string, unknown>,\n\tasNode: true,\n): ReturnType<typeof React.Children.map<T, C>>\n\nexport function cloneChildrenWithProps(children: React.ReactNode, props: Record<string, unknown>, asNode?: true) {\n\tconst cloned = React.Children.map(children, child => {\n\t\tif (React.isValidElement(child)) {\n\t\t\treturn React.cloneElement(child, props)\n\t\t}\n\t\treturn child\n\t})\n\tif (asNode) return cloned\n\n\treturn <>{cloned}</>\n}\n", "import * as React from \"react\"\nimport { isFunction } from \"../../utils/utils.ts\"\nimport type { Ref } from \"./refHelper.ts\"\nimport { setRef } from \"./refHelper.ts\"\nimport { useConstant } from \"./useConstant.ts\"\n\ninterface State {\n\tforwardedRef: React.ForwardedRef<unknown> | undefined\n\tchildRef: Ref<unknown> | undefined\n\tref: Ref<unknown> | null | undefined\n}\n\n/**\n * This hook creates a clone function to clone children with parent-forwarded props and ref.\n * It forwards the refs and props to the children in a safe way.\n * Clone function is stateful and should only be called once during the render cycle.\n * If you need to clone children multiple times, you should create a new instance of the hook.\n * */\nexport function useCloneChildrenWithPropsAndRef(forwardedRef?: React.ForwardedRef<unknown>) {\n\tconst hook = useConstant(() => createHook(forwardedRef))\n\n\thook.useSetup(forwardedRef)\n\n\treturn hook.cloneAsElement\n}\n\nfunction createHook(forwardedRef?: React.ForwardedRef<unknown>) {\n\tconst state: State = {\n\t\tforwardedRef,\n\t\tchildRef: null,\n\t\tref: null,\n\t}\n\n\tstate.ref = createRefFunction(state)\n\n\tconst updateIfNeeded = (nextForwardedRef?: React.ForwardedRef<unknown>, ref?: Ref<unknown>) => {\n\t\t// If we don't have a ref, and it didn't change, we don't need to re-create the callback\n\t\t//   we can simply re-use childRef\n\t\tif (!state.forwardedRef && state.forwardedRef === nextForwardedRef) {\n\t\t\tstate.ref = ref\n\t\t\treturn\n\t\t}\n\n\t\tlet shouldUpdate = false\n\n\t\t// There is an edge case here when childRef is changed but forwardRef stays the same.\n\t\t//   We are recreating callback in this case, which results in extra updates to forwardRef.\n\t\t//   It is an acceptable limitation compared to the complexity needed to fix this properly\n\t\tif (state.childRef !== ref) {\n\t\t\tstate.childRef = ref\n\t\t\tshouldUpdate = true\n\t\t}\n\n\t\tif (state.forwardedRef !== nextForwardedRef) {\n\t\t\tstate.forwardedRef = nextForwardedRef\n\t\t\tshouldUpdate = true\n\t\t}\n\n\t\tif (!shouldUpdate) return\n\n\t\tstate.ref = createRefFunction(state)\n\t}\n\n\tlet preventNextCall = false\n\n\tfunction cloneChildrenWithPropsAndRef<T>(\n\t\tchildren: T,\n\t\tprops?: Record<string, unknown> | ((props: Record<string, unknown>) => Record<string, unknown>),\n\t) {\n\t\tif (preventNextCall) {\n\t\t\tthrow new ReferenceError(\n\t\t\t\t\"useCloneChildrenWithPropsAndRef: You should not call cloneChildrenWithPropsAndRef more than once during the render cycle.\",\n\t\t\t)\n\t\t}\n\t\tpreventNextCall = true\n\n\t\tif (React.Children.count(children) > 1 && forwardedRef) {\n\t\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\t\tthrow new ReferenceError(\n\t\t\t\t\t\"useCloneChildrenWithPropsAndRef: You should not have more than one child when using a forwarded ref.\",\n\t\t\t\t)\n\t\t\t}\n\t\t\tstate.forwardedRef = undefined\n\t\t\tstate.ref = state.childRef\n\t\t}\n\n\t\treturn React.Children.map(children, child => {\n\t\t\tif (React.isValidElement(child)) {\n\t\t\t\t// React assigns ref to child.ref, it doesn't exist in `child.props`\n\t\t\t\tconst ownRef = \"ref\" in child ? (child.ref as Ref<unknown>) : undefined\n\n\t\t\t\tupdateIfNeeded(state.forwardedRef, ownRef)\n\n\t\t\t\tconst newProps = isFunction(props) ? props(child.props as Record<string, unknown>) : props\n\t\t\t\treturn React.cloneElement(child, state.ref !== ownRef ? { ...newProps, ref: state.ref } : newProps)\n\t\t\t}\n\t\t\treturn child\n\t\t})\n\t}\n\n\tconst cloneAsElement = function cloneAsElement<T>(children: T, props?: Record<string, unknown>) {\n\t\treturn <>{cloneChildrenWithPropsAndRef(children, props)}</>\n\t}\n\n\t/**\n\t * Clones children and adds props and refs and returns them as a real type of React.Children.map\n\t * */\n\tcloneAsElement.cloneAsArray = cloneChildrenWithPropsAndRef\n\n\treturn {\n\t\t// used during render phase to sync props with state\n\t\tuseSetup: (newRef?: React.ForwardedRef<unknown>) => {\n\t\t\tpreventNextCall = false\n\t\t\tupdateIfNeeded(newRef, state.childRef)\n\t\t},\n\t\t/**\n\t\t * Clones children and adds props and refs and returns them as a JSX.Element\n\t\t * Making it easier to use as it wraps them in a Fragment.\n\t\t * */\n\t\tcloneAsElement,\n\t}\n}\n\nfunction createRefFunction(state: State): Ref<unknown> | undefined {\n\tif (!state.forwardedRef) return state.childRef\n\tconst { forwardedRef: prevForwardedRef, childRef: prevChildRef } = state\n\n\treturn (value: unknown) => {\n\t\tsetRef(prevChildRef, value)\n\t\tsetRef(prevForwardedRef, value)\n\t}\n}\n", "import type { MotionValue } from \"framer-motion\"\nimport { motionValue } from \"framer-motion\"\nimport React from \"react\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { isUndefined } from \"../utils/utils.ts\"\n\nexport const effectValuesKeys = [\n\t\"opacity\",\n\t\"x\",\n\t\"y\",\n\t\"scale\",\n\t\"rotate\",\n\t\"rotateX\",\n\t\"rotateY\",\n\t\"skewX\",\n\t\"skewY\",\n\t/** @deprecated */\n\t\"transformPerspective\",\n] as const\n\n/**\n * All effects that can be composed operate on a single set of motion values, by\n * adding or multiplying their values with other effect values. FXValues is the\n * shared interface that can be animated.\n */\nexport type FXValues = Record<(typeof effectValuesKeys)[number], MotionValue<number>>\n\nexport const makeFXValues = (defaults?: Partial<Record<keyof FXValues, number>>) => {\n\treturn {\n\t\tx: motionValue(defaults?.x ?? 0),\n\t\ty: motionValue(defaults?.y ?? 0),\n\t\topacity: motionValue(defaults?.opacity ?? 1),\n\t\tscale: motionValue(defaults?.scale ?? 1),\n\t\trotate: motionValue(defaults?.rotate ?? 0),\n\t\trotateX: motionValue(defaults?.rotateX ?? 0),\n\t\trotateY: motionValue(defaults?.rotateY ?? 0),\n\t\tskewX: motionValue(defaults?.skewX ?? 0),\n\t\tskewY: motionValue(defaults?.skewY ?? 0),\n\t\t/** @deprecated */\n\t\ttransformPerspective: motionValue(defaults?.transformPerspective ?? 0),\n\t} as const\n}\n\nexport const defaultFXValues: Record<keyof FXValues, number> = {\n\tx: 0,\n\ty: 0,\n\tscale: 1,\n\topacity: 1,\n\trotate: 0,\n\trotateX: 0,\n\trotateY: 0,\n\tskewX: 0,\n\tskewY: 0,\n\t/** @deprecated */\n\ttransformPerspective: 0,\n}\n\n/** @internal */\nexport function isFXValuesKey(key: string): key is keyof FXValues {\n\treturn key in defaultFXValues\n}\n\nexport const effectEnabledStyle: React.CSSProperties = {\n\twillChange: \"transform\",\n} as const\nObject.freeze(effectEnabledStyle)\nexport const effectDisabledStyle = {}\nObject.freeze(effectDisabledStyle)\n\n/**\n * Create the fx values object, resetting the motion values to defaults when the\n * effect is disabled.\n */\nexport function useFXValues(values?: Partial<Record<keyof FXValues, number>>, enabled?: boolean) {\n\tconst effect = useConstant(() => ({ values: makeFXValues(enabled ? values : undefined) }))\n\n\tReact.useEffect(() => {\n\t\tif (enabled) return\n\n\t\tfor (const key of effectValuesKeys) {\n\t\t\tconst value = defaultFXValues[key]\n\t\t\tif (isUndefined(value)) continue\n\t\t\teffect.values[key].set(value)\n\t\t}\n\t}, [enabled])\n\n\treturn effect\n}\n", "import type { MotionStyle, Transition, ValueAnimationTransition } from \"framer-motion\"\nimport { animate, useReducedMotionConfig } from \"framer-motion\"\nimport { startTransition, useCallback, useEffect, useMemo, useRef, useState } from \"react\"\nimport type { MutableRefCallback } from \"../components/utils/refHelper.ts\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport type { Prefixed } from \"./hocOptions.ts\"\nimport type { FXValues } from \"./useFXValues.ts\"\nimport {\n\tdefaultFXValues,\n\teffectDisabledStyle,\n\teffectEnabledStyle,\n\teffectValuesKeys,\n\tmakeFXValues,\n} from \"./useFXValues.ts\"\nimport { useSharedIntersectionObserver } from \"./useSharedIntersectionObserver.ts\"\n\nexport interface LoopEffectOptions {\n\tloopEffectEnabled: boolean | undefined\n\tloopTransition: Transition | undefined\n\tloopRepeatType: Extract<NonNullable<Transition[\"repeatType\"]>, \"mirror\" | \"loop\"> | undefined\n\tloopRepeatDelay: number | undefined\n\tloop: Partial<Record<keyof FXValues, number>> | undefined\n\tloopPauseOffscreen: boolean | undefined\n}\n\nexport type PrefixedLoopEffectOptions = Prefixed<LoopEffectOptions>\n\nexport const loopOptionsKeys = new Set<keyof LoopEffectOptions>([\n\t\"loopEffectEnabled\",\n\t\"loopTransition\",\n\t\"loop\",\n\t\"loopRepeatType\",\n\t\"loopRepeatDelay\",\n\t\"loopPauseOffscreen\",\n])\n\n// A delay utility that cleans up any timeouts when unmounted.\nconst useDelay = () => {\n\tconst timeoutRef = useRef<number | undefined>()\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tclearTimeout(timeoutRef.current)\n\t\t}\n\t}, [])\n\n\treturn async (d: number) =>\n\t\tnew Promise(resolve => {\n\t\t\ttimeoutRef.current = setTimeout(() => {\n\t\t\t\tresolve(true)\n\t\t\t}, d * 1000) as unknown as number\n\t\t})\n}\n\nexport function useLoop(\n\t{\n\t\tloopEffectEnabled,\n\t\tloopRepeatDelay,\n\t\tloopTransition,\n\t\tloopRepeatType,\n\t\tloop,\n\t\tloopPauseOffscreen,\n\t}: Partial<LoopEffectOptions>,\n\tref: MutableRefCallback<HTMLElement>,\n): {\n\tvalues: FXValues\n\tstyle: MotionStyle\n} {\n\tconst shouldReduceMotion = useReducedMotionConfig()\n\tconst values = useConstant(makeFXValues)\n\tconst mirrorStateRef = useRef(false)\n\tconst delay = useDelay()\n\t// biome-ignore lint/suspicious/noConfusingVoidType: void is the return type of Promise.all\n\tconst animationPromiseRef = useRef<Promise<(void | undefined)[]> | null>(null)\n\n\tconst animateValues = useCallback(async () => {\n\t\tif (!loop) return\n\t\tconst transition = loopTransition || undefined\n\n\t\tconst mirror = mirrorStateRef.current && loopRepeatType === \"mirror\"\n\t\tconst to = mirror ? defaultFXValues : loop\n\t\tconst from = mirror ? loop : defaultFXValues\n\n\t\tmirrorStateRef.current = !mirrorStateRef.current\n\n\t\tanimationPromiseRef.current = Promise.all(\n\t\t\teffectValuesKeys.map(key => {\n\t\t\t\tif (shouldReduceMotion && key !== \"opacity\") return\n\n\t\t\t\t// Jump to new value and reset velocity to 0\n\t\t\t\tvalues[key].jump(from[key] ?? defaultFXValues[key])\n\n\t\t\t\treturn new Promise<void>(resolve => {\n\t\t\t\t\tconst opts: ValueAnimationTransition = {\n\t\t\t\t\t\t...transition,\n\t\t\t\t\t\tonComplete: () => resolve(),\n\t\t\t\t\t}\n\n\t\t\t\t\tconst target = to[key] ?? from[key]\n\t\t\t\t\tif (typeof target === \"number\") {\n\t\t\t\t\t\tanimate(values[key], target, opts)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}),\n\t\t)\n\t\treturn animationPromiseRef.current\n\t}, [loop, loopRepeatType, loopTransition, shouldReduceMotion])\n\n\tconst [isRunning, setIsRunning] = useState(false)\n\tconst shouldRunRef = useRef(false) // the refs purpose is to stop the running `animateLoop`\n\n\tconst animateLoop = useCallback(async () => {\n\t\tif (!loopEffectEnabled || !shouldRunRef.current) return\n\t\tawait animateValues()\n\t\tawait delay(loopRepeatDelay ?? 0)\n\t\tvoid animateLoop()\n\t}, [animateValues, delay, loopEffectEnabled, loopRepeatDelay])\n\n\tconst start = useCallback(() => {\n\t\tif (shouldRunRef.current) return // already running\n\n\t\tshouldRunRef.current = true\n\t\tstartTransition(() => setIsRunning(true)) // force re-render to apply `style` prop updates\n\n\t\tvoid animateLoop()\n\t}, [animateLoop])\n\n\tconst stop = useCallback((overrideRunRef = true) => {\n\t\t// Stop animations first\n\t\teffectValuesKeys.forEach(key => {\n\t\t\tvalues[key].stop()\n\t\t})\n\t\teffectValuesKeys.forEach(key => {\n\t\t\tvalues[key].set(defaultFXValues[key])\n\t\t})\n\n\t\tmirrorStateRef.current = false\n\n\t\tif (overrideRunRef) {\n\t\t\tshouldRunRef.current = false\n\t\t\tstartTransition(() => setIsRunning(false)) // force re-render to apply `style` prop updates\n\t\t}\n\t}, [])\n\n\tconst hasLoop = loopEffectEnabled && loop\n\n\tconst startStopTabVisibilityListener = useCallback(() => {\n\t\tif (document.hidden) {\n\t\t\t// stop without overriding the ref, so that we know if we should start it again when the page becomes visible.\n\t\t\tstop(false)\n\t\t} else if (shouldRunRef.current) {\n\t\t\tshouldRunRef.current = false // needed so that start works\n\t\t\tstart()\n\t\t}\n\t}, [start, stop])\n\n\tuseEffect(() => {\n\t\tif (!hasLoop) return\n\t\tdocument.addEventListener(\"visibilitychange\", startStopTabVisibilityListener)\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"visibilitychange\", startStopTabVisibilityListener)\n\t\t}\n\t}, [hasLoop, startStopTabVisibilityListener])\n\n\tuseEffect(() => {\n\t\t// the IntersectionObserver handles starting the animation\n\t\tif (hasLoop && loopPauseOffscreen) return\n\n\t\tif (hasLoop) {\n\t\t\tstart()\n\t\t} else {\n\t\t\tstop()\n\t\t}\n\t}, [start, stop, loopPauseOffscreen, hasLoop])\n\n\t// Cleanup on unmount\n\tuseEffect(() => {\n\t\treturn () => stop()\n\t}, [stop])\n\n\tconst isIntersectingRef = useRef(false)\n\tconst stopAfterAnimationEnds = useCallback(async () => {\n\t\t// No animation running\n\t\tif (!animationPromiseRef.current) return\n\n\t\tawait animationPromiseRef.current\n\n\t\t// If meanwhile the element is intersecting again, we do nothing.\n\t\tif (isIntersectingRef.current) return\n\n\t\tstop()\n\t}, [stop])\n\n\t/**\n\t * This is only called 1x when the observed ref is intersecting or stops intersecting (due to the implicit `threshold: 0` option on the IO)\n\t */\n\tconst startAndStopBasedOnIntersection = useCallback(\n\t\t(entry: IntersectionObserverEntry) => {\n\t\t\tif (entry.isIntersecting) {\n\t\t\t\tisIntersectingRef.current = true\n\t\t\t\tstart()\n\t\t\t} else {\n\t\t\t\tisIntersectingRef.current = false\n\t\t\t\t// If there is an animation running, it could move out of the viewport. So we wait for it to end before stopping.\n\t\t\t\tvoid stopAfterAnimationEnds()\n\t\t\t}\n\t\t},\n\t\t[start, stopAfterAnimationEnds],\n\t)\n\n\tuseSharedIntersectionObserver(ref, startAndStopBasedOnIntersection, {\n\t\tenabled: hasLoop && loopPauseOffscreen,\n\t})\n\n\tconst addWillChange = isRunning || !loopPauseOffscreen\n\treturn useMemo(() => {\n\t\treturn {\n\t\t\tvalues,\n\t\t\tstyle: hasLoop && addWillChange ? effectEnabledStyle : effectDisabledStyle,\n\t\t}\n\t}, [hasLoop, addWillChange])\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { frame, useMotionValue, useReducedMotionConfig, useScroll, useTransform } from \"framer-motion\"\nimport React, { useContext } from \"react\"\nimport { type MutableRefCallback, useRefEffect } from \"../components/utils/refHelper.ts\"\nimport { useOnRouteChange } from \"../router/useCurrentRoute.tsx\"\nimport type { Prefixed } from \"./hocOptions.ts\"\nimport { parallaxTransform } from \"./parallaxTransform.ts\"\nimport { type FXValues, effectDisabledStyle, effectEnabledStyle } from \"./useFXValues.ts\"\nimport { SharedIntersectionObserverContext, observeElement } from \"./useSharedIntersectionObserver.ts\"\n\nexport interface ParallaxTransformOptions {\n\tspeed: number\n\tadjustPosition: boolean\n\toffset: number\n\tparallaxTransformEnabled: boolean | undefined\n}\n\nexport type PrefixedParallaxTransformOptions = Prefixed<ParallaxTransformOptions>\n\nexport const parallaxOptionsKeys = new Set<keyof ParallaxTransformOptions>([\n\t\"speed\",\n\t\"adjustPosition\",\n\t\"offset\",\n\t\"parallaxTransformEnabled\",\n])\n\ninterface Output {\n\tvalues: Pick<FXValues, \"y\">\n\tstyle: MotionStyle | undefined\n}\n\nexport function useParallax(\n\toptions: Partial<ParallaxTransformOptions>,\n\tref: MutableRefCallback<HTMLElement>,\n\tvisibilityStyle?: MotionStyle[\"visibility\"],\n): Output {\n\tconst { speed = 100, offset = 0, adjustPosition = false, parallaxTransformEnabled } = options\n\tconst originalPosition = React.useRef<number | null>(null)\n\tconst shouldReduceMotion = useReducedMotionConfig()\n\n\tconst transform = React.useCallback(\n\t\t(yValue: number) => {\n\t\t\t// Don't set any transform if we do not have a offsetTop yet.\n\t\t\t// This allows us to capture the boundingRect inside\n\t\t\t// useLayoutEffect without any transform\n\t\t\tif (originalPosition.current === null) return 0\n\t\t\t// Optimization: If the speed is nominal, don't transform\n\t\t\tif (speed === 100) return 0\n\t\t\treturn parallaxTransform(yValue, originalPosition.current, speed, offset, adjustPosition)\n\t\t},\n\t\t[speed, offset, adjustPosition],\n\t)\n\n\t/**\n\t * Merge scroll-derived Y with the any animations the element might be running.\n\t */\n\tconst { scrollY } = useScroll()\n\tconst parallaxY = useTransform(scrollY, transform)\n\n\t// When the adjusting the elements' position based on its original\n\t// position, we set it's visibility to hidden until we have\n\t// retrieved the original position. We reset this value in the\n\t// useLayoutEffect above. This avoids the element 'jumping' when\n\t// using SSG.\n\t//\n\t// We use `visibility` instead of `display` here, because we need the\n\t// element to receive a layout so we can call\n\t// `getBoundingClientRect()` to get it's position.\n\tconst visibility = useMotionValue(adjustPosition && originalPosition.current === null ? \"hidden\" : visibilityStyle)\n\tconst defaultValue = useMotionValue(0)\n\n\tconst observers = useContext(SharedIntersectionObserverContext)\n\n\t/**\n\t * Get the element that is having the parallax applied's offset from\n\t * the top of the viewport when it mounts. We use this to do\n\t * calculations later.\n\t *\n\t * @FIXME: This breaks if the element changes layout unrelated to\n\t * the parallax transform, for example when switching breakpoints.\n\t */\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: The effect should only execute on mount, when the parallax transform is enabled, and when adjustPosition changes.\n\tuseRefEffect(\n\t\tref,\n\t\telement => {\n\t\t\t// We don't want to run anything on cleanup or if the parallax transform is disabled.\n\t\t\tif (element === null || !parallaxTransformEnabled) return\n\n\t\t\t// \"undefined\" is the key the entry where no root margin has been passed -> all elements that have no root margin share that observer.\n\t\t\t// null is the document root.\n\t\t\tconst unobserve = observeElement(observers, \"undefined\", element, null, entry => {\n\t\t\t\toriginalPosition.current = entry.boundingClientRect.top\n\t\t\t\tframe.update(() => {\n\t\t\t\t\tparallaxY.set(transform(scrollY.get()))\n\t\t\t\t\tif (adjustPosition) {\n\t\t\t\t\t\tvisibility.set(visibilityStyle ?? \"initial\")\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\tunobserve()\n\t\t\t})\n\t\t\treturn unobserve\n\t\t},\n\t\t[adjustPosition, parallaxTransformEnabled],\n\t)\n\n\tuseOnRouteChange(() => {\n\t\tif (!parallaxTransformEnabled) return\n\t\tparallaxY.set(0)\n\t})\n\n\treturn {\n\t\tvalues: {\n\t\t\ty: shouldReduceMotion || !parallaxTransformEnabled ? defaultValue : parallaxY,\n\t\t},\n\t\tstyle: parallaxTransformEnabled\n\t\t\t? {\n\t\t\t\t\t...effectEnabledStyle,\n\t\t\t\t\tvisibility,\n\t\t\t\t}\n\t\t\t: effectDisabledStyle,\n\t}\n}\n", "export function parallaxTransform(\n\tscrollY: number,\n\toriginalPosition: number,\n\tspeed: number,\n\toffset: number,\n\tadjustPosition: boolean,\n) {\n\t// 1x speed means the element stays at its original position, so to get a\n\t// value we can use to multiply the current scroll with, we need to subtract\n\t// 1 for it to be 0, resulting in the scroll position having no influence on\n\t// the element.\n\tconst speedFactor = speed / 100 - 1\n\t// The initial position of the element is adjusted, so that when scrolling\n\t// with the speedFactor, the elemant will be at its original position when\n\t// hitting the top of the viewport.\n\t//\n\t// The offset can be used to adjust the position where the element reach at\n\t// its original position.\n\tconst initialPosition = adjustPosition ? (originalPosition - offset) * speedFactor : 0\n\t// The scroll offset is the parallax adjustment that is applied to the\n\t// element. When the speedFactor is 0, it does not move, when it is 1 the\n\t// element moves twice as fast as the scrolling and when it is -1 it goes in\n\t// the reverse direction of the scrolling (staying fixed on the page)\n\tconst scrollOffset = -scrollY * speedFactor\n\treturn initialPosition + scrollOffset\n}\n", "import {\n\ttype MotionProps,\n\ttype MotionStyle,\n\ttype TargetAndTransition,\n\ttype ValueAnimationTransition,\n\tanimate,\n\tframe,\n\tisMotionValue,\n\tusePresence,\n\tuseReducedMotionConfig,\n\tvisualElementStore,\n} from \"framer-motion\"\nimport { useMemo, useRef } from \"react\"\nimport type { MutableRefCallback } from \"../components/utils/refHelper.ts\"\nimport { useRefEffect } from \"../components/utils/refHelper.ts\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { isEqual } from \"../render/utils/isEqual.ts\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport { isNumber, isObject, isString } from \"../utils/utils.ts\"\nimport type { FXValues } from \"./useFXValues.ts\"\nimport {\n\tdefaultFXValues,\n\teffectDisabledStyle,\n\teffectEnabledStyle,\n\teffectValuesKeys,\n\tisFXValuesKey,\n\tmakeFXValues,\n} from \"./useFXValues.ts\"\n\ntype EffectOrMotionProp<T> =\n\t| (Partial<Record<keyof FXValues, number>> & { transition: ValueAnimationTransition<number> })\n\t| T\n\nfunction isTargetAndTransition(value: unknown): value is TargetAndTransition {\n\treturn typeof value === \"object\" && value !== null\n}\n\nfunction getTransition(value: EffectOrMotionProp<MotionProps[\"animate\"]>) {\n\tif (!isTargetAndTransition(value)) return undefined\n\treturn value?.transition\n}\n\nfunction runEffectAnimation(\n\ttarget: EffectOrMotionProp<MotionProps[\"animate\"]>,\n\teffect: { values: FXValues },\n\tshouldReduceMotion: boolean | null,\n\tref: MutableRefCallback<HTMLElement>,\n\tappearId?: unknown,\n\tinstant?: boolean,\n) {\n\tconst transition = getTransition(target)\n\n\treturn Promise.all(\n\t\teffectValuesKeys.map(key => {\n\t\t\treturn new Promise<void>(resolve => {\n\t\t\t\tif (shouldReduceMotion && key !== \"opacity\") return resolve()\n\n\t\t\t\tconst motionValue = effect.values[key]\n\n\t\t\t\tmotionValue.stop()\n\n\t\t\t\tlet value = !isTargetAndTransition(target) ? defaultFXValues[key] : (target?.[key] ?? defaultFXValues[key])\n\t\t\t\tif (isMotionValue(value)) value = value.get()\n\t\t\t\tif (!isNumber(value)) return resolve()\n\n\t\t\t\t// Update the base target for this value. The base target is the\n\t\t\t\t// value that Motion will animate to if a value disappears from\n\t\t\t\t// all props. For example, if we have `whileHover` set but the\n\t\t\t\t// value isn't defined in `animate`.\n\t\t\t\t//\n\t\t\t\t// This is usually not necessary but this composed MotionValue\n\t\t\t\t// is opaque to Framer Motion.\n\t\t\t\tconst visualElement = visualElementStore.get(ref.current)\n\t\t\t\tif (visualElement) visualElement.setBaseTarget(key, value)\n\n\t\t\t\t// If this is the first time a value is being animated, check to\n\t\t\t\t// see if we're handling off from an existing animation.\n\t\t\t\tlet startTime: number | undefined\n\t\t\t\tif (isString(appearId) && !motionValue?.hasAnimated && safeWindow.MotionHandoffAnimation) {\n\t\t\t\t\tconst handoffAnimationStartTime = safeWindow.MotionHandoffAnimation(appearId, key, frame)\n\t\t\t\t\tif (handoffAnimationStartTime) {\n\t\t\t\t\t\tstartTime = handoffAnimationStartTime\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (instant) {\n\t\t\t\t\tmotionValue.set(value)\n\t\t\t\t} else {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\t\t\tanimate(motionValue, value, {\n\t\t\t\t\t\t...transition,\n\t\t\t\t\t\tvelocity: 0,\n\t\t\t\t\t\tstartTime,\n\t\t\t\t\t\tonComplete: () => resolve(),\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t})\n\t\t}),\n\t)\n}\n\nexport interface PresenceEffectOptions {\n\tinitial?: EffectOrMotionProp<MotionProps[\"initial\"]>\n\tanimate?: EffectOrMotionProp<MotionProps[\"animate\"]>\n\texit?: EffectOrMotionProp<MotionProps[\"exit\"]>\n\n\t// Prefixed props\n\tpresenceInitial?: EffectOrMotionProp<MotionProps[\"initial\"]>\n\tpresenceAnimate?: EffectOrMotionProp<MotionProps[\"animate\"]>\n\tpresenceExit?: EffectOrMotionProp<MotionProps[\"exit\"]>\n}\n\n/**\n * Extract prefixed keys. These will only be present if the ground node of a\n * Smart Component has an appear effect. This is necessary so we don't conflict\n * with props that control the active variant.\n */\nexport const presenceOptionsKeys = new Set<keyof PresenceEffectOptions>([\n\t\"presenceInitial\",\n\t\"presenceAnimate\",\n\t\"presenceExit\",\n])\n\nexport function usePresenceAnimation(\n\t{\n\t\tinitial: motionInitial,\n\t\tanimate: motionAnimate,\n\t\texit: motionExit,\n\t\tpresenceInitial,\n\t\tpresenceAnimate,\n\t\tpresenceExit,\n\t}: PresenceEffectOptions,\n\tref: MutableRefCallback<HTMLElement>,\n\tenabled: boolean,\n\tstyle?: MotionStyle,\n\tappearId?: unknown,\n) {\n\tconst initial = presenceInitial ?? motionInitial\n\tconst animateConfig = presenceAnimate ?? motionAnimate\n\tconst exit = presenceExit ?? motionExit\n\tconst [isPresent, safeToRemove] = usePresence()\n\tconst internalState = useRef({\n\t\tlastPresence: false,\n\t\tlastAnimate: animateConfig,\n\t\thasMounted: false,\n\t\trunning: false,\n\t})\n\n\tconst effect = useConstant(() => {\n\t\t// By falling back to style when initial is not defined, we create a\n\t\t// type too complex for typescript to understand. the types here could\n\t\t// be provided by a user, casting to unknown values solves the complex\n\t\t// type, but also forces us to narrow the type properly at runtime.\n\t\tconst base = (initial ?? style) as Record<string, unknown>\n\t\tif (!isObject(base)) return { values: makeFXValues() }\n\t\tconst defaults: Record<string, number> = {}\n\t\tfor (const key in base) {\n\t\t\tconst value = isObject(base) ? base[key] : undefined\n\t\t\tif (!isNumber(value)) continue\n\t\t\tdefaults[key] = value\n\t\t}\n\n\t\treturn { values: makeFXValues(defaults) }\n\t})\n\n\t// On mount, and whenever animateConfig is removed, make sure that Motion\n\t// knows that the value we provided as a motion value may not be the base.\n\t// We need to run when the animate prop is removed to tell Motion what the\n\t// new base for the motion values are.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: This hook must only run on mount and when the animateConfig changes.\n\tuseRefEffect(\n\t\tref,\n\t\t(element: HTMLElement | null) => {\n\t\t\tconst { hasMounted } = internalState.current\n\t\t\tif (hasMounted && animateConfig) return\n\n\t\t\tconst visualElement = visualElementStore.get(element)\n\t\t\tif (!visualElement) return\n\n\t\t\tObject.assign(internalState.current, { hasMounted: true })\n\t\t\tfor (const key in effect.values) {\n\t\t\t\tif (!isFXValuesKey(key)) continue\n\t\t\t\tconst value = style?.[key]\n\t\t\t\tvisualElement.setBaseTarget(key, isNumber(value) ? value : defaultFXValues[key])\n\t\t\t}\n\t\t},\n\t\t[animateConfig],\n\t)\n\n\tconst shouldReduceMotion = useReducedMotionConfig()\n\tuseRefEffect(ref, (element: HTMLElement | null) => {\n\t\tif (!enabled) {\n\t\t\t// By calling the usePresence hook, motion will now only allow the\n\t\t\t// component to be removed from the DOM if we call safeToRemove, so\n\t\t\t// if this effect is not enabled, call safeToRemove immediately.\n\t\t\tsafeToRemove?.()\n\t\t\treturn\n\t\t}\n\t\tif (element === null) return\n\n\t\tif (isPresent !== internalState.current.lastPresence) {\n\t\t\t// If the presence of the motion element has changed, try to run an\n\t\t\t// animation.\n\t\t\tObject.assign(internalState.current, { lastPresence: isPresent })\n\t\t\tif (isPresent) {\n\t\t\t\tif (initial && animateConfig) {\n\t\t\t\t\tObject.assign(internalState.current, { running: true })\n\t\t\t\t\tvoid runEffectAnimation(animateConfig, effect, shouldReduceMotion, ref, appearId).then(() =>\n\t\t\t\t\t\tObject.assign(internalState.current, { running: false }),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t} else if (exit) {\n\t\t\t\tObject.assign(internalState.current, { running: true })\n\t\t\t\tvoid runEffectAnimation(exit, effect, shouldReduceMotion, ref, appearId)\n\t\t\t\t\t.then(() => Object.assign(internalState.current, { running: false }))\n\t\t\t\t\t.then(() => safeToRemove())\n\t\t\t} else {\n\t\t\t\tsafeToRemove()\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// Otherwise, if the animate prop has changed, update values to\n\t\t// reflect the new config. If the animation is not running, and we\n\t\t// have previously mounted, instantly set all the motion values to\n\t\t// the new target. This happens when the appear animation happens on\n\t\t// some other variant than the current one.\n\t\tconst { lastAnimate, running } = internalState.current\n\t\tconst hasAnimateChanged = !isEqual(animateConfig, lastAnimate)\n\t\tif (!hasAnimateChanged || !animateConfig) return\n\t\tObject.assign(internalState.current, { lastAnimate: animateConfig })\n\t\tvoid runEffectAnimation(animateConfig, effect, shouldReduceMotion, ref, appearId, !running).then(() =>\n\t\t\tObject.assign(internalState.current, { running: false }),\n\t\t)\n\t})\n\n\tconst effectEnabled = enabled && animateConfig\n\n\treturn useMemo(() => {\n\t\treturn { values: effect.values, style: effectEnabled ? effectEnabledStyle : effectDisabledStyle }\n\t}, [effectEnabled])\n}\n", "import type { TargetAndTransition, Transition, ValueAnimationTransition } from \"framer-motion\"\nimport { animate, scroll, transform, useReducedMotionConfig, visualElementStore } from \"framer-motion\"\nimport React, { useMemo } from \"react\"\nimport type { MutableRefCallback } from \"../components/utils/refHelper.ts\"\nimport { useCurrentRouteKey, useOnRouteChange } from \"../router/useCurrentRoute.tsx\"\nimport { asRecord } from \"../utils/asRecord.ts\"\nimport { isNumber } from \"../utils/utils.ts\"\nimport type { EffectScrollTarget } from \"./createTransformInputRange.ts\"\nimport { createTransformInputRange } from \"./createTransformInputRange.ts\"\nimport type { Prefixed } from \"./hocOptions.ts\"\nimport { useAppearEffect } from \"./useAppearEffect.ts\"\nimport type { FXValues } from \"./useFXValues.ts\"\nimport {\n\tdefaultFXValues,\n\teffectDisabledStyle,\n\teffectEnabledStyle,\n\teffectValuesKeys,\n\tuseFXValues,\n} from \"./useFXValues.ts\"\nimport { useScrollDirectionChange } from \"./useScrollDirectionChange.ts\"\n\ninterface StyleEffect extends Record<keyof FXValues, number> {\n\ttransition?: Transition\n}\nexport interface StyleAppearEffectOptions {\n\tstyleAppearEffectEnabled: boolean | undefined\n\tthreshold: number | undefined\n\tanimateOnce: boolean\n\t/**\n\t * Because we are using framer-motion variants with an `initial` value to\n\t * allow us to avoid problems with static generation, we need to know what\n\t * the target opacity or rotate should be, since it may not always be 1, and can't be\n\t * read from the DOM. This is because the DOM will have already been written\n\t * with the above `opacity` value at mount.\n\t */\n\ttargetOpacity: number | undefined\n\topacity: number | undefined\n\tx: number | undefined\n\ty: number | undefined\n\tscale: number | undefined\n\ttransition: Transition | undefined\n\trotate: number | undefined\n\trotateX: number | undefined\n\trotateY: number | undefined\n\tperspective: number | undefined\n\n\tenter: Readonly<StyleEffect>\n\texit: Readonly<StyleEffect>\n\tanimate: Partial<Readonly<StyleEffect>>\n\n\ttargets?: EffectStyleScrollTarget[]\n\tscrollDirection?: EffectStyleScrollTarget\n}\n\ntype EffectStyleScrollTarget = EffectScrollTarget<StyleEffect>\n\nexport type PrefixedStyleAppearEffectOptions = Prefixed<StyleAppearEffectOptions>\n\nexport const styleAppearOptionsKeys = new Set<keyof StyleAppearEffectOptions>([\n\t\"threshold\",\n\t\"animateOnce\",\n\t\"opacity\",\n\t\"targetOpacity\",\n\t\"x\",\n\t\"y\",\n\t\"scale\",\n\t\"transition\",\n\t\"rotate\",\n\t\"rotateX\",\n\t\"rotateY\",\n\t\"perspective\",\n\t\"enter\",\n\t\"exit\",\n\t\"animate\",\n\t\"styleAppearEffectEnabled\",\n\t\"targets\",\n\t\"scrollDirection\",\n])\n\ninterface InternalState extends Record<string, unknown> {\n\tisPlaying: boolean\n\tscheduledAppearState: undefined | boolean\n\tlastAppearState: boolean | string\n}\n\ninterface InputOutputRanges {\n\tinputRange: number[]\n\toutputRange: string[]\n}\n\nconst defaultOutputRange = [\"animate\", \"animate\"]\nconst defaultRanges: InputOutputRanges = { inputRange: [], outputRange: [] }\n\n// The input and output ranges must match. Since the API to generate the input\n// range creates tuples for the start and end of a 'section', we also create\n// tuples for our variants, except for Exit, since that has no defined end.\nfunction createInputOutputRange(\n\ttargets: EffectStyleScrollTarget[],\n\tthreshold: number,\n\thasExit: boolean,\n): InputOutputRanges {\n\tconst inputRange = createTransformInputRange(targets, threshold)\n\tconst outputRange = [...defaultOutputRange]\n\n\tconst firstRange = inputRange[0]\n\tif (!isNumber(firstRange)) return defaultRanges\n\tif (firstRange > 1) {\n\t\tinputRange.unshift(0, firstRange - 1)\n\t\toutputRange.unshift(\"initial\", \"initial\")\n\t}\n\n\tif (hasExit) {\n\t\tconst idx = inputRange.length - 1\n\t\tconst last = inputRange[idx]\n\t\tif (!isNumber(last)) return defaultRanges\n\t\tinputRange.push(last + 1)\n\t\toutputRange.push(\"exit\")\n\t}\n\n\treturn {\n\t\tinputRange,\n\t\toutputRange,\n\t}\n}\n\nfunction makeStyle(defaults?: Partial<StyleEffect>): Readonly<StyleEffect> {\n\treturn {\n\t\tx: defaults?.x ?? defaultFXValues.x,\n\t\ty: defaults?.y ?? defaultFXValues.y,\n\t\tscale: defaults?.scale ?? defaultFXValues.scale,\n\t\topacity: defaults?.opacity ?? defaultFXValues.opacity,\n\t\ttransformPerspective: defaults?.transformPerspective ?? defaultFXValues.transformPerspective,\n\t\trotate: defaults?.rotate ?? defaultFXValues.rotate,\n\t\trotateX: defaults?.rotateX ?? defaultFXValues.rotateX,\n\t\trotateY: defaults?.rotateY ?? defaultFXValues.rotateY,\n\t\tskewX: defaults?.skewX ?? defaultFXValues.skewX,\n\t\tskewY: defaults?.skewY ?? defaultFXValues.skewY,\n\t\ttransition: defaults?.transition ?? undefined,\n\t}\n}\n\nfunction useAnimationVariants({\n\topacity,\n\ttargetOpacity,\n\tperspective: transformPerspective,\n\tenter,\n\texit,\n\tanimate: animateVariant,\n\t...defaultStyles\n}: Partial<StyleAppearEffectOptions>) {\n\treturn React.useMemo(\n\t\t() =>\n\t\t\t({\n\t\t\t\tinitial:\n\t\t\t\t\tenter ??\n\t\t\t\t\tmakeStyle({\n\t\t\t\t\t\t...defaultStyles,\n\t\t\t\t\t\topacity: opacity ?? targetOpacity ?? 1,\n\t\t\t\t\t\ttransformPerspective,\n\t\t\t\t\t}),\n\t\t\t\tanimate:\n\t\t\t\t\tanimateVariant ??\n\t\t\t\t\tmakeStyle({\n\t\t\t\t\t\topacity: targetOpacity,\n\t\t\t\t\t}),\n\t\t\t\texit: exit ?? makeStyle(),\n\t\t\t}) as const,\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: `defaultStyles` makes this memo re-run on every render, but that appears to be fine.\n\t\t[animateVariant, defaultStyles, enter, exit, opacity, targetOpacity, transformPerspective],\n\t)\n}\n\nexport function useStyleAppearEffect(\n\toptions: Partial<StyleAppearEffectOptions>,\n\tref: MutableRefCallback<HTMLElement>,\n): { values: FXValues; style: React.CSSProperties } {\n\tconst shouldReduceMotion = useReducedMotionConfig()\n\tconst variants = useAnimationVariants(options)\n\tconst enabled = options.styleAppearEffectEnabled\n\tconst effect = useFXValues(enabled ? variants.initial : variants.animate, enabled)\n\n\tconst playState = React.useRef<InternalState>({\n\t\tisPlaying: false,\n\t\tscheduledAppearState: undefined,\n\t\tlastAppearState: !options.styleAppearEffectEnabled,\n\t})\n\n\tconst currentRouteKey = useCurrentRouteKey()\n\n\t/**\n\t * Record the promise of the last animation so we can await it.\n\t */\n\t// biome-ignore lint/suspicious/noConfusingVoidType: void is correct here since we return `Promise<void>`'s\n\tconst animation = React.useRef<Promise<void[]>>()\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: All dependencies are object values or stable.\n\tconst runAnimation = React.useCallback(\n\t\tasync ({ transition, ...target }: TargetAndTransition, fromInitial?: boolean) => {\n\t\t\t// Use a transition from the TransitionAndTarget, or use the\n\t\t\t// `animate` transition if provided, finally falling back to a\n\t\t\t// legacy `options.transition` for previously generated effects.\n\t\t\tconst transitionWithFallback = transition ?? variants.animate.transition ?? options.transition\n\n\t\t\t// Wait for currently running animations to finish.\n\t\t\tawait animation.current\n\n\t\t\tconst visualElement = visualElementStore.get(ref.current)\n\n\t\t\t// Start animations, optionally starting from the initial values.\n\t\t\t// eslint-disable-next-line require-atomic-updates -- non-atomic updates to react refs are fine.\n\t\t\tanimation.current = Promise.all(\n\t\t\t\teffectValuesKeys.map((key: keyof FXValues) => {\n\t\t\t\t\tif (fromInitial) effect.values[key].set(variants.initial[key] ?? defaultFXValues[key])\n\n\t\t\t\t\tconst toValue = target[key] ?? defaultFXValues[key]\n\n\t\t\t\t\t/**\n\t\t\t\t\t * Update the base target for this value. The base target is the value that\n\t\t\t\t\t * Motion will animate to if a value disappears from all props. For example,\n\t\t\t\t\t * if we have `whileHover` set but the value isn't defined in `animate`.\n\t\t\t\t\t *\n\t\t\t\t\t * This is usually not necessary but this composed MotionValue is opaque to\n\t\t\t\t\t * Framer Motion.\n\t\t\t\t\t */\n\t\t\t\t\tif (visualElement && typeof toValue !== \"object\") {\n\t\t\t\t\t\tvisualElement.setBaseTarget(key, toValue)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn new Promise<void>(resolve => {\n\t\t\t\t\t\tif (shouldReduceMotion && key !== \"opacity\") {\n\t\t\t\t\t\t\tif (isNumber(toValue)) effect.values[key].set(toValue)\n\t\t\t\t\t\t\tresolve()\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst opts: ValueAnimationTransition = {\n\t\t\t\t\t\t\t\trestDelta: key === \"scale\" ? 0.001 : undefined,\n\t\t\t\t\t\t\t\t...transitionWithFallback,\n\t\t\t\t\t\t\t\tonComplete: () => resolve(),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// @TODO: Ignored for now, but should re-check later.\n\t\t\t\t\t\t\tif (typeof toValue === \"number\") {\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\t\t\t\t\t\tanimate(effect.values[key], toValue, opts)\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[],\n\t)\n\n\t// If we are animating based on this element's visibility in the viewport,\n\t// we use an Intersection Observer.\n\tconst hasAnimatedOnce = options.animateOnce && playState.current.lastAppearState === true\n\tconst animateWithIntersectionObserver =\n\t\t!options.targets && options.styleAppearEffectEnabled && !options.scrollDirection && !hasAnimatedOnce\n\n\tuseAppearEffect(\n\t\tref,\n\t\t(appears: boolean) => {\n\t\t\tconst { isPlaying, lastAppearState } = playState.current\n\n\t\t\tif (isPlaying) {\n\t\t\t\tplayState.current.scheduledAppearState = appears\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tplayState.current.scheduledAppearState = undefined\n\t\t\tplayState.current.lastAppearState = appears\n\n\t\t\tif (lastAppearState === appears) return\n\n\t\t\tvoid runAnimation(appears ? variants.animate : variants.exit, appears)\n\t\t},\n\t\t{\n\t\t\tenabled: animateWithIntersectionObserver,\n\t\t\tanimateOnce: !!options.animateOnce,\n\t\t\tthreshold: {\n\t\t\t\ty: options.threshold,\n\t\t\t},\n\t\t},\n\t)\n\n\t// If we are animating based on another layers offset from the top of the\n\t// browser viewport, we use motionone's `scroll` polyfill for the scroll\n\t// timeline API.\n\tconst animateWithScrollInfo = options.targets && enabled && !options.scrollDirection\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: All dependencies are object values or stable.\n\tReact.useEffect(() => {\n\t\tif (!animateWithScrollInfo) return\n\n\t\t// Track if we have animated to a variant. This allows us to avoid\n\t\t// running that animation more than once if  \"animateOnce\" is true. We\n\t\t// must initialize the object with `initial: true` to prevent animating\n\t\t// from `animate` --> `initial` when `replay` is false.\n\t\tconst playedState: Record<string, boolean> = { initial: true }\n\n\t\t// Reset state when the route changes.\n\t\tconst _ = currentRouteKey\n\n\t\tlet lastVariant = \"initial\"\n\n\t\treturn scroll((_, { y: scrollY }) => {\n\t\t\tconst { targets } = options\n\t\t\tif (!targets) return\n\n\t\t\t// It can be that this function fires after scroll target refs have\n\t\t\t// been dehydrated. Check the first target to see if it is still\n\t\t\t// hydrated and bail if not.\n\t\t\tif (!targets[0] || (targets[0].ref && !targets[0].ref.current)) return\n\n\t\t\tconst { inputRange, outputRange } = createInputOutputRange(\n\t\t\t\ttargets,\n\t\t\t\t(options.threshold ?? 0) * scrollY.containerLength,\n\t\t\t\t!!options.exit,\n\t\t\t)\n\n\t\t\t// The input range can be empty if a ref is missing or unset.\n\t\t\t// Transform ranges must have the same number of entries. If target\n\t\t\t// refs are missing these ranges may not match. In which case do not\n\t\t\t// run the effect.\n\t\t\tif (inputRange.length === 0 || inputRange.length !== outputRange.length) return\n\n\t\t\tconst variant = transform(scrollY.current, inputRange, outputRange)\n\n\t\t\t// If we are only allowed to animate to a variant once, return early\n\t\t\t// if we have animated to it before.\n\t\t\tif (options.animateOnce && playedState[variant]) return\n\t\t\tplayedState[variant] = true\n\n\t\t\t// Prevent unnecessary animations by early returning if the\n\t\t\t// currently active variant is the last variant animated to.\n\t\t\tif (lastVariant === variant) return\n\t\t\tlastVariant = variant\n\t\t\tconst variantAnimation = asRecord(variants)[variant]\n\t\t\tif (!variantAnimation) return\n\t\t\tvoid runAnimation(variantAnimation)\n\t\t})\n\t}, [currentRouteKey, animateWithScrollInfo])\n\n\tuseScrollDirectionChange(options.scrollDirection, target => void runAnimation(target ?? variants.animate), {\n\t\tenabled,\n\t\trepeat: !options.animateOnce,\n\t})\n\n\tuseOnRouteChange(() => {\n\t\tif (!enabled) return\n\t\tif (!options.targets && !options.scrollDirection) return\n\t\tfor (const key of effectValuesKeys) {\n\t\t\teffect.values[key].set(variants.initial?.[key] ?? defaultFXValues[key])\n\t\t}\n\t})\n\n\treturn useMemo(() => {\n\t\treturn { values: effect.values, style: enabled ? effectEnabledStyle : effectDisabledStyle }\n\t}, [enabled])\n}\n", "/**\n * OffsetTop must be calculated by looping. See motionone:\n * https://github.com/motiondivision/motionone/blob/main/packages/dom/src/gestures/scroll/offsets/inset.ts\n */\nexport function calcOffsetTop(element: Element, container: HTMLElement) {\n\tlet top = 0\n\n\tlet current: Element | null = element\n\twhile (current && current !== container) {\n\t\tif (!(current instanceof HTMLElement)) break\n\n\t\ttop += current.offsetTop\n\t\tcurrent = current.offsetParent\n\t}\n\n\treturn top\n}\n", "import type React from \"react\"\nimport { calcOffsetTop } from \"./calculateOffsetTop.ts\"\n\nexport type ScrollDirection = \"up\" | \"down\"\n\nexport interface EffectScrollTarget<T> {\n\tref?: React.RefObject<HTMLElement>\n\toffset?: number\n\tdirection?: ScrollDirection\n\ttarget: T\n}\n\n/**\n * When scrolling directly to an element with element.scrollIntoView(), the\n * scroll progress will be exactly 0, but users expect that to trigger the\n * animation. We add -1 offset to ensure that the progress is guaranteed to be >\n * 0 if scrolled to with this API.\n */\nconst scrollObserverOffset = 1\n\nexport function createTransformInputRange(\n\ttransformTargets: EffectScrollTarget<unknown>[],\n\tthreshold: number = 0,\n\t/**\n\t * A callback to be executed once for every transform target with the index\n\t * of the target. This callback will be called in reverse index order, so\n\t * callee's may need to use `unshift` to build the right output range.\n\t */\n\tcallback?: (index: number) => void,\n) {\n\t// Starting from the last transform target, record the offsetTop of each\n\t// ref. This is used to compare while iterating from last to first.\n\tconst starts: number[] = []\n\n\t// Build an array of input ranges in px values from the top of the page.\n\t// These are pairs where each pair is the offset from the top of the page to\n\t// the element, and the offset from the top of the page to the end of the\n\t// element, or the top of the next element, whichever is smaller. There may\n\t// be dead space between these pairs, or they may be sequential. e.g.\n\t// [ 200, 500, 800, 900 ]\n\tconst inputRange: number[] = []\n\n\tfor (let index = transformTargets.length; index >= 0; index--) {\n\t\tconst { ref: targetRef, offset } = transformTargets[index] ?? {}\n\t\tif (!targetRef || !targetRef.current) continue\n\n\t\tconst offsetTop = calcOffsetTop(targetRef.current, document.documentElement)\n\t\tconst top = offsetTop - scrollObserverOffset - (offset ?? 0) - threshold\n\t\tconst height = targetRef.current?.clientHeight ?? 0\n\n\t\t// The end is which ever is higher up the page, the end of this\n\t\t// element, or the start of the next.\n\t\tconst previousTop = starts[starts.length - 1]\n\t\tconst end = Math.max(top + height, 0)\n\n\t\t// Track this start offset. We will use it to compare the next target.\n\t\tstarts.push(top)\n\n\t\tinputRange.unshift(Math.max(top, 0), previousTop === undefined ? end : Math.min(end, Math.max(previousTop - 1, 0)))\n\n\t\t// In cases where performance is important, instead of iterating through\n\t\t// targets a second time, we can execute a callback with the current\n\t\t// index.\n\t\tcallback?.(index)\n\t}\n\n\treturn inputRange\n}\n", "import { scroll } from \"framer-motion\"\nimport React from \"react\"\nimport { useCurrentRouteKey } from \"../router/useCurrentRoute.tsx\"\nimport type { EffectScrollTarget, ScrollDirection } from \"./createTransformInputRange.ts\"\n\nfunction currentScrollDirection(offset: number, lastOffset: number = 0): ScrollDirection {\n\tif (offset < lastOffset) return \"up\"\n\treturn \"down\"\n}\n\nconst scrollDirectionThreshold = 4\n\ninterface Options {\n\trepeat?: boolean\n\tenabled?: boolean\n}\n\nexport function useScrollDirectionChange<T extends EffectScrollTarget<unknown>>(\n\tscrollDirection: T | undefined,\n\tcb: (value: T[\"target\"] | undefined) => void,\n\toptions: Options = {},\n) {\n\tconst { direction, target } = scrollDirection ?? {}\n\tconst { repeat = true, enabled = true } = options\n\tconst currentRouteKey = useCurrentRouteKey()\n\tReact.useEffect(() => {\n\t\tif (!direction || !enabled) return\n\n\t\t// Reset the effect state when the route changes.\n\t\tconst _ = currentRouteKey\n\n\t\t// Track the last y offset to determine when the scroll direction\n\t\t// changes.\n\t\tlet lastOffset: number | undefined = undefined\n\t\t// When the direction changes, record the current offset so that we can\n\t\t// trigger the effect only when the scroll has continued past this point\n\t\t// by a threshold.\n\t\tlet directionChangeOffset: number = 0\n\t\t// Track the current direction so that we can trigger an effect when it\n\t\t// changes.\n\t\tlet lastDirection: ScrollDirection | undefined = undefined\n\t\t// Track the target that the effect is currently animated too, so that\n\t\t// we can only update the target when it changes.\n\t\tlet currentTarget: T[\"target\"] | undefined = undefined\n\t\treturn scroll((_, { y: scrollY }) => {\n\t\t\tif (!repeat && currentTarget === target) return\n\n\t\t\t// Don't allow overscroll to impact the direction calculations.\n\t\t\tif (scrollY.current > scrollY.scrollLength) return\n\t\t\tif (scrollY.current < 0) return\n\n\t\t\tconst d = currentScrollDirection(scrollY.current, lastOffset)\n\t\t\tlastOffset = scrollY.current\n\n\t\t\tconst hasDirectionChanged = d !== lastDirection\n\t\t\tlastDirection = d\n\n\t\t\tif (hasDirectionChanged) {\n\t\t\t\tdirectionChangeOffset = scrollY.current\n\t\t\t} else {\n\t\t\t\tconst delta = Math.abs(scrollY.current - directionChangeOffset)\n\t\t\t\tif (delta < scrollDirectionThreshold) return\n\t\t\t\tconst nextTarget = d === direction ? target : undefined\n\t\t\t\tif (nextTarget !== currentTarget) cb(nextTarget)\n\t\t\t\tcurrentTarget = nextTarget\n\t\t\t}\n\t\t})\n\t}, [currentRouteKey, direction, repeat, target, enabled, cb])\n}\n", "import type { MotionStyle, MotionValue, SpringOptions } from \"framer-motion\"\nimport { animateValue, frame, scroll, transform, useReducedMotionConfig } from \"framer-motion\"\nimport React, { useLayoutEffect } from \"react\"\nimport type { MutableRefCallback } from \"../components/utils/refHelper.ts\"\nimport { useRefEffect } from \"../components/utils/refHelper.ts\"\nimport { useCurrentRouteKey, useOnRouteChange } from \"../router/useCurrentRoute.tsx\"\nimport { objectKeys } from \"../utils/objectKeys.ts\"\nimport type { EffectScrollTarget } from \"./createTransformInputRange.ts\"\nimport { createTransformInputRange } from \"./createTransformInputRange.ts\"\nimport type { Prefixed } from \"./hocOptions.ts\"\nimport type { FXValues } from \"./useFXValues.ts\"\nimport {\n\tdefaultFXValues,\n\teffectDisabledStyle,\n\teffectEnabledStyle,\n\teffectValuesKeys,\n\tuseFXValues,\n} from \"./useFXValues.ts\"\n\nexport interface StyleTransformEffectOptions {\n\tstyleTransformEffectEnabled: boolean | undefined\n\ttransformViewportThreshold: number | undefined\n\tspring: SpringOptions\n\ttransformTrigger: \"onScroll\" | \"onInView\" | \"onScrollTarget\" | undefined\n\ttransformTargets: EffectStyleScrollTarget[] | undefined\n}\n\nexport type PrefixedStyleTransformEffectOptions = Prefixed<StyleTransformEffectOptions>\n\nexport const styleTransformOptionsKeys = new Set<keyof StyleTransformEffectOptions>([\n\t\"transformViewportThreshold\",\n\t\"styleTransformEffectEnabled\",\n\t\"transformTargets\",\n\t\"spring\",\n\t\"transformTrigger\",\n])\n\nconst defaultValues = (\n\ttransformTargets: EffectStyleScrollTarget[] | undefined,\n\tshouldReduceMotion: boolean | null,\n): Partial<Record<keyof FXValues, number>> | undefined => {\n\tconst initial = transformTargets?.[0]?.target\n\treturn shouldReduceMotion ? { opacity: initial?.opacity ?? 1 } : initial\n}\n\nconst defaultRanges = (): Record<keyof FXValues, number[]> => ({\n\topacity: [],\n\tx: [],\n\ty: [],\n\tscale: [],\n\trotate: [],\n\trotateX: [],\n\trotateY: [],\n\tskewX: [],\n\tskewY: [],\n\ttransformPerspective: [],\n})\n\n// Add spring animations to motion values. This uses a private motion API to\n// replicate `useScroll`, but in an optional way that allows the user to decide\n// when to enable or disable the spring effect.\nfunction useAttachOptionalSpring(\n\tvalues: Record<keyof FXValues, MotionValue<number>>,\n\tspring: SpringOptions | undefined,\n) {\n\tconst springs = React.useRef({} as Record<keyof FXValues, ReturnType<typeof animateValue>>)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: We already check for json stringified spring\n\tReact.useEffect(() => {\n\t\tif (spring === undefined) return\n\n\t\tfor (const key of objectKeys(values)) {\n\t\t\tconst m: MotionValue<number> = values[key]\n\n\t\t\tlet latestSetter: (value: number) => void\n\t\t\tlet latestValue: number\n\n\t\t\tfunction startAnimation() {\n\t\t\t\tconst active = springs.current[key]\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-misused-promises -- wrong inferred type\n\t\t\t\tif (active) active.stop()\n\n\t\t\t\tsprings.current[key] = animateValue({\n\t\t\t\t\tkeyframes: [m.get(), latestValue],\n\t\t\t\t\tvelocity: m.getVelocity(),\n\t\t\t\t\t...spring,\n\t\t\t\t\trestDelta: 0.001,\n\t\t\t\t\tonUpdate: latestSetter,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// @ts-expect-error - this is a private API.\n\t\t\tm.attach((v, set) => {\n\t\t\t\tlatestValue = v\n\t\t\t\tlatestSetter = set\n\t\t\t\tframe.postRender(startAnimation)\n\t\t\t\treturn m.get()\n\t\t\t})\n\t\t}\n\t}, [JSON.stringify(spring)])\n}\n\ntype EffectStyleScrollTarget = EffectScrollTarget<Record<keyof FXValues, number>>\n\nfunction createInputOutputRanges(transformTargets: EffectStyleScrollTarget[], threshold: number) {\n\t// Build an object mapping style keys to their output range. e.g. {opacity:\n\t// [ 0, 0.5, 0.5, 1 ] }. These are pairs, where the first entry is the\n\t// proceeding transformTarget's to, and the second entry is the current\n\t// transformTarget's to. This ensures that we don't update the motion value\n\t// if there is dead space between input offsets.\n\tconst effectKeyOutputRange = defaultRanges()\n\tconst inputRange = createTransformInputRange(transformTargets, threshold, index => {\n\t\tconst previousTarget = transformTargets[index - 1]?.target\n\t\tconst currentTarget = transformTargets[index]?.target\n\t\tfor (const key of effectValuesKeys) {\n\t\t\teffectKeyOutputRange[key]?.unshift(previousTarget?.[key] ?? 0, currentTarget?.[key] ?? 0)\n\t\t}\n\t})\n\n\treturn { inputRange, effectKeyOutputRange }\n}\n\nfunction createPageOutputRange(transformTargets: EffectStyleScrollTarget[]) {\n\tconst keyOutputRange = defaultRanges()\n\n\tfor (const { target } of transformTargets) {\n\t\tfor (const key of effectValuesKeys) keyOutputRange[key]?.push(target[key])\n\t}\n\n\treturn keyOutputRange\n}\n\nconst pageInputRange = [0, 1]\n\nexport function useStyleTransform(\n\t{\n\t\ttransformTrigger,\n\t\tstyleTransformEffectEnabled,\n\t\ttransformTargets,\n\t\tspring,\n\t\ttransformViewportThreshold = 0,\n\t}: Partial<StyleTransformEffectOptions>,\n\tref: MutableRefCallback<HTMLElement>,\n): { values: FXValues; style: MotionStyle | undefined } {\n\tconst shouldReduceMotion = useReducedMotionConfig()\n\tconst effect = useFXValues(defaultValues(transformTargets, shouldReduceMotion), styleTransformEffectEnabled)\n\tconst effectDisabled = !styleTransformEffectEnabled || !transformTargets\n\tconst triggerOnScroll = transformTrigger === \"onScrollTarget\"\n\tconst currentRouteKey = useCurrentRouteKey()\n\n\tuseLayoutEffect(() => {\n\t\tif (effectDisabled || !triggerOnScroll) return\n\n\t\t// create offsets based on the provided targets.\n\t\treturn scroll((_, { y: scrollY }) => {\n\t\t\t// It can be that this function fires after scroll target refs have been\n\t\t\t// dehydrated. Check the first target to see if it is still hydrated and\n\t\t\t// bail if not.\n\t\t\tif (!transformTargets[0] || (transformTargets[0].ref && !transformTargets[0].ref.current)) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst { inputRange: scrollYInputRange, effectKeyOutputRange } = createInputOutputRanges(\n\t\t\t\ttransformTargets,\n\t\t\t\ttransformViewportThreshold * scrollY.containerLength,\n\t\t\t)\n\n\t\t\t// The input range can be empty if a ref is missing or unset.\n\t\t\tif (scrollYInputRange.length === 0) return\n\n\t\t\t// Finally, transform all of the values.\n\t\t\tfor (const key of effectValuesKeys) {\n\t\t\t\tif (shouldReduceMotion && key !== \"opacity\") continue\n\t\t\t\t// Transform ranges must have the same number of entries.\n\t\t\t\tif (scrollYInputRange.length !== effectKeyOutputRange[key].length) continue\n\n\t\t\t\t// If a value is undefined, we don't interpolate it\n\t\t\t\tif (effectKeyOutputRange[key][0] === undefined) continue\n\n\t\t\t\teffect.values[key].set(transform(scrollY.current, scrollYInputRange, effectKeyOutputRange[key]))\n\t\t\t}\n\t\t})\n\t}, [shouldReduceMotion, triggerOnScroll, transformViewportThreshold, transformTargets, effectDisabled])\n\n\tuseRefEffect(\n\t\tref,\n\t\t(element: HTMLElement | null) => {\n\t\t\tif (effectDisabled || triggerOnScroll || element === null) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Reset state when the route changes.\n\t\t\tconst _ = currentRouteKey\n\n\t\t\tconst outputRange = createPageOutputRange(transformTargets)\n\n\t\t\t// If the effect isn't controlled by target refs, we can scroll\n\t\t\t// based on the page, using motionone's built in offsets.\n\t\t\treturn scroll(\n\t\t\t\t(_, { y: scrollY }) => {\n\t\t\t\t\tfor (const key of effectValuesKeys) {\n\t\t\t\t\t\tif (shouldReduceMotion && key !== \"opacity\") continue\n\t\t\t\t\t\t// Transform ranges must have the same number of\n\t\t\t\t\t\t// entries. If target refs are missing these ranges may\n\t\t\t\t\t\t// not match.\n\t\t\t\t\t\tif (pageInputRange.length !== outputRange[key].length) continue\n\n\t\t\t\t\t\tif (outputRange[key][0] === undefined) continue\n\n\t\t\t\t\t\teffect.values[key].set(transform(scrollY.progress, pageInputRange, outputRange[key]))\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\ttransformTrigger === \"onInView\"\n\t\t\t\t\t? {\n\t\t\t\t\t\t\ttarget: element ?? undefined,\n\t\t\t\t\t\t\toffset: [\"start end\", \"end end\"],\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\t)\n\t\t},\n\t\t[currentRouteKey, shouldReduceMotion, transformTrigger, triggerOnScroll, transformTargets, effectDisabled],\n\t)\n\n\tuseAttachOptionalSpring(effect.values, spring)\n\n\tuseOnRouteChange(() => {\n\t\tif (effectDisabled) return\n\t\tconst values = defaultValues(transformTargets, shouldReduceMotion)\n\t\tfor (const key of effectValuesKeys) {\n\t\t\teffect.values[key].set(values?.[key] ?? defaultFXValues[key])\n\t\t}\n\t})\n\n\treturn React.useMemo(() => {\n\t\treturn {\n\t\t\tvalues: effect.values,\n\t\t\tstyle: styleTransformEffectEnabled ? effectEnabledStyle : effectDisabledStyle,\n\t\t}\n\t}, [styleTransformEffectEnabled])\n}\n", "import { withFX } from \"../modules/withFX.tsx\"\n\n/**\n * @public\n * @deprecated\n */\nexport const withParallaxTransform = withFX\n/**\n * @public\n * @deprecated\n */\nexport const withStyleAppearEffect = withFX\n", "import type React from \"react\"\nimport { createContext, useContext, useRef } from \"react\"\nimport { isEqual } from \"../render/utils/isEqual.ts\"\n\ntype PresetProps = Record<string, unknown>\ntype ComponentPresets = Record<string, PresetProps>\n\n/**\n * This context is used to pass down component presets from the RichTextNode to\n * the component embeds in rich text in the CMS.\n */\n\nconst Context = /* @__PURE__ */ createContext<ComponentPresets>({})\n\ninterface ProviderProps {\n\tpresets: ComponentPresets\n\tchildren?: React.ReactNode\n}\n\nexport function ComponentPresetsProvider({ presets, children }: ProviderProps) {\n\tconst lastPresets = useRef<ComponentPresets>(presets)\n\n\tif (!isEqual(presets, lastPresets.current, false)) {\n\t\tlastPresets.current = presets\n\t}\n\n\treturn <Context.Provider value={lastPresets.current}>{children}</Context.Provider>\n}\n\ninterface ConsumerProps {\n\tcomponentIdentifier: string\n\tchildren: (props: PresetProps) => React.ReactNode\n}\n\nexport function ComponentPresetsConsumer({ componentIdentifier, children }: ConsumerProps) {\n\tconst componentPresets = useContext(Context)\n\tconst presetProps = componentPresets[componentIdentifier] ?? {}\n\n\treturn children(presetProps)\n}\n", "import React from \"react\"\nimport { useCloneChildrenWithPropsAndRef } from \"../components/utils/useCloneChildrenWithPropsAndRef.tsx\"\n\nexport interface ComponentViewport {\n\twidth?: string\n\theight?: number\n\ty?: number\n}\n\nconst ComponentViewportContext = /* @__PURE__ */ React.createContext<ComponentViewport>({})\n\nexport function useComponentViewport() {\n\treturn React.useContext(ComponentViewportContext)\n}\n\n/**\n * This context wraps all instances of smart components. It exposes the smart\n * component\u2019s dimensions so that the component can learn them during run time.\n * Unless the component doesn\u2019t declare that it supports this mechanism (via the\n * `@framerComponentViewportWidth` annotation) \u2013 in which case the dimensions\n * are set to `undefined`.\n * https://github.com/framer/FramerStudio/pull/16570#discussion_r1484244932\n */\nexport const ComponentViewportProvider = /* @__PURE__ */ React.forwardRef(function ComponentViewportProvider(\n\t{ width, height, y, children, ...rest }: React.PropsWithChildren<ComponentViewport>,\n\tref,\n) {\n\tconst componentViewport = React.useMemo(() => {\n\t\treturn { width, height, y }\n\t}, [width, height, y])\n\tconst cloneWithPropsAndRef = useCloneChildrenWithPropsAndRef(ref)\n\n\treturn (\n\t\t<ComponentViewportContext.Provider value={componentViewport}>\n\t\t\t{cloneWithPropsAndRef(children, rest)}\n\t\t</ComponentViewportContext.Provider>\n\t)\n})\n", "import { LayoutGroup, type MotionProps, type MotionStyle } from \"framer-motion\"\nimport React from \"react\"\nimport { AutomaticLayoutIds } from \"../components/AnimateLayout/LayoutIdContext.tsx\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { ComponentContainerContext } from \"../render/presentation/ComponentContainerContext.tsx\"\nimport { htmlElementAsMotionComponent } from \"../render/utils/htmlElementAsMotionComponent.ts\"\nimport { withGeneratedLayoutId } from \"../render/utils/withGeneratedLayoutId.tsx\"\nimport { NodeIdContext } from \"./NodeIdContext.tsx\"\nimport { useMaybeWrapComponentWithCodeBoundary } from \"./code-boundary/maybeWrapComponentWithCodeBoundary.tsx\"\n\ntype ContainerProps = {\n\tas?: keyof HTMLElementTagNameMap\n\tclassName?: string\n\tstyle?: MotionStyle | React.CSSProperties\n\t/** Whether the component container should be a motion.element or a plain HTML element. (Undefined if false or if codegenned before Jan 2025.) */\n\trendersWithMotion?: true\n\t/** The ID of the scope (web page or smart component) where the component instance is rendered. (Undefined if codegenned before Jan 2025.) */\n\tscopeId?: string\n\t/** The ID of the node that corresponds to the component instance. (Undefined if codegenned before Jan 2025.) */\n\tnodeId?: string\n\t/** Whether the component instance is authored by a user (= is a code component, not a smart one). (Undefined if false or if codegenned before Jan 2025.) */\n\tisAuthoredByUser?: true\n\t/** Whether the component we\u2019re wrapping is coming from the same project (true), or from somewhere else (undefined). (Undefined if false or if codegenned before Jan 2025.) */\n\tisModuleExternal?: true\n\t/** Whether the component is inside another component\u2019s slot. (Undefined if false or if codegenned before Jan 2025.) */\n\tinComponentSlot?: true\n\t// \u2193 Narrow the definition of `style` based on `rendersWithMotion`\n} & ({ rendersWithMotion: true; style?: MotionStyle } | { rendersWithMotion?: false; style?: React.CSSProperties }) &\n\tPick<MotionProps, \"layout\" | \"layoutId\" | \"layoutDependency\">\n\nconst ContainerInner = /* @__PURE__ */ React.forwardRef<HTMLDivElement, React.PropsWithChildren<ContainerProps>>(\n\tfunction ContainerInner(\n\t\t{ children, layoutId, as, scopeId, nodeId, isAuthoredByUser, isModuleExternal, inComponentSlot, ...props },\n\t\tref,\n\t) {\n\t\tconst outerLayoutId = useConstant(() => (layoutId ? `${layoutId}-container` : undefined))\n\t\tconst MotionComponent = htmlElementAsMotionComponent(as)\n\n\t\tconst clonedChildren = React.Children.map(children, child => {\n\t\t\treturn React.isValidElement<{ layoutId: string | null | undefined }>(child)\n\t\t\t\t? React.cloneElement(child, { layoutId })\n\t\t\t\t: child\n\t\t})\n\n\t\tconst childrenWithCodeBoundary = useMaybeWrapComponentWithCodeBoundary(\n\t\t\tclonedChildren,\n\t\t\tscopeId,\n\t\t\tnodeId,\n\t\t\tisAuthoredByUser,\n\t\t\tisModuleExternal,\n\t\t\tinComponentSlot,\n\t\t)\n\n\t\treturn (\n\t\t\t<MotionComponent layoutId={outerLayoutId} {...props} ref={ref}>\n\t\t\t\t<ComponentContainerContext.Provider value>\n\t\t\t\t\t<NodeIdContext.Provider value={nodeId ?? null}>\n\t\t\t\t\t\t<AutomaticLayoutIds enabled={false}>\n\t\t\t\t\t\t\t{/*\n                                    When the container is a direct descendent of a layout group effect we need to inherit that layout group\n                                    to support layout animations between sibling smart component instances. Otherwise only the id is inherited\n                                    to limit performance impact.\n                                */}\n\t\t\t\t\t\t\t<LayoutGroup id={layoutId ?? \"\"} inherit={props.layout ? true : \"id\"}>\n\t\t\t\t\t\t\t\t{childrenWithCodeBoundary}\n\t\t\t\t\t\t\t</LayoutGroup>\n\t\t\t\t\t\t</AutomaticLayoutIds>\n\t\t\t\t\t</NodeIdContext.Provider>\n\t\t\t\t</ComponentContainerContext.Provider>\n\t\t\t</MotionComponent>\n\t\t)\n\t},\n)\n\n/**\n * A container for smart & code components.\n * @internal\n */\nexport const Container = /* @__PURE__ */ withGeneratedLayoutId(ContainerInner)\n\n/**\n * A container for smart & code components that\u2019s used instead of @see Container when the component is inside a smart component.\n * @internal\n */\nexport const SmartComponentScopedContainer = /* @__PURE__ */ React.forwardRef<\n\tHTMLDivElement,\n\tReact.PropsWithChildren<ContainerProps>\n>(function SmartComponentScopedContainer(props, ref) {\n\tconst {\n\t\tas,\n\t\tchildren,\n\t\t// Code boundary-specific props\n\t\tscopeId,\n\t\tnodeId,\n\t\tisAuthoredByUser,\n\t\trendersWithMotion,\n\t\tisModuleExternal,\n\t\tinComponentSlot,\n\t\t// Other props, including some possibly used-passed ones\n\t\t...otherProps\n\t} = props\n\n\tconst childrenWithCodeBoundary = useMaybeWrapComponentWithCodeBoundary(\n\t\tchildren,\n\t\tscopeId,\n\t\tnodeId,\n\t\tisAuthoredByUser,\n\t\tisModuleExternal,\n\t\tinComponentSlot,\n\t)\n\n\t// Generally, this component could render any HTML element. Ideally, it would\u2019ve been typed as such, too \u2013\n\t// e.g. the type of `ref` would match the type of `props.as`. Instead, we\u2019re type-casting everything to `div`.\n\t// Why?\n\t//\n\t// 1) Properly typing everything seems to bring an immense amount of complexity, due to multiple issues\n\t//    with TypeScript turning union types into intersection types: https://framer-team.slack.com/archives/C3L0MQQ6L/p1732651329585059?thread_ts=1732651034.235219&cid=C3L0MQQ6L\n\t//    and with TypeScript erroring with TS2590 when you use JSX over React.createElement: https://framer-team.slack.com/archives/C3L0MQQ6L/p1732705478561269?thread_ts=1732651034.235219&cid=C3L0MQQ6L\n\t//    I\u2019d rather keep it straightforward and easy to maintain.\n\t// 2) Properly typing everything doesn\u2019t even bring that much value, as this component is never\n\t//    called directly by other code \u2013 it\u2019s only used in codegen.\n\t//\n\t// Note that type-casting to `div` isn\u2019t unheard of \u2013 e.g. `htmlElementAsMotionComponent` does it too.\n\tconst tagName = (props.as ?? \"div\") as \"div\"\n\n\tif (props.rendersWithMotion) {\n\t\tconst Component = htmlElementAsMotionComponent(tagName)\n\t\treturn (\n\t\t\t<NodeIdContext.Provider value={nodeId ?? null}>\n\t\t\t\t<Component\n\t\t\t\t\t{...otherProps}\n\t\t\t\t\tref={ref}\n\t\t\t\t\t// Passing `props.style` explicitly to allow TypeScript to narrow the type of `props.style` according\n\t\t\t\t\t// to the value of `props.rendersWithMotion`.\n\t\t\t\t\tstyle={props.style}\n\t\t\t\t>\n\t\t\t\t\t{childrenWithCodeBoundary}\n\t\t\t\t</Component>\n\t\t\t</NodeIdContext.Provider>\n\t\t)\n\t} else {\n\t\tconst Component = tagName\n\t\t// Omit Motion-specific props (if provided)\n\t\tconst { layoutId, layoutDependency, ...plainHTMLRenderableProps } = otherProps\n\t\treturn (\n\t\t\t<NodeIdContext.Provider value={nodeId ?? null}>\n\t\t\t\t{/* Passing `props.style` explicitly to allow TypeScript to narrow the type of `props.style` according\n                 to the value of `props.rendersWithMotion`. */}\n\t\t\t\t<Component {...plainHTMLRenderableProps} ref={ref} style={props.style}>\n\t\t\t\t\t{childrenWithCodeBoundary}\n\t\t\t\t</Component>\n\t\t\t</NodeIdContext.Provider>\n\t\t)\n\t}\n})\n", "import React from \"react\"\nimport { useLayoutId } from \"./useLayoutId.ts\"\n\n/**\n * Higher Order Component to provide a generated layoutId to the wrapped\n * component in the Framer preview, but preserving any user-specified layoutId\n * prop.\n *\n * @internal\n */\nexport const withGeneratedLayoutId = <T extends object>(Component: React.ComponentType<T>) =>\n\tReact.forwardRef((props: T, ref) => {\n\t\tconst layoutId = useLayoutId(props)\n\n\t\treturn <Component layoutId={layoutId} {...props} layoutIdKey={undefined} duplicatedFrom={undefined} ref={ref} />\n\t})\n", "import type { ErrorInfo, ReactNode } from \"react\"\nimport { Component, Suspense } from \"react\"\nimport { SuspenseThatPreservesDom } from \"../../router/SuspenseThatPreservesDom.tsx\"\nimport { nullFallback } from \"./NullFallback.tsx\"\nimport { collectErrorToAnalytics } from \"./collectErrorToAnalytics.tsx\"\nimport { logError } from \"./logger.ts\"\nimport { shouldEnableCodeBoundaries } from \"./shouldEnableCodeBoundaries.ts\"\n\ninterface CodeComponentBoundaryProps {\n\tchildren: ReactNode\n\tfallback: ReactNode\n\tgetErrorMessage: () => string\n}\n\n/**\n * A code boundary for code components. Ensures any errors thrown by code components\n * (either during SSR, or during client render) don\u2019t crash the whole page \u2013 and, instead,\n * just disable the code component (rendering `fallback` instead).\n *\n * The fallback is normally `null` (= the component is disabled completely), except when\n * the boundary is used by a code override \u2013 in which case, the fallback is the component\n * without the override.\n */\nexport function CodeComponentBoundary({ getErrorMessage, fallback, children }: CodeComponentBoundaryProps) {\n\tif (!shouldEnableCodeBoundaries()) {\n\t\treturn children\n\t}\n\n\treturn (\n\t\t<ServerSideErrorBoundary fallback={fallback}>\n\t\t\t<ClientSideErrorBoundary fallback={fallback} getErrorMessage={getErrorMessage}>\n\t\t\t\t{children}\n\t\t\t</ClientSideErrorBoundary>\n\t\t</ServerSideErrorBoundary>\n\t)\n}\n\n/**\n * Catches errors thrown by a code component during client rendering \u2013 and renders `fallback` (normally null) instead.\n */\nclass ClientSideErrorBoundary extends Component<\n\t{\n\t\tgetErrorMessage: () => string\n\t\tchildren: ReactNode\n\t\tfallback: ReactNode\n\t},\n\t{ hasError: boolean }\n> {\n\toverride state = { hasError: false }\n\n\tstatic getDerivedStateFromError() {\n\t\treturn { hasError: true }\n\t}\n\n\toverride componentDidCatch(error: unknown, errorInfo: ErrorInfo | undefined) {\n\t\tlogError(this.props.getErrorMessage(), errorInfo?.componentStack)\n\n\t\tcollectErrorToAnalytics(error, errorInfo)\n\t}\n\n\toverride render() {\n\t\tconst { children, fallback = nullFallback } = this.props\n\t\tconst { hasError } = this.state\n\n\t\treturn hasError ? fallback : children\n\t}\n}\n\n/**\n * Catches errors thrown by a code component during server rendering \u2013 and renders `fallback` (normally null) instead.\n *\n * This component is separate from `ClientSideErrorBoundary` because, as of React 18, React doesn\u2019t trigger\n * `getDerivedStateFromError`/`componentDidCatch` on the server. Instead, it renders a Suspense fallback\n * and re-tries rendering on the client.\n */\nfunction ServerSideErrorBoundary({ children, fallback = nullFallback }: { children: ReactNode; fallback: ReactNode }) {\n\treturn typeof window === \"undefined\" ? (\n\t\t// On the server, Suspense fallback is activated by errors. So we use the actual Suspense,\n\t\t// and render the actual error fallback if Suspense activates.\n\t\t<Suspense fallback={fallback}>{children}</Suspense>\n\t) : (\n\t\t// On the client, Suspense fallback is activated by data fetching. So we use SuspenseThatPreservesDom,\n\t\t// because we don\u2019t want to render a fallback if the boundary gets inadvertently activated.\n\t\t//\n\t\t// \u201CWhy won\u2019t you just render plain children without Suspense?\u201D Because that would cause a hydration mismatch\n\t\t// (the server has Suspense, the client doesn\u2019t).\n\t\t<SuspenseThatPreservesDom>{children}</SuspenseThatPreservesDom>\n\t)\n}\n", "import type React from \"react\"\nimport { Suspense, createContext, useContext } from \"react\"\nimport { shouldSuspenseBoundariesBeActive } from \"./error-boundary/SynchronousSuspenseErrorBoundary.tsx\"\n\nconst suspendPromise = /* @__PURE__ */ (() => (typeof window !== \"undefined\" ? new Promise<void>(() => {}) : null))()\n\nfunction Suspend(): React.ReactNode | never {\n\t// on the server, we never want to suspend on the fallback.\n\t// for the opt-out case: see SuspenseErrorBoundary's render function\n\tif (typeof window === \"undefined\" || shouldSuspenseBoundariesBeActive) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\thidden\n\t\t\t\t// biome-ignore lint/security/noDangerouslySetInnerHtml: intentional, need to emit an HTML comment\n\t\t\t\tdangerouslySetInnerHTML={{ __html: \"<!-- SuspenseThatPreservesDOM fallback rendered -->\" }}\n\t\t\t/>\n\t\t)\n\t}\n\n\t// there is no reliable way to cleanup this promise after a suspended tree is rendered\n\t// e.g. `useEffect` will not be called again after the unsuspension.\n\t// the overhead of keeping one dangling promise around for is minimal (around 20 bytes).\n\tthrow suspendPromise\n}\nconst suspend = <Suspend />\n\nconst DisableSuspenseSuspenseThatPreservesDomContext = createContext(false)\nDisableSuspenseSuspenseThatPreservesDomContext.displayName = \"DisableSuspenseSuspenseThatPreservesDomContext\"\n\n/**\n * On the on-page canvas, we want to use `OnPageSuspense` instead. If we don't disable\n * `SuspenseThatPreservesDom` then `OnPageSuspense` catches the always pending promise. This will\n * cause the on-page canvas to never render.\n */\nexport function DisableSuspenseSuspenseThatPreservesDom({ children }: React.PropsWithChildren) {\n\treturn (\n\t\t<DisableSuspenseSuspenseThatPreservesDomContext.Provider value={true}>\n\t\t\t{children}\n\t\t</DisableSuspenseSuspenseThatPreservesDomContext.Provider>\n\t)\n}\n\n/**\n * This is a Suspense boundary that\u2019s usually inactive but can be toggled active. \u201CInactive\u201D means\n * that it effectively functions as a no-op component that simply renders its children. This is\n * opposed to regular Suspense boundaries, which are \u201Cactive\u201D because they render a fallback when\n * something inside them suspends.\n *\n * For why this exists and how we\u2019re using this, see\n * https://www.notion.so/framer/SuspenseThatPreservesDOM-1b0adf6e8c968089ae0dc158fc514e6b?pvs=4\n */\nexport function SuspenseThatPreservesDom({ children }: { children: React.ReactNode }) {\n\tconst isSuspenseBoundaryDisabled = useContext(DisableSuspenseSuspenseThatPreservesDomContext)\n\n\tif (isSuspenseBoundaryDisabled) {\n\t\treturn <>{children}</>\n\t}\n\n\treturn <Suspense fallback={suspend}>{children}</Suspense>\n}\n", "import type React from \"react\"\nimport type { ErrorInfo } from \"react\"\nimport { Component } from \"react\"\nimport { sendTrackingEvent } from \"../../utils/sendTrackingEvent.ts\"\nimport { getPleaseReportMessage } from \"../../utils/utils.ts\"\n\ninterface Props {\n\tchildren: React.ReactNode\n}\n\ninterface State {\n\terror?: unknown\n}\n\nexport let shouldSuspenseBoundariesBeActive = false\nexport const testing = {\n\tresetShouldSuspenseBoundariesBeActive() {\n\t\tshouldSuspenseBoundariesBeActive = false\n\t},\n}\n\n/**\n * This is an error boundary that catches React error #426 (https://react.dev/errors/426) \u2013\n * \u201CA component suspended while responding to synchronous input\u201D \u2013 and prevents it from crashing the\n * app when there are no active\u00B9 Suspense boundaries around the component that suspended.\n *\n * It does that by activating\u00B9 all SuspenseThatPreservesDOM boundaries. Critically, this relies on\n * an implicit assumption that there is at least one SuspenseThatPreservesDOM boundary around the\n * suspended component. This is true as of Mar 2025 (we have a bunch of granular\n * SuspenseThatPreserveDOM boundaries around the tree, and also a top-level catch-all\n * SuspenseThatPreserveDOM boundary in Router), but this might change.\n * - We don\u2019t have any hard logic or tests that enforces this assumption, but we do have a helpful\n *   log (in componentDidCatch) that hints what happened if the app still crashes despite activating\n *   all SuspenseThatPreservesDOM boundaries.\n * - If this assumption does ever change, and #426 starts causing crashes, the easy workaround is to\n *   wrap `return this.props.children` in a regular <Suspense> boundary.\n *\n * For more details about what this is and why it exists, see\n * https://www.notion.so/framer/SuspenseThatPreservesDOM-1b0adf6e8c968089ae0dc158fc514e6b?pvs=4\n *\n * \u00B9 \u2014 \u201CActive\u201D and \u201Cinactive\u201D are concrete terms; see\n * https://www.notion.so/framer/SuspenseThatPreservesDOM-1b0adf6e8c968089ae0dc158fc514e6b?pvs=4\n */\nexport class SynchronousSuspenseErrorBoundary extends Component<Props, State> {\n\toverride state: State = { error: undefined }\n\n\tstatic getDerivedStateFromError(error: unknown) {\n\t\treturn { error }\n\t}\n\n\t// Note: SynchronousSuspenseErrorBoundary is relying on some narrow implementation details of React\n\t// which we don\u2019t fully understand: https://www.notion.so/framer/SuspenseThatPreservesDOM-1b0adf6e8c968089ae0dc158fc514e6b?pvs=4#1d1adf6e8c96801a9ef2d6f2f0c27f8c\n\t//\n\t// As a side effect, `componentDidCatch` is usually *never* executed. If you do see the log below,\n\t// it means that you\u2019re experiencing a scenario not covered by our tests.\n\toverride componentDidCatch(error: unknown, errorInfo: undefined | ErrorInfo) {\n\t\tif (!isSuspense426Error(error)) return\n\n\t\tconst componentStack = errorInfo?.componentStack\n\n\t\t// biome-ignore lint/suspicious/noConsole: intentional\n\t\tconsole.error(\n\t\t\t\"Caught an error in SynchronousSuspenseErrorBoundary:\\n\\n\",\n\t\t\terror,\n\t\t\t\"\\n\\nComponent stack:\\n\",\n\t\t\tcomponentStack,\n\t\t\t\"\\n\\nThis error indicates a state update wasn\u2019t wrapped with `startTransition`. \" +\n\t\t\t\t\"Some of the UI might flash as a result. \" +\n\t\t\t\tgetPleaseReportMessage(\n\t\t\t\t\t\"If you are the author of this website, update external components and check recently added custom code or code overrides.\",\n\t\t\t\t),\n\t\t)\n\n\t\tconst stack = error instanceof Error && typeof error.stack === \"string\" ? error.stack : undefined\n\t\tsendTrackingEvent(\"published_site_load_recoverable_error\", {\n\t\t\tmessage: String(error),\n\t\t\tstack,\n\t\t\t// only log componentStack if we don't have a stack\n\t\t\tcomponentStack: stack ? undefined : componentStack,\n\t\t})\n\t}\n\n\toverride render() {\n\t\tconst error = this.state.error\n\t\tif (error === undefined) return this.props.children\n\n\t\tif (!isSuspense426Error(error)) throw error\n\n\t\t// Turn SuspenseThatPreservesDom boundaries into regular boundaries...\n\t\tshouldSuspenseBoundariesBeActive = true\n\n\t\t// ...and re-render the same content. The component that previously suspended will re-suspend again,\n\t\t// but now, that will simply make the nearest SuspenseThatPreservesDom boundary to render a fallback\n\t\t// instead of ignoring the suspension.\n\t\treturn this.props.children\n\t}\n}\n\n/**\n * This function detects when React throws https://react.dev/errors/426:\n *\n * > A component suspended while responding to synchronous input. This will cause the UI to be\n * > replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition.\n *\n * This error is thrown when a setState update that\u2019s not wrapped in a startTransition causes some component\n * to suspend, *and* there are no active <Suspense> boundaries around that component to render a fallback.\n * Unless caught by an error boundary, it\u2019s a non-recoverable crash.\n */\nfunction isSuspense426Error(error: unknown): error is Error {\n\tconst unminifiedMessage = \"A component suspended while responding to synchronous input.\"\n\tconst minifiedMessage = \"Minified React error #426\"\n\n\treturn (\n\t\terror instanceof Error && (error.message.includes(unminifiedMessage) || error.message.includes(minifiedMessage))\n\t)\n}\n", "// biome-ignore lint/correctness/noUnusedImports: build fails without React imported\nimport React from \"react\"\n\nfunction NullFallback() {\n\treturn (\n\t\t<div\n\t\t\thidden\n\t\t\t// biome-ignore lint/security/noDangerouslySetInnerHtml: needed for the comment\n\t\t\tdangerouslySetInnerHTML={{ __html: \"<!-- Code boundary fallback rendered -->\" }}\n\t\t/>\n\t)\n}\n\n/** This is used as a code boundary fallback, to make it very clear why something hides when we hide it. */\nexport const nullFallback = <NullFallback />\n", "import type { ErrorInfo } from \"react\"\nimport { sendTrackingEvent } from \"../../utils/sendTrackingEvent.ts\"\nimport { isWindow } from \"../../utils/utils.ts\"\n\nexport function collectErrorToAnalytics(error: unknown, errorInfo?: ErrorInfo) {\n\tif (!isWindow) return\n\t// we only want to collect 1%, because this can be quite noisy (floods the data pipeline)\n\tif (Math.random() > 0.01) return\n\n\tconst stack = error instanceof Error && typeof error.stack === \"string\" ? error.stack : null\n\tconst componentStack = errorInfo?.componentStack\n\n\tsendTrackingEvent(\"published_site_load_recoverable_error\", {\n\t\tmessage: String(error),\n\t\tstack,\n\t\t// only log componentStack if we don't have a stack\n\t\tcomponentStack: stack ? undefined : componentStack,\n\t})\n}\n", "export function logError(...args: unknown[]) {\n\t// Reduce the console noise in Jest tests\n\tif (process.env.NODE_ENV === \"test\") return\n\n\t// biome-ignore lint/suspicious/noConsole: intentional logging\n\tconsole.error(...args)\n}\n", "import { RenderTarget } from \"../../render/types/RenderEnvironment.ts\"\n\nexport function shouldEnableCodeBoundaries() {\n\t// Code boundaries are disabled on the canvas because the canvas has a separate mechanism for handling them [1].\n\t//\n\t// \u201CHold on, but aren\u2019t code boundaries only used in code generation, not on canvas?\u201D True, but code-generated\n\t// code is still often evaluated on the canvas \u2013 e.g. when you render a smart component instance.\n\t//\n\t// [1]: https://github.com/framer/FramerStudio/pull/19170#discussion_r1836711927\n\treturn RenderTarget.current() !== RenderTarget.canvas\n}\n", "import type { ErrorInfo, ReactNode } from \"react\"\nimport { Component } from \"react\"\nimport { collectErrorToAnalytics } from \"./collectErrorToAnalytics.tsx\"\n\ninterface Props {\n\tchildren?: ReactNode\n}\n\ninterface State {\n\thasError: boolean\n}\n\n/**\n * A previous, deprecated version of the code boundary. Replaced by ./CodeComponentBoundary.tsx.\n * For more details, see https://www.notion.so/framer/Code-Boundaries-153adf6e8c96803dbd27ffe5cfd1e874?pvs=4#157adf6e8c9680a593cad4dfc6dd9cec\n * @deprecated\n */\nexport class DeprecatedContainerErrorBoundary extends Component<Props, State> {\n\toverride state = { hasError: false }\n\n\t// We use `componentDidCatch` instead of `static getDerivedStateFromError()` because the latter could also catch hydration errors.\n\t// Hydration errors are recoverable by React, so we don't want to hide the coponent in that case (since the tree will not unmount).\n\toverride componentDidCatch(error: unknown, errorInfo: undefined | ErrorInfo) {\n\t\tconst componentStack = errorInfo?.componentStack\n\t\t// biome-ignore lint/suspicious/noConsole: intentional\n\t\tconsole.error(\n\t\t\t\"Error in component (see previous log). This component has been hidden. Please check any custom code or code overrides to fix.\",\n\t\t\tcomponentStack,\n\t\t)\n\t\tthis.setState({ hasError: true })\n\n\t\tcollectErrorToAnalytics(error, errorInfo)\n\t}\n\n\toverride render() {\n\t\tconst { children } = this.props\n\t\tconst { hasError } = this.state\n\n\t\treturn hasError ? null : children\n\t}\n}\n", "import type { ExternalComponent } from \"@framerjs/shared/src/ssg/externalComponent.ts\"\nimport React from \"react\"\n\nconst ExternalComponentContext = /* @__PURE__ */ (() => React.createContext<ExternalComponent | undefined>(undefined))()\n\n/**\n * In Framer, a component can be project-local (if it\u2019s defined in the same project it\u2019s used in),\n * or project-external (if it comes from a different project).\n *\n * This hook returns how deeply nested the component is inside project-external components,\n * plus the scope of the nearest external component. For example, if you have:\n *\n * /some-web-page          (defined in projectId: AAA, scopeId: not applicable)\n *   <HeroComponent>       (defined in projectId: AAA, scopeId: /some-web-page)\n *     <DesignSystemHero>  (defined in projectId: BBB [note: external!], scopeId: <HeroComponent>)\n *       <HeroMobile>      (defined in projectId: BBB, scopeId: <DesignSystemHero>)\n *         <Ticker>        (defined in projectId: CCC [note: external!], scopeId: <HeroMobile>)\n *           <TickerSlot>  (defined in projectId: BBB, scopeId: <HeroMobile>)\n *\n * then calling `useNearestExternalComponent()` inside `<TickerSlot>` will return `{ level:2, scopeId: HeroMobile }`.\n */\nexport function useNearestExternalComponent(): ExternalComponent | undefined {\n\treturn React.useContext(ExternalComponentContext)\n}\n\n/**\n * Retrieves the top-most external component in the tree.\n */\nexport function useFurthestExternalComponent(): ExternalComponent | undefined {\n\tconst nearestExternalComponent = useNearestExternalComponent()\n\tconst furthestExternalComponent = React.useMemo(() => {\n\t\tif (!nearestExternalComponent) return undefined\n\n\t\tlet item = nearestExternalComponent\n\t\twhile (item.parent && item.parent.level > 0) {\n\t\t\titem = item.parent\n\t\t}\n\t\treturn item\n\t}, [nearestExternalComponent])\n\n\treturn furthestExternalComponent\n}\n\n/**\n * As of Dec 2024, this component is used to wrap project-external components. Wrapping happens every time\n * an external component is encountered, even if it\u2019s already nested inside other external component.\n *\n * For example, if you have:\n *\n * /page                       (defined in projectId: AAA)\n *   <HeroComponent>           (defined in projectId: AAA)\n *     <DesignSystemHero />    (defined in projectId: BBB)\n *       <HeroMobile />        (defined in projectId: BBB)\n *         <Ticker>            (defined in projectId: CCC)\n *           <TickerSlot />    (defined in projectId: BBB)\n *\n * then <DesignSystemHero> and <Ticker> will each be wrapped in an `IsExternalComponent` boundary, since they\u2019re\n * external to projects they\u2019re used in.\n */\nexport function IsExternalComponent({\n\tchildren,\n\tscopeId,\n\tnodeId,\n}: {\n\tchildren: React.ReactNode\n\tscopeId: string\n\tnodeId: string\n}) {\n\tconst parent = useNearestExternalComponent()\n\n\tconst newValue = React.useMemo(\n\t\t() => ({ level: (parent?.level ?? 0) + 1, scopeId, nodeId, parent }),\n\t\t[scopeId, nodeId, parent],\n\t)\n\treturn <ExternalComponentContext.Provider value={newValue}>{children}</ExternalComponentContext.Provider>\n}\n", "const CRASH_ERROR_MESSAGE_PREFIX = \"code-crash:\"\n\nfunction formatCodeCrashLocationFromSourceNode(scopeId: string, nodeId: string) {\n\treturn `${CRASH_ERROR_MESSAGE_PREFIX}${scopeId}:${nodeId}`\n}\n\nexport function parseSourceNodeFromCodeCrashLocation(crashLocation: string) {\n\tif (!crashLocation.startsWith(CRASH_ERROR_MESSAGE_PREFIX)) return null\n\n\tconst partsArray = crashLocation.split(\":\")\n\tif (partsArray.length !== 3) return null\n\n\tconst [, scopeId, nodeId] = partsArray\n\tif (!scopeId || !nodeId) return null\n\n\treturn { scopeId, nodeId }\n}\n\nexport function getErrorMessageForComponent(scopeId: string, nodeId: string) {\n\treturn getErrorMessageFor(\"component\", scopeId, nodeId)\n}\n\nexport function getErrorMessageForOverride(scopeId: string, nodeId: string) {\n\treturn getErrorMessageFor(\"override\", scopeId, nodeId)\n}\n\nexport function getErrorMessageFor(element: \"component\" | \"override\", scopeId: string, nodeId: string) {\n\treturn (\n\t\t`A code ${element} crashed while rendering due to the error above. ` +\n\t\t`To find and fix it, open the project in the editor \u2192 open Quick Actions (press Cmd+K or Ctrl+K) \u2192 paste this: ${formatCodeCrashLocationFromSourceNode(scopeId, nodeId)} \u2192 click \u201CShow Layer\u201D.`\n\t)\n}\n", "import { isUndefined } from \"../../utils/utils.ts\"\n\n/**\n * We want to apply a code boundary around two kinds of component instances:\n * 1) all local instances of local code components\n * 2) all local instances of external components (both code and smart)\n *\n * All other components won\u2019t get a code boundary \u2013 and will, therefore, propagate\n * their errors upwards to either 1) or 2).\n *\n * For why we\u2019re treating external components like that, see https://www.notion.so/framer/Code-Boundaries-153adf6e8c96803dbd27ffe5cfd1e874#153adf6e8c9680689438dbe7cf310461\n */\nexport function shouldWrapComponentWithBoundary(\n\tscopeIdOfThisComponent: string,\n\tscopeIdOfNearestExternalComponent: string | undefined,\n\texternalComponentLevel: number | undefined,\n\tisAuthoredByUser: boolean,\n\tisExternalComponent: boolean,\n\tinComponentSlot: boolean,\n) {\n\tconst isLocalComponentInstance = isNodeLocalToProject(\n\t\tscopeIdOfThisComponent,\n\t\tscopeIdOfNearestExternalComponent,\n\t\texternalComponentLevel,\n\t\tinComponentSlot,\n\t)\n\n\t// Note that the boolean expression below can be simplified, but I\u2019m keeping it\n\t// explicit to match cases from the design doc.\n\treturn (\n\t\t// case 1: all (local instances) of (local) (code components)\n\t\t(isLocalComponentInstance && !isExternalComponent && isAuthoredByUser) ||\n\t\t// case 2: all (local instances) of (external components)\n\t\t(isLocalComponentInstance && isExternalComponent)\n\t)\n}\n\n/**\n * We want to apply a code boundary only to overrides that wrap project-local frames.\n *\n * All overrides applied inside external components will not get a code boundary \u2013\n * and will, therefore, propagate their errors upwards to the external component.\n *\n * For why we\u2019re treating external components like that, see https://www.notion.so/framer/Code-Boundaries-153adf6e8c96803dbd27ffe5cfd1e874#153adf6e8c9680689438dbe7cf310461\n */\nexport function shouldWrapOverrideWithBoundary(\n\tscopeIdOfNodeWithOverride: string,\n\tscopeIdOfNearestExternalComponent: string | undefined,\n\texternalComponentLevel: number | undefined,\n\tinComponentSlot: boolean,\n) {\n\treturn isNodeLocalToProject(\n\t\tscopeIdOfNodeWithOverride,\n\t\tscopeIdOfNearestExternalComponent,\n\t\texternalComponentLevel,\n\t\tinComponentSlot,\n\t)\n}\n\nfunction isNodeLocalToProject(\n\tscopeIdOfThisNode: string,\n\tscopeIdOfNearestExternalComponent: string | undefined,\n\texternalComponentLevel: number | undefined,\n\tinComponentSlot: boolean,\n) {\n\t// We know a component instance is local when it\u2019s not nested inside any external component.\n\tif (isUndefined(externalComponentLevel)) return true\n\n\t// \u201CTicker edge case\u201D:\n\t//\n\t// Imagine a Framer customer has a website page that uses Ticker. The page will look like this:\n\t//\n\t// \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\t// \u2502 Web page                 \u2502\n\t// \u2502                          \u2502          xxxx\n\t// \u2502                          \u2502\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500> x  x\n\t// \u2502                          \u2502\u2502         xxxx\n\t// \u2502                          \u2502\u2502\n\t// \u2502     oooooooooooooooo     \u2502\u2502\n\t// \u2502     o Ticker       o     \u2502\u2502         xxxxxxx\n\t// \u2502     o              o     \u2502\u2502 \u250C\u2500\u2500\u2500\u2500\u2500> x     x\n\t// \u2502     o xxxx xxxxxxx o     \u2502\u2502 \u2502       xxxxxxx\n\t// \u2502     o x  x x     x o\u2500\u2500\u2500\u2500\u2500\u253C\u2534\u2500\u2518\n\t// \u2502     o xxxx xxxxxxx o     \u2502\n\t// \u2502     o              o     \u2502\n\t// \u2502     oooooooooooooooo     \u2502\n\t// \u2502                          \u2502\n\t// \u2502                          \u2502\n\t// \u2502                          \u2502\n\t// \u2502                          \u2502\n\t// \u2502                          \u2502\n\t// \u2502                          \u2502\n\t// \u2502                          \u2502\n\t// \u2502                          \u2502\n\t// \u2502                          \u2502\n\t// \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\t//\n\t// Here, the ooo... rectangle is a Ticker (which is an external component), and xxx...\n\t// rectangles are ticker slots (which are local to the project).\n\t//\n\t// To the user, ticker slots live in the same project the web page lives. If some component\n\t// inside a ticker slot crashes, obviously, only that component should be disabled.\n\t//\n\t// However, to React, the component tree looks different:\n\t// <WebPage>\n\t//   <div className=\"something-whatever\">\n\t//     <IsExternalComponent>\n\t//       <Ticker>\n\t//         <div className=\"ticker-slot-1\">\n\t//           <TickerSlot1 />\n\t//         </div>\n\t//         <div className=\"ticker-slot-2\">\n\t//           <TickerSlot2 />\n\t//         </div>\n\t//       </Ticker>\n\t//     </IsExternalComponent>\n\t//   </div>\n\t// </WebPage>\n\t//\n\t// To React, ticker slots live *inside* Ticker. And therefore, because Ticker is external\n\t// and is wrapped with <IsExternalComponent>, they live with `externalComponentLevel === 1`,\n\t// not `externalComponentLevel === 0`. This means checking just `externalComponentLevel === 0`\n\t// is not sufficient.\n\t//\n\t// This is the \u201CTicker edge case\u201D. Any external component with slots will have this problem.\n\t// Thus, we also need to check one more scenario.\n\n\tconst nodeIsDefinedInSameScopeAsExternalComponent = scopeIdOfThisNode === scopeIdOfNearestExternalComponent\n\n\tif (\n\t\t// We know a component instance is local when it\u2019s nested inside one external component,\n\t\texternalComponentLevel === 1 &&\n\t\t// and it lives in a slot,\n\t\tinComponentSlot &&\n\t\t// and it\u2019s a slot of *that sole external component* (and not some other local component\n\t\t// with slots that lives inside the external component).\n\t\tnodeIsDefinedInSameScopeAsExternalComponent\n\t) {\n\t\treturn true\n\t}\n\n\treturn false\n}\n", "import type React from \"react\"\nimport { isUndefined } from \"../../utils/utils.ts\"\nimport { useLibraryFeatures } from \"../LibraryFeaturesContext.ts\"\nimport { CodeComponentBoundary } from \"./CodeComponentBoundary.tsx\"\nimport { DeprecatedContainerErrorBoundary } from \"./DeprecatedContainerErrorBoundary.tsx\"\nimport { IsExternalComponent, useNearestExternalComponent } from \"./ExternalComponentContext.tsx\"\nimport { getErrorMessageForComponent } from \"./errorMessages.ts\"\nimport { shouldWrapComponentWithBoundary } from \"./shouldWrapWithBoundary.ts\"\n\n/**\n * Wraps passed children (which are presumed to be a smart or code component) with a code boundary, if necessary.\n */\nexport function useMaybeWrapComponentWithCodeBoundary(\n\tchildren: React.ReactNode,\n\tscopeId?: string,\n\tnodeId?: string,\n\t/** @see ContainerProps.isAuthoredByUser */\n\tisAuthoredByUser?: boolean,\n\t/** @see ContainerProps.isModuleExternal */\n\tisModuleExternal?: boolean,\n\t/** @see ContainerProps.inComponentSlot */\n\tinComponentSlot?: boolean,\n) {\n\tconst nearestExternalComponent = useNearestExternalComponent()\n\tconst { disableCustomCode } = useLibraryFeatures()\n\n\tif (\n\t\t// Those props will either be all undefined, which means the Container hasn\u2019t yet been\n\t\t// re-serialized since we introduced code boundaries, and we should use the old\n\t\t// ContainerErrorBoundary \u2013 or all defined, which means we have enough information to use\n\t\t// the new boundary.\n\t\tisUndefined(scopeId) ||\n\t\tisUndefined(nodeId)\n\t) {\n\t\treturn <DeprecatedContainerErrorBoundary>{children}</DeprecatedContainerErrorBoundary>\n\t}\n\n\tif (disableCustomCode && isAuthoredByUser) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tpadding: \"12px 16px\",\n\t\t\t\t\t// Standard error box styles\n\t\t\t\t\tborderWidth: 1,\n\t\t\t\t\tborderRadius: 6,\n\t\t\t\t\tborderStyle: \"solid\",\n\t\t\t\t\tborderColor: \"rgba(149, 149, 149, 0.15)\",\n\t\t\t\t\tbackgroundColor: \"rgba(149, 149, 149, 0.1)\",\n\t\t\t\t\tfontSize: 12,\n\t\t\t\t\tcolor: \"#a5a5a5\",\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\tCode component disabled\n\t\t\t</div>\n\t\t)\n\t}\n\n\tconst shouldWrapWithBoundary = shouldWrapComponentWithBoundary(\n\t\tscopeId,\n\t\tnearestExternalComponent?.scopeId,\n\t\tnearestExternalComponent?.level,\n\t\tisAuthoredByUser ?? false,\n\t\tisModuleExternal ?? false,\n\t\tinComponentSlot ?? false,\n\t)\n\n\tif (shouldWrapWithBoundary) {\n\t\tchildren = (\n\t\t\t<CodeComponentBoundary getErrorMessage={getErrorMessageForComponent.bind(null, scopeId, nodeId)} fallback={null}>\n\t\t\t\t{children}\n\t\t\t</CodeComponentBoundary>\n\t\t)\n\t}\n\n\tif (isModuleExternal) {\n\t\tchildren = (\n\t\t\t<IsExternalComponent scopeId={scopeId} nodeId={nodeId}>\n\t\t\t\t{children}\n\t\t\t</IsExternalComponent>\n\t\t)\n\t}\n\n\treturn children\n}\n", "import type { MotionProps, Point, SpringOptions } from \"framer-motion\"\nimport {\n\tanimate,\n\tcancelFrame,\n\tframe,\n\tuseMotionValue,\n\tuseReducedMotionConfig,\n\tuseSpring,\n\tuseTransform,\n} from \"framer-motion\"\nimport type { CSSProperties, JSXElementConstructor, PropsWithChildren } from \"react\"\nimport {\n\tSuspense,\n\tcreateContext,\n\tmemo,\n\tstartTransition,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseId,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseState,\n} from \"react\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { assertNever } from \"../utils/assert.ts\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport { isEmptyObject } from \"../utils/utils.ts\"\nimport type { Alignment, Placement } from \"./floatingPositionSafeAreaStyle.ts\"\nimport { useForceUpdate } from \"./useForceUpdate.ts\"\nimport { withCSS } from \"./withCSS.tsx\"\n\ntype CustomCursorHash = string\n\ninterface CursorDefinition {\n\tcomponent: JSXElementConstructor<MotionProps & { variant: string | undefined; ref: unknown; className?: string }>\n\toffset: Point | null\n\ttransition: SpringOptions | undefined\n\tvariant: string | undefined\n\tplacement: Placement | undefined\n\talignment: Alignment | undefined\n}\n\ntype RegisterCursors = (cursors: Record<CustomCursorHash, CursorDefinition>) => void\ntype Unregister = () => void\n\ninterface Context {\n\tonRegisterCursors: (callback: RegisterCursors) => Unregister\n\tregisterCursors: (cursors: Record<CustomCursorHash, CursorDefinition>, id: string) => void\n}\n\nconst CustomCursorContext = /* @__PURE__ */ createContext<Context>({\n\tonRegisterCursors: () => () => {},\n\tregisterCursors: () => {},\n})\n\nconst replaceCursorClassName = /* @__PURE__ */ \"framer-cursor-none\"\nconst cursorComponentClassName = /* @__PURE__ */ \"framer-pointer-events-none\"\n\nfunction getActiveDefinitions(\n\tmap: Map<string, CustomCursorHash[]>,\n\tpreviousDefinitions: Record<CustomCursorHash, CursorDefinition>,\n\tnewDefinitions: Record<CustomCursorHash, CursorDefinition>,\n): Record<CustomCursorHash, CursorDefinition> {\n\tconst allCursors: Record<CustomCursorHash, CursorDefinition> = {}\n\tfor (const [, hashes] of map) {\n\t\tfor (const hash of hashes) {\n\t\t\tconst value = allCursors[hash] ?? previousDefinitions[hash] ?? newDefinitions[hash]\n\t\t\tif (value) allCursors[hash] = value\n\t\t}\n\t}\n\treturn allCursors\n}\n\n/**\n * Wrap the entire website in a context that provides an event-emitter which\n * facilitates:\n *  1. Web pages to record their cursors to the global list\n *  2. The Custom Cursor implementation to update whenever the list changes.\n *\n * This is slight overkill, as there should only ever be 1\n * <CustomCursorComponent/>, but this architecture ensures that future changes\n * can't accidentally rerender the entire webpage at 60fps, which would be a huge\n * performance hit.\n */\nconst CustomCursorContextProvider = /* @__PURE__ */ memo(function CustomCursorList({ children }: PropsWithChildren) {\n\tconst value = useConstant(() => {\n\t\tconst events = new Set<RegisterCursors>()\n\t\tlet allCursors: Record<CustomCursorHash, CursorDefinition> = {}\n\t\t// Track hashes registered by calling hooks. When the hook unmounts, we\n\t\t// remove it from the map. Subsequent calls to registerCursors will\n\t\t// garbage collect unused cursor definitions. When all hashes are\n\t\t// unregistered, CustomCursor can improve performance by not listening\n\t\t// to mouse moves and checking for cursor attribute.\n\t\tconst byCaller = new Map<string, CustomCursorHash[]>()\n\t\treturn {\n\t\t\tonRegisterCursors: (callback: RegisterCursors): Unregister => {\n\t\t\t\tcallback(allCursors)\n\t\t\t\tevents.add(callback)\n\t\t\t\treturn () => events.delete(callback)\n\t\t\t},\n\t\t\tregisterCursors: (cursors: Record<CustomCursorHash, CursorDefinition>, id: string) => {\n\t\t\t\tbyCaller.set(id, Object.keys(cursors))\n\n\t\t\t\tallCursors = getActiveDefinitions(byCaller, allCursors, cursors)\n\n\t\t\t\tfor (const callback of events) callback(allCursors)\n\n\t\t\t\treturn () => {\n\t\t\t\t\tbyCaller.delete(id)\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\t})\n\n\t// Don't show custom cursors when the user has the reduced motion\n\t// accessibility option enabled, and the creator of the website has flagged\n\t// that they wish to hide cursors in this case.\n\tconst shouldReduceMotion = useReducedMotionConfig()\n\n\treturn (\n\t\t<CustomCursorContext.Provider value={value}>\n\t\t\t{children}\n\t\t\t{!shouldReduceMotion && <CustomCursorComponent />}\n\t\t</CustomCursorContext.Provider>\n\t)\n})\n\nexport const CustomCursorHost = /* @__PURE__ */ (() =>\n\twithCSS(\n\t\tCustomCursorContextProvider,\n\t\t[\n\t\t\t`.${replaceCursorClassName}, .${replaceCursorClassName} * { cursor: none !important; }`,\n\t\t\t`.${cursorComponentClassName}, .${cursorComponentClassName} * { pointer-events: none !important; }`,\n\t\t],\n\t\t\"framer-lib-cursors-host\",\n\t))()\n\nconst staticCursorStyle: CSSProperties = /* @__PURE__ */ (() => ({\n\tposition: \"fixed\",\n\ttop: 0,\n\tleft: 0,\n\tzIndex: 12 + 1, // Max framer z-index + 1\n\tpointerEvents: \"none\",\n}))()\n\nfunction customCursorReplacesNativeCursor(cursor: CursorDefinition | null | undefined): boolean {\n\tif (!cursor) return false\n\tif (cursor.placement || cursor.alignment) return false\n\treturn true\n}\n\nfunction valueForCursorAlignment(alignment: Alignment): string {\n\tswitch (alignment) {\n\t\tcase \"start\":\n\t\t\treturn \"0%\"\n\t\tcase \"center\":\n\t\t\treturn \"-50%\"\n\t\tcase \"end\":\n\t\t\treturn \"-100%\"\n\t\tdefault:\n\t\t\tassertNever(alignment)\n\t}\n}\n\nfunction getCenteringTransform(placement: Placement | undefined, alignment: Alignment | undefined = \"center\"): string {\n\tswitch (placement) {\n\t\tcase \"top\":\n\t\t\treturn `${valueForCursorAlignment(alignment)}, -100%`\n\t\tcase \"right\":\n\t\t\treturn `0%, ${valueForCursorAlignment(alignment)}`\n\t\tcase \"bottom\":\n\t\t\treturn `${valueForCursorAlignment(alignment)}, 0%`\n\t\tcase \"left\":\n\t\t\treturn `-100%, ${valueForCursorAlignment(alignment)}`\n\t\tdefault:\n\t\t\treturn \"-50%, -50%\"\n\t}\n}\n\nexport const portalIdAttribute = \"data-framer-portal-id\"\n\n/**\n * Get the custom cursor based on the element under the pointer. Elements in a\n * Framer site specify the cursor via an attribute that sets a hash of all of\n * the cursor settings. This hash corresponds to an entry that contains the\n * settings and component and is reported to the CustomCursorContext by the web\n * page that requires it on mount.\n *\n * Using a data-attribute and elementFromPoint has several benefits over the\n * alternative (which is wrapping each layer that sets or modifies a custom\n * cursor in a Higher Order Component that tracks mouseenter/exit) for several\n * reasons:\n * 1. It allows us to easily provide custom cursors to layers that may or may\n *    not support this higher order component. For example, in the future we can\n *    introduce a ControlType.CustomCursor that will allow any layer in a Smart\n *    Component to update the cursor without the layer in that Smart Component\n *    needing to change its behavior.\n * 2. It means we do not have to maintain a state machine or \"stack\" of layers\n *    that have recorded the cursor has entered/exited since ancestors don't\n *    report a mouseleave when the cursor moves into a descendant). Such a stack\n *    may be prone to errors if the window is blurred or the user switches tabs,\n *    or in cases where the DOM isn't setup as expected.\n * 3. It means that the cursor hit detection is done by the browser, which means\n *    it is more likely to match the native cursor.\n *\n * Their are 2 downsides to this approach:\n * 1. We must call elementFromPoint once per mousemove animation frame (at\n *    least) and iterate through the entries until we find an element with an\n *    attribute. This is theoretically expensive in a project where many\n *    elements are stacked on top of each other. However in practice, this\n *    number is rarely in the large double digits, so doesn't represent a real\n *    performance issue at this time.\n * 2. If the browser does not trigger a mousemove event, the cursor will not\n *    update even if content underneath changes.\n *\n * It may be possible to cache the results of this function by using\n * document.elementFromPoint and returning the last result for that top element.\n * However, this can be problematic if the top element doesn't change, but\n * elements underneath do. For that reason that optimization hasn't been\n * included at this time.\n *\n * It's important to note that elementFromPoint triggers style recalculation\n * and can trigger layout. It's important this is called in the read phase to\n * reduce the likelihood of this happening.\n */\nfunction getCursorHash(x: number, y: number): CustomCursorHash | null | undefined {\n\tlet el = document.elementFromPoint(x, y)\n\twhile (el) {\n\t\tif (el === document.body) return undefined\n\t\tconst value = el.getAttribute(\"data-framer-cursor\")\n\t\tif (value) return value\n\t\tif (el.hasAttribute(portalIdAttribute)) {\n\t\t\tconst id = el.getAttribute(portalIdAttribute)\n\t\t\tel = el.parentElement\n\t\t\tif (id) el = document.getElementById(id) ?? el\n\t\t} else {\n\t\t\tel = el.parentElement\n\t\t}\n\t}\n\treturn undefined\n}\n\ninterface State {\n\tcursors: Record<CustomCursorHash, CursorDefinition>\n\tcursorHash: CustomCursorHash | null | undefined\n}\n\nconst CustomCursorComponent = /* @__PURE__ */ memo(function CustomCursorComponent() {\n\tconst { onRegisterCursors } = useContext(CustomCursorContext)\n\t// By default, we don't SSR anything as mobile devices usually have less power than those that have pointers.\n\tconst [hasHoverCapability, setHasHoverCapability] = useState(false)\n\n\tconst pointerX = useMotionValue(0)\n\tconst pointerY = useMotionValue(0)\n\tconst opacity = useMotionValue(0)\n\n\tconst cursorRef = useRef<HTMLElement>(null)\n\tconst internalState = useRef<State>({ cursors: {}, cursorHash: undefined })\n\tconst forceRender = useForceUpdate()\n\n\tuseLayoutEffect(() => {\n\t\tconst noHoverMQ = safeWindow.matchMedia(\"(any-hover: none)\")\n\t\tfunction updateRender(e: MediaQueryListEvent) {\n\t\t\tif (e.matches) {\n\t\t\t\tstartTransition(() => setHasHoverCapability(false))\n\t\t\t} else {\n\t\t\t\t// Enabling via startTransition here would make UX worse.\n\t\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition\n\t\t\t\tsetHasHoverCapability(true)\n\t\t\t}\n\t\t}\n\t\tnoHoverMQ.addEventListener(\"change\", updateRender)\n\n\t\tif (!noHoverMQ.matches) {\n\t\t\t// Enabling via startTransition here would make UX worse.\n\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition\n\t\t\tsetHasHoverCapability(true)\n\t\t}\n\n\t\treturn () => {\n\t\t\tnoHoverMQ.removeEventListener(\"change\", updateRender)\n\t\t}\n\t}, [])\n\n\tuseEffect(() => {\n\t\tif (!hasHoverCapability) return\n\n\t\tlet x = 0\n\t\tlet y = 0\n\n\t\tfunction updateValues() {\n\t\t\tpointerX.set(x)\n\t\t\tpointerY.set(y)\n\n\t\t\t// Fade in the cursor as soon as it moves. This is a noop if the\n\t\t\t// opacity is already 1, so we don't have to track any state.\n\t\t\t// @TODO: Ignored for now, but should re-check later.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\tanimate(opacity, 1, { type: \"tween\", duration: 0.2 })\n\t\t}\n\n\t\t// Hit test what is under the cursor every frame in the read phase. This\n\t\t// reduces the chances that the DOM has changed, and reduces the\n\t\t// likelihood that document.elementFromPoint triggers layout. If the\n\t\t// cursor needs to change, schedule a rerender in the update phase.\n\t\t// Testing in every frame allows the custom cursor to update to elements\n\t\t// changing underneath it without the user moving the cursor.\n\t\tconst updateVariant = () => {\n\t\t\tif (isEmptyObject(internalState.current.cursors)) return\n\n\t\t\tconst hash = getCursorHash(x, y)\n\t\t\tif (hash !== internalState.current.cursorHash) {\n\t\t\t\tinternalState.current.cursorHash = hash\n\n\t\t\t\t// startTransition here would make UX worse.\n\t\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition\n\t\t\t\tframe.update(() => forceRender())\n\t\t\t}\n\t\t}\n\n\t\tfunction updateCursor(e: PointerEvent) {\n\t\t\t// Devices like iPads could provide a hover capability by e.g. plugging in a mouse. But if it's not used, we cancel the rAF loop.\n\t\t\tif (e.pointerType === \"touch\") {\n\t\t\t\tcancelFrame(updateVariant)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tframe.read(updateVariant, true)\n\t\t\tx = e.clientX\n\t\t\ty = e.clientY\n\t\t\tframe.update(updateValues)\n\t\t}\n\n\t\t// Rethrow events dispatched to the document to the cursor component.\n\t\t// This allows pressed variants to be triggered, or changing the cursor\n\t\t// variant on click.\n\t\tfunction fireEventToTarget(e: PointerEvent) {\n\t\t\tif (e.target === cursorRef.current || !cursorRef.current) return\n\n\t\t\tconst event = new PointerEvent(e.type, {\n\t\t\t\tbubbles: true,\n\t\t\t\tcancelable: e.cancelable,\n\t\t\t\tpointerType: e.pointerType,\n\t\t\t\tpointerId: e.pointerId,\n\t\t\t\tcomposed: e.composed,\n\t\t\t\tisPrimary: e.isPrimary,\n\t\t\t\tbuttons: e.buttons,\n\t\t\t\tbutton: e.button,\n\t\t\t})\n\n\t\t\t// This rethrown event must be dispatched in the following frame to\n\t\t\t// ensure that any motion elements under the mouse that may have an\n\t\t\t// onTap handler execute correctly. Motion's onTap handler is\n\t\t\t// cancelled if another pointerup event is dispatched to an\n\t\t\t// unrelated element. This works in conjunction with the prop\n\t\t\t// `globalTapTarget` which allows the cursor component to also\n\t\t\t// properly control its tap events even though the pointer up is not\n\t\t\t// dispatched to the cursor (as it has pointer events disabled).\n\t\t\tframe.update(() => {\n\t\t\t\tcursorRef.current?.dispatchEvent(event)\n\t\t\t})\n\t\t}\n\n\t\tsafeWindow.addEventListener(\"pointermove\", updateCursor)\n\n\t\tdocument.addEventListener(\"pointerdown\", fireEventToTarget)\n\t\tdocument.addEventListener(\"pointerup\", fireEventToTarget)\n\n\t\tframe.read(updateVariant, true)\n\n\t\treturn () => {\n\t\t\tsafeWindow.removeEventListener(\"pointermove\", updateCursor)\n\n\t\t\tdocument.removeEventListener(\"pointerdown\", fireEventToTarget)\n\t\t\tdocument.removeEventListener(\"pointerup\", fireEventToTarget)\n\n\t\t\tcancelFrame(updateVariant)\n\t\t}\n\n\t\t// These effect dependencies are static. The effect should only be run\n\t\t// on mount/unmount.\n\t}, [opacity, pointerX, pointerY, forceRender, hasHoverCapability])\n\n\t// Hide the custom cursor when the user blurs the browser, or mouse leaves\n\t// the window to prevent a detached cursor from being left in the mouse's\n\t// last known position, resulting in a \"snap\" to a new position as the\n\t// cursor returns to the window in a different location.\n\tuseEffect(() => {\n\t\tif (!hasHoverCapability) return\n\n\t\tfunction hideCursor() {\n\t\t\tvoid animate(opacity, 0, { type: \"tween\", duration: 0.2 })\n\t\t}\n\n\t\tdocument.addEventListener(\"mouseleave\", hideCursor)\n\t\tsafeWindow.addEventListener(\"blur\", hideCursor)\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"mouseleave\", hideCursor)\n\t\t\tsafeWindow.removeEventListener(\"blur\", hideCursor)\n\t\t}\n\t}, [opacity, hasHoverCapability])\n\n\t// Whenever any web page registers new cursors, record them to the internal\n\t// state of this component, and ensure that the rendered cursor is update to\n\t// reflect changes to the list.\n\tuseLayoutEffect(() => {\n\t\tfunction updateCursors(newCursors: Record<CustomCursorHash, CursorDefinition>) {\n\t\t\tinternalState.current.cursors = newCursors\n\n\t\t\t// Update the active cursor if the webpage changes the cursor.\n\t\t\tinternalState.current.cursorHash = !isEmptyObject(newCursors)\n\t\t\t\t? getCursorHash(pointerX.get(), pointerY.get())\n\t\t\t\t: null\n\n\t\t\t// It's important to always force a render when a web page reports\n\t\t\t// cursors, even if the cursorHash may not have changed. This can\n\t\t\t// happen when the hash is set before the configuration is reported\n\t\t\t// by the web page.\n\n\t\t\t// Enabling startTransition here would make UX worse.\n\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition\n\t\t\tforceRender()\n\t\t}\n\n\t\tconst unregister = onRegisterCursors(updateCursors)\n\n\t\treturn () => {\n\t\t\tunregister()\n\t\t\tdocument.body.classList.toggle(replaceCursorClassName, false)\n\t\t}\n\n\t\t// These effect dependencies are static. The effect should only be run\n\t\t// on mount/unmount.\n\t}, [pointerX, pointerY, onRegisterCursors, forceRender])\n\n\tconst { cursors, cursorHash } = internalState.current\n\tconst cursor = cursorHash ? cursors[cursorHash] : null\n\tconst replaceNativeCursor = customCursorReplacesNativeCursor(cursor)\n\n\t// Ensure the cursor is hidden whenever the cursor is configured in that\n\t// way. This must happen in an effect in case the cursor hash is set before\n\t// the cursors are registered by the current web page.\n\tuseLayoutEffect(() => {\n\t\tif (!hasHoverCapability) return\n\n\t\tdocument.body.classList.toggle(replaceCursorClassName, replaceNativeCursor)\n\t}, [replaceNativeCursor, hasHoverCapability])\n\n\tconst Cursor = cursor?.component\n\n\tconst springRaw = cursor?.transition ?? { duration: 0 }\n\t// useSpring -> attachFollow -> JSAnimation -> findSpring expects duration\n\t// in milliseconds, but SpringOptions documents it in seconds. Convert here.\n\tconst spring: SpringOptions =\n\t\tspringRaw.duration !== undefined ? { ...springRaw, duration: springRaw.duration * 1000 } : springRaw\n\tconst sprungX = useSpring(pointerX, spring)\n\tconst sprungY = useSpring(pointerY, spring)\n\n\tconst x = useTransform(() => sprungX.get() + (cursor?.offset?.x ?? 0))\n\tconst y = useTransform(() => sprungY.get() + (cursor?.offset?.y ?? 0))\n\n\tconst alignment = cursor?.alignment\n\tconst placement = cursor?.placement\n\n\tconst transformTemplate = useCallback(\n\t\t(_: unknown, t: string) => `translate(${getCenteringTransform(placement, alignment)}) ${t}`,\n\t\t[alignment, placement],\n\t)\n\n\tif (!hasHoverCapability || !cursor || !Cursor) return null\n\n\treturn (\n\t\t<Suspense>\n\t\t\t<Cursor\n\t\t\t\ttransformTemplate={transformTemplate}\n\t\t\t\tstyle={{\n\t\t\t\t\t...staticCursorStyle,\n\t\t\t\t\tx,\n\t\t\t\t\ty,\n\t\t\t\t\topacity,\n\t\t\t\t}}\n\t\t\t\tglobalTapTarget\n\t\t\t\tvariant={cursor?.variant}\n\t\t\t\tref={cursorRef}\n\t\t\t\tclassName={cursorComponentClassName}\n\t\t\t/>\n\t\t</Suspense>\n\t)\n})\n\n/**\n * Allow web pages to register their custom cursors to the global context so\n * that the same cursor can be used across pages without flashes of missing\n * cursors.\n */\nexport function useCustomCursors(webPageCursors: Record<CustomCursorHash, CursorDefinition>): void {\n\tconst { registerCursors } = useContext(CustomCursorContext)\n\tconst cursors = useConstant(() => webPageCursors)\n\tconst id = useId()\n\n\tuseLayoutEffect(() => {\n\t\treturn registerCursors(cursors, id)\n\t}, [registerCursors, id])\n}\n", "import type { MotionProps, MotionStyle, MotionValue } from \"framer-motion\"\nimport { cancelFrame, frame, motion, motionValue, usePresence } from \"framer-motion\"\nimport React, { useContext } from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { refHasValue } from \"../components/utils/refHelper.ts\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { ResetOuterLinkContext } from \"../modules/Link/useReplaceNestedLinks.tsx\"\nimport { ComponentContainerContext } from \"../render/presentation/ComponentContainerContext.tsx\"\nimport type { Point } from \"../render/types/Point.ts\"\nimport type { Rect } from \"../render/types/Rect.ts\"\nimport type { Size } from \"../render/types/Size.ts\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport { isReactChild, isReactElement } from \"../utils/type-guards.ts\"\nimport { isObject, isString, isUndefined } from \"../utils/utils.ts\"\nimport { InjectSelectionStyle } from \"./InjectSelectionStyle.tsx\"\nimport type { Alignment, Placement } from \"./floatingPositionSafeAreaStyle.ts\"\nimport {\n\tfloatingPositionSafeAreaStyle,\n\tgetSafePlacementFloatingPositionRect,\n\tmotionOriginFromFloatingPosition,\n} from \"./floatingPositionSafeAreaStyle.ts\"\n\ninterface AncestorInfo {\n\tposition: \"fixed\" | \"absolute\"\n\tscrolls: boolean\n}\n\n/**\n * If the Floating layer is in a fixed position context, the best rendering will\n * be achieved by rendering the Floating layer with fixed positioning. As soon\n * as we detect that an ancestor is fixed, we can opt into that. Otherwise using\n * absolute positioning.\n *\n * At the same time, we can check for any ancestors that aren't the body element\n * that are scrollable. When the Floating layer is in a scrollable container, we\n * need to do extra work to ensure that even if those containers are scrolled,\n * the relative overlay stays pinned to its anchor. This is some overhead so we\n * only do it when we need to.\n */\nfunction domReadGetAncestorInfo(anchorRef: React.MutableRefObject<HTMLElement>): AncestorInfo {\n\tlet el: HTMLElement | null = anchorRef.current\n\n\tconst info: AncestorInfo = {\n\t\tposition: \"absolute\",\n\t\tscrolls: false,\n\t}\n\n\twhile (el) {\n\t\tif (el?.tagName === \"BODY\") return info\n\t\tif (getComputedStyle(el)?.position === \"fixed\") info.position = \"fixed\"\n\t\tif (el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight) info.scrolls = true\n\t\tif (info.scrolls && info.position === \"fixed\") return info\n\t\tel = el.parentElement\n\t}\n\n\treturn info\n}\n\nfunction domReadStartAnimationFrameLoop(onRead: VoidFunction) {\n\tframe.read(onRead, true)\n\treturn () => cancelFrame(onRead)\n}\n\n/**\n * Create a function that can be called to update the style and shape of the\n * safe area. We store the last mouse position inline so that we can update the\n * safe area to stay near the mouse when the anchor moves.\n */\nfunction domWriteCreateUpdateSafeArea(safeAreaRef: React.MutableRefObject<HTMLElement | null>) {\n\tlet x: number = 0\n\tlet y: number = 0\n\n\treturn (anchorRect: Rect, calculatedRect: Rect, placement: Placement, event?: MouseEvent) => {\n\t\tif (!safeAreaRef.current?.style) return\n\n\t\tx = event?.clientX ?? x\n\t\ty = event?.clientY ?? y\n\n\t\tObject.assign(safeAreaRef.current.style, floatingPositionSafeAreaStyle(x, y, placement, anchorRect, calculatedRect))\n\t}\n}\n\nfunction domWriteUpdatePosition(\n\tfloatingPositionRef: React.MutableRefObject<HTMLElement | null>,\n\tposition: \"fixed\" | \"absolute\",\n\trect: Rect,\n\tscrollX: number,\n\tscrollY: number,\n) {\n\tif (!floatingPositionRef.current) return\n\n\tObject.assign(floatingPositionRef.current.style, {\n\t\tposition,\n\t\tvisibility: \"visible\",\n\t\t// Append \"px\" because we are assigning this object straight to style.\n\t\tleft: (rect?.x ?? 0) + scrollX + \"px\",\n\t\ttop: (rect?.y ?? 0) + scrollY + \"px\",\n\t})\n}\n\nconst FloatingStackingContext = /* @__PURE__ */ (() => {\n\tconst Context = React.createContext<Set<HTMLElement>>(new Set())\n\tContext.displayName = \"FloatingStackingContext\"\n\treturn Context\n})()\n\n/**\n * For the best UX, when triggered on hover, the Floating layer is only\n * dismissed when the mouse is not inside the floating element, the anchor, or\n * the safe area.\n *\n * Additionally support hiding Floating layers with the \"Escape\" key when they\n * do not have a safe area.\n */\nfunction useDismissFloatingLayer(\n\tanchorRef: React.MutableRefObject<HTMLElement | null>,\n\tfloatingPositionRef: React.MutableRefObject<HTMLElement | null>,\n\tsafeAreaRef: React.MutableRefObject<HTMLDivElement | null>,\n\t{ safeArea, onDismiss }: { safeArea: boolean; onDismiss: () => void | (() => Promise<void>) },\n) {\n\tconst descendantStackingContext = useConstant(() => new Set<HTMLElement>())\n\tconst ancestorStackingContext = React.useContext(FloatingStackingContext)\n\n\tconst [isPresent, safeToRemove] = usePresence()\n\n\t// Toggle the `pointer-events` style of the floating element to prevent it\n\t// from unintentionally showing the floating layer while an exit animation\n\t// is playing. Ensure that `pointer-events` is reset when `isPresent` is\n\t// true in the case of a cancelled animation.\n\t//\n\t// Additionally track the visibility of the element in its ancestors\n\t// context. This tells any ancestor Floating layers that they have\n\t// descendant Floating layers that have to be dismissed before they can be\n\t// dismissed.\n\tReact.useEffect(() => {\n\t\tif (isPresent) {\n\t\t\tif (!floatingPositionRef.current) return\n\t\t\tfloatingPositionRef.current.style.pointerEvents = \"\"\n\t\t\tancestorStackingContext.add(floatingPositionRef.current)\n\t\t} else {\n\t\t\tif (!floatingPositionRef.current) return\n\t\t\tfloatingPositionRef.current.style.pointerEvents = \"none\"\n\t\t\tancestorStackingContext.delete(floatingPositionRef.current)\n\t\t\t// Tell `framer-motion` that it can safely remove this Floating\n\t\t\t// Layer as soon as any exit animations have completed.\n\t\t\tsafeToRemove()\n\t\t}\n\t}, [isPresent, safeToRemove, floatingPositionRef, ancestorStackingContext])\n\n\tReact.useEffect(() => {\n\t\tif (!safeArea) {\n\t\t\tconst handleEscape = (e: KeyboardEvent) => {\n\t\t\t\tif (e.key !== \"Escape\") return\n\t\t\t\tonDismiss()\n\t\t\t}\n\t\t\tsafeWindow.addEventListener(\"keyup\", handleEscape)\n\t\t\treturn () => safeWindow.removeEventListener(\"keyup\", handleEscape)\n\t\t}\n\n\t\tlet latestEvent: MouseEvent | undefined\n\n\t\tfunction maybeDismiss() {\n\t\t\tif (!latestEvent || descendantStackingContext.size !== 0) return\n\t\t\tfor (const element of document.elementsFromPoint(latestEvent.x, latestEvent.y)) {\n\t\t\t\tif (element === anchorRef.current) return\n\t\t\t\tif (element === floatingPositionRef.current) return\n\t\t\t\tif (element === safeAreaRef.current) return\n\t\t\t}\n\n\t\t\tonDismiss()\n\t\t}\n\n\t\tfunction scheduleMaybeDismiss(event: MouseEvent) {\n\t\t\tlatestEvent = event\n\t\t\tframe.read(maybeDismiss)\n\t\t}\n\n\t\tsafeWindow.addEventListener(\"mousemove\", scheduleMaybeDismiss)\n\n\t\treturn () => {\n\t\t\tsafeWindow.removeEventListener(\"mousemove\", scheduleMaybeDismiss)\n\t\t}\n\t}, [onDismiss, safeArea, anchorRef, safeAreaRef, floatingPositionRef])\n\n\treturn descendantStackingContext\n}\n\nfunction makeGetSafePlacementFloatingPositionRect({\n\tplacement,\n\talignment,\n\toffset,\n\tcollisionDetectionSize,\n\tcollisionDetectionPadding,\n}: {\n\tplacement: Placement\n\talignment: Alignment\n\toffset: Point\n\t/**\n\t * If the floating layer should avoid collision with the window, provide the\n\t * window bounds as a Size.\n\t */\n\tcollisionDetectionSize?: Size\n\tcollisionDetectionPadding?: number\n}) {\n\treturn (anchor: Rect, element: Rect) =>\n\t\tgetSafePlacementFloatingPositionRect(\n\t\t\tanchor,\n\t\t\telement,\n\t\t\tplacement,\n\t\t\talignment,\n\t\t\toffset,\n\t\t\tcollisionDetectionSize,\n\t\t\tcollisionDetectionPadding,\n\t\t)\n}\n\n/**\n * Determine the motion transform origin for the floating layer based on its\n * placement and alignment. This can change if we have to flip the placement to\n * avoid collision with the window.\n */\nfunction useDynamicMotionOrigin(initialPlacement: Placement, alignment: Alignment) {\n\treturn useConstant(() => {\n\t\tconst { originX, originY } = motionOriginFromFloatingPosition(initialPlacement, alignment)\n\t\tconst origin = { x: motionValue(originX), y: motionValue(originY) }\n\n\t\treturn [\n\t\t\torigin,\n\t\t\t(placement: Placement) => {\n\t\t\t\tconst values = motionOriginFromFloatingPosition(placement, alignment)\n\t\t\t\torigin.x.set(values.originX)\n\t\t\t\torigin.y.set(values.originY)\n\t\t\t},\n\t\t] as const\n\t})\n}\n\n/**\n * Clone the child of the floating layer to assign transform origin motion\n * values. This ensures that any animations performed by the floating layer will\n * always appear to originate from the trigger even if we have flipped the\n * placement to avoid collision with the window.\n */\nfunction childrenWithOrigin(\n\tchild: React.ReactNode,\n\t{ x, y }: { x: MotionValue<number>; y: MotionValue<number> },\n): React.ReactNode | null {\n\tif (!child || !isReactChild(child) || !isReactElement(child)) return null\n\tif (!isObject(child.props.style) && !isUndefined(child.props.style)) return null\n\n\tconst style: MotionStyle = {\n\t\t...child.props.style,\n\t\toriginX: x,\n\t\toriginY: y,\n\t}\n\n\treturn React.cloneElement(child as React.ReactElement<{ style: MotionStyle }>, { style })\n}\n\ninterface FloatingProps extends MotionProps {\n\talignment: Alignment\n\tplacement: Placement\n\toffsetX: number\n\toffsetY: number\n\tanchorRef: React.MutableRefObject<HTMLElement | null>\n\tsafeArea: boolean\n\tclassName: string\n\t/** @deprecated */\n\tportalSelector?: string\n\tzIndex: number | undefined\n\tcollisionDetection?: boolean\n\tcollisionDetectionPadding?: number\n\tonDismiss: () => void | (() => Promise<void>)\n}\n\n// These Selectors are serialized into Web Pages and Layout Templates. They\n// cannot be changed without potentially breaking existing sites.\nexport const overlayContainerId = \"overlay\"\nexport const templateOverlayContainerId = \"template-overlay\"\n\nfunction getPortalContainer(deprecatedSelector: string | undefined, inComponent: boolean) {\n\t// If the component that is rendering the Floating layer is in any component\n\t// (not a Web Page) or doesn't provide a selector, then its safe to render\n\t// it into the appropriate portal container, because it brings its own\n\t// serialization class name.\n\tif (inComponent || isUndefined(deprecatedSelector)) {\n\t\tconst container =\n\t\t\tdocument.querySelector(`#${templateOverlayContainerId}`) ?? document.querySelector(`#${overlayContainerId}`)\n\t\tif (container) return container\n\t}\n\n\t// Otherwise the Floating layer can only be rendered into the provided\n\t// selector element.\n\tconst container = isString(deprecatedSelector) ? document.querySelector(deprecatedSelector) : undefined\n\tif (container) return container\n\n\treturn document.body\n}\n\nexport function Floating({\n\talignment,\n\tplacement,\n\tsafeArea,\n\toffsetX,\n\toffsetY,\n\tanchorRef,\n\tclassName,\n\tchildren,\n\tportalSelector,\n\tzIndex,\n\tcollisionDetection = false,\n\tcollisionDetectionPadding,\n\tonDismiss,\n\t...rest\n}: React.PropsWithChildren<FloatingProps>) {\n\tconst floatingPositionRef = React.useRef<HTMLDivElement>(null)\n\tconst safeAreaRef = React.useRef<HTMLDivElement>(null)\n\tconst contentRef = React.useRef<HTMLDivElement>(null)\n\tconst [origin, updateOrigin] = useDynamicMotionOrigin(placement, alignment)\n\n\t// Calculate the position of the Floating layer, as well as the shape of the\n\t// safe area whenever show, or the placement, alignment or offset changes.\n\t//\n\t// If we detect the element is in a scrollable ancestor that isn't the body\n\t// element, we start a requestAnimationFrame loop that ensures the Floating\n\t// layer stays pinned to its anchor.\n\t//\n\t// Finally, if the Floating layer has a safe area, we bind a function to\n\t// mouse move on the anchor that will update the shape of the safe area to\n\t// ensure the mouse can always safely travel to either of the closest\n\t// corners of the Floating layer.\n\tReact.useLayoutEffect(() => {\n\t\tif (!refHasValue(anchorRef) || !contentRef.current || !placement || !alignment) return\n\n\t\tconst offset: Point = {\n\t\t\tx: offsetX ?? 0,\n\t\t\ty: offsetY ?? 0,\n\t\t}\n\n\t\t// Partially apply the arguments to update the rect to ensure arguments\n\t\t// are consistently applied.\n\t\tlet cleanup: VoidFunction | undefined\n\t\tlet cleanupHasRun = false\n\t\tlet initialUpdateHasRun = false\n\t\tlet anchorRect: Rect\n\t\tlet safePlacement: Placement\n\t\tlet calculatedRect: Rect\n\t\tlet latestEvent: MouseEvent | undefined\n\t\tlet updateSafeArea: ReturnType<typeof domWriteCreateUpdateSafeArea>\n\t\tlet scrollX = 0\n\t\tlet scrollY = 0\n\n\t\tconst ancestorInfo = domReadGetAncestorInfo(anchorRef)\n\t\tconst position = ancestorInfo.position\n\n\t\tconst elementRect = contentRef.current.getBoundingClientRect()\n\n\t\tconst getSafePlacementRect = makeGetSafePlacementFloatingPositionRect({\n\t\t\tplacement,\n\t\t\talignment,\n\t\t\toffset,\n\t\t\tcollisionDetectionSize: collisionDetection\n\t\t\t\t? { width: safeWindow.innerWidth, height: safeWindow.innerHeight }\n\t\t\t\t: undefined,\n\t\t\tcollisionDetectionPadding,\n\t\t})\n\n\t\tconst onRender = () => {\n\t\t\tif (cleanupHasRun) return\n\t\t\tdomWriteUpdatePosition(floatingPositionRef, position, calculatedRect, scrollX, scrollY)\n\t\t\tif (safeArea) updateSafeArea(anchorRect, calculatedRect, safePlacement, latestEvent)\n\t\t\tlatestEvent = undefined\n\t\t}\n\n\t\tconst initialRender = () => {\n\t\t\tupdateSafeArea = domWriteCreateUpdateSafeArea(safeAreaRef)\n\n\t\t\tif (latestEvent) {\n\t\t\t\tonRender()\n\t\t\t} else {\n\t\t\t\tdomWriteUpdatePosition(floatingPositionRef, position, calculatedRect, scrollX, scrollY)\n\t\t\t}\n\n\t\t\tinitialUpdateHasRun = true\n\t\t}\n\n\t\tconst onUpdate = () => {\n\t\t\tif (cleanupHasRun) return\n\t\t\tupdateOrigin(safePlacement)\n\t\t}\n\n\t\tconst domReadUpdateSafePlacementAndRect = () => {\n\t\t\tif (!getSafePlacementRect || cleanupHasRun) return\n\n\t\t\tif (position === \"fixed\") {\n\t\t\t\tscrollX = 0\n\t\t\t\tscrollY = 0\n\t\t\t} else {\n\t\t\t\tscrollX = safeWindow.scrollX\n\t\t\t\tscrollY = safeWindow.scrollY\n\t\t\t}\n\n\t\t\tanchorRect = anchorRef.current.getBoundingClientRect()\n\t\t\tconst safePlacementAndRect = getSafePlacementRect(anchorRect, elementRect)\n\t\t\tsafePlacement = safePlacementAndRect[0]\n\t\t\tcalculatedRect = safePlacementAndRect[1]\n\t\t}\n\n\t\tdomReadUpdateSafePlacementAndRect()\n\t\tonUpdate()\n\t\tinitialRender()\n\n\t\tif (ancestorInfo.scrolls) {\n\t\t\t// Start a read/write loop to ensure the Floating layer stays pinned to its anchor,\n\t\t\t// returning a function to cancel the loop when the overlay is dismissed.\n\t\t\tcleanup = domReadStartAnimationFrameLoop(domReadUpdateSafePlacementAndRect)\n\t\t}\n\n\t\tif (!safeArea) {\n\t\t\treturn () => {\n\t\t\t\tcleanup?.()\n\t\t\t\tcleanupHasRun = true\n\t\t\t}\n\t\t}\n\n\t\tconst handleMouseMove = (event: MouseEvent) => {\n\t\t\tlatestEvent = event\n\n\t\t\t// We take care of the safe area in the initial render, so we don't need to run the same\n\t\t\t// logic again before that.\n\t\t\tif (!initialUpdateHasRun) return\n\n\t\t\tframe.read(domReadUpdateSafePlacementAndRect, false, true)\n\t\t\tframe.update(onUpdate, false, true)\n\t\t\tframe.render(onRender, false, true)\n\t\t}\n\n\t\tconst anchor = anchorRef.current\n\t\tanchor.addEventListener(\"mousemove\", handleMouseMove)\n\n\t\treturn () => {\n\t\t\tanchor.removeEventListener(\"mousemove\", handleMouseMove)\n\t\t\tcleanup?.()\n\t\t\tcleanupHasRun = true\n\t\t}\n\t}, [\n\t\tsafeArea,\n\t\tplacement,\n\t\talignment,\n\t\toffsetX,\n\t\toffsetY,\n\t\tanchorRef,\n\t\tcollisionDetection,\n\t\tcollisionDetectionPadding,\n\t\tupdateOrigin,\n\t])\n\n\tconst descendantContext = useDismissFloatingLayer(anchorRef, floatingPositionRef, safeAreaRef, {\n\t\tsafeArea,\n\t\tonDismiss,\n\t})\n\n\tconst inComponent = useContext(ComponentContainerContext)\n\n\treturn ReactDOM.createPortal(\n\t\t<motion.div\n\t\t\tref={floatingPositionRef}\n\t\t\tclassName={className}\n\t\t\tstyle={{\n\t\t\t\t// Start from the top left of the screen to prevent jumps.\n\t\t\t\ttop: 0,\n\t\t\t\tleft: 0,\n\t\t\t\t// Initially rendered as hidden, but the layout effect will set\n\t\t\t\t// to visible when the position is calculated.\n\t\t\t\tvisibility: \"hidden\",\n\t\t\t\twidth: \"auto\",\n\t\t\t\theight: \"auto\",\n\t\t\t\tposition: \"absolute\",\n\t\t\t\tzIndex,\n\t\t\t}}\n\t\t\t{...rest}\n\t\t>\n\t\t\t{safeArea ? (\n\t\t\t\t<div ref={safeAreaRef} style={{ position: \"absolute\" }} data-safearea />\n\t\t\t) : (\n\t\t\t\t// biome-ignore lint/a11y/useKeyWithClickEvents: overlays don't support key events yet.\n\t\t\t\t<div style={{ position: \"fixed\", inset: 0 }} aria-hidden onClick={onDismiss} />\n\t\t\t)}\n\t\t\t<FloatingStackingContext.Provider value={descendantContext}>\n\t\t\t\t{/* Reset the outer link context (and don\u2019t do nested link replacement) since the overlay\n                    is in a portal, and there would be no ancestor link causing the \u201Cinvalid DOM nesting\u201D issue. */}\n\t\t\t\t<ResetOuterLinkContext>\n\t\t\t\t\t<InjectSelectionStyle triggerId={anchorRef.current?.id ?? undefined}>\n\t\t\t\t\t\t<div ref={contentRef}>{childrenWithOrigin(children, origin)}</div>\n\t\t\t\t\t</InjectSelectionStyle>\n\t\t\t\t</ResetOuterLinkContext>\n\t\t\t</FloatingStackingContext.Provider>\n\t\t</motion.div>,\n\t\tgetPortalContainer(portalSelector, inComponent),\n\t)\n}\n", "import { isCommandKeyPressed } from \"@framerjs/shared/src/environment.ts\"\nimport type { NestedLinkInfo } from \"@framerjs/shared/src/ssg/nestedLinkInfo.ts\"\nimport { isMotionComponent, motion, unwrapMotionComponent } from \"framer-motion\"\nimport type { ComponentType, HTMLProps, ReactHTMLElement, ReactNode } from \"react\"\nimport type React from \"react\"\nimport { Children, createContext, createElement, isValidElement, useCallback, useContext, useMemo } from \"react\"\nimport type { MutableRefCallback } from \"../../components/utils/refHelper.ts\"\nimport { useRefEffect } from \"../../components/utils/refHelper.ts\"\nimport { useRouter } from \"../../router/RouterContext.tsx\"\nimport { useCurrentRoute } from \"../../router/useCurrentRoute.tsx\"\nimport { useLocaleInfo } from \"../../router/useLocale.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport { isUndefined } from \"../../utils/utils.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { isLinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { nestedLinksCollector } from \"../NestedLinksCollector.ts\"\nimport { useFurthestExternalComponent } from \"../code-boundary/ExternalComponentContext.tsx\"\nimport { useIsOnFramerCanvas } from \"../useIsOnFramerCanvas.ts\"\nimport { getRouteFromPageLink } from \"./getRouteFromPageLink.tsx\"\nimport { linkFromFramerPageLink } from \"./linkFromFramerPageLink.tsx\"\nimport type { PropsAddedByLinkInternal } from \"./types.ts\"\n\ntype PartialNestedLinkInfo = Omit<NestedLinkInfo, \"nodeId\"> & { nodeId: string | undefined }\nconst OuterLinkContext = /* @__PURE__ */ createContext<PartialNestedLinkInfo | undefined>(undefined)\n\nexport function ResetOuterLinkContext({ children }: { children: ReactNode }) {\n\treturn <OuterLinkContext.Provider value={undefined}>{children}</OuterLinkContext.Provider>\n}\n\n/**\n * NOTE: Any change to this function should have a QA for this project https://development.framer.com/projects/Nested-Links--ozJyj13jPMDAbU9zv9WB-1rkcd\n */\nexport function useReplaceNestedLinks(\n\tchildren: ReactNode,\n\tscopeId: string | undefined,\n\tnodeId: string | undefined,\n\thref: string | LinkToWebPage | undefined,\n\tpropsAddedByLink: Partial<PropsAddedByLinkInternal>,\n\tobserverRef: MutableRefCallback<HTMLAnchorElement>,\n) {\n\tconst outerLink = useContext(OuterLinkContext)\n\tconst furthestExternalComponent = useFurthestExternalComponent()\n\tconst innerLink: PartialNestedLinkInfo = useMemo(\n\t\t() => ({ scopeId, nodeId, furthestExternalComponent }),\n\t\t[scopeId, nodeId, furthestExternalComponent],\n\t)\n\n\tconst router = useRouter()\n\tconst currentRoute = useCurrentRoute()\n\tconst { locales } = useLocaleInfo()\n\n\tconst route = useMemo(() => {\n\t\tconst pageLink = isLinkToWebPage(href) ? href : linkFromFramerPageLink(href)\n\t\tif (!pageLink) return\n\n\t\treturn getRouteFromPageLink(pageLink, router, currentRoute, locales)\n\t}, [currentRoute, href, router, locales])\n\n\tconst isOnFramerCanvas = useIsOnFramerCanvas()\n\tconst shouldReplaceLink = Boolean(!isOnFramerCanvas && outerLink?.nodeId && innerLink.nodeId)\n\n\t// This way we are still able to properly handle the click event for this nested link\n\tconst onClick = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tif (!propsAddedByLink.href) return\n\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\n\t\t\t// CMD or CTRL + click\n\t\t\tif (isCommandKeyPressed(event)) {\n\t\t\t\topenExternalLink(propsAddedByLink.href, \"\", \"_blank\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// It's a link that points to a router within the site\n\t\t\tif (route) {\n\t\t\t\tpropsAddedByLink.navigate?.()\n\t\t\t} else {\n\t\t\t\topenExternalLink(propsAddedByLink.href, propsAddedByLink.rel, propsAddedByLink.target)\n\t\t\t}\n\t\t},\n\t\t[propsAddedByLink, route],\n\t)\n\n\t// middle mouse button click\n\tconst onAuxClick = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tif (!propsAddedByLink.href) return\n\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\n\t\t\topenExternalLink(propsAddedByLink.href, \"\", \"_blank\")\n\t\t},\n\t\t[propsAddedByLink],\n\t)\n\n\tconst onKeyDown = useCallback(\n\t\t(event: KeyboardEvent) => {\n\t\t\tif (!propsAddedByLink.href) return\n\t\t\tif (event.key !== \"Enter\") return\n\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\n\t\t\t// It's a link that points to a router within the site\n\t\t\tif (route) {\n\t\t\t\tpropsAddedByLink.navigate?.()\n\t\t\t} else {\n\t\t\t\topenExternalLink(propsAddedByLink.href, propsAddedByLink.rel, propsAddedByLink.target)\n\t\t\t}\n\t\t},\n\t\t[propsAddedByLink, route],\n\t)\n\n\tuseRefEffect(\n\t\tobserverRef,\n\t\t(node: HTMLAnchorElement | null) => {\n\t\t\tif (node === null) return\n\t\t\t// This will indicate `ssg/src/ssg-sandbox-renderer/worker/nestedLinks.ts` to stop handling the events and let the react handlers do their job\n\t\t\tif (!shouldReplaceLink) return\n\t\t\tnode.dataset.hydrated = \"true\"\n\t\t},\n\t\t[shouldReplaceLink],\n\t)\n\n\tlet replacedChildren = children\n\tif (shouldReplaceLink) {\n\t\t// Collect nested links for reporting\n\t\tChildren.forEach(children, child => {\n\t\t\tif (!isChildReplaceable(child)) return\n\n\t\t\tassert(\n\t\t\t\tlinkInfoIsCollectable(outerLink),\n\t\t\t\t\"outerLink must have nodeId defined at this point; this was verified with `shouldReplaceLink` above\",\n\t\t\t)\n\t\t\tassert(\n\t\t\t\tlinkInfoIsCollectable(innerLink),\n\t\t\t\t\"innerLink must have nodeId defined at this point; this was verified with `shouldReplaceLink` above\",\n\t\t\t)\n\n\t\t\tnestedLinksCollector.collectNestedLink(outerLink, innerLink)\n\t\t})\n\n\t\t// Replace nested links (<a> \u2192 <span>)\n\t\treplacedChildren = Children.map(children, (child: ReactHTMLElement<HTMLAnchorElement>) => {\n\t\t\tif (!isChildReplaceable(child)) return child\n\n\t\t\tconst tag = maybeReplaceAnchorWithSpan(child.type)\n\t\t\tconst { children: childChildren, ...childProps } = child.props as HTMLProps<HTMLAnchorElement>\n\n\t\t\tconst props = {\n\t\t\t\t...childProps,\n\t\t\t\t// This attribute is used in `ssg/src/ssg-sandbox-renderer/worker/nestedLinks.ts` to handle the nested links clicks\n\t\t\t\t\"data-nested-link\": true,\n\t\t\t\trole: \"link\",\n\t\t\t\ttabIndex: 0,\n\t\t\t\tonClick,\n\t\t\t\tonAuxClick,\n\t\t\t\tonKeyDown,\n\t\t\t\tas: childProps.as && maybeReplaceAnchorWithSpan(childProps.as),\n\t\t\t}\n\n\t\t\tconst ref = \"ref\" in child ? child.ref : undefined\n\n\t\t\treturn createElement(\n\t\t\t\ttag,\n\t\t\t\t// We need to pass the ref here again, otherwise it will be lost\n\t\t\t\t{ ...props, ref } as Record<string, unknown>,\n\t\t\t\tchildChildren,\n\t\t\t)\n\t\t})\n\t}\n\n\treturn <OuterLinkContext.Provider value={innerLink}>{replacedChildren}</OuterLinkContext.Provider>\n}\n\nfunction linkInfoIsCollectable(linkInfo?: PartialNestedLinkInfo): linkInfo is NestedLinkInfo {\n\treturn !isUndefined(linkInfo?.nodeId)\n}\n\n/**\n * This function checks if a child of Link is replaceable by a span. We support replacing\n * - motion.a \u2192 motion.span\n * - a \u2192 span\n * - <Image as=\"a\"> \u2192 <Image as=\"span\">\n * but there might be other scenarios we haven\u2019t designed for.\n */\nfunction isChildReplaceable(child: ReactNode) {\n\treturn (\n\t\tisValidElement(child) &&\n\t\t(maybeReplaceAnchorWithSpan(child.type) !== child.type ||\n\t\t\tmaybeReplaceAnchorWithSpan(child.props.as) !== child.props.as)\n\t)\n}\n\nfunction openExternalLink(href: string, rel?: string, target?: string) {\n\tconst link = document.createElement(\"a\")\n\tlink.href = href\n\tif (rel) {\n\t\tlink.rel = rel\n\t}\n\tif (target) {\n\t\tlink.target = target\n\t}\n\tdocument.body.appendChild(link)\n\tlink.click()\n\tlink.remove()\n}\n\nfunction maybeReplaceAnchorWithSpan(component: string | ComponentType<unknown>) {\n\tif (component === \"a\") return \"span\"\n\tif (isMotionComponent(component) && unwrapMotionComponent(component) === \"a\") return motion.span\n\treturn component\n}\n", "// This is similar to the Vekter model `Link.ts`. Please keep these in sync.\nexport interface LinkToWebPage {\n\twebPageId: string\n\thash?: string\n\tpathVariables?: Record<string, string>\n\thashVariables?: Record<string, string>\n\tunresolvedPathSlugs?: Record<string, UnresolvedSlug>\n\tunresolvedHashSlugs?: Record<string, UnresolvedSlug>\n}\n\nconst linkKey: keyof LinkToWebPage = \"webPageId\"\nexport function isLinkToWebPage(link: unknown): link is LinkToWebPage {\n\treturn Boolean(link && typeof link === \"object\" && linkKey in link)\n}\n\nexport interface UnresolvedSlug {\n\tcollectionId: string\n\tcollectionItemId: string\n}\n", "import { isTest } from \"@framerjs/shared/src/environment.ts\"\nimport type { NestedLinkInfo } from \"@framerjs/shared/src/ssg/nestedLinkInfo.ts\"\nimport { assert } from \"../utils/assert.ts\"\nimport { isWindow } from \"../utils/utils.ts\"\n\ntype NestedLinkInfoKey = `${string}:${string}:${string}:${string}`\nfunction linkInfoKey(link: NestedLinkInfo): NestedLinkInfoKey {\n\treturn `${link.scopeId}:${link.nodeId}:${link.furthestExternalComponent?.scopeId}:${link.furthestExternalComponent?.nodeId}`\n}\n\n/**\n * Collector for detected nested links.\n *\n * There are 3 possible kinds of nested links:\n * 1. A link inside another in the same project\n * 2. A link inside an external component that is wrapped in a link in the page\n * 3. A link inside an external component that is wrapped in a link in this external component\n *\n * Which means that we may have 3 possible error messages:\n * 1. A message that will contain the nested link layer and the parent link layer\n * 2. A message that will contain the nested external component layer and the parent link layer\n * 3. A message that will only contain the nested external component layer\n */\nclass NestedLinksCollector {\n\tprivate collectedLinks = new Map<NestedLinkInfoKey, NestedLinkInfo>()\n\tprivate nestingInfo = new Map<NestedLinkInfoKey, Set<NestedLinkInfoKey>>()\n\n\tclear() {\n\t\tthis.collectedLinks.clear()\n\t\tthis.nestingInfo.clear()\n\t}\n\n\t/**\n\t * Returns a Map of outer links to their inner links.\n\t *\n\t * NOTE: This function is called in the SSG renderer sandbox (<root>/src/ssg/src/ssg-sandbox-renderer/sandbox/worker/renderer.ts)\n\t */\n\tgetLinks() {\n\t\tconst result = new Map<NestedLinkInfo, NestedLinkInfo[]>()\n\n\t\tfor (const [outerLinkKey, innerLinkKeys] of this.nestingInfo) {\n\t\t\tconst outerLinkInfo = this.collectedLinks.get(outerLinkKey)\n\t\t\tassert(outerLinkInfo, `Outer link not found: ${outerLinkKey}`)\n\n\t\t\tconst links = Array.from(innerLinkKeys).map(innerLinkKey => {\n\t\t\t\tconst innerLinkInfo = this.collectedLinks.get(innerLinkKey)\n\t\t\t\tassert(innerLinkInfo, `Inner link not found: ${innerLinkKey}`)\n\t\t\t\treturn innerLinkInfo\n\t\t\t})\n\n\t\t\tresult.set(outerLinkInfo, links)\n\t\t}\n\n\t\treturn result\n\t}\n\n\tcollectNestedLink(outerLink: NestedLinkInfo, innerLink: NestedLinkInfo) {\n\t\tif ((isWindow && !isTest()) || !outerLink.nodeId || !innerLink.nodeId) {\n\t\t\treturn\n\t\t}\n\n\t\tthis.collectedLinks.set(linkInfoKey(outerLink), outerLink)\n\t\tthis.collectedLinks.set(linkInfoKey(innerLink), innerLink)\n\n\t\tconst outerLinkNestingInfo = this.nestingInfo.get(linkInfoKey(outerLink)) ?? new Set()\n\t\touterLinkNestingInfo.add(linkInfoKey(innerLink))\n\t\tthis.nestingInfo.set(linkInfoKey(outerLink), outerLinkNestingInfo)\n\t}\n}\n\n/**\n * @internal\n */\nexport const nestedLinksCollector = /* @__PURE__ */ new NestedLinksCollector()\n", "import { RenderTarget } from \"../render/types/RenderEnvironment.ts\"\n/**\n * Returns a constant value based on whether the caller is mounted in a Framer\n * Canvas environment.\n *\n * @public\n */\nexport function useIsOnFramerCanvas() {\n\treturn RenderTarget.current() === RenderTarget.canvas\n}\n", "export function isInternalURL(href: string | undefined) {\n\tif (href === undefined) return false\n\t// If updating this, please also update the selectors in rewriteLinksWithQueryParams.ts.\n\tif (href.startsWith(\"#\") || href.startsWith(\"/\") || href.startsWith(\".\")) return true\n\treturn false\n}\n\nexport function isValidURL(href: string, isInternal: boolean) {\n\ttry {\n\t\tconst url = new URL(href)\n\t\treturn Boolean(url.protocol) // in theory this should always be true, but just in case?\n\t} catch {\n\t\t// Ignore thrown errors.\n\t}\n\treturn isInternal\n}\n", "import { inferInitialRouteFromPath } from \"../../router/inferInitialRouteFromPath.ts\"\nimport type { ActiveRoute, Locale, Route, RouterAPI } from \"../../router/types.ts\"\nimport { isString } from \"../../utils/utils.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { isInternalURL } from \"./urlChecks.tsx\"\n\nexport function getRouteFromPageLink(\n\tpageLink: string | LinkToWebPage,\n\trouter: Partial<RouterAPI>,\n\tcurrentRoute: ActiveRoute | undefined,\n\tlocales?: readonly Locale[],\n): Route | undefined {\n\tif (isString(pageLink)) {\n\t\tconst isInternal = isInternalURL(pageLink)\n\n\t\tif (!router.routes || !router.getRoute || !currentRoute || !isInternal) {\n\t\t\treturn\n\t\t}\n\n\t\t// see propsForRoutePath for why we have those checks in place. We target only internal links (routes) here, so no need for errors.\n\t\tconst [pathnameWithQueryParams] = pageLink.split(\"#\", 2)\n\t\tif (pathnameWithQueryParams === undefined) return\n\n\t\tconst [pathname] = pathnameWithQueryParams.split(\"?\", 2)\n\t\tif (pathname === undefined) return\n\n\t\tconst { routeId } = inferInitialRouteFromPath(router.routes, pathname, undefined, locales)\n\t\treturn router.getRoute(routeId)\n\t}\n\n\tconst { webPageId } = pageLink\n\treturn router.getRoute?.(webPageId)\n}\n", "import type { RouterAPI } from \"../router/types.ts\"\nimport { isString } from \"../utils/utils.ts\"\n\n/**\n * @internal\n * @deprecated\n */\nexport interface FramerPageLinkCollectionItemAttribute {\n\tcollection: string\n\tcollectionItemId: string\n\tpathVariables: Record<string, string>\n}\n\n/**\n * @internal\n * @deprecated\n */\nexport interface FramerPageLinkAttributes {\n\telement?: string | null\n\tcollectionItem?: FramerPageLinkCollectionItemAttribute\n}\n\nconst elementKey: keyof FramerPageLinkAttributes = \"element\"\nconst collectionKey: keyof FramerPageLinkCollectionItemAttribute = \"collection\"\nconst collectionItemIdKey: keyof FramerPageLinkCollectionItemAttribute = \"collectionItemId\"\nconst pathVariablesKey: keyof FramerPageLinkCollectionItemAttribute = \"pathVariables\"\n\n// This includes the comma that separates the media type from the data.\nconst mediaType = \"framer/page-link,\"\n/**\n * @internal\n * @deprecated\n */\nexport type FramerLink = `data:${typeof mediaType}${string}`\n/**\n * @internal\n * @deprecated\n */\nexport function isFramerPageLink(value: unknown): value is FramerLink {\n\treturn isString(value) && value.startsWith(`data:${mediaType}`)\n}\n\n/**\n * @internal\n * @deprecated\n */\nexport function createFramerPageLink(targetId: string | null = null, options: FramerPageLinkAttributes = {}): string {\n\tconst target = targetId ? targetId : \"none\"\n\tconst link = new URL(`data:${mediaType}${target}`)\n\n\tif (options.element) {\n\t\tlink.searchParams.append(elementKey, options.element)\n\t}\n\n\tif (options.collectionItem) {\n\t\tlink.searchParams.append(collectionKey, options.collectionItem.collection)\n\t\tlink.searchParams.append(collectionItemIdKey, options.collectionItem.collectionItemId)\n\t\tlink.searchParams.append(pathVariablesKey, new URLSearchParams(options.collectionItem.pathVariables).toString())\n\t}\n\n\treturn link.href\n}\n\n/**\n * @internal\n * @deprecated\n */\nexport interface PageLinkParsedResult {\n\ttarget: string | null\n\telement: string | null | undefined\n\tcollectionItem: FramerPageLinkCollectionItemAttribute | undefined\n}\n\n/**\n * @internal\n * @deprecated\n */\nexport function parseFramerPageLink(link: unknown): PageLinkParsedResult | undefined {\n\tif (!isFramerPageLink(link)) return\n\n\ttry {\n\t\tconst url = new URL(link)\n\t\tconst target = url.pathname.substring(mediaType.length)\n\t\tconst searchParams = url.searchParams\n\n\t\tconst element = searchParams.has(elementKey) ? searchParams.get(elementKey) : undefined\n\t\tlet collectionItem: FramerPageLinkCollectionItemAttribute | undefined\n\n\t\tconst collection = searchParams.get(collectionKey)\n\t\tconst collectionItemId = searchParams.get(collectionItemIdKey)\n\t\tconst pathVariablesValue = searchParams.get(pathVariablesKey)\n\n\t\tif (collection && collectionItemId && pathVariablesValue) {\n\t\t\tconst pathVariables = Object.fromEntries(new URLSearchParams(pathVariablesValue).entries())\n\t\t\tcollectionItem = {\n\t\t\t\tcollection,\n\t\t\t\tcollectionItemId,\n\t\t\t\tpathVariables,\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\ttarget: target === \"none\" ? null : target,\n\t\t\t/**\n\t\t\t * For historical reason we used to set \"element=none\" into the\n\t\t\t * datalink, we no longer do that today, but we still keep this code\n\t\t\t * so we could parse legacy links correctly.\n\t\t\t */\n\t\t\telement: element === \"none\" ? undefined : element,\n\t\t\tcollectionItem,\n\t\t}\n\t} catch {\n\t\treturn\n\t}\n}\n\n/**\n * @internal\n * @deprecated\n */\nexport function shouldOpenLinkInNewTab(link: unknown) {\n\treturn !isFramerPageLink(link)\n}\n\n/**\n * @internal\n * @deprecated\n */\nexport const enum PageLinkAttribute {\n\tPage = \"data-framer-page-link-target\",\n\tElement = \"data-framer-page-link-element\",\n\tPathVariables = \"data-framer-page-link-path-variables\",\n\tCurrent = \"data-framer-page-link-current\",\n}\n\n/** @internal @deprecated */\nexport function navigateFromAttributes(\n\tnavigate: RouterAPI[\"navigate\"],\n\telement: HTMLAnchorElement,\n\timplicitPathVariables?: Record<string, unknown>,\n): boolean {\n\t// These attributes are set by `replaceFramerPageLinks`.\n\tlet routeId = element.getAttribute(PageLinkAttribute.Page)\n\tlet elementId: string | undefined\n\tlet pathVariables: Record<string, unknown> | undefined\n\tif (routeId) {\n\t\telementId = element.getAttribute(PageLinkAttribute.Element) ?? undefined\n\t\tconst pathVariablesRaw = element.getAttribute(PageLinkAttribute.PathVariables)\n\t\tif (pathVariablesRaw) {\n\t\t\tpathVariables = Object.fromEntries(new URLSearchParams(pathVariablesRaw).entries())\n\t\t}\n\t} else {\n\t\t// Just in case for some reason the link on the element wasn't resolved, try to parse it.\n\t\tconst href = element.getAttribute(\"href\")\n\t\tif (!href) return false\n\t\tconst link = parseFramerPageLink(href)\n\t\tif (!link || !link.target) return false\n\t\trouteId = link.target\n\t\telementId = link.element ?? undefined\n\t\tpathVariables = link.collectionItem?.pathVariables\n\t}\n\n\tconst smoothScroll = elementId ? element.dataset.framerSmoothScroll !== undefined : undefined\n\tnavigate(routeId, elementId, Object.assign({}, implicitPathVariables, pathVariables), smoothScroll)\n\treturn true\n}\n", "import type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { type FramerPageLinkCollectionItemAttribute, isFramerPageLink, parseFramerPageLink } from \"../framerPageLink.ts\"\n\n/**\n * Convert a deprecated framer page link string (data:framer/page-link,augiA20Il) into the same shape as a ComplexLink from\n * Vekter.\n *\n * @internal\n */\nexport function linkFromFramerPageLink(link: string | undefined): LinkToWebPage | string | undefined {\n\tif (!isFramerPageLink(link)) return link\n\tconst parsed = parseFramerPageLink(link)\n\tif (!parsed) return undefined\n\tconst { target, element, collectionItem } = parsed\n\tif (!target) return undefined\n\n\treturn {\n\t\twebPageId: target,\n\t\thash: element ?? undefined,\n\t\tpathVariables: createVariablesFromPageLinkCollectionItem(collectionItem),\n\t}\n}\n\nfunction createVariablesFromPageLinkCollectionItem(\n\tcollectionItem: FramerPageLinkCollectionItemAttribute | undefined,\n): Record<string, string> | undefined {\n\tif (!collectionItem) return undefined\n\n\tconst variables: Record<string, string> = {}\n\tfor (const pathVariablesKey in collectionItem.pathVariables) {\n\t\tconst value = collectionItem.pathVariables[pathVariablesKey]\n\t\tif (value) variables[pathVariablesKey] = value\n\t}\n\treturn variables\n}\n", "import { frame } from \"framer-motion\"\nimport React from \"react\"\nimport { withCSS } from \"./withCSS.tsx\"\n\nexport interface TextSelectionColors {\n\tcolor?: string\n\tbackgroundColor?: string\n}\n\ninterface InjectSelectionStyleProps {\n\ttriggerId?: string\n\tchildren: React.ReactNode\n}\n\nconst textSelectionColorVariable = \"--text-selection-color\"\nconst textSelectionBackgroundColorVariable = \"--text-selection-background-color\"\n\nfunction updateTextSelectionStyles(triggerId?: string): TextSelectionColors | undefined {\n\tif (!triggerId) return\n\n\tframe.read(() => {\n\t\tconst el = document.getElementById(triggerId)\n\t\tif (!el) return\n\n\t\tconst styles = getComputedStyle(el)\n\t\tconst textSelectionColor = styles.getPropertyValue(\"--selection-color\").trim()\n\t\tconst textSelectionBackgroundColor = styles.getPropertyValue(\"--selection-background-color\").trim()\n\n\t\t// Set the text selection style variables on all matching elements. In the case of relative overlay, this will be the first portal child. In the case of fixed overlay, this will be both the overlay and any other children of the portal.\n\t\tframe.render(() => {\n\t\t\tconst overlayPortal = document.querySelectorAll<HTMLElement>(`[data-framer-portal-id=\"${triggerId}\"]`)\n\t\t\tif (overlayPortal.length === 0) return\n\n\t\t\tif (textSelectionColor) {\n\t\t\t\toverlayPortal.forEach(el => el.style.setProperty(textSelectionColorVariable, textSelectionColor))\n\t\t\t}\n\n\t\t\tif (textSelectionBackgroundColor) {\n\t\t\t\toverlayPortal.forEach(el =>\n\t\t\t\t\tel.style.setProperty(textSelectionBackgroundColorVariable, textSelectionBackgroundColor),\n\t\t\t\t)\n\t\t\t}\n\t\t})\n\t})\n}\n\nfunction getTextSelectionStylesFromTrigger(triggerId?: string): [string] {\n\treturn [\n\t\t`[data-framer-portal-id=\"${triggerId}\"] * ::selection {\n    color: var(${textSelectionColorVariable});\n    background-color: var(${textSelectionBackgroundColorVariable});\n}`,\n\t]\n}\n\nfunction InjectSelectionStyleWithoutCSS({ triggerId, children }: InjectSelectionStyleProps) {\n\tReact.useLayoutEffect(() => {\n\t\tif (triggerId) updateTextSelectionStyles(triggerId)\n\t}, [triggerId])\n\n\treturn children\n}\n\nexport const InjectSelectionStyle = /* @__PURE__ */ (() =>\n\twithCSS(\n\t\tInjectSelectionStyleWithoutCSS,\n\t\t(_target, props) => getTextSelectionStylesFromTrigger(props?.triggerId),\n\t\t\"InjectSelectionStyle\",\n\t))()\n", "import { Line } from \"./Line.ts\"\nimport { Point } from \"./Point.ts\"\nimport { Rect } from \"./Rect.ts\"\n\n/**\n * @internal\n */\nexport const Polygon = {\n\t/**\n\t * Determine if the vertices are ordered clockwise or counter-clockwise. This works for simple\n\t * (non-self-intersecting) convex polygons. If the polygon is collapsed into a line (signedArea = 0), we consider it\n\t * clockwise for it works with how Framer draws the polygons.\n\t * See: https://paulbourke.net/geometry/polygonmesh/\n\t * @internal */\n\tisClockwise: (points: Point[]) => {\n\t\treturn Polygon.signedArea(points) <= 0\n\t},\n\n\t/**\n\t * Calculate the signed area to determine if the vertices go clockwise or counter clockwise. We flip all the y\n\t * values because the y axis in our canvas coordinate is fipped.\n\t * See: https://mathworld.wolfram.com/PolygonArea.html\n\t * @internal */\n\tsignedArea: (points: Point[]) => {\n\t\tlet sum = 0\n\t\tconst len = points.length\n\t\tfor (let i = 0; i < len; i++) {\n\t\t\tconst pointA = points[i]\n\t\t\tconst pointB = points[(i + 1) % len]\n\t\t\tif (!pointA || !pointB) continue\n\n\t\t\tsum += pointA.x * -pointB.y - pointB.x * -pointA.y\n\t\t}\n\t\treturn (1 / 2) * sum\n\t},\n\n\t/**\n\t * Determine if some Point lies inside (or on) the polygon formed by other\n\t * Points. The other points must be provided in a clockwise/counter\n\t * clockwise order otherwise the line segments we create to test the polygon\n\t * will not be representative.\n\t *\n\t * Solution for convex polygons based on:\n\t * https://www.eecs.umich.edu/courses/eecs380/HANDOUTS/PROJ2/InsidePoly.html\n\t *\n\t * We create a line segment for each side of the polygon. The point we are\n\t * testing must be on or on the same side of each line segment.\n\t *\n\t * @internal\n\t */\n\tcontainsPoint: (polygonPoints: Point[], point: Point) => {\n\t\tlet sign: boolean | undefined = undefined\n\t\tfor (let i = 0; i < polygonPoints.length; i++) {\n\t\t\t// If the first point on the line we are testing is one of the\n\t\t\t// polygon points, we consider it inside.\n\t\t\tif (Point.isEqual(polygonPoints[i]!, point)) return true\n\n\t\t\t// Form a segment between the i'th point\n\t\t\tconst x1 = polygonPoints[i]?.x ?? 0\n\t\t\tconst y1 = polygonPoints[i]?.y ?? 0\n\n\t\t\t// And the i+1'th, or if i is the last, with the first point\n\t\t\tconst i2 = (i + 1) % polygonPoints.length\n\n\t\t\tif (Point.isEqual(polygonPoints[i2]!, point)) return true\n\n\t\t\tconst x2 = polygonPoints[i2]?.x ?? 0\n\t\t\tconst y2 = polygonPoints[i2]?.y ?? 0\n\n\t\t\t// Compute the cross product\n\t\t\tconst d = (point.x - x1) * (y2 - y1) - (point.y - y1) * (x2 - x1)\n\t\t\t// The point is on the line, consider it on the same side.\n\t\t\tif (d === 0) continue\n\n\t\t\tconst localSign = d > 0\n\t\t\t// Initialize the sign if it hasn't been set.\n\t\t\tsign ??= localSign\n\n\t\t\t// If the sign changes, then the point is on a different side.\n\t\t\tif (sign !== localSign) return false\n\t\t}\n\n\t\t// If no change in direction, then on same side of all segments, and thus inside\n\t\treturn true\n\t},\n\n\t/** @internal */\n\tintersects: (pointsA: Point[], pointsB: Point[]) => {\n\t\tif (pointsA.length < 1 || pointsB.length < 1) return false\n\n\t\t// Fast track: if the bounding boxes don't intersect, two polygons can't intersect.\n\t\tconst boundingRectA = Rect.boundingRectFromPoints(pointsA)\n\t\tconst boundingRectB = Rect.boundingRectFromPoints(pointsB)\n\t\tif (!Rect.intersects(boundingRectA, boundingRectB)) return false\n\n\t\t// Check if any edges intersect with another.\n\t\tconst edgesA: Line[] = []\n\t\tconst pointsALength = pointsA.length\n\t\tpointsA.forEach((point, index) => {\n\t\t\tconst nextPoint = pointsA[(index + 1) % pointsALength]\n\t\t\tif (!nextPoint) return\n\n\t\t\tedgesA.push(Line(point, nextPoint))\n\t\t})\n\n\t\tconst edgesB: Line[] = []\n\t\tconst pointsBLength = pointsB.length\n\t\tpointsB.forEach((point, index) => {\n\t\t\tconst nextPoint = pointsB[(index + 1) % pointsBLength]\n\t\t\tif (!nextPoint) return\n\n\t\t\tedgesB.push(Line(point, nextPoint))\n\t\t})\n\n\t\tfor (const edgeA of edgesA) {\n\t\t\tfor (const edgeB of edgesB) {\n\t\t\t\tconst intersection = Line.intersection(edgeA, edgeB, true)\n\t\t\t\tif (intersection) return true\n\t\t\t}\n\t\t}\n\n\t\t// Check if one is fully inside the other: if rect A contains rect B, one of the points on B must be in rect A (and vice versa)\n\t\t// The non-null assertion is safe because we already check the length at the beginning.\n\t\tif (Polygon.containsPoint(pointsB, pointsA[0]!)) return true\n\t\tif (Polygon.containsPoint(pointsA, pointsB[0]!)) return true\n\n\t\treturn false\n\t},\n\n\t/** @internal */\n\tcontains: (pointsA: Point[], pointsB: Point[]) => {\n\t\tfor (let i = 0; i < pointsB.length; i++) {\n\t\t\tif (!Polygon.containsPoint(pointsA, pointsB[i]!)) return false\n\t\t}\n\n\t\treturn true\n\t},\n\n\t/** @internal */\n\tclipToRect: (points: Point[], rect: Rect) => {\n\t\tconst edges = Rect.edges(rect)\n\n\t\t// When finding intersection points, we may have the same point multiple\n\t\t// times. Creating duplicate points means we will have to calculate the\n\t\t// same angle when organizing these points in a clockwise order. So we\n\t\t// avoid that by using a set of string representations of the points.\n\t\tconst seen = new Set<string>()\n\t\tconst count = points.length\n\n\t\tconst clippedPoints: Point[] = []\n\t\tconst originalPoints: Point[] = []\n\n\t\t// Next find points on the polygon inside the rect, otherwise the\n\t\t// intersection points of lines drawn between each polygon point, and\n\t\t// the edges of the clipping rect.\n\t\tfor (let i = 0; i < count; i++) {\n\t\t\tconst point = points[i]!\n\t\t\tconst nextPoint = points[(i + 1) % count]!\n\n\t\t\t// If the point lies in the rect, no need to clip it. Rect.contains\n\t\t\t// point is also very fast so we should use it.\n\t\t\tif (Rect.containsPoint(rect, point)) {\n\t\t\t\tconst intersectionKey = keyForPoint(point)\n\t\t\t\tseen.add(intersectionKey)\n\t\t\t\toriginalPoints.push(point)\n\t\t\t\t// If the next point is also inside the rect, we can continue as\n\t\t\t\t// we don't need to create a clipped point between these points.\n\t\t\t\tif (Rect.containsPoint(rect, nextPoint)) continue\n\t\t\t}\n\n\t\t\t// Otherwise we need to create points for each intersection of the\n\t\t\t// line formed between the point and the next point, and each edge\n\t\t\t// of the rectangle. This can form up to 2 points. We need to check\n\t\t\t// for intersection even if both points of the line aren't inside\n\t\t\t// the rect, as the line formed by the points may pass through 1 or\n\t\t\t// more edges of the rectangle.\n\t\t\tconst line = Line(point, nextPoint)\n\n\t\t\tedges.forEach(edge => {\n\t\t\t\tconst intersection = Line.intersection(line, edge, true)\n\t\t\t\tif (!intersection) return\n\n\t\t\t\tconst intersectionKey = keyForPoint(intersection)\n\t\t\t\tif (seen.has(intersectionKey)) return\n\n\t\t\t\tseen.add(intersectionKey)\n\t\t\t\tclippedPoints.push(intersection)\n\t\t\t})\n\t\t}\n\n\t\t// If we didn't clip any points, return the original points. That way we\n\t\t// don't waste cycles sorting them which can be slow.\n\t\tif (clippedPoints.length === 0) return originalPoints\n\n\t\t// Finally quickly add points of the clipping rect that are inside the\n\t\t// polygon. This ensures that removing a point outside of the rect\n\t\t// doesn't create lines that travel back through the rect to the next\n\t\t// point.\n\t\tRect.points(rect).forEach(point => {\n\t\t\tif (!Polygon.containsPoint(points, point)) return\n\t\t\tseen.add(keyForPoint(point))\n\t\t\tclippedPoints.push(point)\n\t\t})\n\n\t\treturn Point.sortClockwise([...originalPoints, ...clippedPoints])\n\t},\n}\n\nfunction keyForPoint(point: Point) {\n\treturn `${point?.x}-${point?.y}`\n}\n", "import type { Point } from \"../render/types/Point.ts\"\nimport { Polygon } from \"../render/types/Polygon.ts\"\nimport { Rect } from \"../render/types/Rect.ts\"\nimport type { Size } from \"../render/types/Size.ts\"\nimport { assertNever } from \"../utils/assert.ts\"\n\nexport type Placement = \"top\" | \"right\" | \"bottom\" | \"left\"\nexport type Alignment = \"start\" | \"center\" | \"end\"\n\nfunction invertPlacement(placement: Placement): Placement {\n\tswitch (placement) {\n\t\tcase \"top\":\n\t\t\treturn \"bottom\"\n\t\tcase \"right\":\n\t\t\treturn \"left\"\n\t\tcase \"bottom\":\n\t\t\treturn \"top\"\n\t\tcase \"left\":\n\t\t\treturn \"right\"\n\t\tdefault:\n\t\t\tassertNever(placement)\n\t}\n}\n\nfunction preferredOffset(point: number, length: number, max: number, collisionDetectionPadding: number = 0): number {\n\tconst min = Math.max(point, collisionDetectionPadding)\n\t// If the initial left point is smaller than the minimum left (0 or the\n\t// collision padding) return the min left to pin the floating element to the\n\t// left of the window.\n\tif (point < min) return min\n\t// Otherwise if the initial left point plus the size of the floating element\n\t// would cause part of the floating element to be off screen, return a left\n\t// value pinned to the right of the window.\n\tconst size = length + collisionDetectionPadding\n\tif (min + size > max) return max - size\n\n\t// Otherwise return the minimum left value, this should always be `point`.\n\treturn min\n}\n\nfunction collisionAxis(placement: Placement, rect: Rect, windowSize: Size): \"x\" | \"y\" | undefined {\n\tswitch (placement) {\n\t\tcase \"top\":\n\t\tcase \"bottom\":\n\t\t\tif (rect.y < 0 || rect.y + rect.height > windowSize.height) return \"y\"\n\t\t\treturn undefined\n\t\tcase \"left\":\n\t\tcase \"right\":\n\t\t\tif (rect.x < 0 || rect.x + rect.width > windowSize.width) return \"x\"\n\t\t\treturn undefined\n\t\tdefault:\n\t\t\tassertNever(placement)\n\t}\n}\n\nfunction getPlacementAndOffsetAvoidingScreenCollision(\n\trect: Rect,\n\tplacement: Placement,\n\toffset: Point,\n\twindowSize: Size,\n): { x: number; y: number; placement: Placement } {\n\tswitch (collisionAxis(placement, rect, windowSize)) {\n\t\tcase \"x\":\n\t\t\treturn {\n\t\t\t\tplacement: invertPlacement(placement),\n\t\t\t\tx: offset.x * -1,\n\t\t\t\ty: offset.y,\n\t\t\t}\n\t\tcase \"y\":\n\t\t\treturn {\n\t\t\t\tplacement: invertPlacement(placement),\n\t\t\t\tx: offset.x,\n\t\t\t\ty: offset.y * -1,\n\t\t\t}\n\t\tdefault:\n\t\t\treturn {\n\t\t\t\tplacement,\n\t\t\t\tx: offset.x,\n\t\t\t\ty: offset.y,\n\t\t\t}\n\t}\n}\n\nexport function getSafePlacementFloatingPositionRect(\n\tanchor: Rect,\n\telement: Rect,\n\tplacement: Placement,\n\talignment: Alignment,\n\toffset: Point,\n\t/**\n\t * If the floating layer should avoid collision with the window, provide the\n\t * window bounds as a Size.\n\t */\n\tcollisionDetectionSize?: Size,\n\tcollisionDetectionPadding?: number,\n): [Placement, Rect] {\n\tconst rebasedRect = Rect.rebaseRectOnto(element, anchor, placement, alignment)\n\tconst preferredRect: Rect = {\n\t\tx: rebasedRect.x + offset.x,\n\t\ty: rebasedRect.y + offset.y,\n\t\twidth: element.width,\n\t\theight: element.height,\n\t}\n\n\tif (!collisionDetectionSize) return [placement, preferredRect]\n\n\tconst {\n\t\tx,\n\t\ty,\n\t\tplacement: safePlacement,\n\t} = getPlacementAndOffsetAvoidingScreenCollision(preferredRect, placement, offset, collisionDetectionSize)\n\n\tconst rebasedCollisionRect = Rect.rebaseRectOnto(element, anchor, safePlacement, alignment)\n\n\treturn [\n\t\tsafePlacement,\n\t\t{\n\t\t\tx: preferredOffset(\n\t\t\t\trebasedCollisionRect.x + x,\n\t\t\t\telement.width,\n\t\t\t\tcollisionDetectionSize.width,\n\t\t\t\tcollisionDetectionPadding,\n\t\t\t),\n\t\t\ty: preferredOffset(\n\t\t\t\trebasedCollisionRect.y + y,\n\t\t\t\telement.height,\n\t\t\t\tcollisionDetectionSize.height,\n\t\t\t\tcollisionDetectionPadding,\n\t\t\t),\n\t\t\twidth: element.width,\n\t\t\theight: element.height,\n\t\t},\n\t]\n}\n\n/**\n *  Check if point a is inside a polygon formed of point b and other points. I\n *  so, use b, otherwise use a.\n */\nfunction preferredPoint(a: Point, b: Point, points: Point[]) {\n\tif (Polygon.containsPoint([b, ...points], a)) return b\n\treturn a\n}\n\n/**\n * Prevent the point of the polygon that is under the cursor from being closer\n * than 5px to the edge of the anchor on the axis of the Floating layers\n * placement. This ensures that the polygon can't be too shallow to be useful.\n */\nconst minInset = 5\nexport function safeAreaPolygonConstraints(rect: Rect) {\n\treturn {\n\t\tconstrainX: (value: number) => Math.min(Math.max(value, rect.x + minInset), rect.x + rect.width - minInset),\n\t\tconstrainY: (value: number) => Math.min(Math.max(value, rect.y + minInset), rect.y + rect.height - minInset),\n\t} as const\n}\n\nconst mouseOffset = 4\n\n/**\n * Create the points of a triangle between the mouse cursor, and one side\n * (determined by the placement) of the rect. The lines from the cursor point to\n * the side points should not intersect the provided rect.\n */\nexport function polygonPoints(\n\t{ x, y }: Point,\n\tplacement: Placement,\n\trect: Rect,\n\t{ constrainX, constrainY }: ReturnType<typeof safeAreaPolygonConstraints>,\n): Point[] {\n\tconst [tl, bl, tr, br] = Rect.points(rect)\n\n\tswitch (placement) {\n\t\tcase \"left\": {\n\t\t\tconst mousePoint: Point = { x: constrainX(x - mouseOffset), y }\n\t\t\treturn [mousePoint, preferredPoint(br, bl, [mousePoint, tr]), preferredPoint(tr, tl, [mousePoint, br])]\n\t\t}\n\t\tcase \"right\": {\n\t\t\tconst mousePoint: Point = { x: constrainX(x + mouseOffset), y }\n\t\t\treturn [mousePoint, preferredPoint(bl, br, [mousePoint, tl]), preferredPoint(tl, tr, [mousePoint, bl])]\n\t\t}\n\t\tcase \"top\": {\n\t\t\tconst mousePoint: Point = { x, y: constrainY(y - mouseOffset) }\n\t\t\treturn [mousePoint, preferredPoint(bl, tl, [mousePoint, br]), preferredPoint(br, tr, [mousePoint, bl])]\n\t\t}\n\t\tcase \"bottom\": {\n\t\t\tconst mousePoint: Point = { x, y: constrainY(y + mouseOffset) }\n\t\t\treturn [mousePoint, preferredPoint(tl, bl, [mousePoint, tr]), preferredPoint(tr, br, [mousePoint, tl])]\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(placement)\n\t}\n}\n\n/**\n * Create a css inset value for the safe area based on the placement of the\n * floating element, and the delta between the floating element and anchor\n * elements. The safe area is rendered inside the floating element, so the\n * offset should only be <= 0 to move the safe area in line with the anchor.\n */\nfunction safeAreaInset(placement: Placement, delta: Point): string {\n\tswitch (placement) {\n\t\tcase \"left\":\n\t\t\treturn `${Math.min(delta.y, 0)}px auto auto 0px`\n\t\tcase \"right\":\n\t\t\treturn `${Math.min(delta.y, 0)}px 0px auto auto`\n\t\tcase \"top\":\n\t\t\treturn `0px auto auto ${Math.min(delta.x, 0)}px`\n\t\tcase \"bottom\":\n\t\t\treturn `auto auto 0px ${Math.min(delta.x, 0)}px`\n\t\tdefault:\n\t\t\tassertNever(placement)\n\t}\n}\n\nexport function floatingPositionSafeAreaStyle(\n\tx: number,\n\ty: number,\n\tplacement: Placement,\n\tanchorRect: Rect,\n\tfloatingRect: Rect,\n): Partial<CSSStyleDeclaration> {\n\tconst minX = Math.min(floatingRect.x, anchorRect.x)\n\tconst minY = Math.min(floatingRect.y, anchorRect.y)\n\tconst rect = Rect.merge(anchorRect, floatingRect)\n\n\t// The points returned from `polygonPoints` are relative to the client, but\n\t// we will be drawing a polygon inside of a div, so we need to offset all of\n\t// the points so that the top right of the safe area is 0x0.\n\tconst points = polygonPoints({ x, y }, placement, floatingRect, safeAreaPolygonConstraints(anchorRect))\n\t\t.map(point => `${point.x - minX}px ${point.y - minY}px`)\n\t\t.join(\", \")\n\n\treturn {\n\t\theight: `${rect.height}px`,\n\t\twidth: `${rect.width}px`,\n\t\tclipPath: `polygon(${points})`,\n\t\tinset: safeAreaInset(placement, Rect.delta(anchorRect, floatingRect)),\n\t}\n}\n\nfunction valueForFloatingAlignment(alignment: Alignment): number {\n\tswitch (alignment) {\n\t\tcase \"start\":\n\t\t\treturn 0\n\t\tcase \"center\":\n\t\t\treturn 0.5\n\t\tcase \"end\":\n\t\t\treturn 1\n\t\tdefault:\n\t\t\tassertNever(alignment)\n\t}\n}\n\n/**\n * Convert Placement and Alignment to framer-motion's originX/originY so that\n * the Floating element always appears to animate from the anchor.\n */\nexport function motionOriginFromFloatingPosition(\n\tplacement: Placement | undefined = \"bottom\",\n\talignment: Alignment | undefined = \"center\",\n): { originX: number; originY: number } {\n\tswitch (placement) {\n\t\tcase \"top\":\n\t\t\treturn { originX: valueForFloatingAlignment(alignment), originY: 1 }\n\t\tcase \"right\":\n\t\t\treturn { originX: 0, originY: valueForFloatingAlignment(alignment) }\n\t\tcase \"bottom\":\n\t\t\treturn { originX: valueForFloatingAlignment(alignment), originY: 0 }\n\t\tcase \"left\":\n\t\t\treturn { originX: 1, originY: valueForFloatingAlignment(alignment) }\n\t\tdefault:\n\t\t\tassertNever(placement)\n\t}\n}\n", "import React from \"react\"\n\nexport const Instance = /* @__PURE__ */ React.forwardRef(function Instance(\n\t{ Component, ...props }: Record<string, unknown> & { Component: React.ComponentType<Record<string, unknown>> },\n\tref: React.Ref<unknown>,\n) {\n\treturn Component ? <Component {...props} ref={ref} /> : null\n})\n", "import { createElement, useContext } from \"react\"\nimport { GeneratedComponentContext } from \"./GeneratedComponentContext.ts\"\nimport { PropertyOverrides } from \"./PropertyOverrides.tsx\"\n\ninterface Props {\n\tcomponent: React.ComponentType<Record<string, unknown>>\n\tprops: Record<string, unknown>\n}\n\n/**\n * Automatically applies the active breakpoint variant name to embedded component instances\n * (e.g. components rendered from Rich Text) if they do not have a variant set.\n *\n * @internal\n */\nexport function AutoBreakpointVariant({ component, props }: Props) {\n\tconst generatedComponentContext = useContext(GeneratedComponentContext)\n\n\tconst element = createElement(component, props)\n\n\tif (\"variant\" in props && props.variant != null) {\n\t\treturn element\n\t}\n\n\tif (!generatedComponentContext) return element\n\n\tconst { activeVariantId, humanReadableVariantMap } = generatedComponentContext\n\n\tif (!activeVariantId || !humanReadableVariantMap) {\n\t\treturn element\n\t}\n\n\tconst overrides: Record<string, Record<string, unknown>> = {}\n\tfor (const [name, id] of Object.entries(humanReadableVariantMap)) {\n\t\toverrides[id] = { variant: name }\n\t}\n\n\treturn (\n\t\t<PropertyOverrides overrides={overrides} breakpoint={activeVariantId}>\n\t\t\t{element}\n\t\t</PropertyOverrides>\n\t)\n}\n", "import type React from \"react\"\nimport { Component } from \"react\"\nimport { sendTrackingEvent } from \"../utils/sendTrackingEvent.ts\"\nimport { getPleaseReportMessage, isBot } from \"../utils/utils.ts\"\n\ninterface Props {\n\tchildren: React.ReactNode\n}\n\ninterface State {\n\terror?: unknown\n}\n\n/**\n * Top-level error boundary that gracefully degrades to a non-interactive fallback UI. See also https://github.com/framer/company/issues/31364.\n * Inspired by https://github.com/uncurated-tests/graceful-degradation-hydration-error/blob/main/app/gracefully-degrading-error-boundary.tsx\n * @internal\n */\nexport class GracefullyDegradingErrorBoundary extends Component<Props, State> {\n\toverride state: State = { error: undefined }\n\n\tprivate message = \"Made UI non-interactive due to an error.\"\n\tprivate messageFatal = \"Fatal error.\"\n\n\tstatic getDerivedStateFromError(error: unknown) {\n\t\treturn { error }\n\t}\n\n\toverride componentDidCatch(error: unknown) {\n\t\twindow.__framer_hadFatalError = true\n\n\t\tif (\"cause\" in (error as Error)) {\n\t\t\t// eslint-disable-next-line framer-studio/tscompat -- This is a safe unwrap.\n\t\t\terror = (error as Error).cause // unwrap the error\n\t\t}\n\n\t\t// biome-ignore lint/suspicious/noConsole: intentional\n\t\tconsole.error(getPleaseReportMessage(isBot ? this.message : this.messageFatal, error))\n\n\t\tconst sampleRate = Math.random()\n\n\t\t// when code boundaries are released, make sure we don't flood immediately. Bump 25% -> 50% -> 100%.\n\t\tif (sampleRate > 0.5) return\n\t\tconst stack = error instanceof Error && typeof error.stack === \"string\" ? error.stack : null\n\t\tsendTrackingEvent(\"published_site_load_error\", {\n\t\t\tmessage: String(error),\n\t\t\tstack,\n\t\t})\n\t}\n\n\toverride render() {\n\t\tconst error = this.state.error\n\t\tif (!error) return this.props.children\n\n\t\t/**\n\t\t * At this point, we know that nothing interactive can happen anymore, so we can run side-effects (reading from the DOM) in render.\n\t\t *\n\t\t * As a side-note, we don't need to handle recoverable hydration errors here, because recoverable errors, such as hydration mismatches, are handled by React and skip error boundaries.\n\t\t * So we only need to handle fatal errors. A fatal error is an error outside of hydration, where React would unmount the root. An example would be a runtime TypeError.\n\t\t */\n\n\t\t// eslint-disable-next-line framer-studio/tscompat -- This is a safe unwrap.\n\t\tconst unwrappedError = \"cause\" in (error as Error) ? (error as Error).cause : error\n\t\tconst closingHTMLComment = /-->/gu // The only thing we need to escape in an HTML comment, is the closing tag.\n\t\tconst closingHTMLCommentReplacement = \"--!>\"\n\t\tconst dom = isBot\n\t\t\t? document.getElementById(\"main\")?.innerHTML || \"\"\n\t\t\t: // @FIXME: We should have a UI for fatal error recovery.\n\t\t\t\t// We don't have a UI for fatal error recovery currently, so we just render nothing for regular users. If we were to throw, React would unmount too.\n\t\t\t\t// We do render instead of throwing, so that:\n\t\t\t\t// - `componentDidCatch` runs (if we throw here, it does not)\n\t\t\t\t// - we can skip logging `Recoverable error during hydration`, because we know it was fatal.\n\t\t\t\t\"\"\n\n\t\treturn (\n\t\t\t// This has the caveat that we will slightly modify the DOM, but it appears to be fine in this case.\n\t\t\t// The alternative would be to queue a new task that runs after and then set the innerHTML (= avoids the dummy-div), but that means we'll have DOM -> no DOM -> DOM transitions. With the div, we have DOM -> DOM and remove possible race-conditions.\n\t\t\t<div\n\t\t\t\tstyle={{ display: \"contents\" }}\n\t\t\t\tsuppressHydrationWarning\n\t\t\t\t// biome-ignore lint/security/noDangerouslySetInnerHtml: React would unmount the root on errors, but we must ensure that bots can still read the SSR'd content.\n\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t__html:\n\t\t\t\t\t\t`<!-- DOM replaced by GracefullyDegradingErrorBoundary due to \"${(unwrappedError as Error).message.replace(closingHTMLComment, closingHTMLCommentReplacement)}\". ${getPleaseReportMessage()}: -->` +\n\t\t\t\t\t\t`<!-- Stack: ${(error as Error).stack?.replace(closingHTMLComment, \"--!>\")} -->` +\n\t\t\t\t\t\tdom,\n\t\t\t\t}}\n\t\t\t/>\n\t\t)\n\t}\n}\n", "import { isCommandKeyPressed, isIOS } from \"@framerjs/shared/src/environment.ts\"\nimport type { TapInfo } from \"framer-motion\"\nimport type { PropsWithChildren, RefAttributes } from \"react\"\nimport type React from \"react\"\nimport { forwardRef, isValidElement, useMemo } from \"react\"\nimport {\n\ttype MaybeRef,\n\ttype MutableRefCallback,\n\tuseObserverRef,\n\tuseRefEffect,\n} from \"../../components/utils/refHelper.ts\"\nimport { useCloneChildrenWithPropsAndRef } from \"../../components/utils/useCloneChildrenWithPropsAndRef.tsx\"\nimport { findAnchorElement } from \"../../render/utils/findAnchorElement.ts\"\nimport { useRouter } from \"../../router/RouterContext.tsx\"\nimport { getPathForRoute } from \"../../router/history.ts\"\nimport type { ActiveRoute, Locale, RouterAPI } from \"../../router/types.ts\"\nimport { useCurrentRoute } from \"../../router/useCurrentRoute.tsx\"\nimport { useLocaleInfo } from \"../../router/useLocale.ts\"\nimport { usePreloadRoute } from \"../../router/useRoutePreloader.ts\"\nimport { isBot, isEmptyObject, isFunction, isObject, isPromise, isString } from \"../../utils/utils.ts\"\nimport { yieldToMain } from \"../../utils/yield.ts\"\nimport { withChildrenCanSuspend } from \"../ChildrenCanSuspend.tsx\"\nimport { isLinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { useIsOnFramerCanvas } from \"../useIsOnFramerCanvas.ts\"\nimport {\n\tfindMatchingRouteAttributesForResolvedPath,\n\tfindMatchingRouteAttributesForWebPageLink,\n} from \"./findMatchingRouteAttributes.tsx\"\nimport { linkFromFramerPageLink } from \"./linkFromFramerPageLink.tsx\"\nimport { linkMatchesRoute } from \"./linkMatchesRoute.tsx\"\nimport { observeRouteForPreloading } from \"./observeRouteForPreloading.ts\"\nimport { useImplicitPathVariables } from \"./pathVariables.tsx\"\nimport { type PropsForLinkOptions, getTargetAttrValue, propsForLink } from \"./propsForLink.tsx\"\nimport { useResolveSlugsWithSuspense } from \"./resolveSlugs.ts\"\nimport { AnchorLinkTarget, type LinkProps, type PropsAddedByLink, type PropsAddedByLinkInternal } from \"./types.ts\"\nimport { useReplaceNestedLinks } from \"./useReplaceNestedLinks.tsx\"\nimport { type TrackLinkClick, useTrackLinkClick } from \"./useTrackLinkClick.ts\"\n\nfunction performNavigation(\n\trouter: Partial<RouterAPI>,\n\trouteId: string,\n\tpreload: PropsAddedByLinkInternal[\"preload\"],\n\telementId?: string,\n\tcombinedPathVariables?: Record<string, unknown>,\n\tsmoothScroll?: boolean,\n\tbeforeUrlUpdate?: () => void,\n) {\n\tvoid preload()\n\trouter.navigate?.(routeId, elementId, combinedPathVariables, smoothScroll, beforeUrlUpdate)\n}\n\nfunction createOnClickLinkHandler(\n\thref: string,\n\ttrackLinkClick: TrackLinkClick,\n\tnavigate: PropsAddedByLinkInternal[\"navigate\"],\n) {\n\treturn async (event: React.MouseEvent | MouseEvent | React.PointerEvent | PointerEvent) => {\n\t\t// If command is pressed when clicking a link we want to open a new tab instead\n\t\tconst usedCommandKey = isCommandKeyPressed(event)\n\n\t\t/**\n\t\t * Note: in the preview iframe we hijack all anchor link\n\t\t * clicks and modify the target based on the href, so that\n\t\t * we won't try to open an external links in the preview\n\t\t * iframe, for example. (see src/app/vekter/src/preview-next/utils/interceptAnchorLinks.ts)\n\t\t */\n\t\t// We don't need SPA routing when opening links in a new tab\n\t\tconst anchorElement = findAnchorElement(event.target)\n\t\tconst isExternalLink = !anchorElement || anchorElement.getAttribute(\"target\") === AnchorLinkTarget._blank\n\t\tconst shouldPerformNavigation = !usedCommandKey && !isExternalLink\n\n\t\tconst track = () => void trackLinkClick(href)\n\t\tif (!shouldPerformNavigation) {\n\t\t\t// Yield before running tracking code to keep INP low; user-blocking so this queues before any other tasks\n\t\t\tawait yieldToMain({ priority: \"user-blocking\", ensureContinueBeforeUnload: true, continueAfter: \"paint\" })\n\t\t\ttrack()\n\t\t\treturn\n\t\t}\n\n\t\tevent.preventDefault()\n\t\tnavigate(track)\n\t}\n}\n\ntype Props = PropsWithChildren<LinkProps> & RefAttributes<unknown>\n\nfunction propsForRoutePath(\n\thref: string,\n\trouter: Partial<RouterAPI>,\n\tcurrentRoute: ActiveRoute | undefined,\n\tlinkOptions: PropsForLinkOptions & { smoothScroll: boolean | undefined },\n\tpreload: ReturnType<typeof usePreloadRoute>,\n\tlocaleId?: string,\n\tlocales?: readonly Locale[],\n\timplicitPathVariables?: Record<string, unknown>,\n): Partial<PropsAddedByLinkInternal> {\n\tif (!currentRoute) return propsForLink(href, linkOptions)\n\n\tconst matchedRoute = findMatchingRouteAttributesForResolvedPath(router, href, implicitPathVariables, locales)\n\t// If we couldn't find a matching route, we will assume the href is an external link.\n\tif (!matchedRoute) return propsForLink(href, linkOptions)\n\n\tconst { routeId, route, elementId, pathVariables, locale } = matchedRoute\n\tif (!route) return propsForLink(href, linkOptions)\n\n\t// Make the link relative to the current path if we can.\n\tconst path = getPathForRoute(route, {\n\t\t// If the link is resolved, we trust that the slugs are resolved.\n\t\tcurrentRoutePath: currentRoute.path,\n\t\tcurrentRoutePathLocalized: currentRoute.pathLocalized,\n\t\tcurrentPathVariables: currentRoute.pathVariables,\n\t\t// The hash value is already fully resolved so we don't need to\n\t\t// provide any hashVariables.\n\t\thash: elementId,\n\t\tpathVariables,\n\t\tpreserveQueryParams: router.preserveQueryParams && !isBot, // don't preserve query params for bots\n\t\tsiteCanonicalURL: router.siteCanonicalURL,\n\t\tlocaleId,\n\t})\n\n\tconst anchorTarget = getTargetAttrValue(linkOptions.openInNewTab, true)\n\tconst isBlankTarget = anchorTarget === AnchorLinkTarget._blank\n\tconst linkContext = { pathVariables, locale }\n\tconst navigate = (beforeUrlUpdate?: () => void) =>\n\t\tperformNavigation(\n\t\t\trouter,\n\t\t\trouteId,\n\t\t\t() => preload(routeId, linkContext, false, !isBlankTarget),\n\t\t\telementId,\n\t\t\tpathVariables,\n\t\t\tlinkOptions.smoothScroll,\n\t\t\tbeforeUrlUpdate,\n\t\t)\n\n\treturn {\n\t\thref: path,\n\t\ttarget: anchorTarget,\n\t\tonClick: createOnClickLinkHandler(path, linkOptions.trackLinkClick, navigate),\n\t\tnavigate,\n\t\t\"data-framer-page-link-current\":\n\t\t\t(currentRoute &&\n\t\t\t\tlinkMatchesRoute(\n\t\t\t\t\tcurrentRoute,\n\t\t\t\t\t{ webPageId: routeId, hash: elementId, pathVariables },\n\t\t\t\t\timplicitPathVariables,\n\t\t\t\t)) ||\n\t\t\tundefined,\n\n\t\tpreload: () => preload(routeId, linkContext, true, !isBlankTarget),\n\t\t_routeId: routeId,\n\t\t_pathVariables: pathVariables,\n\t\t_locale: locale,\n\t} satisfies PropsAddedByLinkInternal\n}\n\n/**\n * NOTE: Any change to this component should have a QA for this project https://development.framer.com/projects/Nested-Links--ozJyj13jPMDAbU9zv9WB-1rkcd\n */\n/** @public */\nexport const Link = /* @__PURE__ */ withChildrenCanSuspend<unknown, Props>(\n\t/* @__PURE__ */\n\tforwardRef(function Link(\n\t\t{\n\t\t\tchildren,\n\t\t\thref,\n\t\t\topenInNewTab,\n\t\t\tsmoothScroll,\n\t\t\tclickTrackingId,\n\t\t\trelValues,\n\t\t\tpreserveParams,\n\t\t\tnodeId,\n\t\t\tscopeId,\n\t\t\tmotionChild,\n\t\t\t...restProps\n\t\t}: Props,\n\t\tforwardedRef,\n\t) {\n\t\tconst router = useRouter()\n\t\tconst currentRoute = useCurrentRoute()\n\t\tconst implicitPathVariables = useImplicitPathVariables()\n\t\tconst { activeLocale, locales } = useLocaleInfo()\n\t\tconst resolveSlugsWithSuspense = useResolveSlugsWithSuspense()\n\t\tconst preload = usePreloadRoute()\n\t\tconst isOnFramerCanvas = useIsOnFramerCanvas()\n\n\t\tconst trackLinkClick = useTrackLinkClick({\n\t\t\tnodeId,\n\t\t\tclickTrackingId,\n\t\t\trouter,\n\t\t\thref,\n\t\t\tactiveLocale,\n\t\t})\n\n\t\tconst propsAddedByLink = useMemo((): Partial<PropsAddedByLinkInternal> => {\n\t\t\tif (!href) return {}\n\n\t\t\tconst pageLink = isLinkToWebPage(href) ? href : linkFromFramerPageLink(href)\n\t\t\tif (!pageLink) return {}\n\n\t\t\tif (isString(pageLink)) {\n\t\t\t\treturn propsForRoutePath(\n\t\t\t\t\tpageLink,\n\t\t\t\t\trouter,\n\t\t\t\t\tcurrentRoute,\n\t\t\t\t\t{ openInNewTab, trackLinkClick, rel: relValues?.join(\" \"), preserveParams, smoothScroll },\n\t\t\t\t\tpreload,\n\t\t\t\t\tactiveLocale?.id,\n\t\t\t\t\tlocales,\n\t\t\t\t\timplicitPathVariables,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst { unresolvedPathSlugs, unresolvedHashSlugs } = pageLink\n\t\t\tconst maybeResolvedSlugs = resolveSlugsWithSuspense(unresolvedPathSlugs, unresolvedHashSlugs, activeLocale)\n\n\t\t\t// FIXME: With React 19, use the `use` hook instead.\n\t\t\tif (isPromise(maybeResolvedSlugs)) {\n\t\t\t\tthrow maybeResolvedSlugs\n\t\t\t}\n\n\t\t\tconst maybeRouteAttributes = findMatchingRouteAttributesForWebPageLink(\n\t\t\t\trouter,\n\t\t\t\tcurrentRoute,\n\t\t\t\tpageLink,\n\t\t\t\tactiveLocale,\n\t\t\t\tmaybeResolvedSlugs,\n\t\t\t\timplicitPathVariables,\n\t\t\t)\n\n\t\t\tconst { routeId, href: resolvedHref, elementId, pathVariables, locale } = maybeRouteAttributes\n\n\t\t\tconst anchorTarget = getTargetAttrValue(openInNewTab, true)\n\t\t\tconst isBlankTarget = anchorTarget === AnchorLinkTarget._blank\n\t\t\tconst linkContext = { pathVariables, locale }\n\t\t\tconst navigate = (beforeUrlUpdate?: () => void) =>\n\t\t\t\tperformNavigation(\n\t\t\t\t\trouter,\n\t\t\t\t\trouteId,\n\t\t\t\t\t() => preload(routeId, linkContext, false, !isBlankTarget),\n\t\t\t\t\telementId,\n\t\t\t\t\tpathVariables,\n\t\t\t\t\tsmoothScroll,\n\t\t\t\t\tbeforeUrlUpdate,\n\t\t\t\t)\n\t\t\treturn {\n\t\t\t\thref: resolvedHref,\n\t\t\t\ttarget: anchorTarget,\n\t\t\t\tonClick: createOnClickLinkHandler(resolvedHref, trackLinkClick, navigate),\n\t\t\t\t\"data-framer-page-link-current\":\n\t\t\t\t\t(currentRoute && linkMatchesRoute(currentRoute, pageLink, implicitPathVariables)) || undefined,\n\n\t\t\t\tnavigate,\n\t\t\t\tpreload: () => preload(routeId, linkContext, true, !isBlankTarget),\n\t\t\t\t_routeId: routeId,\n\t\t\t\t_pathVariables: pathVariables,\n\t\t\t\t_locale: locale,\n\t\t\t} satisfies PropsAddedByLinkInternal\n\t\t}, [\n\t\t\thref,\n\t\t\trouter,\n\t\t\tactiveLocale,\n\t\t\timplicitPathVariables,\n\t\t\topenInNewTab,\n\t\t\tcurrentRoute,\n\t\t\tsmoothScroll,\n\t\t\ttrackLinkClick,\n\t\t\trelValues,\n\t\t\tlocales,\n\t\t\tpreserveParams,\n\t\t\tresolveSlugsWithSuspense,\n\t\t\tpreload,\n\t\t])\n\n\t\tconst hasRef = isValidElement(children) && \"ref\" in children\n\t\tconst observerRef = useObserverRef(hasRef ? (children.ref as MaybeRef<HTMLAnchorElement>) : undefined)\n\n\t\t// FIXME: Figure out why we are omitting navigate in propsAddedByLinkExceptNavigate; might be unnecessary\n\t\tconst {\n\t\t\tnavigate,\n\t\t\tpreload: preloadFn,\n\t\t\t_routeId,\n\t\t\t_pathVariables,\n\t\t\t_locale,\n\t\t\t...restPropsAddedByLink\n\t\t} = propsAddedByLink\n\n\t\tuseRefEffect(\n\t\t\tobserverRef,\n\t\t\t(node: HTMLAnchorElement | null) => {\n\t\t\t\tif (node === null || !_routeId || !preloadFn || isOnFramerCanvas) return\n\n\t\t\t\treturn observeRouteForPreloading?.(\n\t\t\t\t\tnode,\n\t\t\t\t\tpreloadFn,\n\t\t\t\t\t`${_routeId}:${_locale?.id}:${JSON.stringify(_pathVariables)}`,\n\t\t\t\t)\n\t\t\t},\n\t\t\t[preloadFn, _routeId, _pathVariables, _locale],\n\t\t)\n\n\t\t// `navigate` is only set for internal navigation\n\t\tconst isInternalNavigation = Boolean(navigate)\n\t\t// It must be the `forwardedRef`, not `observerRef` \u2013 otherwise the appear animation effect will not work.\n\t\t// FIXME: Figure out why and simplify\n\t\tconst clone = useCloneChildrenWithPropsAndRef(forwardedRef)\n\t\tconst replacedChildren = clone.cloneAsArray(children, childProps =>\n\t\t\tcloneChildPropsWithAggregatedEvents(\n\t\t\t\tchildProps,\n\t\t\t\t{\n\t\t\t\t\t...restProps,\n\t\t\t\t\t...rebindEventHandlersIfNeeded(restPropsAddedByLink, motionChild, isInternalNavigation),\n\t\t\t\t},\n\t\t\t\tobserverRef,\n\t\t\t),\n\t\t)\n\n\t\treturn useReplaceNestedLinks(replacedChildren, scopeId, nodeId, href, propsAddedByLink, observerRef)\n\t}),\n)\n\nfunction cloneChildPropsWithAggregatedEvents(\n\tchildProps: Record<string, unknown>,\n\tlinkProps: PropsAddedByLink,\n\tobserverRef: MutableRefCallback<HTMLAnchorElement>,\n) {\n\tconst mergedStyle = mergeStyles(childProps.style, linkProps.style)\n\n\tconst aggregatedProps = {\n\t\t...childProps,\n\t\t...linkProps,\n\t\t...(mergedStyle && { style: mergedStyle }),\n\t\tref: observerRef,\n\t}\n\tconst { onTap, onClick } = linkProps\n\tif (!onTap && !onClick) {\n\t\treturn aggregatedProps\n\t}\n\n\tconst { onClick: childOnClick, onTap: childOnTap } = childProps\n\n\t// If Link is hijacking onClick/onTap, aggregate with the ones coming from the child\n\t// props. For example, the child might be a variant that uses onTap for press variant.\n\treturn {\n\t\t...aggregatedProps,\n\t\tonClick:\n\t\t\tonClick || childOnClick\n\t\t\t\t? (event: React.MouseEvent) => {\n\t\t\t\t\t\tif (isFunction(childOnClick)) {\n\t\t\t\t\t\t\tchildOnClick?.(event)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick?.(event)\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\tonTap:\n\t\t\tonTap || childOnTap\n\t\t\t\t? (event: PointerEvent, info: TapInfo) => {\n\t\t\t\t\t\tif (isFunction(childOnTap)) {\n\t\t\t\t\t\t\tchildOnTap?.(event, info)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonTap?.(event, info)\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t}\n}\n\n// Merges two style objects. Only returns a style object if at least one of the inputs has meaningful styles.\nfunction mergeStyles(childStyle: unknown, linkStyle: React.CSSProperties | undefined): React.CSSProperties | undefined {\n\tconst maybeChildStyle = isObject(childStyle) ? childStyle : undefined\n\tconst hasChildStyles = maybeChildStyle && !isEmptyObject(maybeChildStyle)\n\tconst hasLinkStyles = linkStyle && !isEmptyObject(linkStyle)\n\n\tif (!hasChildStyles && !hasLinkStyles) return undefined\n\n\treturn { ...maybeChildStyle, ...linkStyle }\n}\n\n// There's a long standing iOS/iPadOS bug where onClick is not triggered if the element is\n// unmounted by an onTap (variant transition). Hence on iOS we switch to use onTap. We can't\n// use onTap directly because we're not certain that the descendant would be a motion\n// component, so we have to bind the event listeners ourselves using `press`.\n// https://github.com/framer/company/issues/31758\n//\n// This should only be applied for internal navigation. External links use onClick\n// for click tracking and rely on default browser link handling - converting these\n// to onTap and inserting onClick with preventDefault would break that functionality.\nfunction rebindEventHandlersIfNeeded(\n\tlinkProps: PropsAddedByLink,\n\tmotionChild: boolean | undefined,\n\tisInternalNavigation: boolean,\n): PropsAddedByLink {\n\tconst shouldReplaceClickWithTap = Boolean(motionChild && isIOS())\n\tif (!shouldReplaceClickWithTap) return linkProps\n\n\tconst { onClick, ...restProps } = linkProps\n\t// If we're not binding onClick at all, just let browsers deal with the native navigation.\n\tif (!onClick) return linkProps\n\n\tif (isInternalNavigation) {\n\t\treturn {\n\t\t\t...restProps,\n\t\t\tonTap: onClick,\n\t\t\t// When the link is an internal link, we're already doing SPA routing in onClick\n\t\t\t// prevent the default click behavior so that we don't trigger a native anchor link navigation again.\n\t\t\tonClick: preventClickOnNativeAnchorLink,\n\t\t}\n\t}\n\n\t// External links don't do SPA routing, thus no need for preventDefault.\n\treturn { ...restProps, onTap: onClick }\n}\n\nfunction preventClickOnNativeAnchorLink(event: React.MouseEvent) {\n\tconst anchorElement = findAnchorElement(event.target)\n\tif (!anchorElement || anchorElement.getAttribute(\"target\") === AnchorLinkTarget._blank) return\n\n\tevent.preventDefault()\n}\n", "/**\n * Search the closest anchor element ancestor of the given target.\n * @param target The starting element.\n * @param withinElement If an element is given, the search will stop when it\n * hits the element. Otherwise, it will try to get the closest anchor element.\n */\nexport function findAnchorElement(target: unknown, withinElement?: HTMLElement | null): HTMLAnchorElement | null {\n\tif (target instanceof HTMLAnchorElement) {\n\t\treturn target\n\t}\n\n\tif (target instanceof Element) {\n\t\tif (target === withinElement) {\n\t\t\treturn null\n\t\t}\n\n\t\treturn findAnchorElement(target.parentElement, withinElement)\n\t}\n\n\treturn null\n}\n", "import type { ComponentType, ReactNode } from \"react\"\nimport { forwardRef } from \"react\"\nimport { SuspenseThatPreservesDom } from \"../router/SuspenseThatPreservesDom.tsx\"\n\nexport function ChildrenCanSuspend({ children }: { children: ReactNode }) {\n\treturn <SuspenseThatPreservesDom>{children}</SuspenseThatPreservesDom>\n}\n\nexport function withChildrenCanSuspend<T, P extends {}>(\n\tComponent: ComponentType<P>,\n): ReturnType<typeof forwardRef<T, P>> {\n\treturn forwardRef<T, P>(function withChildrenCanSuspendInner(props, ref) {\n\t\treturn (\n\t\t\t<ChildrenCanSuspend>\n\t\t\t\t<Component {...props} ref={ref} />\n\t\t\t</ChildrenCanSuspend>\n\t\t)\n\t})\n}\n", "import { getPathForRoute } from \"../../router/history.ts\"\nimport { inferInitialRouteFromPath } from \"../../router/inferInitialRouteFromPath.ts\"\nimport type { ActiveRoute, Locale, Route, RouterAPI } from \"../../router/types.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport type { ResolvedSlugs } from \"./resolveSlugs.ts\"\nimport { isInternalURL } from \"./urlChecks.tsx\"\n\nexport function findMatchingRouteAttributesForWebPageLink(\n\trouter: Partial<RouterAPI>,\n\tcurrentRoute: ActiveRoute | undefined,\n\tpageLink: LinkToWebPage,\n\tactiveLocale: Locale | null,\n\tresolvedSlugs: ResolvedSlugs,\n\timplicitPathVariables?: Record<string, unknown>,\n): RouteAttributes {\n\tconst { webPageId, hash, pathVariables, hashVariables } = pageLink\n\n\treturn getRouteAttributes(\n\t\trouter,\n\t\tcurrentRoute,\n\t\twebPageId,\n\t\thash,\n\t\timplicitPathVariables,\n\t\tpathVariables,\n\t\thashVariables,\n\t\tresolvedSlugs,\n\t\tactiveLocale,\n\t)\n}\n\nexport function findMatchingRouteAttributesForResolvedPath(\n\trouter: Partial<RouterAPI>,\n\tpath: string,\n\timplicitPathVariables?: Record<string, unknown>,\n\tlocales?: readonly Locale[],\n): RouteAttributes | undefined {\n\tif (!router.routes || !router.getRoute) {\n\t\treturn\n\t}\n\n\tconst isInternal = isInternalURL(path)\n\tif (!isInternal) {\n\t\treturn\n\t}\n\n\ttry {\n\t\tconst [pathnameWithQueryParams, hash] = path.split(\"#\", 2)\n\t\tassert(pathnameWithQueryParams !== undefined, \"A href must have a defined pathname.\")\n\t\tconst [pathname] = pathnameWithQueryParams.split(\"?\", 2)\n\t\tassert(pathname !== undefined, \"A href must have a defined pathname.\")\n\t\tconst { routeId, pathVariables, localeId } = inferInitialRouteFromPath(router.routes, pathname, undefined, locales)\n\t\tconst route = router.getRoute(routeId)\n\t\tif (route) {\n\t\t\tconst combinedPathVariables = Object.assign({}, implicitPathVariables, pathVariables)\n\t\t\tconst locale = localeId ? locales?.find(({ id }) => id === localeId) : undefined\n\n\t\t\treturn {\n\t\t\t\trouteId,\n\t\t\t\troute,\n\t\t\t\thref: path,\n\t\t\t\t// If the link is resolved (in ResolveLink), we trust that the hash is also resolved. Otherwise, it\n\t\t\t\t// should be resolved by getHashForRoute.\n\t\t\t\telementId: hash,\n\t\t\t\tpathVariables: combinedPathVariables,\n\t\t\t\tlocale,\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Fall through, we could not match the path to a path defined in our\n\t\t// routes. We will assume the href is an external link.\n\t}\n}\n\ninterface RouteAttributes {\n\trouteId: string\n\troute: Route | undefined\n\thref: string\n\telementId?: string\n\tpathVariables?: Record<string, unknown>\n\tlocale?: Locale\n}\n\nfunction getRouteAttributes(\n\trouter: Partial<RouterAPI>,\n\tcurrentRoute: ActiveRoute | undefined,\n\trouteId: string,\n\thash: string | undefined,\n\timplicitPathVariables: Record<string, unknown> | undefined,\n\tpathVariables: Record<string, unknown> | undefined,\n\thashVariables: Record<string, unknown> | undefined,\n\tresolvedSlugs: ResolvedSlugs | undefined,\n\tactiveLocale?: Locale | null,\n) {\n\tconst combinedPathVariables = { ...implicitPathVariables, ...pathVariables, ...resolvedSlugs?.path }\n\tconst combinedHashVariables = { ...implicitPathVariables, ...hashVariables, ...resolvedSlugs?.hash }\n\n\tconst route = router.getRoute?.(routeId)\n\tconst resolvedHref = getPathForRoute(route, {\n\t\tcurrentRoutePath: currentRoute?.path,\n\t\tcurrentRoutePathLocalized: currentRoute?.pathLocalized,\n\t\tcurrentPathVariables: currentRoute?.pathVariables,\n\t\thash: hash,\n\t\tpathVariables: combinedPathVariables,\n\t\thashVariables: combinedHashVariables,\n\t\tpreserveQueryParams: router.preserveQueryParams,\n\t\tsiteCanonicalURL: router.siteCanonicalURL,\n\t\tlocaleId: activeLocale?.id,\n\t})\n\n\tconst resolvedHash = resolvedHref.split(\"#\", 2)[1]\n\n\treturn {\n\t\trouteId,\n\t\troute,\n\t\thref: resolvedHref,\n\t\telementId: resolvedHash,\n\t\tpathVariables: combinedPathVariables,\n\t\tlocale: activeLocale ?? undefined,\n\t}\n}\n", "import { useContext } from \"react\"\nimport type { ActiveRoute } from \"../../router/types.ts\"\nimport { useCurrentRoute } from \"../../router/useCurrentRoute.tsx\"\nimport { isString } from \"../../utils/utils.ts\"\nimport { isLinkToWebPage } from \"../LinkToWebPage.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { linkFromFramerPageLink } from \"./linkFromFramerPageLink.tsx\"\nimport { PathVariablesContext, pathVariablesRegExp } from \"./pathVariables.tsx\"\n\n/**\n * @param route The current route to compare against.\n * @param link The link that may point at the current page.\n * @param implicitPathVariables Path variables that will be used by default if\n * not explicitly defined in the link.\n */\nexport function linkMatchesRoute(\n\troute: ActiveRoute,\n\t{\n\t\twebPageId,\n\t\thash,\n\t\tpathVariables,\n\t}: Omit<LinkToWebPage, \"pathVariables\"> & { pathVariables?: Record<string, unknown> },\n\timplicitPathVariables?: Record<string, unknown>,\n): boolean {\n\tif (webPageId !== route.id) return false\n\t// If we allowed page links to be active when they had an element, all page\n\t// links that were to an element on the current page would always be active.\n\t// We don't want that, so for now, we ignore links with elements. In future,\n\t// maybe we can build a feature so that links to an element on the current\n\t// page are only active when the element is in view.\n\tif (hash) return false\n\t// If there's path variables provided via a context, we should only return\n\t// true when the context matches the path variable in the current route.\n\tif (route.path && route.pathVariables) {\n\t\tconst combinedPathVariable = Object.assign({}, implicitPathVariables, pathVariables)\n\t\tfor (const [, key] of route.path.matchAll(pathVariablesRegExp)) {\n\t\t\tif (!key) return false\n\t\t\tif (route.pathVariables[key] !== combinedPathVariable[key]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}\n\n/**\n * @internal\n */\nexport function useLinkMatchesRoute(link: unknown): boolean {\n\tconst route = useCurrentRoute()\n\tconst contextPathVariables = useContext(PathVariablesContext)\n\tif (!route) return false\n\tconst pageLink = isString(link) ? linkFromFramerPageLink(link) : link\n\treturn isLinkToWebPage(pageLink) ? linkMatchesRoute(route, pageLink, contextPathVariables) : false\n}\n", "import { createContext, useContext } from \"react\"\nimport { useCurrentRoute } from \"../../router/useCurrentRoute.tsx\"\n\n// Note: This regular expression should match all other places in our code base.\nexport const pathVariablesRegExp = /:([a-z]\\w*)/gi\n\n/** @internal */\nexport const PathVariablesContext = /* @__PURE__ */ createContext<Record<string, unknown> | undefined>(undefined)\n\n/**\n * Implicit path variables (defaults to use for links) are provided\u2026\n *\n * - via the PathVariablesContext, for use with repeaters\n *\n *   e.g. a link to /blog/:slug, repeated multiple times with different :slug\n *   variables\n *\n * - via the current dynamic page\n *\n *   e.g. a page links to itself (permalink? scroll target?)\n *\n * XXX: You never know which route these path variables are intended for, so\n * it's possible to have a mismatch. Should this hook accept a route ID?\n *\n * @internal\n */\nexport function useImplicitPathVariables() {\n\tconst contextPathVariables = useContext(PathVariablesContext)\n\tconst currentPathVariables = useCurrentRoute()?.pathVariables\n\tconst pathVariables = contextPathVariables || currentPathVariables\n\treturn pathVariables\n}\n", "import { shouldPreloadBasedOnUA } from \"../../router/useRoutePreloader.ts\"\nimport type { PropsAddedByLinkInternal } from \"./types.ts\"\n\ndeclare global {\n\tinterface NetworkInformation {\n\t\teffectiveType?: string\n\t\tsaveData?: boolean\n\t\taddEventListener?: (type: string, listener: (event: Event) => void) => void\n\t}\n\n\tinterface Navigator {\n\t\tconnection?: NetworkInformation\n\t\tmozConnection?: NetworkInformation\n\t\twebkitConnection?: NetworkInformation\n\t\tdeviceMemory?: number\n\t}\n}\n\n/**\n * Context stored for each observed element to enable data preloading.\n */\nexport interface ObservedRouteContext {\n\tid: string\n\tpreload: () => void | Promise<void>\n}\n\nconst PRELOAD_AFTER_MS = 500 // ms\nconst OBSERVER_THRESHOLD = 0.9 // 90% in viewport\nconst LOW_MEMORY_THRESHOLD = 1.7 // GB\nconst MAX_CONCURRENT_PRELOADS_SLOW_NETWORK = 4\nconst MAX_CONCURRENT_PRELOADS_FAST_NETWORK = Infinity\nexport const nodeToRoute = new WeakMap<Element, ObservedRouteContext | undefined>()\nexport const preloadedRoutes = new Set<string>()\nexport const routeToNodesInViewport = new Map<string, Set<Element>>()\n\n// see https://www.notion.so/framer/RFC-Preloading-Routes-V2-9feb51be6e8042a0b82bdc0a0ce0dab0\nexport function getObserveRouteForPreloadingFn() {\n\t// eslint-disable-next-line compat/compat\n\tconst connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection || {}\n\t// eslint-disable-next-line compat/compat\n\tconst lowDeviceMemory = navigator.deviceMemory && navigator.deviceMemory > LOW_MEMORY_THRESHOLD\n\n\t// eslint-disable-next-line framer-studio/no-implicit-undefined-let -- assigned in updateConnection\n\tlet effectiveType: string, preloadDisabled: boolean, maxPreloadAmount: number\n\tfunction updateConnection() {\n\t\teffectiveType = connection.effectiveType || \"\"\n\t\t// for 2G/slow-2G, preloads might compete with e.g. images when users scroll down, so we don't want to take away network capacity by preloading.\n\t\t// we could check for `navigator.onLine` too, but that's not reliable: https://jfhr.me/how-to-really-know-if-your-webapp-is-online/\n\t\tpreloadDisabled = connection.saveData || effectiveType.includes(\"2g\")\n\t\t// 3G is slower than 4G, so we don't want to preload too much at once to avoid saturating the network.\n\t\tmaxPreloadAmount =\n\t\t\teffectiveType === \"3g\" || lowDeviceMemory\n\t\t\t\t? MAX_CONCURRENT_PRELOADS_SLOW_NETWORK\n\t\t\t\t: MAX_CONCURRENT_PRELOADS_FAST_NETWORK\n\t}\n\n\tconnection.addEventListener?.(\"change\", updateConnection)\n\tupdateConnection()\n\n\tconst observer = new IntersectionObserver(onPreloadIntersectionChange, { threshold: OBSERVER_THRESHOLD })\n\n\tlet activePreloadsAmount = 0\n\tasync function preloadTimeout(context: ObservedRouteContext, target: Element) {\n\t\t// limitation: if network changes while a node is in viewport, we will not preload it (we'll preload only when it exits and re-enters the viewport again).\n\t\t// TODO: when we add a queue (line 82), we could handle this case too (manage a queue while internet is slow).\n\t\tif (preloadDisabled) return\n\n\t\tconst { id, preload } = context\n\t\tconst nodesInViewport = routeToNodesInViewport.get(id)\n\t\t// we don't clear timeouts but still want to prevent preloading routes more than once.\n\t\t// so we don't do anything if no more nodes that relate to the route are in viewport,\n\t\t// or if the preload has been started already.\n\t\tif (!nodesInViewport?.size || preloadedRoutes.has(id)) return\n\n\t\t++activePreloadsAmount\n\t\tpreloadedRoutes.add(id)\n\n\t\tconst preloadPromise = preload()?.catch(() => {\n\t\t\tif (process.env.NODE_ENV !== \"production\") {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Error in preloadRoute during preloadTimeout. This should never happen as it introduces bugs. Please make sure preloadRoute does not throw.\",\n\t\t\t\t)\n\t\t\t}\n\t\t})\n\n\t\t// unobserve all nodes related to the route and clear the set.\n\t\tobserver.unobserve(target)\n\t\tnodeToRoute.delete(target)\n\t\tfor (const node of nodesInViewport) {\n\t\t\tobserver.unobserve(node)\n\t\t\tnodeToRoute.delete(node)\n\t\t}\n\t\tnodesInViewport.clear()\n\t\trouteToNodesInViewport.delete(id)\n\n\t\tawait preloadPromise\n\t\t--activePreloadsAmount\n\t}\n\n\tfunction onPreloadIntersectionChange(entries: IntersectionObserverEntry[]) {\n\t\tfor (const entry of entries) {\n\t\t\tconst target = entry.target\n\t\t\tconst context = nodeToRoute.get(target)\n\n\t\t\tif (!context || preloadedRoutes.has(context.id)) {\n\t\t\t\t// we could use WeakRefs and store all routeToNodes (not only those in the viewport) but Safari 13.1 doesn't support it.\n\t\t\t\t// However, trading less complexity with paying a small fee of observing some nodes a bit too long (they have been preloaded already) seems to be a good tradeoff.\n\t\t\t\tobserver.unobserve(target)\n\t\t\t\tnodeToRoute.delete(target)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst preloadId = context.id\n\t\t\tconst nodes = routeToNodesInViewport.get(preloadId)\n\t\t\tconst amountOfNodesInViewport = routeToNodesInViewport.get(preloadId)?.size ?? 0\n\n\t\t\tif (entry.isIntersecting) {\n\t\t\t\t// TODO: Refac to use a queue / p-limit instead of this check\n\t\t\t\t// currently, we might lose preloads here (should be preloaded, but we don't, as limit is reached).\n\t\t\t\t// so only on the next out of viewport -> in viewport, the route is considered again.\n\t\t\t\tif (activePreloadsAmount >= maxPreloadAmount) continue\n\n\t\t\t\tif (nodes) nodes.add(target)\n\t\t\t\telse routeToNodesInViewport.set(preloadId, new Set([target]))\n\n\t\t\t\tsetTimeout(preloadTimeout, PRELOAD_AFTER_MS, context, target)\n\t\t\t} else {\n\t\t\t\tif (nodes) nodes.delete(target)\n\t\t\t\t// if the size is 0 or 1 (as the current node has exited the viewport), we can remove the route.\n\t\t\t\tif (amountOfNodesInViewport <= 1) routeToNodesInViewport.delete(preloadId)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn (node: Element, preload: PropsAddedByLinkInternal[\"preload\"], id: string) => {\n\t\t// we already preloaded this route, so no need to observe the node.\n\t\tif (preloadedRoutes.has(id)) return\n\t\tnodeToRoute.set(node, { id, preload })\n\t\tobserver.observe(node)\n\n\t\treturn () => {\n\t\t\tnodeToRoute.delete(node)\n\t\t\tobserver.unobserve(node)\n\t\t}\n\t}\n}\n\nexport const observeRouteForPreloading =\n\t// this also guards `window`\n\t!shouldPreloadBasedOnUA || typeof IntersectionObserver === \"undefined\"\n\t\t? null\n\t\t: /* @__PURE__ */ getObserveRouteForPreloadingFn()\n", "import type { TapHandlers } from \"framer-motion\"\nimport type { CSSProperties } from \"react\"\nimport type { SupportedLinkRelValue } from \"../../render/types/SupportedRelValue.ts\"\nimport type { Locale } from \"../../router/types.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport type { ObservedRouteContext } from \"./observeRouteForPreloading.ts\"\n\nexport interface LinkProps {\n\thref: string | LinkToWebPage | undefined\n\t/**\n\t * Which browsing context to display the linked URL. If not provided, the\n\t * Link component will only open the link in a new tab if the href is an\n\t * external URL.\n\t */\n\topenInNewTab?: boolean\n\tsmoothScroll?: boolean\n\tclickTrackingId?: string\n\trelValues?: readonly SupportedLinkRelValue[]\n\tpreserveParams?: boolean\n\tnodeId?: string\n\tscopeId?: string\n\t/**\n\t * Indicates whether `motion.a` is used for the child component, allowing the use of `onTap`\n\t * instead of `onClick` on the link.\n\t */\n\tmotionChild?: boolean\n\tstyle?: CSSProperties\n}\n\nexport interface PropsAddedByLink {\n\thref?: string\n\ttarget?: string\n\trel?: string\n\tonClick?: (\n\t\tevent: React.MouseEvent | MouseEvent | React.PointerEvent | PointerEvent | React.TouchEvent | TouchEvent,\n\t) => void\n\tonTap?: TapHandlers[\"onTap\"]\n\t// TODO: Rollup fails when we import PageLinkAttribute in this file.\n\t\"data-framer-page-link-current\"?: true | undefined\n\tstyle?: CSSProperties\n}\n\n/** Props for internal (same-site) links. */\nexport interface PropsAddedByLinkInternal extends PropsAddedByLink {\n\tnavigate: (beforeUrlUpdate?: () => void) => void\n\tpreload: ObservedRouteContext[\"preload\"]\n\n\t/** @internal */\n\t_routeId: string\n\t/** @internal */\n\t_pathVariables?: Record<string, unknown>\n\t/** @internal */\n\t_locale?: Locale\n}\n\n/** @internal */\nexport enum AnchorLinkTarget {\n\t_blank = \"_blank\",\n\t_self = \"_self\",\n}\n", "import type { AnchorHTMLAttributes } from \"react\"\nimport { forwardCurrentQueryParams } from \"../../router/forwardQueryParams.ts\"\nimport { AnchorLinkTarget } from \"./types.ts\"\nimport { isInternalURL, isValidURL } from \"./urlChecks.tsx\"\nimport type { TrackLinkClick } from \"./useTrackLinkClick.ts\"\n\ntype LinkAttributes = Pick<AnchorHTMLAttributes<HTMLAnchorElement>, \"href\" | \"rel\" | \"target\" | \"onClick\"> & {\n\t\"data-framer-preserve-params\"?: boolean\n}\nexport interface PropsForLinkOptions {\n\topenInNewTab: boolean | undefined\n\ttrackLinkClick: TrackLinkClick\n\trel: string | undefined\n\tpreserveParams: boolean | undefined\n}\n\nexport function propsForLink(href: string, options?: PropsForLinkOptions): LinkAttributes {\n\tconst isInternal = isInternalURL(href)\n\n\tconst props: LinkAttributes = {\n\t\thref: href === \"\" || isValidURL(href, isInternal) ? href : `https://${href}`,\n\t\ttarget: getTargetAttrValue(options?.openInNewTab, isInternal),\n\t\trel: !isInternal ? combineRels(\"noopener\", options?.rel) : undefined,\n\t}\n\n\tif (options?.preserveParams) {\n\t\tprops.href = forwardCurrentQueryParams(props.href ?? href)\n\t\t// required for rewriteLinksWithQueryParams.ts to work and params to be preserved in SSGd pages\n\t\tprops[\"data-framer-preserve-params\"] = true\n\t}\n\n\tif (options?.trackLinkClick) {\n\t\tprops.onClick = () => {\n\t\t\tvoid options.trackLinkClick(href)\n\t\t}\n\t}\n\n\treturn props\n}\n\nexport function getTargetAttrValue(\n\topenInNewTab: boolean | undefined,\n\tisInternal: boolean,\n): AnchorLinkTarget | undefined {\n\tif (openInNewTab !== undefined) {\n\t\t// `_self` is the browser default, we can just omit the attribute\n\t\treturn openInNewTab ? AnchorLinkTarget._blank : undefined\n\t}\n\n\t// If the target prop is not set, fallback to the default behavior based on the link\n\treturn isInternal ? undefined : AnchorLinkTarget._blank\n}\n\nfunction combineRels(rel: string | undefined, otherRel: string | undefined) {\n\tif (rel && !otherRel) return rel\n\tif (!rel && otherRel) return otherRel\n\tif (rel && otherRel) return `${rel} ${otherRel}`\n\treturn undefined\n}\n", "import { useCallback } from \"react\"\nimport type { LocaleInfo } from \"../../router/types.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport { isPromise } from \"../../utils/utils.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { type CollectionUtilsCacheContextValue, useCollectionUtils } from \"../cms/CollectionUtilsCache.tsx\"\nimport { resolveSlug } from \"../resolveSlug.ts\"\n\nexport async function resolveSlugs(\n\tunresolvedPathSlugs: LinkToWebPage[\"unresolvedPathSlugs\"],\n\tunresolvedHashSlugs: LinkToWebPage[\"unresolvedHashSlugs\"],\n\tactiveLocale: LocaleInfo[\"activeLocale\"],\n\tcollectionUtils: CollectionUtilsCacheContextValue,\n): Promise<ResolvedSlugs> {\n\tasync function handleSlugs(\n\t\tunresolvedSlugs: LinkToWebPage[\"unresolvedPathSlugs\"],\n\t): Promise<Record<string, string | undefined>> {\n\t\tif (!unresolvedSlugs) return {}\n\n\t\tconst result: Record<string, string | undefined> = {}\n\n\t\tfor (const slugKey in unresolvedSlugs) {\n\t\t\tconst unresolvedSlug = unresolvedSlugs[slugKey]\n\t\t\tassert(unresolvedSlug, \"unresolvedSlug should be defined\")\n\n\t\t\tconst maybeSlug = resolveSlug(unresolvedSlug, collectionUtils, activeLocale)\n\t\t\tconst value = isPromise(maybeSlug) ? await maybeSlug : maybeSlug\n\t\t\tif (value) {\n\t\t\t\tresult[slugKey] = value\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n\n\tconst [pathResult, slugResult] = await Promise.allSettled([\n\t\thandleSlugs(unresolvedPathSlugs),\n\t\thandleSlugs(unresolvedHashSlugs),\n\t])\n\n\treturn {\n\t\tpath: pathResult.status === \"fulfilled\" ? pathResult.value : undefined,\n\t\thash: slugResult.status === \"fulfilled\" ? slugResult.value : undefined,\n\t}\n}\n\nexport function resolveSlugsWithSuspense(\n\tunresolvedPathSlugs: LinkToWebPage[\"unresolvedPathSlugs\"],\n\tunresolvedHashSlugs: LinkToWebPage[\"unresolvedHashSlugs\"],\n\tactiveLocale: LocaleInfo[\"activeLocale\"],\n\tcollectionUtils: CollectionUtilsCacheContextValue,\n\tpromises: Promise<string | undefined>[] = [],\n): ResolvedSlugs | Promise<PromiseSettledResult<string | undefined>[]> {\n\tfunction handleSlugs(unresolvedSlugs: LinkToWebPage[\"unresolvedPathSlugs\"]) {\n\t\tif (!unresolvedSlugs) return\n\n\t\tconst result: Record<string, string | undefined> = {}\n\n\t\tfor (const slugKey in unresolvedSlugs) {\n\t\t\tconst unresolvedSlug = unresolvedSlugs[slugKey]\n\t\t\tif (!unresolvedSlug) continue\n\n\t\t\tconst maybeSlug = resolveSlug(unresolvedSlug, collectionUtils, activeLocale)\n\t\t\tif (isPromise(maybeSlug)) {\n\t\t\t\tpromises.push(maybeSlug)\n\t\t\t} else if (maybeSlug) {\n\t\t\t\tresult[slugKey] = maybeSlug\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n\n\tconst result: ResolvedSlugs = {\n\t\tpath: handleSlugs(unresolvedPathSlugs),\n\t\thash: handleSlugs(unresolvedHashSlugs),\n\t}\n\n\tif (promises.length > 0) {\n\t\treturn Promise.allSettled(promises)\n\t}\n\n\treturn result\n}\n\nexport function useResolveSlugsWithSuspense() {\n\tconst collectionUtils = useCollectionUtils()\n\treturn useCallback(\n\t\t(\n\t\t\tunresolvedPathSlugs: LinkToWebPage[\"unresolvedPathSlugs\"],\n\t\t\tunresolvedHashSlugs: LinkToWebPage[\"unresolvedHashSlugs\"],\n\t\t\tactiveLocale: LocaleInfo[\"activeLocale\"],\n\t\t\tpromises: Promise<string | undefined>[] = [],\n\t\t) => {\n\t\t\treturn resolveSlugsWithSuspense(unresolvedPathSlugs, unresolvedHashSlugs, activeLocale, collectionUtils, promises)\n\t\t},\n\t\t[collectionUtils],\n\t)\n}\n\nexport interface ResolvedSlugs {\n\tpath: Record<string, string | undefined> | undefined\n\thash: Record<string, string | undefined> | undefined\n}\n", "import type { LocaleInfo } from \"../router/types.ts\"\nimport { getPleaseReportMessage, isPromise } from \"../utils/utils.ts\"\nimport type { UnresolvedSlug } from \"./LinkToWebPage.ts\"\nimport type { CollectionUtilsCache, CollectionUtilsCacheContextValue } from \"./cms/CollectionUtilsCache.tsx\"\n\ntype MaybeSlug = ReturnType<CollectionUtilsCache[\"getRecordIdBySlug\"]>\n\nfunction handleResolveSlugError(error?: unknown, fallbackMessage?: string) {\n\t// We don't want the page to crash when resolving of a slug fails\n\t// TODO: use (lightweight) logging/metrics for errors here in user sites instead of console.\n\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\tconsole.warn(\n\t\tgetPleaseReportMessage(\n\t\t\t`Failed to resolve slug: ${error instanceof Error ? error.message : (fallbackMessage ?? \"Unknown error\")}`,\n\t\t),\n\t)\n\n\treturn undefined\n}\n\nexport function resolveSlug(\n\tunresolvedSlug: UnresolvedSlug,\n\tcollectionUtils: CollectionUtilsCacheContextValue,\n\tactiveLocale: LocaleInfo[\"activeLocale\"],\n): MaybeSlug {\n\ttry {\n\t\tconst utils = collectionUtils?.get(unresolvedSlug.collectionId)\n\t\tif (!utils) {\n\t\t\treturn handleResolveSlugError(\n\t\t\t\tundefined,\n\t\t\t\t`Couldn't find collection utils for collection id: \"${unresolvedSlug.collectionId}\"`,\n\t\t\t)\n\t\t}\n\n\t\tconst maybeSlug = utils.getSlugByRecordId(unresolvedSlug.collectionItemId, activeLocale ?? undefined)\n\t\tif (isPromise(maybeSlug)) {\n\t\t\treturn maybeSlug.catch(handleResolveSlugError)\n\t\t}\n\t\treturn maybeSlug\n\t} catch (error) {\n\t\thandleResolveSlugError(error)\n\t}\n}\n", "import { useCallback } from \"react\"\nimport type { Locale, RouterAPI } from \"../../router/types.ts\"\nimport { safeWindow } from \"../../utils/safeWindow.ts\"\nimport { sendTrackingEvent } from \"../../utils/sendTrackingEvent.ts\"\nimport { isPromise, isString } from \"../../utils/utils.ts\"\nimport { type LinkToWebPage, isLinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { useCollectionUtils } from \"../cms/CollectionUtilsCache.tsx\"\nimport { linkFromFramerPageLink } from \"./linkFromFramerPageLink.tsx\"\n\nexport type TrackLinkClick = (absoluteHref: string | undefined) => Promise<void>\n\ninterface TrackLinkClickDeps {\n\tnodeId: string | undefined\n\tclickTrackingId: string | undefined\n\trouter: Partial<RouterAPI>\n\thref: string | LinkToWebPage | undefined\n\tactiveLocale: Locale | null\n}\n\nexport function useTrackLinkClick({\n\tnodeId,\n\tclickTrackingId,\n\trouter,\n\thref,\n\tactiveLocale,\n}: TrackLinkClickDeps): TrackLinkClick {\n\tconst collectionUtils = useCollectionUtils()\n\treturn useCallback(\n\t\tasync (hrefAttribute: string | undefined) => {\n\t\t\tif (!router.pageviewEventData?.current) return\n\t\t\t// We assume router.pageviewEventData is set at this point.\n\t\t\t// It looks like a race-condition in theory, but isn't in practice: The routers\n\t\t\t// `useEffect` runs pretty early during page load and we disable Reacts\n\t\t\t// event replaying system for improved INP in\n\t\t\t// src/library/src/router/hydration/reactHydrationINPOptimizer.ts\n\t\t\t// This means, this callback in practice doesn't trigger before the useEffect has run.\n\t\t\tconst pageviewEventData =\n\t\t\t\trouter.pageviewEventData.current instanceof Promise\n\t\t\t\t\t? await router.pageviewEventData.current\n\t\t\t\t\t: router.pageviewEventData.current\n\t\t\tconst pageLink = isLinkToWebPage(href) ? href : linkFromFramerPageLink(href)\n\n\t\t\tif (!isLinkToWebPage(pageLink)) {\n\t\t\t\t// Track the external link click right away\n\t\t\t\treturn sendTrackingEvent(\n\t\t\t\t\t\"published_site_click\",\n\t\t\t\t\t{\n\t\t\t\t\t\t...pageviewEventData,\n\t\t\t\t\t\thref: hrefAttribute ? makeUrlAbsolute(hrefAttribute) : null,\n\t\t\t\t\t\tnodeId: nodeId ?? null,\n\t\t\t\t\t\ttrackingId: clickTrackingId || null,\n\t\t\t\t\t\ttargetRoutePath: null,\n\t\t\t\t\t\ttargetWebPageId: null,\n\t\t\t\t\t\ttargetCollectionItemId: null,\n\t\t\t\t\t},\n\t\t\t\t\t\"eager\",\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst targetWebPageId = pageLink.webPageId\n\t\t\tconst targetRoute = router?.getRoute?.(targetWebPageId)\n\t\t\tconst targetRoutePath = targetRoute?.path ?? null\n\t\t\tlet targetCollectionItemId: string | null = null\n\t\t\tif (targetRoute?.collectionId && pageLink.pathVariables) {\n\t\t\t\t// Resolve the collection item ID\n\t\t\t\tconst utils = collectionUtils?.get(targetRoute.collectionId)\n\t\t\t\tif (!utils) return\n\n\t\t\t\tconst [slug] = Object.values(pageLink.pathVariables)\n\t\t\t\tif (isString(slug)) {\n\t\t\t\t\tconst maybeCollectionItemId = utils.getRecordIdBySlug(slug, activeLocale || undefined)\n\t\t\t\t\tconst collectionItemId = isPromise(maybeCollectionItemId)\n\t\t\t\t\t\t? await maybeCollectionItemId\n\t\t\t\t\t\t: maybeCollectionItemId\n\t\t\t\t\ttargetCollectionItemId = collectionItemId ?? null\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn sendTrackingEvent(\n\t\t\t\t\"published_site_click\",\n\t\t\t\t{\n\t\t\t\t\t...pageviewEventData,\n\t\t\t\t\thref: hrefAttribute ? makeUrlAbsolute(hrefAttribute) : null,\n\t\t\t\t\tnodeId: nodeId ?? null,\n\t\t\t\t\ttrackingId: clickTrackingId ?? null,\n\t\t\t\t\ttargetRoutePath,\n\t\t\t\t\ttargetWebPageId,\n\t\t\t\t\ttargetCollectionItemId,\n\t\t\t\t},\n\t\t\t\t\"eager\",\n\t\t\t)\n\t\t},\n\t\t[nodeId, clickTrackingId, router, href, activeLocale, collectionUtils],\n\t)\n}\n\n/**\n * Returns absolute path for links on the same domain, or the original URL if it's external.\n */\nfunction makeUrlAbsolute(href: string) {\n\ttry {\n\t\tconst url = new URL(href, safeWindow.document.baseURI)\n\t\treturn url.origin === safeWindow.location.origin ? url.pathname + url.search + url.hash : url.href\n\t} catch {\n\t\treturn href\n\t}\n}\n", "import { getPathForRoute } from \"../../router/history.ts\"\nimport type { Locale, RouterAPI } from \"../../router/types.ts\"\nimport { isPromise, isString } from \"../../utils/utils.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { isLinkToWebPage } from \"../LinkToWebPage.ts\"\nimport { linkFromFramerPageLink } from \"./linkFromFramerPageLink.tsx\"\nimport { propsForLink } from \"./propsForLink.tsx\"\nimport type { resolveSlugsWithSuspense } from \"./resolveSlugs.ts\"\n\n/** @internal */\nexport function resolveLink(\n\thref: LinkToWebPage | string | undefined,\n\trouter: Partial<RouterAPI>,\n\timplicitPathVariables?: Record<string, unknown>,\n\tactiveLocale?: Locale | null,\n): string | undefined {\n\treturn resolveLinkInternal(href, router, implicitPathVariables, undefined, activeLocale)\n}\n\n/** @internal */\nexport function resolveLinkInternal(\n\thref: LinkToWebPage | string | undefined,\n\trouter: Partial<RouterAPI>,\n\timplicitPathVariables?: Record<string, unknown>,\n\t/**\n\t * Resolve and return only the hash part of the link, useful when getting\n\t * the value of an element id.\n\t */\n\tonlyHash?: boolean,\n\tactiveLocale?: Locale | null | undefined,\n\tresolveSlugs?: (\n\t\tunresolvedPathSlugs: LinkToWebPage[\"unresolvedPathSlugs\"],\n\t\tunresolvedHashSlugs: LinkToWebPage[\"unresolvedHashSlugs\"],\n\t) => ReturnType<typeof resolveSlugsWithSuspense>,\n): string | undefined {\n\t// Parsing framer page links means this function is stuck in library.\n\tconst pageLink = isLinkToWebPage(href) ? href : linkFromFramerPageLink(href)\n\tif (!isLinkToWebPage(pageLink)) return isString(href) ? propsForLink(href).href : undefined\n\t// Bail out, we can't convert an object to a string path.\n\tif (!router.getRoute || !router.currentRouteId) return undefined\n\n\tconst currentRoute = router.getRoute(router.currentRouteId)\n\tconst { webPageId, hash, pathVariables, hashVariables, unresolvedHashSlugs, unresolvedPathSlugs } = pageLink\n\tconst route = router.getRoute(webPageId)\n\n\tconst resolvedSlugs =\n\t\tunresolvedPathSlugs || unresolvedHashSlugs ? resolveSlugs?.(unresolvedPathSlugs, unresolvedHashSlugs) : undefined\n\n\t// Skip further work if we're waiting for slugs to be resolved\n\tif (isPromise(resolvedSlugs)) return\n\n\tconst combinedPathVariables = Object.assign(\n\t\t{},\n\t\trouter.currentPathVariables,\n\t\timplicitPathVariables,\n\t\tpathVariables,\n\t\tresolvedSlugs?.path,\n\t)\n\tconst combinedHashVariables = Object.assign(\n\t\t{},\n\t\trouter.currentPathVariables,\n\t\timplicitPathVariables,\n\t\thashVariables,\n\t\tresolvedSlugs?.hash,\n\t)\n\n\tconst path = getPathForRoute(route, {\n\t\tcurrentRoutePath: currentRoute?.path,\n\t\tcurrentRoutePathLocalized: currentRoute?.pathLocalized,\n\t\tcurrentPathVariables: router.currentPathVariables,\n\t\thash,\n\t\tpathVariables: combinedPathVariables,\n\t\thashVariables: combinedHashVariables,\n\t\trelative: false,\n\t\tpreserveQueryParams: router.preserveQueryParams,\n\t\tonlyHash,\n\t\tsiteCanonicalURL: router.siteCanonicalURL,\n\t\tlocaleId: activeLocale?.id,\n\t})\n\n\tif (onlyHash) return path\n\n\tconst slugPrefix = activeLocale?.slug ? `/${activeLocale.slug}` : \"\"\n\n\treturn slugPrefix + path\n}\n", "import { getPathForRoute } from \"../../router/history.ts\"\nimport type { LocaleId, RouterAPI } from \"../../router/types.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\n\n/** @public */\nexport function resolvePageScope(\n\tpageLink: LinkToWebPage,\n\trouter: Partial<RouterAPI>,\n\tlocaleId?: LocaleId,\n): string | undefined {\n\t// Bail out, we can't convert an object to a string path.\n\tif (!router.getRoute || !router.currentRouteId) return undefined\n\n\tconst currentRoute = router.getRoute(router.currentRouteId)\n\tconst { webPageId } = pageLink\n\tconst route = router.getRoute(webPageId)\n\n\treturn getPathForRoute(route, {\n\t\tcurrentRoutePath: currentRoute?.path,\n\t\tcurrentRoutePathLocalized: currentRoute?.pathLocalized,\n\t\tcurrentPathVariables: router.currentPathVariables,\n\t\trelative: false,\n\t\tpreserveQueryParams: false,\n\t\tsiteCanonicalURL: undefined,\n\t\tlocaleId,\n\t})\n}\n", "import { MotionConfig, MotionGlobalConfig, WillChangeMotionValue } from \"framer-motion\"\nimport React from \"react\"\nimport { Navigation } from \"../components/Navigation.tsx\"\nimport { MainLoop } from \"../core/Loop.ts\"\nimport { DataObserver } from \"../deprecated/DataObserver.tsx\"\nimport { FormContext } from \"../render/presentation/Forms/FormContainer.tsx\"\nimport { Router } from \"../router/Router.tsx\"\nimport { RoutesProvider } from \"../router/RouterContext.tsx\"\nimport { FetchClientProvider } from \"./FetchClient.tsx\"\nimport type { PageRootProps } from \"./PageRootProps.ts\"\nimport { RenderTargetEnvironmentProvider } from \"./RenderTargetEnvironmentContext.tsx\"\nimport { CollectionUtilsCacheProvider } from \"./cms/CollectionUtilsCache.tsx\"\nimport { SnippetsProvider } from \"./custom-code/context.tsx\"\n\n// This makes sure that motion will add the `will-change` property to anything that animates. See\n// https://github.com/motiondivision/motion/pull/3129 for more details. Previously motion would\n// always do this, but that got removed in 11.13, but we still need that behaviour so this will make\n// sure it keeps behaving the same as before.\nMotionGlobalConfig.WillChange = WillChangeMotionValue\n\n/**\n * @description Router Component\n * Safari iOS has a weird bug that will make `font-size` scale-up in the presence\n * of a unit width/height + `overflow: hidden` + an element in the DOM that has\n * opacity 0 and is set to opacity 1 in JS, just like in the case of our effects\n * with Motion. We set the width of published sites to auto to fix the issue. It\n * must explicitly be set on published sites because the same fix brakes the\n * preview.\n * Webkit issue: https://bugs.webkit.org/show_bug.cgi?id=240653\n * */\n\n/** @public */\nexport function PageRoot(props: PageRootProps) {\n\tconst {\n\t\tRootComponent,\n\t\tisWebsite,\n\t\tenvironment,\n\t\trouteId,\n\t\tframerSiteId,\n\t\tpathVariables,\n\t\troutes,\n\t\tcollectionUtils,\n\t\tnotFoundPage,\n\t\tisReducedMotion = false,\n\t\tskipAnimations = false,\n\t\tincludeDataObserver = false,\n\t\tlocaleId,\n\t\tlocales,\n\t\tpreserveQueryParams,\n\t\tEditorBar,\n\t\tdefaultPageStyle,\n\t\tdisableHistory,\n\t\tLayoutTemplate,\n\t\tsiteCanonicalURL,\n\t\tadaptLayoutToTextDirection,\n\t\tloadSnippetsModule,\n\t\tinitialCollectionItemId,\n\t} = props\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: must only run the first time the site is mounted\n\tReact.useEffect(() => {\n\t\tif (isWebsite) return\n\t\t// Required by DataObserver\n\t\tMainLoop.start()\n\t}, [])\n\n\tif (isWebsite) {\n\t\treturn (\n\t\t\t<RenderTargetEnvironmentProvider value={environment ?? \"preview\"}>\n\t\t\t\t<MotionConfig\n\t\t\t\t\treducedMotion={skipAnimations ? \"always\" : isReducedMotion ? \"user\" : \"never\"}\n\t\t\t\t\tskipAnimations={skipAnimations}\n\t\t\t\t>\n\t\t\t\t\t<CollectionUtilsCacheProvider collectionUtils={collectionUtils}>\n\t\t\t\t\t\t<FetchClientProvider>\n\t\t\t\t\t\t\t<FormContext.Provider value={framerSiteId}>\n\t\t\t\t\t\t\t\t<SnippetsProvider loadSnippetsModule={loadSnippetsModule}>\n\t\t\t\t\t\t\t\t\t<Router\n\t\t\t\t\t\t\t\t\t\tinitialRoute={routeId}\n\t\t\t\t\t\t\t\t\t\tinitialPathVariables={pathVariables}\n\t\t\t\t\t\t\t\t\t\tinitialLocaleId={localeId}\n\t\t\t\t\t\t\t\t\t\tinitialCollectionItemId={initialCollectionItemId}\n\t\t\t\t\t\t\t\t\t\troutes={routes}\n\t\t\t\t\t\t\t\t\t\tcollectionUtils={collectionUtils}\n\t\t\t\t\t\t\t\t\t\tnotFoundPage={notFoundPage}\n\t\t\t\t\t\t\t\t\t\tlocales={locales}\n\t\t\t\t\t\t\t\t\t\tdefaultPageStyle={defaultPageStyle ?? { minHeight: \"100vh\", width: \"auto\" }}\n\t\t\t\t\t\t\t\t\t\tpreserveQueryParams={preserveQueryParams}\n\t\t\t\t\t\t\t\t\t\tEditorBar={EditorBar}\n\t\t\t\t\t\t\t\t\t\tdisableHistory={disableHistory}\n\t\t\t\t\t\t\t\t\t\tLayoutTemplate={LayoutTemplate}\n\t\t\t\t\t\t\t\t\t\tsiteCanonicalURL={siteCanonicalURL}\n\t\t\t\t\t\t\t\t\t\tadaptLayoutToTextDirection={adaptLayoutToTextDirection}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</SnippetsProvider>\n\t\t\t\t\t\t\t</FormContext.Provider>\n\t\t\t\t\t\t</FetchClientProvider>\n\t\t\t\t\t</CollectionUtilsCacheProvider>\n\t\t\t\t</MotionConfig>\n\t\t\t</RenderTargetEnvironmentProvider>\n\t\t)\n\t} else {\n\t\t// Using (deprecated `Data` requires a DataObserver, but we should *not*\n\t\t// add a DataObserver for code that uses `useStore`, because then it\n\t\t// will not fall back onto using \u201Cnormal\u201D React useState.\n\t\tconst Wrapper = includeDataObserver ? DataObserver : React.Fragment\n\n\t\t// For navigation we still need to provide the routes, because\n\t\t// `usePrototypeNavigate` uses `getRoute` to get the component for a\n\t\t// specific target id\n\t\treturn (\n\t\t\t<Wrapper>\n\t\t\t\t<RoutesProvider routes={routes}>\n\t\t\t\t\t<Navigation>\n\t\t\t\t\t\t{React.isValidElement(RootComponent)\n\t\t\t\t\t\t\t? RootComponent\n\t\t\t\t\t\t\t: React.createElement(\n\t\t\t\t\t\t\t\t\t// @ts-expect-error to figure out how to type this properly, as tests are using different\n\t\t\t\t\t\t\t\t\t// $$typeof symbol and isValidElement fails\n\t\t\t\t\t\t\t\t\tRootComponent,\n\t\t\t\t\t\t\t\t\t{ key: routeId },\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t</Navigation>\n\t\t\t\t</RoutesProvider>\n\t\t\t</Wrapper>\n\t\t)\n\t}\n}\n", "import { motion } from \"framer-motion\"\nimport type { FormEvent } from \"react\"\nimport React, { startTransition, useContext } from \"react\"\nimport {\n\tfindMatchingRouteAttributesForResolvedPath,\n\tfindMatchingRouteAttributesForWebPageLink,\n} from \"../../../modules/Link/findMatchingRouteAttributes.tsx\"\nimport { useImplicitPathVariables } from \"../../../modules/Link/pathVariables.tsx\"\nimport { resolveSlugs } from \"../../../modules/Link/resolveSlugs.ts\"\nimport { isValidURL } from \"../../../modules/Link/urlChecks.tsx\"\nimport type { LinkToWebPage } from \"../../../modules/LinkToWebPage.ts\"\nimport { isLinkToWebPage } from \"../../../modules/LinkToWebPage.ts\"\nimport { useCollectionUtils } from \"../../../modules/cms/CollectionUtilsCache.tsx\"\nimport { useRouter } from \"../../../router/RouterContext.tsx\"\nimport { useCurrentRoute } from \"../../../router/useCurrentRoute.tsx\"\nimport { useLocaleInfo } from \"../../../router/useLocale.ts\"\nimport { assert, assertNever } from \"../../../utils/assert.ts\"\nimport { safeWindow } from \"../../../utils/safeWindow.ts\"\nimport { isObject, isString } from \"../../../utils/utils.ts\"\nimport { yieldToMain } from \"../../../utils/yield.ts\"\nimport { calculateProofOfWork } from \"./antibot.ts\"\nimport { addUTMTagsToFormData, getEncodedFormFieldsHeader } from \"./formData.ts\"\nimport { HoneypotFields, useHoneypotFields } from \"./honeypot.tsx\"\nimport { trackFormSubmit } from \"./trackFormSubmit.ts\"\nimport type { FormContainerProps } from \"./types.ts\"\nimport { useCaptcha } from \"./useCaptcha.ts\"\n\ntype Action =\n\t| { type: \"submit\" }\n\t| { type: \"success\" }\n\t| { type: \"error\" }\n\t| { type: \"incomplete\" }\n\t| { type: \"complete\" }\n\ninterface FormState {\n\tstate: \"pending\" | \"success\" | \"error\" | \"incomplete\" | \"complete\"\n}\n\nconst pendingState: FormState = { state: \"pending\" }\nconst successState: FormState = { state: \"success\" }\nconst incompleteState: FormState = { state: \"incomplete\" }\nconst completeState: FormState = { state: \"complete\" }\nconst errorState: FormState = { state: \"error\" }\n\nfunction formReducer({ state }: FormState, { type }: Action): FormState {\n\tswitch (type) {\n\t\tcase \"complete\":\n\t\t\tif (state === \"error\") return errorState\n\t\t\treturn completeState\n\t\tcase \"incomplete\":\n\t\t\tif (state === \"error\") return errorState\n\t\t\treturn incompleteState\n\t\tcase \"submit\":\n\t\t\treturn pendingState\n\t\tcase \"success\":\n\t\t\treturn successState\n\t\tcase \"error\":\n\t\t\treturn errorState\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nfunction stateCanSubmitForm({ state }: FormState) {\n\treturn state === \"incomplete\" || state === \"complete\"\n}\n\nfunction preventDefault(e: FormEvent<HTMLFormElement>) {\n\te.preventDefault()\n}\n\n// Modern browsers (aka safari) might block popups triggered asynchronously, so we open the link in the current tab.\nfunction openExternalLinkInCurrentTab(\n\tlink: string,\n\tformRef: React.RefObject<HTMLFormElement> | ((instance: HTMLFormElement | null) => void),\n) {\n\tconst href = isValidURL(link, false) ? link : `https://${link}`\n\n\t// We use an anchor element (as opposed to window.open), because the preview app hijacks all anchor link clicks\n\t// and modifies the target based on the href, so that we won't try to open an external links in the preview iframe.\n\t// see src/app/vekter/src/preview-next/utils/interceptAnchorLinks.ts\n\tconst linkElement = document.createElement(\"a\")\n\tlinkElement.href = href\n\tlinkElement.target = \"_self\"\n\tlinkElement.style.display = \"none\"\n\n\t// We are appending the (invisible) link element to the form, instead of document.body, because the link must live\n\t// under the PreviewRenderer where we hijack anchor link clicks in the preview iframe.\n\tif (!(\"current\" in formRef && formRef.current)) return\n\tformRef.current.appendChild(linkElement)\n\n\tlinkElement.click()\n\tlinkElement.remove()\n}\n\n/** @internal */\nexport const FormContext = React.createContext<string | undefined>(undefined)\n\n/** @internal */\nexport const FormContainer = /* @__PURE__ */ React.forwardRef<\n\tHTMLFormElement,\n\tFormContainerProps & {\n\t\t/** Careful: changing the state here will require the child components to be regenerated.  */\n\t\tchildren: (state: { state: FormState[\"state\"] }) => React.ReactElement\n\t}\n>(function FormContainer(\n\t{\n\t\taction,\n\t\tchildren,\n\t\tredirectUrl,\n\t\tonSuccess,\n\t\tonError,\n\t\tonLoading,\n\t\tsubmitTrackingId,\n\t\tnodeId,\n\t\tformCaptchaProvider,\n\t\tformCaptchaSiteKey,\n\t\t...props\n\t},\n\tforwardedRef,\n) {\n\tconst fallbackRef = React.useRef<HTMLFormElement>(null)\n\tconst ref = forwardedRef ?? fallbackRef\n\tconst shouldUseHoneypot = !(formCaptchaProvider && formCaptchaSiteKey)\n\tconst {\n\t\tstates: honeypotStateRefs,\n\t\tconvertHoneypotFieldsForSubmission,\n\t\treplaceHoneypotWithMetadata,\n\t} = useHoneypotFields(shouldUseHoneypot)\n\tconst router = useRouter()\n\tconst currentRoute = useCurrentRoute()\n\tconst implicitPathVariables = useImplicitPathVariables()\n\tconst collectionUtils = useCollectionUtils()\n\n\tconst { executeChallenge } = useCaptcha({ provider: formCaptchaProvider, siteKey: formCaptchaSiteKey })\n\n\t// Assume that a form has at least one unfilled, required input field.\n\t// Technically this is possible to not be the cause if all required inputs\n\t// are prefilled with defaultValue. That edge-case should be rare, and isn't\n\t// worth walking the dom on mount to verify. The only impact this would have\n\t// on a design is if you used a prefilled input AND a submit button with an\n\t// \"incomplete\" variant that made it unclickable. In that case, the user can\n\t// probably just remove their \"incomplete\" variant.\n\tconst [state, dispatch] = React.useReducer(formReducer, incompleteState)\n\tconst { activeLocale, locales } = useLocaleInfo()\n\tconst projectHash = useContext(FormContext)\n\t// We are using a ref to store the callbacks so we can access the latest\n\t// values of them in a long-lived event handler that needs to access the\n\t// latest values after a react render has changed these values. @FIXME -\n\t// This technically isn't React 19 compliant, but probably isn't a problem\n\t// since it isn't render related, just using a ref as a stable pointer.\n\tconst callbacks = React.useRef({ onSuccess, onError, onLoading })\n\tcallbacks.current = { onSuccess, onError, onLoading }\n\n\tconst submissionInProgressRef = React.useRef(false)\n\n\tasync function redirectTo(link: string | LinkToWebPage) {\n\t\tif (isString(link)) {\n\t\t\tconst matchingRoute = findMatchingRouteAttributesForResolvedPath(router, link, implicitPathVariables, locales)\n\t\t\t// If we couldn't find a matching route, we assume it's an external link.\n\t\t\tif (!matchingRoute) {\n\t\t\t\topenExternalLinkInCurrentTab(link, ref)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst { routeId, elementId, pathVariables } = matchingRoute\n\t\t\trouter.navigate?.(routeId, elementId, pathVariables)\n\t\t\treturn\n\t\t}\n\n\t\tassert(isLinkToWebPage(link), \"Expected link to be either a LinkToWebPage or a string\", link)\n\n\t\tconst resolvedSlugs = await resolveSlugs(\n\t\t\tlink.unresolvedPathSlugs,\n\t\t\tlink.unresolvedHashSlugs,\n\t\t\tactiveLocale,\n\t\t\tcollectionUtils,\n\t\t)\n\t\tconst matchingRoute = findMatchingRouteAttributesForWebPageLink(\n\t\t\trouter,\n\t\t\tcurrentRoute,\n\t\t\tlink,\n\t\t\tactiveLocale,\n\t\t\tresolvedSlugs,\n\t\t\timplicitPathVariables,\n\t\t)\n\n\t\tconst { routeId, elementId, pathVariables } = matchingRoute\n\t\trouter.navigate?.(routeId, elementId, pathVariables)\n\t}\n\n\tconst handleSubmit = async (event: React.SyntheticEvent<HTMLFormElement>) => {\n\t\tevent.preventDefault()\n\n\t\tif (!action || !projectHash || submissionInProgressRef.current) return\n\t\tsubmissionInProgressRef.current = true\n\n\t\tconvertHoneypotFieldsForSubmission()\n\n\t\t// collect form data as it has been submitted\n\t\tconst data = new FormData(event.currentTarget)\n\n\t\t// await next paint before doing more stuff -> improves INP\n\t\tawait yieldToMain({ priority: \"user-visible\", continueAfter: \"paint\" })\n\n\t\treplaceHoneypotWithMetadata(data)\n\n\t\tstartTransition(() => dispatch({ type: \"submit\" }))\n\n\t\taddUTMTagsToFormData(data, safeWindow.document)\n\n\t\tfor (const [key, value] of data) {\n\t\t\t// We don't want to include File objects in the FormData\n\t\t\t// as we do not support them on the backend yet.\n\t\t\tif (value instanceof File) data.delete(key)\n\t\t}\n\n\t\ttry {\n\t\t\tcallbacks.current.onLoading?.()\n\n\t\t\ttrackFormSubmit({\n\t\t\t\trouter,\n\t\t\t\tnodeId,\n\t\t\t\tsubmitTrackingId,\n\t\t\t\tactiveLocale,\n\t\t\t})\n\t\t\t// submitForm will throw an error if the response is not ok\n\t\t\t// and of course fetch throws on a network error by default.\n\t\t\tawait submitForm(action, data, projectHash, executeChallenge)\n\n\t\t\tstartTransition(() => dispatch({ type: \"success\" }))\n\t\t\tcallbacks.current.onSuccess?.()\n\n\t\t\tif (redirectUrl) {\n\t\t\t\tawait redirectTo(redirectUrl)\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tstartTransition(() => dispatch({ type: \"error\" }))\n\t\t\tcallbacks.current.onError?.()\n\n\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\tconsole.error(error)\n\t\t}\n\n\t\tsubmissionInProgressRef.current = false\n\t}\n\n\tconst handleKeyDown = (event: React.KeyboardEvent<HTMLFormElement>) => {\n\t\tconst { target: input, currentTarget: form, key } = event\n\t\tconst isTextArea = input instanceof HTMLTextAreaElement\n\n\t\t// If the target is a textarea, we don't want to submit the form on enter.\n\t\tif (isTextArea) return\n\n\t\tif (key === \"Enter\" && form.checkValidity()) {\n\t\t\tevent.preventDefault()\n\t\t\tvoid handleSubmit(event)\n\t\t}\n\t}\n\n\tconst checkValidity = async (e: React.FormEvent<HTMLFormElement>) => {\n\t\t// capture current target here so React's synthetic event system doesn't unset it when we execute the transition\n\t\tconst target = e.currentTarget\n\t\t// await next paint and then dispatch the update as transition -> improves INP\n\t\tawait yieldToMain({ priority: \"background\", continueAfter: \"paint\" })\n\t\tstartTransition(() => dispatch({ type: anyEmptyRequiredFields(target) ? \"incomplete\" : \"complete\" }))\n\t}\n\n\treturn (\n\t\t<motion.form\n\t\t\t{...props}\n\t\t\tonSubmit={stateCanSubmitForm(state) ? handleSubmit : preventDefault}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tonChange={checkValidity}\n\t\t\tref={ref}\n\t\t>\n\t\t\t{children(state)}\n\t\t\t{shouldUseHoneypot && <HoneypotFields states={honeypotStateRefs} />}\n\t\t</motion.form>\n\t)\n})\n\nfunction anyEmptyRequiredFields(element: Element): boolean {\n\tif (element.children.length === 0) return false\n\n\tfor (const child of element.children) {\n\t\tif (\n\t\t\tchild instanceof HTMLInputElement ||\n\t\t\tchild instanceof HTMLTextAreaElement ||\n\t\t\tchild instanceof HTMLSelectElement\n\t\t) {\n\t\t\tif (child.required && child.value === \"\") return true\n\t\t} else {\n\t\t\tconst result = anyEmptyRequiredFields(child)\n\t\t\tif (result) return true\n\t\t}\n\t}\n\n\treturn false\n}\n\nasync function submitForm(\n\taction: string,\n\tdata: FormData,\n\tprojectHash: string,\n\texecuteChallenge: (action: string) => Promise<string | undefined>,\n) {\n\tconst proofOfWork = await calculateProofOfWork()\n\n\tif (!proofOfWork) {\n\t\tthrow new Error(\"Failed to calculate proof of work\")\n\t}\n\n\tconst captchaToken = await executeChallenge(\"submit\")\n\n\tconst headers: Record<string, string> = {\n\t\t\"Framer-Site-Id\": projectHash,\n\t\t\"Framer-POW\": proofOfWork.secret,\n\t\t\"Framer-Form-Fields\": getEncodedFormFieldsHeader(data),\n\t}\n\n\tif (captchaToken) {\n\t\theaders[\"Framer-Captcha-Response\"] = captchaToken\n\t}\n\n\tconst response = await fetch(action, {\n\t\tbody: data,\n\t\tmethod: \"POST\",\n\t\theaders,\n\t})\n\n\tif (response.ok) {\n\t\treturn response\n\t} else {\n\t\tconst body = await response.json()\n\t\tconst error = \"Failed to submit form\"\n\t\tif (responseHasError(body)) {\n\t\t\tthrow new Error(`${error} - ${body.error.message}`)\n\t\t}\n\t\tthrow new Error(error)\n\t}\n}\n\nfunction responseHasError(response: unknown): response is { error: { message: string } } {\n\treturn (\n\t\ttypeof response === \"object\" &&\n\t\tresponse !== null &&\n\t\t\"error\" in response &&\n\t\tisObject(response.error) &&\n\t\t\"message\" in response.error &&\n\t\ttypeof response.error.message === \"string\"\n\t)\n}\n", "const salt = \"framer\"\nconst difficulty = 3\nconst tokenLength = 30\n// maximum time in milliseconds (10 seconds). It allows slow mobile device to calculate PoW\n// in most cases, calculation takes less than a second.\nconst maxTime = 10000\n\ninterface ProofOfWork {\n\tsecret: string\n\thash: string\n}\n\nfunction createWorkerTask() {\n\treturn function () {\n\t\tasync function sha256(text: string) {\n\t\t\tconst buffer = new TextEncoder().encode(text)\n\t\t\tconst hashBuffer = await crypto.subtle.digest(\"SHA-256\", buffer)\n\t\t\treturn Array.from(new Uint8Array(hashBuffer))\n\t\t\t\t.map(b => b.toString(16).padStart(2, \"0\"))\n\t\t\t\t.join(\"\")\n\t\t}\n\n\t\tfunction randomCharacters(count: number) {\n\t\t\tconst characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\"\n\t\t\tlet result = \"\"\n\t\t\tconst charactersLength = characters.length\n\t\t\tfor (let i = 0; i < count; i++) {\n\t\t\t\tresult += characters.charAt(Math.floor(Math.random() * charactersLength))\n\t\t\t}\n\t\t\treturn result\n\t\t}\n\n\t\t// eslint-disable-next-line no-restricted-globals -- this is inside a web worker\n\t\taddEventListener(\"message\", async event => {\n\t\t\tconst { salt, difficulty, tokenLength, maxTime } = event.data\n\t\t\tconst target = \"0\".repeat(difficulty)\n\t\t\tconst startTime = performance.now()\n\n\t\t\tlet processing = true\n\t\t\twhile (processing) {\n\t\t\t\tconst timestamp = performance.now()\n\t\t\t\t// Check if we've exceeded the maximum time\n\t\t\t\tif (timestamp - startTime > maxTime) {\n\t\t\t\t\tprocessing = false\n\t\t\t\t\tpostMessage({ success: false })\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst nonce = randomCharacters(tokenLength)\n\t\t\t\tconst secret = `${Date.now()}:${nonce}`\n\t\t\t\tconst hash = await sha256(salt + secret)\n\n\t\t\t\tif (hash.startsWith(target)) {\n\t\t\t\t\tpostMessage({ success: true, secret, hash })\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}.toString()\n}\n\nexport async function calculateProofOfWork(): Promise<ProofOfWork | undefined> {\n\treturn new Promise((resolve, reject) => {\n\t\t// Web Worker is used to keep the browser responsive and prevent animations from stalling\n\t\tconst webWorkerURL = URL.createObjectURL(\n\t\t\tnew Blob([\"(\", createWorkerTask(), \")()\"], {\n\t\t\t\ttype: \"application/javascript\",\n\t\t\t}),\n\t\t)\n\n\t\tconst worker = new Worker(webWorkerURL)\n\n\t\tworker.onmessage = event => {\n\t\t\tworker.terminate()\n\t\t\tURL.revokeObjectURL(webWorkerURL)\n\n\t\t\tif (event.data.success) {\n\t\t\t\tresolve({ secret: event.data.secret, hash: event.data.hash })\n\t\t\t} else {\n\t\t\t\tresolve(undefined)\n\t\t\t}\n\t\t}\n\n\t\tworker.onerror = event => {\n\t\t\tworker.terminate()\n\t\t\tURL.revokeObjectURL(webWorkerURL)\n\t\t\treject(event)\n\t\t}\n\n\t\t// Execute Web Worker task\n\t\tworker.postMessage({\n\t\t\tsalt,\n\t\t\tdifficulty,\n\t\t\ttokenLength,\n\t\t\tmaxTime,\n\t\t})\n\t})\n}\n", "export function getEncodedFormFieldsHeader(data: FormData) {\n\treturn Array.from(data.keys()).map(encodeURIComponent).join(\",\")\n}\n\ninterface HasCookie {\n\tcookie: string\n}\n\n/**\n    Includes UTM tags from the `framerFormsUTMTags` cookie, that is set in\n    src/app/vekter/src/export/bundled/captureFormsUTMTagsInCookie.ts\n*/\nexport function addUTMTagsToFormData(data: FormData, document: HasCookie) {\n\ttry {\n\t\t// RegExp inlined from src/app/vekter/src/web/lib/cookies.ts\n\t\tconst matches = document.cookie.match(\"(^|;) ?framerFormsUTMTags=([^;]*)(;|$)\")\n\t\tif (matches !== null && matches[2]) {\n\t\t\tconst parsed = JSON.parse(decodeURIComponent(matches[2]))\n\t\t\tif (!parsed || typeof parsed !== \"object\") return\n\t\t\t;[\"utm_source\", \"utm_medium\", \"utm_campaign\", \"utm_term\", \"utm_content\", \"gclid\"].forEach(key => {\n\t\t\t\tif (typeof parsed[key] === \"string\") data.append(key, parsed[key])\n\t\t\t})\n\t\t}\n\t} catch (e) {\n\t\t// Ignore errors reading or decoding the cookie\n\t}\n}\n", "import React from \"react\"\nimport { FormContext } from \"./FormContainer.tsx\"\n\nconst HONEYPOT_VERSION = \"3\"\nconst HONEYPOT_FIELD_NAME = \"__framer\"\nconst COMMON_FIELD_NAMES = [\n\t\"website\",\n\t\"company\",\n\t\"message\",\n\t\"subject\",\n\t\"title\",\n\t\"description\",\n\t\"feedback\",\n\t\"notes\",\n\t\"details\",\n\t\"remarks\",\n\t\"comments\",\n]\n\nconst MODULE_LOAD_TIME = /* @__PURE__ */ (() => Date.now())()\n\nconst FIELD_DATA_ENUM = {\n\tname: 0,\n\tvalue: 1,\n\tsetAttribute: 2,\n\tvalueProperty: 3,\n\tisInputEventTrusted: 4,\n\tinputChangeTimeSinceModuleLoad: 5,\n\twasFilledBeforeHydration: 6,\n} as const\n\nconst METADATA_KEYS_ENUM = {\n\tfieldData: 0,\n\tfieldCount: 1,\n\tfieldFilledCount: 2,\n\thpVersion: 3,\n\tsiteId: 4,\n\ttimeToSubmissionSinceModuleLoad: 5,\n} as const\n\nconst getTimeSinceModuleLoadInSeconds = (): string => {\n\treturn ((Date.now() - MODULE_LOAD_TIME) / 1000).toFixed(2)\n}\n\ninterface HoneypotMethodsUsed {\n\tsetAttribute: boolean\n\tvalueProperty: boolean\n\tisInputEventTrusted?: boolean\n\tinputChangeTimeSinceModuleLoad?: string\n\twasFilledBeforeHydration?: boolean\n}\n\ninterface HoneypotInputStateRef {\n\tinputRef: React.RefObject<HTMLInputElement>\n\toriginalName: string\n\tmethodsUsed: HoneypotMethodsUsed\n}\n\nconst HoneypotInput = /* @__PURE__ */ ({ inputStateRef }: { inputStateRef: HoneypotInputStateRef }) => {\n\tconst { inputRef, originalName } = inputStateRef\n\n\t// Check if input already has a value before hydration\n\tReact.useLayoutEffect(() => {\n\t\tconst honeypotInput = inputRef.current\n\t\tif (!honeypotInput) return\n\n\t\tconst methodsUsed = inputStateRef.methodsUsed\n\n\t\tif (honeypotInput.value) {\n\t\t\tmethodsUsed.wasFilledBeforeHydration = true\n\t\t}\n\t}, [inputRef, inputStateRef])\n\n\tReact.useEffect(() => {\n\t\tconst myInput = inputRef.current\n\t\tif (!myInput) return\n\n\t\tconst methodsUsed = inputStateRef.methodsUsed\n\n\t\tconst originalSetAttributeMethod = Element.prototype.setAttribute\n\t\tconst originalSetAttribute = originalSetAttributeMethod.bind(myInput)\n\t\tmyInput.setAttribute = function (attrName: string, attrValue: string) {\n\t\t\tif (attrName === \"value\") {\n\t\t\t\tmethodsUsed.setAttribute = true\n\t\t\t\tmethodsUsed.inputChangeTimeSinceModuleLoad = getTimeSinceModuleLoadInSeconds()\n\t\t\t}\n\t\t\toriginalSetAttribute(attrName, attrValue)\n\t\t}\n\n\t\tconst originalDescriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, \"value\")\n\t\tif (originalDescriptor) {\n\t\t\tObject.defineProperty(myInput, \"value\", {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tget: function () {\n\t\t\t\t\treturn originalDescriptor.get?.call(this) ?? \"\"\n\t\t\t\t},\n\t\t\t\tset: function (newValue: string) {\n\t\t\t\t\tmethodsUsed.valueProperty = true\n\t\t\t\t\tmethodsUsed.inputChangeTimeSinceModuleLoad = getTimeSinceModuleLoadInSeconds()\n\t\t\t\t\toriginalDescriptor.set?.call(this, newValue)\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\n\t\tconst handleInput = (event: Event) => {\n\t\t\tmethodsUsed.isInputEventTrusted = event.isTrusted\n\t\t\tmethodsUsed.inputChangeTimeSinceModuleLoad = getTimeSinceModuleLoadInSeconds()\n\t\t}\n\t\tmyInput.addEventListener(\"input\", handleInput)\n\n\t\treturn () => {\n\t\t\tmyInput.setAttribute = originalSetAttributeMethod.bind(myInput)\n\t\t\tif (originalDescriptor) {\n\t\t\t\tObject.defineProperty(myInput, \"value\", originalDescriptor)\n\t\t\t}\n\t\t\tmyInput.removeEventListener(\"input\", handleInput)\n\t\t}\n\t}, [inputRef, inputStateRef])\n\n\treturn (\n\t\t<input\n\t\t\tref={inputRef}\n\t\t\ttype=\"text\"\n\t\t\tname={originalName}\n\t\t\tsuppressHydrationWarning={true}\n\t\t\ttabIndex={-1}\n\t\t\tautoComplete=\"one-time-code\" // https://www.nikolailehbr.ink/blog/prevent-form-spamming-honeypot#use-autocompleteone-time-code\n\t\t\taria-hidden=\"true\"\n\t\t\tstyle={{\n\t\t\t\tposition: \"absolute\",\n\t\t\t\ttransform: \"scale(0)\",\n\t\t\t}}\n\t\t\tdefaultValue=\"\"\n\t\t\tdata-1p-ignore\n\t\t\tdata-lpignore=\"true\"\n\t\t\tdata-form-type=\"other\"\n\t\t\tdata-bwignore\n\t\t/>\n\t)\n}\n\nexport function useHoneypotFields(isEnabled: boolean) {\n\tconst framerSiteId = React.useContext(FormContext)\n\n\tconst states: HoneypotInputStateRef[] = React.useMemo(\n\t\t() =>\n\t\t\tisEnabled\n\t\t\t\t? COMMON_FIELD_NAMES.map(fieldName => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tinputRef: React.createRef<HTMLInputElement>(),\n\t\t\t\t\t\t\toriginalName: fieldName,\n\t\t\t\t\t\t\tmethodsUsed: {\n\t\t\t\t\t\t\t\tsetAttribute: false,\n\t\t\t\t\t\t\t\tvalueProperty: 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: [],\n\t\t[isEnabled],\n\t)\n\n\t/**\n\t * FormData includes honeypot fields and we should mark these with unique names to prevent possible duplicate names\n\t */\n\tconst convertHoneypotFieldsForSubmission = React.useCallback(() => {\n\t\tstates.forEach(state => {\n\t\t\tconst currentHoneypotInput = state.inputRef.current\n\t\t\tif (currentHoneypotInput) {\n\t\t\t\tcurrentHoneypotInput.name = `${HONEYPOT_FIELD_NAME}_${state.originalName}`\n\t\t\t}\n\t\t})\n\t}, [states])\n\n\tconst replaceHoneypotWithMetadata = React.useCallback(\n\t\t(formData: FormData) => {\n\t\t\tif (!isEnabled) return\n\n\t\t\tconst honeypotCount = states.length\n\t\t\tlet honeypotFilled = 0\n\t\t\tconst filledFieldsData: string[] = []\n\n\t\t\tstates.forEach(state => {\n\t\t\t\tconst currentHoneypotInput = state.inputRef.current\n\n\t\t\t\tif (currentHoneypotInput) {\n\t\t\t\t\tconst currentName = currentHoneypotInput.name\n\t\t\t\t\tconst currentValue = currentHoneypotInput.value\n\n\t\t\t\t\tif (currentValue) {\n\t\t\t\t\t\thoneypotFilled++\n\n\t\t\t\t\t\t// Gather all metadata for this filled honeypot input\n\t\t\t\t\t\tconst fieldData = {\n\t\t\t\t\t\t\t[FIELD_DATA_ENUM.name]: state.originalName,\n\t\t\t\t\t\t\t[FIELD_DATA_ENUM.value]: currentValue,\n\t\t\t\t\t\t\t[FIELD_DATA_ENUM.setAttribute]: state.methodsUsed.setAttribute,\n\t\t\t\t\t\t\t[FIELD_DATA_ENUM.valueProperty]: state.methodsUsed.valueProperty,\n\t\t\t\t\t\t\t[FIELD_DATA_ENUM.isInputEventTrusted]: state.methodsUsed.isInputEventTrusted,\n\t\t\t\t\t\t\t[FIELD_DATA_ENUM.inputChangeTimeSinceModuleLoad]: state.methodsUsed.inputChangeTimeSinceModuleLoad,\n\t\t\t\t\t\t\t[FIELD_DATA_ENUM.wasFilledBeforeHydration]: state.methodsUsed.wasFilledBeforeHydration,\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfilledFieldsData.push(JSON.stringify(fieldData))\n\t\t\t\t\t}\n\n\t\t\t\t\tformData.delete(currentName)\n\t\t\t\t\tcurrentHoneypotInput.name = state.originalName\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tformData.append(`${HONEYPOT_FIELD_NAME}_${METADATA_KEYS_ENUM.fieldData}`, `[${filledFieldsData.join(\",\")}]`)\n\t\t\tformData.append(`${HONEYPOT_FIELD_NAME}_${METADATA_KEYS_ENUM.fieldCount}`, honeypotCount.toString())\n\t\t\tformData.append(`${HONEYPOT_FIELD_NAME}_${METADATA_KEYS_ENUM.fieldFilledCount}`, honeypotFilled.toString())\n\t\t\tformData.append(`${HONEYPOT_FIELD_NAME}_${METADATA_KEYS_ENUM.hpVersion}`, HONEYPOT_VERSION)\n\t\t\tformData.append(`${HONEYPOT_FIELD_NAME}_${METADATA_KEYS_ENUM.siteId}`, framerSiteId || \"\")\n\t\t\tformData.append(\n\t\t\t\t`${HONEYPOT_FIELD_NAME}_${METADATA_KEYS_ENUM.timeToSubmissionSinceModuleLoad}`,\n\t\t\t\tgetTimeSinceModuleLoadInSeconds(),\n\t\t\t)\n\t\t},\n\t\t[isEnabled, states, framerSiteId],\n\t)\n\n\treturn {\n\t\tstates,\n\t\tconvertHoneypotFieldsForSubmission,\n\t\treplaceHoneypotWithMetadata,\n\t}\n}\n\nexport function HoneypotFields({ states }: { states: HoneypotInputStateRef[] }) {\n\treturn (\n\t\t<>\n\t\t\t{states.map(stateRef => (\n\t\t\t\t// Names are unique at the moment, so using the originalName is fine\n\t\t\t\t<HoneypotInput key={`hp_${stateRef.originalName}`} inputStateRef={stateRef} />\n\t\t\t))}\n\t\t</>\n\t)\n}\n", "import type { Locale, RouterAPI } from \"../../../router/types.ts\"\nimport { type PageviewEventData, sendTrackingEvent } from \"../../../utils/sendTrackingEvent.ts\"\n\ninterface TrackFormSubmitParams {\n\tnodeId: string | undefined\n\tsubmitTrackingId: string | undefined\n\tactiveLocale: Locale | null\n\trouter: Partial<RouterAPI>\n}\n\nexport function trackFormSubmit({ router, nodeId, submitTrackingId }: TrackFormSubmitParams) {\n\tif (!router?.pageviewEventData?.current) return\n\n\tif (router.pageviewEventData.current instanceof Promise) {\n\t\tvoid router.pageviewEventData.current.then(pageviewEventData => {\n\t\t\tsendFormSubmitTrackingEvent(pageviewEventData, nodeId, submitTrackingId)\n\t\t})\n\t} else {\n\t\tsendFormSubmitTrackingEvent(router.pageviewEventData.current, nodeId, submitTrackingId)\n\t}\n}\n\nfunction sendFormSubmitTrackingEvent(\n\tpageviewEventData: PageviewEventData,\n\tnodeId: string | undefined,\n\ttrackingId: string | undefined,\n) {\n\treturn sendTrackingEvent(\n\t\t\"published_site_form_submit\",\n\t\t{\n\t\t\t...pageviewEventData,\n\t\t\tnodeId: nodeId ?? null,\n\t\t\ttrackingId: trackingId || null,\n\t\t},\n\t\t\"eager\",\n\t)\n}\n", "import React from \"react\"\nimport { requestIdleCallback } from \"../../../utils/utils.ts\"\nimport type { CaptchaProvider } from \"./types.ts\"\n\ndeclare global {\n\tinterface Window {\n\t\tgrecaptcha?: {\n\t\t\tready: (callback: () => void) => void\n\t\t\texecute: (siteKey: string, options?: { action: string }) => Promise<string>\n\t\t}\n\t}\n}\n\nconst RECAPTCHA_SCRIPT_URL = \"https://www.google.com/recaptcha/api.js\"\n\nfunction getRecaptchaScriptUrl(siteKey: string): string {\n\treturn `${RECAPTCHA_SCRIPT_URL}?render=${encodeURIComponent(siteKey)}&badge=bottomleft`\n}\n\n/** Module-level map so multiple forms with the same site key share one load. */\nconst captchaScriptPromises = new Map<string, Promise<void>>()\n\nfunction loadRecaptchaScript(siteKey: string): Promise<void> {\n\tconst existing = captchaScriptPromises.get(siteKey)\n\tif (existing) return existing\n\n\t// Check if the script was already injected outside of our control.\n\tconst scriptUrl = getRecaptchaScriptUrl(siteKey)\n\tif (document.querySelector(`script[src=\"${scriptUrl}\"]`)) {\n\t\tconst resolved = Promise.resolve()\n\t\tcaptchaScriptPromises.set(siteKey, resolved)\n\t\treturn resolved\n\t}\n\n\tconst promise = new Promise<void>((resolve, reject) => {\n\t\tconst script = document.createElement(\"script\")\n\t\tscript.src = scriptUrl\n\t\tscript.onload = () => resolve()\n\t\tscript.onerror = () => {\n\t\t\t// Reset so a retry is possible on next submission.\n\t\t\tcaptchaScriptPromises.delete(siteKey)\n\t\t\tscript.remove()\n\t\t\treject(new Error(\"Failed to load captcha script\"))\n\t\t}\n\t\tdocument.head.appendChild(script)\n\t})\n\n\tcaptchaScriptPromises.set(siteKey, promise)\n\treturn promise\n}\n\nfunction executeRecaptcha(siteKey: string, _action: string): Promise<string> {\n\treturn new Promise<string>((resolve, reject) => {\n\t\tconst { grecaptcha } = window\n\t\tif (!grecaptcha) {\n\t\t\treject(new Error(\"Captcha script not available\"))\n\t\t\treturn\n\t\t}\n\n\t\tgrecaptcha.ready(() => {\n\t\t\tgrecaptcha.execute(siteKey).then(resolve, reject)\n\t\t})\n\t})\n}\n\ninterface UseCaptchaOptions {\n\tprovider: CaptchaProvider | undefined\n\tsiteKey: string | undefined\n}\n\ninterface UseCaptchaResult {\n\t/** Call at submission time to retrieve a captcha token. Returns undefined when no captcha provider is configured. */\n\texecuteChallenge: (action: string) => Promise<string | undefined>\n}\n\nexport function useCaptcha({ provider, siteKey }: UseCaptchaOptions): UseCaptchaResult {\n\tReact.useEffect(() => {\n\t\tif (provider === \"recaptcha_v3\" && siteKey) {\n\t\t\trequestIdleCallback(() => {\n\t\t\t\tloadRecaptchaScript(siteKey).catch(() => {\n\t\t\t\t\t// executeChallenge will surface the error at submission time.\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\t}, [provider, siteKey])\n\n\tconst executeChallenge = React.useCallback(\n\t\tasync (action: string): Promise<string | undefined> => {\n\t\t\tif (provider !== \"recaptcha_v3\" || !siteKey) return undefined\n\n\t\t\tawait loadRecaptchaScript(siteKey)\n\t\t\treturn executeRecaptcha(siteKey, action)\n\t\t},\n\t\t[provider, siteKey],\n\t)\n\n\treturn { executeChallenge }\n}\n", "import { isDesktop } from \"@framerjs/shared/src/environment.ts\"\nimport type { CSSProperties, PropsWithChildren } from \"react\"\nimport type React from \"react\"\nimport { Fragment, startTransition, useCallback, useEffect, useLayoutEffect, useMemo, useRef } from \"react\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { CustomCursorHost } from \"../modules/CustomCursor.tsx\"\nimport { EditorBarLauncher } from \"../modules/EditorBarLauncher.tsx\"\nimport { useLibraryFeatures } from \"../modules/LibraryFeaturesContext.ts\"\nimport type { PageRootProps } from \"../modules/PageRootProps.ts\"\nimport { TriggerStateProvider } from \"../modules/TriggerStateContext.tsx\"\nimport { useLoadSnippets } from \"../modules/custom-code/useLoadSnippets.ts\"\nimport { isObject, isString, noop } from \"../utils/utils.ts\"\nimport { yieldToMain } from \"../utils/yield.ts\"\nimport { RouterAPIProvider } from \"./RouterContext.tsx\"\nimport { SuspenseThatPreservesDom } from \"./SuspenseThatPreservesDom.tsx\"\nimport { NotFoundErrorBoundary } from \"./error-boundary/NotFoundErrorBoundary.tsx\"\nimport { SynchronousSuspenseErrorBoundary } from \"./error-boundary/SynchronousSuspenseErrorBoundary.tsx\"\nimport { fillPathVariables } from \"./fillPathVariables.ts\"\nimport { getSitePrefix } from \"./getSitePrefix.ts\"\nimport {\n\tgetPathForRoute,\n\tisHistoryState,\n\tpushHistoryState,\n\tpushRouteState,\n\tuseNativeLoadingSpinner,\n\tusePopStateHandler,\n\tuseReplaceInitialState,\n\tuseSwitchLocale,\n} from \"./history.ts\"\nimport { MarkSuspenseEffects, useMarkRouterEffects } from \"./hydration/hydrationTimings.ts\"\nimport { TurnOnReactEventHandling } from \"./hydration/reactHydrationINPOptimizer.ts\"\nimport { isSamePage } from \"./isSamePage.ts\"\nimport { isLazyComponentType } from \"./lazy.tsx\"\nimport { useSendPageView } from \"./pageAnalytics.ts\"\nimport { useViewTransition } from \"./pageEffects/useViewTransition.ts\"\nimport { pathVariablesRegExpGlobal } from \"./pathVariables.ts\"\nimport { URLSearchParamsProvider } from \"./queryParameters.tsx\"\nimport { renderPage } from \"./renderPage.tsx\"\nimport { announceNavigation } from \"./routerDomUtils.ts\"\nimport type {\n\tLocale,\n\tLocaleId,\n\tLocaleInfo,\n\tNavigationPerformanceDetail,\n\tRoute,\n\tRouteId,\n\tRouterAPI,\n\tRoutes,\n\tSetCurrentRouteId,\n\tUpdateURL,\n} from \"./types.ts\"\nimport { defaultLocaleId } from \"./types.ts\"\nimport { useForceUpdate } from \"./useForceUpdate.ts\"\nimport { useGetRouteCallback } from \"./useGetRouteCallback.ts\"\nimport { LayoutDirectionContext, LocaleInfoContext } from \"./useLocale.ts\"\nimport { type MonitorNextPaintAfterRender, useMonitorNextPaintAfterRender } from \"./useMonitorNextPaintAfterRender.ts\"\nimport { EMPTY_ARRAY, getRouteElementId, monitorINPRelatedInputs } from \"./utils.ts\"\n\ninterface Props extends Pick<\n\tPageRootProps,\n\t| \"collectionUtils\"\n\t| \"notFoundPage\"\n\t| \"preserveQueryParams\"\n\t| \"LayoutTemplate\"\n\t| \"EditorBar\"\n\t| \"siteCanonicalURL\"\n\t| \"disableHistory\"\n\t| \"locales\"\n\t| \"adaptLayoutToTextDirection\"\n\t| \"initialCollectionItemId\"\n> {\n\troutes: Routes\n\tinitialRoute: RouteId\n\tinitialPathVariables?: Record<string, unknown>\n\tinitialLocaleId?: LocaleId\n\tdefaultPageStyle: CSSProperties\n}\n\nfunction updateScrollPosition(\n\thash: string | undefined,\n\tsmoothScroll: boolean | undefined,\n\tisHistoryTransition: boolean,\n) {\n\tconst element = hash && document.getElementById(hash)\n\tif (element) {\n\t\tscrollElementIntoView(element, smoothScroll)\n\t\treturn\n\t}\n\n\tif (isHistoryTransition) return\n\n\twindow.scrollTo(0, 0)\n}\n\nfunction useScheduleRenderSideEffects(dep: number) {\n\tconst actions = useRef<(() => void)[]>([])\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: explicit dependencies are needed to schedule the side effects\n\tuseLayoutEffect(() => {\n\t\tif (!actions.current?.length) return\n\t\tactions.current.forEach(action => action())\n\t\tactions.current = []\n\t}, [dep])\n\n\treturn useCallback((cb: () => void) => {\n\t\tactions.current.push(cb)\n\t}, [])\n}\n\ntype StartNavigation = (\n\ttransitionFn: (signal?: AbortSignal) => void,\n\tnextRender: ReturnType<MonitorNextPaintAfterRender<NavigationPerformanceDetail>>,\n\tupdateURL?: UpdateURL,\n\tisAbortable?: boolean,\n) => Promise<void>\n\nfunction executeBeforeUrlUpdateOnce(beforeUrlUpdate: VoidFunction | undefined) {\n\tif (!beforeUrlUpdate) return noop\n\n\tlet beforeUrlUpdateExecuted = false\n\treturn () => {\n\t\tif (beforeUrlUpdateExecuted) return\n\t\tbeforeUrlUpdateExecuted = true\n\t\tbeforeUrlUpdate?.()\n\t}\n}\n\n/**\n * Wrapper around navigation transitions (React, not view transitions). Add side-effects of the navigation transition here.\n * @return The returned callback returns a promise that resolves when the URL navigation is complete, including rendering and URL update.\n */\nfunction useNavigationTransition(): StartNavigation {\n\tconst startNativeSpinner = useNativeLoadingSpinner()\n\tconst navigationController = useRef<AbortController | undefined>(undefined)\n\n\treturn useCallback<StartNavigation>(\n\t\tasync (transitionFn, nextRender, updateURL, isAbortable = true) => {\n\t\t\tconst hasUpdateURL = updateURL !== undefined\n\n\t\t\t// abort previous navigation\n\t\t\t// React batches transitions, so we do not need any special handling for React.\n\t\t\tnavigationController.current?.abort()\n\t\t\tconst controller = isAbortable ? new AbortController() : undefined\n\t\t\tnavigationController.current = controller\n\n\t\t\tconst signal = controller?.signal\n\t\t\tconst stopMonitoringINPRelatedInputs = monitorINPRelatedInputs(signal)\n\t\t\tvoid nextRender.promise.finally(stopMonitoringINPRelatedInputs)\n\n\t\t\tif (!hasUpdateURL) {\n\t\t\t\tnavigationController.current = undefined\n\t\t\t\ttransitionFn(signal)\n\t\t\t\treturn nextRender.promise\n\t\t\t}\n\n\t\t\t// Perform the actual navigation (React update)\n\t\t\t// TODO: ideally this should run before the native spinner, but the browser schedules it after - for now ok, because the style recalc from\n\t\t\t// the transition CSS is somewhat expensive: https://framer-team.slack.com/archives/C05V49Q4NJ2/p1720012284107269\n\t\t\ttransitionFn(signal)\n\n\t\t\tlet resolveNavigationPromise: () => void\n\t\t\tconst navigationPromise = new Promise<void>((resolve, reject) => {\n\t\t\t\tresolveNavigationPromise = resolve\n\n\t\t\t\t// reject the navigation promise if the navigation is aborted by a more recent transition\n\t\t\t\tsignal?.addEventListener(\"abort\", reject)\n\t\t\t}).catch(noop)\n\n\t\t\t// enable the native spinner + update URL\n\t\t\t// updateURL must be called before the next paint after render otherwise the browser native scroll restoration\n\t\t\t// will save the restore position as 0,0 and backwards navigation will not restore the correct position\n\t\t\tstartNativeSpinner(navigationPromise, updateURL, controller)\n\n\t\t\tawait nextRender.promise\n\t\t\tif (signal?.aborted) return // after any async work, check if the navigation was aborted\n\n\t\t\tconst navigationTransition = window.navigation?.transition\n\n\t\t\t// we now stop the spinner\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: The promise constructor runs synchronously, so the variable is set at this point.\n\t\t\tresolveNavigationPromise!()\n\n\t\t\t// Await navigation to finish to make sure the navigation is complete before triggering side-effects\n\t\t\t// This avoids race conditions in Edge et al. where the announcement happens milliseconds\n\t\t\t// before the loading spinner disappears, and the screen reader reads \u201CLoading complete\u201D\n\t\t\t// instead of the announcement\n\t\t\ttry {\n\t\t\t\tawait navigationTransition?.finished\n\t\t\t} catch (error: unknown) {\n\t\t\t\t// One known way this can reject is when the network is down.\n\t\t\t\t// TODO: We should have a graceful (UI) way to handle network down errors.\n\t\t\t\t// For that purpose, we should track if there are any loading errors when importing pages/loading CMS data.\n\t\t\t\t// Currently, we don't do that, so we keep this an error, as we don't know if the react render has happened correctly or not.\n\t\t\t\t// biome-ignore lint/suspicious/noConsole:\n\t\t\t\tconsole.error(\"Navigation transition failed\", error)\n\t\t\t}\n\n\t\t\t// after the navigation transition has finished, check if the navigation was aborted\n\t\t\tif (signal?.aborted) return\n\n\t\t\tannounceNavigation()\n\t\t},\n\t\t[startNativeSpinner],\n\t)\n}\n\nexport function Router({\n\tdefaultPageStyle,\n\tdisableHistory,\n\tinitialPathVariables,\n\tinitialRoute,\n\tnotFoundPage,\n\tcollectionUtils,\n\troutes,\n\tinitialLocaleId,\n\tinitialCollectionItemId,\n\tlocales = EMPTY_ARRAY,\n\tpreserveQueryParams = false,\n\tLayoutTemplate,\n\tEditorBar,\n\tsiteCanonicalURL,\n\tadaptLayoutToTextDirection,\n}: PropsWithChildren<Props>) {\n\tuseMarkRouterEffects()\n\n\tuseReplaceInitialState({\n\t\tdisabled: disableHistory,\n\t\trouteId: initialRoute,\n\t\tinitialPathVariables,\n\t\tinitialLocaleId,\n\t})\n\n\tconst startViewTransition = useViewTransition()\n\tconst [dep, forceUpdate] = useForceUpdate()\n\tconst scheduleSideEffect = useScheduleRenderSideEffects(dep)\n\tconst startNavigation = useNavigationTransition()\n\tconst monitorNextPaintAfterRender = useMonitorNextPaintAfterRender<NavigationPerformanceDetail>(\"framer-route-change\")\n\tconst { synchronousNavigationOnDesktop } = useLibraryFeatures()\n\tconst transitionFn = useMemo(() => {\n\t\tif (!synchronousNavigationOnDesktop || !isDesktop()) {\n\t\t\treturn startTransition\n\t\t}\n\t\treturn (fn: () => void) => fn()\n\t}, [synchronousNavigationOnDesktop])\n\tconst loadSnippets = useLoadSnippets()\n\n\tconst isInitialNavigationRef = useRef(true)\n\n\tconst currentPathnameWithHashRef = useRef<string>()\n\tconst currentRouteRef = useRef(initialRoute)\n\tconst currentPathVariablesRef = useRef(initialPathVariables)\n\tconst currentLocaleIdRef = useRef<LocaleId | undefined>(initialLocaleId)\n\n\tconst currentLocaleId = currentLocaleIdRef.current\n\tconst activeLocale = useMemo((): Locale | null => {\n\t\treturn (\n\t\t\tlocales.find(({ id }) => {\n\t\t\t\tif (!currentLocaleId) return id === defaultLocaleId\n\t\t\t\treturn id === currentLocaleId\n\t\t\t}) ?? null\n\t\t)\n\t}, [currentLocaleId, locales])\n\n\tconst textDirection = activeLocale?.textDirection ?? \"ltr\"\n\tconst layoutDirection = adaptLayoutToTextDirection ? textDirection : \"ltr\"\n\n\tuseLayoutEffect(() => {\n\t\tif (!adaptLayoutToTextDirection) return\n\t\tdocument.documentElement.setAttribute(\"dir\", textDirection)\n\t}, [textDirection, adaptLayoutToTextDirection])\n\n\tconst switchLocale = useSwitchLocale()\n\tconst localeInfo = useMemo((): LocaleInfo => {\n\t\treturn {\n\t\t\tactiveLocale,\n\t\t\tlocales,\n\t\t\tsetLocale: async (localeOrLocaleId: Locale | LocaleId) => {\n\t\t\t\tconst nextRender = monitorNextPaintAfterRender({\n\t\t\t\t\tlocalized: true,\n\t\t\t\t})\n\n\t\t\t\t// Await a paint to keep INP low before running the rest of the code (especially the `history.pushState`)\n\t\t\t\tawait yieldToMain({ priority: \"user-blocking\", continueAfter: \"paint\" })\n\n\t\t\t\tlet localeId: string | undefined\n\n\t\t\t\tif (isString(localeOrLocaleId)) {\n\t\t\t\t\tlocaleId = localeOrLocaleId\n\t\t\t\t} else if (isObject(localeOrLocaleId)) {\n\t\t\t\t\tlocaleId = localeOrLocaleId.id\n\t\t\t\t}\n\n\t\t\t\tconst defaultLocale = locales.find(({ id }) => id === defaultLocaleId)\n\n\t\t\t\tconst nextLocale = locales.find(({ id }) => id === localeId)\n\t\t\t\tif (!nextLocale) return\n\n\t\t\t\tconst currentRouteId = currentRouteRef.current\n\t\t\t\tconst currentRoute = routes[currentRouteId]\n\t\t\t\tif (!currentRoute) return\n\n\t\t\t\ttry {\n\t\t\t\t\tconst localeResult = await switchLocale({\n\t\t\t\t\t\tcurrentLocale: activeLocale,\n\t\t\t\t\t\tnextLocale,\n\t\t\t\t\t\troute: currentRoute,\n\t\t\t\t\t\trouteId: currentRouteId,\n\t\t\t\t\t\tdefaultLocale,\n\t\t\t\t\t\tpathVariables: currentPathVariablesRef.current,\n\t\t\t\t\t\tpreserveQueryParams,\n\t\t\t\t\t})\n\t\t\t\t\tif (!localeResult) return\n\n\t\t\t\t\tconst currentStatePaginationInfo = isHistoryState(window.history.state)\n\t\t\t\t\t\t? window.history.state.paginationInfo\n\t\t\t\t\t\t: undefined\n\t\t\t\t\tconst currentPath = localeResult.path\n\n\t\t\t\t\tisInitialNavigationRef.current = false\n\n\t\t\t\t\t// eslint-disable-next-line require-atomic-updates -- the ref is stable from React.\n\t\t\t\t\tcurrentPathVariablesRef.current = localeResult.pathVariables\n\t\t\t\t\tcurrentLocaleIdRef.current = nextLocale.id\n\n\t\t\t\t\tconst updateURL = async (ignorePushStateWrapper = false) => {\n\t\t\t\t\t\tif (!currentPath) return\n\n\t\t\t\t\t\treturn pushHistoryState(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\trouteId: currentRouteId,\n\t\t\t\t\t\t\t\tpathVariables: localeResult.pathVariables,\n\t\t\t\t\t\t\t\tlocaleId: nextLocale.id,\n\t\t\t\t\t\t\t\tpaginationInfo: currentStatePaginationInfo,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tcurrentPath,\n\t\t\t\t\t\t\tignorePushStateWrapper,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\n\t\t\t\t\tvoid startNavigation(\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tvoid startViewTransition(\n\t\t\t\t\t\t\t\tcurrentRouteId,\n\t\t\t\t\t\t\t\tcurrentRouteId,\n\t\t\t\t\t\t\t\t() => transitionFn(forceUpdate),\n\t\t\t\t\t\t\t\t// no signal here, because we update the refs above immediately\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t},\n\t\t\t\t\t\tnextRender,\n\t\t\t\t\t\tupdateURL,\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t)\n\t\t\t\t} catch {\n\t\t\t\t\t// This should not happen because switchLocale already provides a fallback when there are async errors\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\t}, [\n\t\tactiveLocale,\n\t\tforceUpdate,\n\t\tlocales,\n\t\tpreserveQueryParams,\n\t\troutes,\n\t\tstartNavigation,\n\t\tstartViewTransition,\n\t\tmonitorNextPaintAfterRender,\n\t\ttransitionFn,\n\t\tswitchLocale,\n\t])\n\n\tconst setCurrentRouteId = useCallback<SetCurrentRouteId>(\n\t\t(\n\t\t\trouteId,\n\t\t\tlocaleId,\n\t\t\thash,\n\t\t\tpathnameWithHash,\n\t\t\tpathVariables,\n\t\t\tisHistoryTransition,\n\t\t\tnextRender,\n\t\t\tsmoothScroll = false,\n\t\t\tupdateURL,\n\t\t) => {\n\t\t\tisInitialNavigationRef.current = false\n\n\t\t\tconst currentRouteId = currentRouteRef.current\n\t\t\tcurrentRouteRef.current = routeId\n\t\t\tcurrentPathVariablesRef.current = pathVariables\n\t\t\tcurrentLocaleIdRef.current = localeId\n\n\t\t\t// Update the current path so that it is in sync with the route state\n\t\t\t// when we track pagevews in `useSendPageView`\n\t\t\tcurrentPathnameWithHashRef.current = pathnameWithHash\n\n\t\t\tscheduleSideEffect(() => {\n\t\t\t\t// After the render is complete, reset scroll position, or\n\t\t\t\t// scroll to the active element.\n\t\t\t\tupdateScrollPosition(hash, smoothScroll, isHistoryTransition)\n\t\t\t})\n\n\t\t\t// History transitions are handled by the popstate handler\n\t\t\tif (isHistoryTransition) {\n\t\t\t\ttransitionFn(forceUpdate)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvoid startNavigation(\n\t\t\t\tsignal => {\n\t\t\t\t\tvoid startViewTransition(currentRouteId, routeId, () => transitionFn(forceUpdate), signal)\n\t\t\t\t},\n\t\t\t\tnextRender,\n\t\t\t\tupdateURL,\n\t\t\t\ttrue,\n\t\t\t)\n\t\t},\n\t\t[forceUpdate, scheduleSideEffect, startNavigation, startViewTransition, transitionFn],\n\t)\n\n\tusePopStateHandler(currentRouteRef, setCurrentRouteId)\n\n\tconst navigate = useCallback<RouterAPI[\"navigate\"]>(\n\t\tasync (routeId, hash, pathVariables, smoothScroll, beforeUrlUpdate) => {\n\t\t\tconst newRoute = routes[routeId] as Route | undefined\n\n\t\t\tconst routeStatus = isLazyComponentType(newRoute?.page) ? newRoute.page.getStatus() : undefined\n\t\t\tconst hasRendered = routeStatus?.hasRendered\n\t\t\tconst nextRender = monitorNextPaintAfterRender({\n\t\t\t\tcached: hasRendered,\n\t\t\t\tpreloaded: hasRendered ? undefined : routeStatus?.hasLoaded,\n\t\t\t})\n\n\t\t\tconst executeBeforeUrlUpdate = executeBeforeUrlUpdateOnce(beforeUrlUpdate)\n\n\t\t\t// We queue `executeBeforeUrlUpdate` with guaranteed execution to ensure it'll still execute even if the user closes the tab before the URL is about to be updated.\n\t\t\t// We explicitly don't `await` here, because we want to ensure the promise is executed eventually, but not block on it.\n\t\t\t// This also means this might run any time before the URL update, and not just exactly before it. But that's fine here, too.\n\t\t\tvoid yieldToMain({ priority: \"background\", ensureContinueBeforeUnload: true, continueAfter: \"paint\" }).then(\n\t\t\t\texecuteBeforeUrlUpdate,\n\t\t\t)\n\n\t\t\t// Await a paint to reduce the chance of INP being increased by synchronous work that is outside of our control (e.g. GTM, tiktok analytics etc.).\n\t\t\t// The difference here is, we don't really care about running the rest of this code, as the tab is (probably) being closed.\n\t\t\t// Only `beforeUrlUpdate` is important, and we've already queued that using `yieldToMain` above.\n\t\t\tawait yieldToMain({ priority: \"user-blocking\", continueAfter: \"paint\" })\n\n\t\t\tif (pathVariables) {\n\t\t\t\t// Clean up the path variables to only include the ones that are actually used.\n\t\t\t\tconst inUse = new Set<string>()\n\t\t\t\tconst path = newRoute?.path ?? \"/\"\n\t\t\t\tfor (const match of path.matchAll(pathVariablesRegExpGlobal)) {\n\t\t\t\t\tconst usedVariable = match[1]\n\t\t\t\t\tif (usedVariable === undefined) {\n\t\t\t\t\t\tthrow new Error(\"A matching path variable should not be undefined\")\n\t\t\t\t\t}\n\t\t\t\t\tinUse.add(usedVariable)\n\t\t\t\t}\n\t\t\t\tpathVariables = Object.fromEntries(Object.entries(pathVariables).filter(([key]) => inUse.has(key)))\n\t\t\t}\n\n\t\t\t// Scroll if on the same page.\n\t\t\tconst routeElementId = getRouteElementId(newRoute, hash)\n\t\t\tconst currentPathVariables = currentPathVariablesRef.current\n\t\t\tconst currentRouteLocaleId = currentLocaleIdRef.current\n\t\t\tif (\n\t\t\t\tisSamePage(\n\t\t\t\t\t{ routeId: currentRouteRef.current, pathVariables: currentPathVariables },\n\t\t\t\t\t{ routeId, pathVariables },\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// If the route is the same, we don't want to measure the time it takes to navigate to the same page.\n\t\t\t\tnextRender.ignore?.()\n\n\t\t\t\tconst route = routes[routeId]\n\t\t\t\tif (window.history.state?.hash !== hash && !disableHistory && route) {\n\t\t\t\t\texecuteBeforeUrlUpdate()\n\t\t\t\t\tawait pushRouteState(routeId, route, {\n\t\t\t\t\t\tcurrentRoutePath: route.path,\n\t\t\t\t\t\tcurrentPathVariables,\n\t\t\t\t\t\tpathVariables,\n\t\t\t\t\t\thash,\n\t\t\t\t\t\tlocaleId: currentRouteLocaleId,\n\t\t\t\t\t\tpreserveQueryParams,\n\t\t\t\t\t\tsiteCanonicalURL,\n\t\t\t\t\t\tcurrentRoutePathLocalized: route.pathLocalized,\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\t// only update the scroll position after potentially awaiting the URL update\n\t\t\t\t// this is needed so that the scroll restoration always works correctly\n\t\t\t\tupdateScrollPosition(routeElementId, smoothScroll, false)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (!newRoute) return\n\n\t\t\tconst currentRoute = routes[currentRouteRef.current] as Route | undefined\n\t\t\tconst updateURL = async (ignorePushStateWrapper = false) => {\n\t\t\t\texecuteBeforeUrlUpdate()\n\t\t\t\treturn pushRouteState(\n\t\t\t\t\trouteId,\n\t\t\t\t\tnewRoute,\n\t\t\t\t\t{\n\t\t\t\t\t\tcurrentRoutePath: currentRoute?.path,\n\t\t\t\t\t\tcurrentPathVariables,\n\t\t\t\t\t\tcurrentRoutePathLocalized: currentRoute?.pathLocalized,\n\t\t\t\t\t\thash,\n\t\t\t\t\t\tpathVariables,\n\t\t\t\t\t\tlocaleId: currentRouteLocaleId,\n\t\t\t\t\t\tpreserveQueryParams,\n\t\t\t\t\t\tsiteCanonicalURL,\n\t\t\t\t\t},\n\t\t\t\t\tignorePushStateWrapper,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst pathnameWithHash =\n\t\t\t\tgetSitePrefix(siteCanonicalURL) +\n\t\t\t\tgetPathForRoute(newRoute, {\n\t\t\t\t\tcurrentRoutePath: currentRoute?.path,\n\t\t\t\t\tcurrentRoutePathLocalized: currentRoute?.pathLocalized,\n\t\t\t\t\tcurrentPathVariables,\n\t\t\t\t\thash,\n\t\t\t\t\tpathVariables,\n\t\t\t\t\tlocaleId: currentRouteLocaleId,\n\t\t\t\t\tpreserveQueryParams,\n\t\t\t\t\tsiteCanonicalURL,\n\t\t\t\t\trelative: false, // We need an absolute path for the hash\n\t\t\t\t})\n\n\t\t\tsetCurrentRouteId(\n\t\t\t\trouteId,\n\t\t\t\tcurrentRouteLocaleId,\n\t\t\t\trouteElementId,\n\t\t\t\tpathnameWithHash,\n\t\t\t\tpathVariables,\n\t\t\t\tfalse,\n\t\t\t\tnextRender,\n\t\t\t\tsmoothScroll,\n\t\t\t\tdisableHistory ? undefined : updateURL,\n\t\t\t)\n\t\t},\n\t\t[routes, setCurrentRouteId, disableHistory, preserveQueryParams, siteCanonicalURL, monitorNextPaintAfterRender],\n\t)\n\tconst getRoute = useGetRouteCallback(routes)\n\tconst currentRouteId = currentRouteRef.current\n\tconst currentPathnameWithHash = currentPathnameWithHashRef.current\n\tconst currentPathVariables = currentPathVariablesRef.current\n\tconst currentRoute = routes[currentRouteId]\n\tconst currentRoutePath = currentRoute?.path\n\tconst pageviewEventData = useSendPageView(\n\t\tcurrentRoute,\n\t\tcurrentRouteId,\n\t\tcurrentPathnameWithHash,\n\t\tcurrentPathVariables,\n\t\tactiveLocale,\n\t\tinitialCollectionItemId,\n\t)\n\tconst isInitialNavigation = isInitialNavigationRef.current\n\n\tuseEffect(() => {\n\t\tvoid loadSnippets(currentRouteId, currentPathVariables ?? {}, localeInfo.activeLocale, isInitialNavigation)\n\t}, [loadSnippets, currentRouteId, currentPathVariables, localeInfo, isInitialNavigation])\n\n\tconst api = useMemo(\n\t\t(): RouterAPI => ({\n\t\t\tnavigate,\n\t\t\tgetRoute,\n\t\t\tcurrentRouteId,\n\t\t\tcurrentPathVariables,\n\t\t\troutes,\n\t\t\tcollectionUtils,\n\t\t\tpreserveQueryParams,\n\t\t\tpageviewEventData,\n\t\t\tsiteCanonicalURL,\n\t\t\tisInitialNavigation,\n\t\t}),\n\t\t[\n\t\t\tnavigate,\n\t\t\tgetRoute,\n\t\t\tcurrentRouteId,\n\t\t\tcurrentPathVariables,\n\t\t\troutes,\n\t\t\tcollectionUtils,\n\t\t\tpreserveQueryParams,\n\t\t\tsiteCanonicalURL,\n\t\t\tpageviewEventData,\n\t\t\tisInitialNavigation,\n\t\t],\n\t)\n\n\tif (!currentRoute) {\n\t\tthrow new Error(`Router cannot find route for ${currentRouteId}`)\n\t}\n\n\tconst pageExistsInCurrentLocale =\n\t\t!activeLocale || !currentRoute.includedLocales || currentRoute.includedLocales.includes(activeLocale.id)\n\n\t// Used to unmount the current page when switching between CMS detail pages from the same\n\t// collection. These detail pages use the same component and share the same same path. Not\n\t// unmounting causes issues like React state not resetting, and appear animations not playing.\n\tconst pathWithFilledVariables =\n\t\tcurrentRoutePath && currentPathVariables\n\t\t\t? fillPathVariables(currentRoutePath, currentPathVariables)\n\t\t\t: currentRoutePath\n\n\t// We want the page to remount when the locale or collection item changes. This prevents\n\t// unexpected animations and transitions from running, and appear animations not playing.\n\tconst remountKey = String(currentLocaleId) + pathWithFilledVariables\n\n\tconst templatePageStyle = useConstant<React.CSSProperties>(() => ({ ...defaultPageStyle, display: \"contents\" }))\n\n\treturn (\n\t\t<RouterAPIProvider api={api}>\n\t\t\t<LocaleInfoContext.Provider value={localeInfo}>\n\t\t\t\t<LayoutDirectionContext.Provider value={layoutDirection}>\n\t\t\t\t\t<CustomCursorHost>\n\t\t\t\t\t\t<URLSearchParamsProvider>\n\t\t\t\t\t\t\t<TriggerStateProvider currentRoutePath={pathWithFilledVariables} routerAPI={api}>\n\t\t\t\t\t\t\t\t{/* Rendering the editorBar outside SuspenseThatPreservesDom makes it load faster */}\n\t\t\t\t\t\t\t\t{EditorBar && <EditorBarLauncher EditorBar={EditorBar} fast />}\n\n\t\t\t\t\t\t\t\t<SynchronousSuspenseErrorBoundary>\n\t\t\t\t\t\t\t\t\t<SuspenseThatPreservesDom>\n\t\t\t\t\t\t\t\t\t\t<NotFoundErrorBoundary\n\t\t\t\t\t\t\t\t\t\t\tnotFoundPage={notFoundPage}\n\t\t\t\t\t\t\t\t\t\t\tdefaultPageStyle={defaultPageStyle}\n\t\t\t\t\t\t\t\t\t\t\tforceUpdateKey={dep}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{/* always keep MarkSuspenseEffects.Start as the first child of the error boundary */}\n\t\t\t\t\t\t\t\t\t\t\t<MarkSuspenseEffects.Start />\n\n\t\t\t\t\t\t\t\t\t\t\t<WithLayoutTemplate\n\t\t\t\t\t\t\t\t\t\t\t\tLayoutTemplate={LayoutTemplate}\n\t\t\t\t\t\t\t\t\t\t\t\t// If the route had been replaced with an AB testing variant,\n\t\t\t\t\t\t\t\t\t\t\t\t// we need to take the webPageId from the variant,\n\t\t\t\t\t\t\t\t\t\t\t\t// see `patchRoutesForABTesting`\n\t\t\t\t\t\t\t\t\t\t\t\twebPageId={currentRoute?.abTestingVariantId ?? currentRouteId}\n\t\t\t\t\t\t\t\t\t\t\t\tstyle={defaultPageStyle}\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{inLayoutTemplate => {\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\t\t<Fragment key={remountKey}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{pageExistsInCurrentLocale\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? renderPage(currentRoute.page, inLayoutTemplate ? templatePageStyle : defaultPageStyle)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: // LAYOUT_TEMPLATE @TODO: display: content for not found page?\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnotFoundPage && renderPage(notFoundPage, defaultPageStyle)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Fragment>\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</WithLayoutTemplate>\n\t\t\t\t\t\t\t\t\t\t</NotFoundErrorBoundary>\n\n\t\t\t\t\t\t\t\t\t\t{EditorBar && <EditorBarLauncher EditorBar={EditorBar} />}\n\n\t\t\t\t\t\t\t\t\t\t{/* always keep the following two as the last child of the SuspenseThatPreservesDom */}\n\t\t\t\t\t\t\t\t\t\t<TurnOnReactEventHandling />\n\t\t\t\t\t\t\t\t\t\t<MarkSuspenseEffects.End />\n\t\t\t\t\t\t\t\t\t</SuspenseThatPreservesDom>\n\t\t\t\t\t\t\t\t</SynchronousSuspenseErrorBoundary>\n\t\t\t\t\t\t\t</TriggerStateProvider>\n\t\t\t\t\t\t</URLSearchParamsProvider>\n\t\t\t\t\t</CustomCursorHost>\n\t\t\t\t</LayoutDirectionContext.Provider>\n\t\t\t</LocaleInfoContext.Provider>\n\t\t</RouterAPIProvider>\n\t)\n}\n\ninterface WithLayoutTemplateProps {\n\twebPageId: string\n\tstyle?: React.CSSProperties\n\tLayoutTemplate:\n\t\t| React.ComponentType<{\n\t\t\t\twebPageId: string\n\t\t\t\tstyle?: React.CSSProperties\n\t\t\t\tchildren: (inLayoutTemplate: boolean) => React.ReactNode\n\t\t  }>\n\t\t| undefined\n\tchildren: (inLayoutTemplate: boolean) => React.ReactNode\n}\n\nfunction WithLayoutTemplate({ LayoutTemplate, webPageId, style, children }: WithLayoutTemplateProps) {\n\tif (!LayoutTemplate) return children(false)\n\n\treturn (\n\t\t<LayoutTemplate webPageId={webPageId} style={style}>\n\t\t\t{children}\n\t\t</LayoutTemplate>\n\t)\n}\n\nfunction scrollElementIntoView(element: HTMLElement, smoothScroll: boolean | undefined) {\n\t// When using smooth scrolling, we need to include both the\n\t// `block` and `inline` option even though they are using the\n\t// default value. This fixes a weird bug where smooth scrolling\n\t// moves the whole preview viewport when the status bar is\n\t// hidden.\n\tconst scrollIntoViewOptions: ScrollIntoViewOptions | undefined = smoothScroll\n\t\t? { behavior: \"smooth\", block: \"start\", inline: \"nearest\" }\n\t\t: undefined\n\telement.scrollIntoView(scrollIntoViewOptions)\n}\n", "export const FORCE_SHOW_EDITORBAR_LOCALSTORAGE_KEY = \"__framer_force_showing_editorbar_since\" as const\nexport const EDITOR_BUTTON_POSITION_LOCALSTORAGE_KEY = \"__framer_editor_button_position\" as const\nexport const MAX_Z_INDEX = \"2147483647\"\n", "import { FORCE_SHOW_EDITORBAR_LOCALSTORAGE_KEY } from \"@framerjs/shared/src/constants.ts\"\nimport { Suspense, useContext, useMemo, useSyncExternalStore } from \"react\"\nimport { IgnoreErrors } from \"../components/IgnoreErrors.tsx\"\nimport { FormContext } from \"../render/presentation/Forms/FormContainer.tsx\"\nimport { noopSubscribe, returnFalse } from \"../utils/utils.ts\"\nimport { useLibraryFeatures } from \"./LibraryFeaturesContext.ts\"\nimport type { PageRootProps } from \"./PageRootProps.ts\"\n\nexport interface EditorBarProps {\n\tframerSiteId: string\n\tfeatures?: Record<string, boolean>\n}\n\nconst isPrioritized = () => {\n\ttry {\n\t\treturn !!localStorage[FORCE_SHOW_EDITORBAR_LOCALSTORAGE_KEY]\n\t} catch (e) {\n\t\treturn false\n\t}\n}\nconst isntPrioritized = () => !isPrioritized()\n\nexport function EditorBarLauncher({\n\tEditorBar,\n\tfast = false,\n}: {\n\tEditorBar: PageRootProps[\"EditorBar\"]\n\tfast?: boolean\n}) {\n\tconst libraryFeatures = useLibraryFeatures()\n\tconst framerSiteId = useContext(FormContext)\n\n\t// eslint-disable-next-line framer-studio/no-usesyncexternalstore -- safe here\n\tconst enabled = useSyncExternalStore(noopSubscribe, fast ? isPrioritized : isntPrioritized, returnFalse)\n\n\tconst editorBarFeatures = useMemo(() => {\n\t\tconst features: Record<string, boolean> = {}\n\t\tlet key: keyof typeof libraryFeatures\n\t\tfor (key in libraryFeatures) {\n\t\t\t// biome-ignore lint/suspicious/noPrototypeBuiltins: Object.hasOwn not supported in library\n\t\t\tif (libraryFeatures.hasOwnProperty(key) && (key.startsWith(\"editorBar\") || key.startsWith(\"onPage\"))) {\n\t\t\t\tfeatures[key] = libraryFeatures[key] as boolean\n\t\t\t}\n\t\t}\n\t\treturn features\n\t}, [libraryFeatures])\n\n\tif (!EditorBar || !framerSiteId || !enabled) return null\n\n\treturn (\n\t\t<IgnoreErrors>\n\t\t\t<Suspense>\n\t\t\t\t<EditorBar framerSiteId={framerSiteId} features={editorBarFeatures} />\n\t\t\t</Suspense>\n\t\t</IgnoreErrors>\n\t)\n}\n", "import type { PropsWithChildren } from \"react\"\nimport { Component } from \"react\"\n\ninterface State {\n\terror?: unknown\n}\n\nexport class IgnoreErrors extends Component<PropsWithChildren, State> {\n\toverride state = { error: undefined }\n\n\tstatic getDerivedStateFromError(error: unknown) {\n\t\treturn { error }\n\t}\n\n\toverride render() {\n\t\tif (this.state.error) return null\n\t\treturn this.props.children\n\t}\n}\n", "import { createContext, useContext, useEffect, useRef, useState } from \"react\"\nimport { fillPathVariables } from \"../router/fillPathVariables.ts\"\nimport type { RouterAPI } from \"../router/types.ts\"\nimport { assert } from \"../utils/assert.ts\"\nimport { type PageviewEventData, isValidTrackingId, sendTrackingEvent } from \"../utils/sendTrackingEvent.ts\"\nimport { TriggerState, type TriggerStateInitial } from \"../utils/triggerActions.ts\"\nimport { isStaticRenderer } from \"./useIsStaticRenderer.ts\"\n\ninterface TriggerStateContextValue {\n\tgetInitialState: () => TriggerStateInitial\n\ttriggerStateRef: React.MutableRefObject<TriggerState | null>\n}\n\nconst TriggerStateContext = /* @__PURE__ */ (() => {\n\tconst Context = createContext<TriggerStateContextValue | undefined>(undefined)\n\tContext.displayName = \"TriggerStateContext\"\n\treturn Context\n})()\n\ninterface TriggerStateProviderProps {\n\tcurrentRoutePath: string | undefined\n\t/** Should only be undefined if no router is available, e.g. in the component preview */\n\trouterAPI: RouterAPI | undefined\n\tchildren: React.ReactNode\n}\n\nexport function TriggerStateProvider({ currentRoutePath, routerAPI, children }: TriggerStateProviderProps) {\n\tconst visitedPagesRef = useRef<Set<string>>()\n\tconst routeChangeHandlerRef = useRef<Parameters<TriggerStateInitial[\"setRouteChangeHandler\"]>[0]>()\n\tconst routerAPIRef = useRef<RouterAPI | undefined>(routerAPI)\n\tconst triggerStateRef = useRef<TriggerState | null>(null)\n\trouterAPIRef.current = routerAPI\n\n\tuseEffect(() => {\n\t\tif (!currentRoutePath) return\n\n\t\tvisitedPagesRef.current ??= new Set()\n\t\tvisitedPagesRef.current.add(currentRoutePath)\n\n\t\trouteChangeHandlerRef.current?.(currentRoutePath)\n\t}, [currentRoutePath])\n\n\tconst [initialState] = useState<TriggerStateContextValue>(() => ({\n\t\tgetInitialState: (): TriggerStateInitial => ({\n\t\t\tvisitedPages: visitedPagesRef.current ?? new Set(),\n\t\t\tgetCurrentRoutePath: () =>\n\t\t\t\trouterAPIRef.current\n\t\t\t\t\t? resolveRoutePath(\n\t\t\t\t\t\t\trouterAPIRef.current,\n\t\t\t\t\t\t\trouterAPIRef.current.currentRouteId,\n\t\t\t\t\t\t\trouterAPIRef.current.currentPathVariables,\n\t\t\t\t\t\t)\n\t\t\t\t\t: \"\",\n\t\t\tresolveRoute: linkToWebPage =>\n\t\t\t\trouterAPIRef.current\n\t\t\t\t\t? resolveRoutePath(routerAPIRef.current, linkToWebPage.webPageId, linkToWebPage.pathVariables)\n\t\t\t\t\t: \"\",\n\t\t\tsetRouteChangeHandler: (handler: (currentPath: string) => void) => {\n\t\t\t\trouteChangeHandlerRef.current = handler\n\t\t\t},\n\t\t\tsendTrackingEvent: async (event: Parameters<TriggerStateInitial[\"sendTrackingEvent\"]>[0]) => {\n\t\t\t\tif (!routerAPIRef.current) return\n\t\t\t\tvoid sendTrackingEventForTriggerInvoke(routerAPIRef.current.pageviewEventData.current, event)\n\t\t\t},\n\t\t}),\n\t\ttriggerStateRef,\n\t}))\n\n\treturn <TriggerStateContext.Provider value={initialState}>{children}</TriggerStateContext.Provider>\n}\n\nasync function sendTrackingEventForTriggerInvoke(\n\tmaybePageViewEventData: PageviewEventData | Promise<PageviewEventData | undefined> | undefined,\n\tevent: Parameters<TriggerStateInitial[\"sendTrackingEvent\"]>[0],\n) {\n\tif (!isValidTrackingId(event.trackingId)) return\n\n\tconst pageViewEventData =\n\t\tmaybePageViewEventData instanceof Promise ? await maybePageViewEventData : maybePageViewEventData\n\tif (!pageViewEventData) return\n\n\tsendTrackingEvent(\n\t\t\"published_site_trigger_invoke\",\n\t\t{\n\t\t\t...pageViewEventData,\n\t\t\t...event,\n\t\t\t// Don't attach a tracking ID if it's empty\n\t\t\ttrackingId: event.trackingId || null,\n\t\t},\n\t\t\"lazy\",\n\t)\n}\n\nfunction resolveRoutePath(routerAPI: RouterAPI, routeId: string, pathVariables?: Record<string, unknown>) {\n\tconst route = routerAPI.getRoute(routeId)\n\tif (!route || !route.path) return \"\"\n\treturn pathVariables ? fillPathVariables(route.path, pathVariables) : route.path\n}\n\nexport function useTriggerState() {\n\tconst triggerStateContext = useContext(TriggerStateContext)\n\tconst triggerState = getTriggerState(triggerStateContext)\n\treturn triggerState\n}\n\nfunction getTriggerState(triggerStateContext?: TriggerStateContextValue) {\n\tif (typeof window === \"undefined\" || !window.document || isStaticRenderer()) return null\n\tassert(triggerStateContext, \"TriggerStateProvider is missing\")\n\n\tconst { getInitialState, triggerStateRef } = triggerStateContext\n\tif (triggerStateRef.current instanceof TriggerState) {\n\t\treturn triggerStateRef.current\n\t}\n\n\t// lazily initialize the trigger state so it can be tree shaken for any sites without triggers\n\ttriggerStateRef.current = new TriggerState(getInitialState())\n\treturn triggerStateRef.current\n}\n\nexport const testing = {\n\tTriggerStateContext,\n}\n", "import { debounce } from \"../render/utils/debounce.ts\"\nimport type { WindowWithTriggerEvents } from \"./createTrigger.ts\"\nimport type { TriggerEventHistoryType } from \"./triggerActions.ts\"\n\nconst triggerHistoryStorageKey = \"framer:trigger-history:v1\"\nconst triggerHistoryStorageVersion = 1\n\nexport const TriggerActionsStorageSymbol = /** @__PURE__ */ Symbol(\"TriggerStorage\")\nexport class TriggerActionsStorage {\n\tprivate readonly eventsToTrack: Set<string> = new Set()\n\tprivate readonly historyEvents = new Map<string, number>()\n\tprivate readonly persistHistory = debounce(() => this.flushHistoryToStorage(), 250)\n\tconstructor() {\n\t\tif (typeof window === \"undefined\" || !window.document) return\n\n\t\tthis.eventsToTrack = getTriggerEventsToTrack()\n\n\t\tthis.initializeHistoryListeners()\n\t\tthis.loadHistoryFromStorage()\n\t}\n\n\tprivate initializeHistoryListeners() {\n\t\tif (typeof window === \"undefined\" || !window.document) return\n\t\twindow.document.addEventListener(\"framer:click\", this.onClickEvent)\n\t\twindow.document.addEventListener(\"framer:formsubmit\", this.onFormSubmitEvent)\n\t\twindow.addEventListener(\"storage\", this.onStorageEvent)\n\t}\n\n\tprivate onClickEvent = (event: Event) => {\n\t\tconst detail = (event as CustomEvent<{ trackingId?: string }>).detail\n\t\tif (!detail?.trackingId) return\n\t\tthis.recordHistoryEvent(\"click\", detail.trackingId)\n\t}\n\n\tprivate onFormSubmitEvent = (event: Event) => {\n\t\tconst detail = (event as CustomEvent<{ trackingId?: string }>).detail\n\t\tif (!detail?.trackingId) return\n\t\tthis.recordHistoryEvent(\"form_submit\", detail.trackingId)\n\t}\n\n\tonTriggerInvoke(triggerTargetId: string) {\n\t\tthis.recordHistoryEvent(\"trigger_invoke\", triggerTargetId)\n\t}\n\n\tprivate onStorageEvent = (event: StorageEvent) => {\n\t\tif (event.key !== triggerHistoryStorageKey) return\n\t\tconst parsed = parseHistoryStorage(event.newValue)\n\t\tif (parsed) {\n\t\t\tupdateMap(this.historyEvents, parsed)\n\t\t}\n\t}\n\n\tprivate recordHistoryEvent(eventType: TriggerEventHistoryType, id: string) {\n\t\tif (!this.eventsToTrack.has(getKey(eventType, id))) return\n\n\t\tthis.historyEvents.set(getKey(eventType, id), Date.now())\n\t\tthis.persistHistory()\n\t}\n\n\tprivate loadHistoryFromStorage() {\n\t\tif (typeof window === \"undefined\") return\n\t\ttry {\n\t\t\tconst parsed = parseHistoryStorage(window.localStorage.getItem(triggerHistoryStorageKey))\n\t\t\tif (parsed) {\n\t\t\t\tupdateMap(this.historyEvents, parsed)\n\t\t\t}\n\t\t} catch {\n\t\t\t// localStorage may be unavailable\n\t\t}\n\t}\n\n\tprivate flushHistoryToStorage() {\n\t\tif (typeof window === \"undefined\") return\n\t\ttry {\n\t\t\twindow.localStorage.setItem(\n\t\t\t\ttriggerHistoryStorageKey,\n\t\t\t\tJSON.stringify({\n\t\t\t\t\tversion: triggerHistoryStorageVersion,\n\t\t\t\t\tevents: Object.fromEntries(this.historyEvents.entries()),\n\t\t\t\t}),\n\t\t\t)\n\t\t} catch {\n\t\t\t// localStorage may be unavailable or full; ignore and keep in-memory history\n\t\t}\n\t}\n\n\thasSeenEvent(eventType: TriggerEventHistoryType, id: string, sinceMs?: number): boolean {\n\t\tconst key = getKey(eventType, id)\n\t\tconst now = Date.now()\n\t\tconst seenAt = this.historyEvents.get(key)\n\t\tif (seenAt === undefined) return false\n\t\tif (!sinceMs) return true\n\n\t\treturn seenAt + sinceMs >= now\n\t}\n}\n\nfunction parseHistoryStorage(raw: string | null): Map<string, number> | undefined {\n\tif (!raw) return undefined\n\ttry {\n\t\tconst parsed = JSON.parse(raw) as { version?: number; events?: Record<string, number> }\n\t\tif (parsed?.version !== triggerHistoryStorageVersion || !parsed.events) return undefined\n\t\treturn new Map(Object.entries(parsed.events))\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\nfunction updateMap(map: Map<string, number>, incoming: Map<string, number>) {\n\tfor (const [key, value] of incoming.entries()) {\n\t\t// Skip events with a newer recorded timestamp\n\t\tif ((map.get(key) ?? 0) >= value) continue\n\t\tmap.set(key, value)\n\t}\n}\n\nfunction getKey(eventType: TriggerEventHistoryType, id: string) {\n\treturn `${eventType}:${id}`\n}\n\nfunction getTriggerEventsToTrack(): Set<string> {\n\tif (typeof window === \"undefined\" || !window.document || !(TriggerActionsStorageSymbol in window)) return new Set()\n\tconst safeWindow = window as WindowWithTriggerEvents\n\treturn new Set(safeWindow[TriggerActionsStorageSymbol])\n}\n", "import type { LinkToWebPage } from \"../modules/LinkToWebPage.ts\"\nimport { debounce } from \"../render/utils/debounce.ts\"\nimport { assert, assertNever } from \"./assert.ts\"\nimport type { TriggerInvokeEventData } from \"./sendTrackingEvent.ts\"\nimport { TriggerActionsStorage } from \"./triggerActionsStorage.ts\"\nimport { noop } from \"./utils.ts\"\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- needs to match Record<string, SerializableValue> DeclarationCollector.dedupe\ntype TriggerInteractionBase = { id: string; operator: \"and\" | \"or\" }\ntype TriggerInteractions =\n\t| { type: \"delay\"; delayMs: number; delayType: \"site\" | \"page\" }\n\t| { type: \"scrollPercentage\"; scrollPercentage: number }\n\t| { type: \"exit\"; exitType: \"mouseleave\" | \"visibilitychange\" | \"all\" }\nexport type TriggerInteraction = TriggerInteractionBase & TriggerInteractions\nexport type TypedTriggerInteraction<T extends TriggerInteraction[\"type\"]> = Extract<TriggerInteraction, { type: T }>\nexport type TriggerInvokeAction = { type: \"showOverlay\" } | { type: \"setComponentVariant\"; variant: string }\n\nexport type TriggerEventHistoryType = \"click\" | \"form_submit\" | \"trigger_invoke\"\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- needs to match Record<string, SerializableValue> DeclarationCollector.dedupe\nexport type TriggerEventHistoryRule = {\n\tid: string\n\teventType: TriggerEventHistoryType\n\teventId: string\n\truleType: \"seen\" | \"not-seen\"\n\twithinMs?: number\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- needs to match Record<string, SerializableValue> DeclarationCollector.dedupe\nexport type KeyValueRule = {\n\tid: string\n\tkey: string\n\ttype: \"set\" | \"not-set\" | \"equals\"\n\tvalue?: string\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- needs to match Record<string, SerializableValue> DeclarationCollector.dedupe\nexport type RouteRule = {\n\tid: string\n\troute: Pick<LinkToWebPage, \"webPageId\" | \"pathVariables\"> | undefined\n\twildcard?: boolean\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- needs to match Record<string, SerializableValue> DeclarationCollector.dedupe\nexport type ScheduleRule = {\n\t/** ISO 8601 format without timezone offset, e.g. \"2026-01-02T15:00:00\" */\n\tstartAt?: string\n\t/** ISO 8601 format without timezone offset, e.g. \"2026-01-02T15:00:00\" */\n\tendAt?: string\n\t/** The offset from UTC, e.g. \"+02:00\" for startAt. If empty the schedule is evaluated as local time. */\n\tstartAtOffset?: string\n\t/**\n\t * The offset from UTC, e.g. \"+02:00\" for endAt. If empty the schedule is evaluated as local time.\n\t * It must be separate because the end and start could span DST boundaries.\n\t */\n\tendAtOffset?: string\n\t/** Required to identify the timezone in the UI, the true offset is embedded in the date strings */\n\ttimezone?: string\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- needs to match Record<string, SerializableValue> DeclarationCollector.dedupe\nexport type Trigger = {\n\tinteractions: TriggerInteraction[]\n\ttrackingId: string\n\t// static checks like route matching can be added here when they are implemented, dynamic checks are added as TriggerConditions\n\tcookies?: { operator: \"and\" | \"or\"; rules: KeyValueRule[] }\n\turlParams?: { operator: \"and\" | \"or\"; rules: KeyValueRule[] }\n\tpageCount?: number\n\tincludeRoutes?: RouteRule[]\n\texcludeRoutes?: RouteRule[]\n\tschedule?: ScheduleRule\n\t/** Rules involving visitor's history with the site */\n\teventHistory?: TriggerEventHistoryRule[]\n}\n\ninterface TriggerEntry {\n\tstatus: \"pending\" | \"triggered\" | \"inactive\"\n\ttargetId: string\n\ttrigger: Trigger\n\tunsubscribeHandlers: Set<VoidFunction>\n\tcallback?: VoidFunction\n}\n\nconst cookieRegex = /^(?<key>[^=]*)=(?<value>.*)$/u\n\nexport interface TriggerStateInitial {\n\t/** For any pages that were already visited before the trigger state was initialized. */\n\tvisitedPages: Set<string>\n\t/** To get the current route id when matching paths. */\n\tgetCurrentRoutePath: () => string\n\t/** To resolve a link to a web page to a path to then do path matching. Doesn't resolve locale specific paths because we match with the default locale. */\n\tresolveRoute: (linkToWebPage: LinkToWebPage) => string\n\t/** To track number of pages visited. */\n\tsetRouteChangeHandler: (handler: (currentPath: string) => void) => void\n\tsendTrackingEvent: (event: Pick<TriggerInvokeEventData, \"trackingId\" | \"nodeId\">) => void\n}\n\ntype EmittableEventType = Extract<TriggerInteraction[\"type\"], \"exit\" | \"scrollPercentage\">\ntype EmittableEventPayload = Extract<TriggerInteractions, { type: EmittableEventType }>\ntype EmitFunction = (eventPayload: EmittableEventPayload) => void\n\nexport class TriggerState {\n\tprivate readonly triggers = new Map<string, TriggerEntry>()\n\tprivate readonly events = new Map<EmittableEventType, { handlers: Set<EmitFunction>; cleanup?: VoidFunction }>()\n\tprivate readonly initializedAtMs = Date.now()\n\tprivate lastRouteChangeAtMs = Date.now()\n\tprivate readonly visitedPages: TriggerStateInitial[\"visitedPages\"]\n\tprivate maxScrollPercentage = getScrollPercentage()\n\tprivate onTriggerListeners = new Set<(triggerId: string) => void>()\n\tprivate readonly delayTimeouts = new Map<string, ReturnType<typeof setTimeout>>()\n\tprivate readonly resolveRoute: TriggerStateInitial[\"resolveRoute\"]\n\tprivate readonly getCurrentRoutePath: TriggerStateInitial[\"getCurrentRoutePath\"]\n\tprivate readonly sendTrackingEvent: TriggerStateInitial[\"sendTrackingEvent\"]\n\tprivate readonly storage = new TriggerActionsStorage()\n\n\tconstructor(initial: TriggerStateInitial) {\n\t\tthis.visitedPages = new Set(initial.visitedPages)\n\t\tthis.resolveRoute = initial.resolveRoute\n\t\tthis.getCurrentRoutePath = initial.getCurrentRoutePath\n\t\tinitial.setRouteChangeHandler(this.onRouteChange)\n\t\tthis.sendTrackingEvent = initial.sendTrackingEvent\n\t}\n\n\tget invokedTriggers() {\n\t\treturn new Set(\n\t\t\t[...this.triggers.entries()]\n\t\t\t\t.filter(([, triggerEntry]) => triggerEntry.status === \"triggered\")\n\t\t\t\t.map(([trigger]) => trigger),\n\t\t)\n\t}\n\n\taddOnTriggerListener(listener: (triggerId: string) => void) {\n\t\tthis.onTriggerListeners.add(listener)\n\t}\n\n\tremoveOnTriggerListener(listener: (triggerId: string) => void) {\n\t\tthis.onTriggerListeners.delete(listener)\n\t}\n\n\tsubscribe(triggerId: string, targetId: string, trigger: Trigger, callback?: () => void) {\n\t\tif (isEmptyTrigger(trigger)) return noop\n\n\t\tconst triggerEntry = this.triggers.get(triggerId) ?? {\n\t\t\tstatus: \"pending\",\n\t\t\ttargetId,\n\t\t\ttrigger,\n\t\t\tunsubscribeHandlers: new Set(),\n\t\t}\n\n\t\tif (triggerEntry.status === \"triggered\") return noop\n\n\t\ttriggerEntry.callback = callback\n\t\ttriggerEntry.status = \"pending\"\n\t\tthis.triggers.set(triggerId, triggerEntry)\n\n\t\tif (this.evaluate(triggerId)) {\n\t\t\tthis.invoke(triggerId)\n\t\t} else {\n\t\t\tthis.register(triggerId)\n\t\t}\n\n\t\treturn () => {\n\t\t\tthis.unsubscribe(triggerId)\n\t\t}\n\t}\n\n\tunsubscribe(triggerId: string) {\n\t\tconst triggerEntry = this.triggers.get(triggerId)\n\t\tif (!triggerEntry) return\n\t\tif (triggerEntry.status === \"triggered\") return\n\n\t\ttriggerEntry.callback = undefined\n\t\ttriggerEntry.status = \"inactive\"\n\n\t\tclearTimeout(this.delayTimeouts.get(triggerId))\n\t\tthis.delayTimeouts.delete(triggerId)\n\n\t\tfor (const unsubscribe of triggerEntry.unsubscribeHandlers) {\n\t\t\tunsubscribe()\n\t\t}\n\t}\n\n\tprivate on(\n\t\tevent: EmittableEventType,\n\t\tinitialize: (emit: EmitFunction) => undefined | VoidFunction,\n\t\ttriggerId: string,\n\t) {\n\t\tconst triggerEntry = this.triggers.get(triggerId)\n\t\tif (!triggerEntry || triggerEntry.status !== \"pending\") return\n\n\t\tconst handler = (eventPayload: EmittableEventPayload) => {\n\t\t\tif (triggerEntry?.status !== \"pending\") return\n\n\t\t\t// evaluate so it will trigger if this event is what is being waited on\n\t\t\tthis.evaluateAndInvoke(triggerId, eventPayload)\n\t\t}\n\n\t\tlet state = this.events.get(event)\n\t\tif (!state) {\n\t\t\tstate = {\n\t\t\t\thandlers: new Set(),\n\t\t\t\tcleanup: initialize(eventPayload => {\n\t\t\t\t\tthis.events.get(event)?.handlers?.forEach(triggerHandler => triggerHandler(eventPayload))\n\t\t\t\t}),\n\t\t\t}\n\t\t\tthis.events.set(event, state)\n\t\t}\n\t\tstate.handlers.add(handler)\n\n\t\ttriggerEntry.unsubscribeHandlers.add(() => {\n\t\t\tthis.off(event, handler)\n\t\t})\n\t}\n\n\tprivate off(event: EmittableEventType, handler: EmitFunction) {\n\t\tconst state = this.events.get(event)\n\t\tif (!state) return\n\n\t\tstate.handlers.delete(handler)\n\n\t\tif (state.handlers.size !== 0) return\n\n\t\tthis.events.delete(event)\n\t\tstate.cleanup?.()\n\t}\n\n\tonRouteChange = (currentPath: string) => {\n\t\tthis.visitedPages.add(currentPath)\n\t\tthis.lastRouteChangeAtMs = Date.now()\n\t\tthis.reevaluatePendingTriggers()\n\t}\n\n\treevaluatePendingTriggers() {\n\t\tfor (const [triggerId, triggerEntry] of this.triggers.entries()) {\n\t\t\tif (triggerEntry.status === \"pending\") {\n\t\t\t\tthis.evaluateAndInvoke(triggerId)\n\t\t\t}\n\t\t}\n\t}\n\n\tevaluate(triggerId: string, eventPayload?: EmittableEventPayload) {\n\t\tconst triggerEntry = this.triggers.get(triggerId)\n\t\tassert(triggerEntry, \"Trigger should be available in triggers map before evaluation\")\n\t\tif (triggerEntry?.status === \"triggered\") return true\n\t\tif (!this.evaluateStaticRules(triggerEntry)) return false\n\n\t\tconst firstCondition = triggerEntry.trigger.interactions[0]\n\t\t// With no conditions the trigger is true because the static rules are already evaluated\n\t\tif (!firstCondition) return true\n\n\t\tlet operator: \"and\" | \"or\" = firstCondition.operator\n\t\tlet result: boolean = this.evaluateCondition(firstCondition, eventPayload)\n\n\t\t// evaluate from left to right (rather than logical order)\n\t\tfor (let i = 1; i < triggerEntry.trigger.interactions.length; i++) {\n\t\t\tconst condition = triggerEntry.trigger.interactions[i]\n\t\t\tassert(condition, \"Condition should be available in conditions array\")\n\n\t\t\tconst evaluatedCondition = this.evaluateCondition(condition, eventPayload)\n\n\t\t\tresult = operator === \"or\" ? result || evaluatedCondition : result && evaluatedCondition\n\t\t\toperator = condition.operator\n\t\t}\n\n\t\treturn result\n\t}\n\n\tprivate evaluateCondition(condition: TriggerInteraction, eventPayload?: EmittableEventPayload): boolean {\n\t\tswitch (condition.type) {\n\t\t\tcase \"delay\": {\n\t\t\t\tconst initial = condition.delayType === \"site\" ? this.initializedAtMs : this.lastRouteChangeAtMs\n\t\t\t\treturn Date.now() - initial >= condition.delayMs\n\t\t\t}\n\t\t\tcase \"scrollPercentage\":\n\t\t\t\tthis.maxScrollPercentage = Math.max(this.maxScrollPercentage, getScrollPercentage())\n\t\t\t\treturn this.maxScrollPercentage >= condition.scrollPercentage\n\t\t\tcase \"exit\":\n\t\t\t\tif (eventPayload?.type !== \"exit\") return false\n\t\t\t\treturn condition.exitType === \"all\"\n\t\t\t\t\t? Boolean(eventPayload.exitType)\n\t\t\t\t\t: eventPayload.exitType === condition.exitType\n\t\t\tdefault:\n\t\t\t\tassertNever(condition)\n\t\t}\n\t}\n\n\tprivate evaluateStaticRules(triggerEntry: TriggerEntry): boolean {\n\t\tif (triggerEntry.trigger.cookies && !this.evaluateCookies(triggerEntry.trigger.cookies)) return false\n\t\tif (triggerEntry.trigger.urlParams && !this.evaluateUrlParams(triggerEntry.trigger.urlParams)) return false\n\t\tif (triggerEntry.trigger.pageCount && this.visitedPages.size < triggerEntry.trigger.pageCount) return false\n\t\tif (!this.evaluateRouteRules(triggerEntry.trigger.includeRoutes, triggerEntry.trigger.excludeRoutes)) return false\n\t\tif (triggerEntry.trigger.schedule && !this.evaluateScheduleRules(triggerEntry.trigger.schedule)) return false\n\t\tif (triggerEntry.trigger.eventHistory && !this.evaluateEventHistoryRules(triggerEntry.trigger.eventHistory)) {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\n\tprivate evaluateEventHistoryRules(eventHistory: Exclude<Trigger[\"eventHistory\"], undefined>): boolean {\n\t\tif (!eventHistory.length) return true\n\n\t\tfor (const rule of eventHistory) {\n\t\t\tconst seen = this.storage.hasSeenEvent(rule.eventType, rule.eventId, rule.withinMs)\n\t\t\tif (rule.ruleType === \"seen\" ? !seen : seen) return false\n\t\t}\n\n\t\treturn true\n\t}\n\n\tprivate evaluateCookies(cookies: Exclude<Trigger[\"cookies\"], undefined>): boolean {\n\t\tif (cookies.rules.length === 0) return true\n\t\tif (typeof window === \"undefined\" || !window.document) return false\n\n\t\tconst cookieStrings = (window.document.cookie ?? \"\")\n\t\t\t.split(\";\")\n\t\t\t.map(cookie => cookie.trim())\n\t\t\t.filter(Boolean)\n\n\t\tconst operatorFunction = cookies.operator === \"and\" ? \"every\" : \"some\"\n\n\t\treturn cookies.rules[operatorFunction](rule => {\n\t\t\tif (!rule.key) return false\n\t\t\tswitch (rule.type) {\n\t\t\t\tcase \"set\":\n\t\t\t\t\treturn cookieStrings.find(cookie => cookie.startsWith(`${rule.key}=`)) !== undefined\n\t\t\t\tcase \"not-set\":\n\t\t\t\t\treturn !cookieStrings.some(cookie => cookie.startsWith(`${rule.key}=`))\n\t\t\t\tcase \"equals\": {\n\t\t\t\t\tconst result = cookieRegex.exec(cookieStrings.find(cookie => cookie.startsWith(`${rule.key}=`)) ?? \"\")\n\t\t\t\t\treturn result?.groups?.value === rule.value\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate evaluateUrlParams(params: Exclude<Trigger[\"urlParams\"], undefined>): boolean {\n\t\tif (params.rules.length === 0) return true\n\t\tif (typeof window === \"undefined\" || !window.location) return false\n\n\t\tconst urlParams = new URLSearchParams(window.location.search ?? \"\")\n\n\t\tconst operatorFunction = params.operator === \"and\" ? \"every\" : \"some\"\n\n\t\treturn params.rules[operatorFunction](rule => {\n\t\t\tif (!rule.key) return false\n\t\t\tswitch (rule.type) {\n\t\t\t\tcase \"set\":\n\t\t\t\t\treturn urlParams.has(rule.key)\n\t\t\t\tcase \"not-set\":\n\t\t\t\t\treturn !urlParams.has(rule.key)\n\t\t\t\tcase \"equals\": {\n\t\t\t\t\tconst value = urlParams.get(rule.key)\n\t\t\t\t\treturn value === rule.value\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate evaluateRouteRules(includeRoutes: RouteRule[] | undefined, excludeRoutes: RouteRule[] | undefined): boolean {\n\t\tif (!includeRoutes?.length && !excludeRoutes?.length) return true\n\t\tconst currentPath = this.getCurrentRoutePath()\n\t\tif (!currentPath) return false\n\n\t\tfor (const routeRule of excludeRoutes ?? []) {\n\t\t\tif (!routeRule.route) continue\n\t\t\tconst targetPath = this.resolveRoute(routeRule.route)\n\t\t\tconst matches = routeRule.wildcard ? currentPath.startsWith(targetPath) : currentPath === targetPath\n\t\t\tif (matches) return false\n\t\t}\n\n\t\tfor (const routeRule of includeRoutes ?? []) {\n\t\t\tif (!routeRule.route) continue\n\t\t\tconst targetPath = this.resolveRoute(routeRule.route)\n\t\t\tconst matches = routeRule.wildcard ? currentPath.startsWith(targetPath) : currentPath === targetPath\n\t\t\tif (matches) return true\n\t\t}\n\n\t\t// if no include paths are specified, return true if no exclude paths matched\n\t\treturn !includeRoutes?.length\n\t}\n\n\tprivate evaluateScheduleRules(schedule: ScheduleRule | undefined): boolean {\n\t\tif (!schedule) return true\n\n\t\tconst now = new Date()\n\t\tif (schedule.startAt && new Date(`${schedule.startAt}${schedule.startAtOffset ?? \"\"}`) > now) return false\n\t\tif (schedule.endAt && new Date(`${schedule.endAt}${schedule.endAtOffset ?? \"\"}`) < now) return false\n\n\t\treturn true\n\t}\n\n\tevaluateAndInvoke(triggerId: string, eventPayload?: EmittableEventPayload) {\n\t\tif (this.evaluate(triggerId, eventPayload)) {\n\t\t\tthis.invoke(triggerId)\n\t\t}\n\t}\n\n\tinvoke(triggerId: string, options: { callCallback?: boolean } = { callCallback: true }) {\n\t\tconst triggerEntry = this.triggers.get(triggerId)\n\t\tif (!triggerEntry || triggerEntry.status !== \"pending\") return\n\n\t\ttriggerEntry.status = \"triggered\"\n\n\t\tfor (const listener of this.onTriggerListeners) {\n\t\t\tlistener(triggerId)\n\t\t}\n\n\t\tif (options.callCallback) {\n\t\t\ttriggerEntry.callback?.()\n\t\t\tthis.trackInvoke(triggerEntry)\n\t\t}\n\t}\n\n\tprivate trackInvoke(triggerEntry: TriggerEntry) {\n\t\tthis.storage.onTriggerInvoke(triggerEntry.targetId)\n\t\t// We delay the tracking event to ensure that the pageview data has had a chance to update if the trigger was\n\t\t// invoked immediately on route change or initial render\n\t\tsetTimeout(() => {\n\t\t\tthis.sendTrackingEvent({\n\t\t\t\ttrackingId: triggerEntry.trigger.trackingId,\n\t\t\t\tnodeId: parseTriggerTargetId(triggerEntry.targetId).nodeId ?? null,\n\t\t\t})\n\t\t}, 20)\n\t}\n\n\tprivate register(triggerId: string) {\n\t\tconst triggerEntry = this.triggers.get(triggerId)\n\t\tif (!triggerEntry || triggerEntry.status !== \"pending\") return\n\n\t\t// somehow schedule the next evaluation, each condition type will be different\n\t\tfor (const condition of triggerEntry.trigger.interactions) {\n\t\t\tswitch (condition.type) {\n\t\t\t\tcase \"delay\":\n\t\t\t\t\t{\n\t\t\t\t\t\tconst initial = condition.delayType === \"site\" ? this.initializedAtMs : this.lastRouteChangeAtMs\n\t\t\t\t\t\tclearTimeout(this.delayTimeouts.get(triggerId))\n\t\t\t\t\t\tthis.delayTimeouts.set(\n\t\t\t\t\t\t\ttriggerId,\n\t\t\t\t\t\t\tsetTimeout(\n\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\tthis.evaluateAndInvoke(triggerId)\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tinitial + condition.delayMs - Date.now(),\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\tbreak\n\t\t\t\tcase \"scrollPercentage\":\n\t\t\t\t\tthis.on(\"scrollPercentage\", initializeScrollPercentageListener, triggerId)\n\t\t\t\t\tbreak\n\t\t\t\tcase \"exit\":\n\t\t\t\t\tthis.on(\"exit\", initializeExitListener, triggerId)\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(condition)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction initializeExitListener(emit: EmitFunction) {\n\tif (typeof window === \"undefined\") return\n\n\tconst visibilityChangeHandler = () => {\n\t\tif (document.hidden) emit({ type: \"exit\", exitType: \"visibilitychange\" })\n\t}\n\twindow.document.addEventListener(\"visibilitychange\", visibilityChangeHandler)\n\tconst mouseLeaveHandler = () => emit({ type: \"exit\", exitType: \"mouseleave\" })\n\twindow.document.documentElement.addEventListener(\"mouseleave\", mouseLeaveHandler)\n\n\treturn () => {\n\t\twindow.document.removeEventListener(\"visibilitychange\", visibilityChangeHandler)\n\t\twindow.document.documentElement.removeEventListener(\"mouseleave\", mouseLeaveHandler)\n\t}\n}\n\nfunction initializeScrollPercentageListener(emit: EmitFunction) {\n\tif (typeof window === \"undefined\") return\n\tconst debouncedEmit = debounce(() => emit({ type: \"scrollPercentage\", scrollPercentage: getScrollPercentage() }), 100)\n\twindow.document.addEventListener(\"scroll\", debouncedEmit)\n\n\treturn () => {\n\t\twindow.document.removeEventListener(\"scroll\", debouncedEmit)\n\t}\n}\n\nfunction getScrollPercentage() {\n\tif (typeof window === \"undefined\" || !window.document) return 0\n\treturn (window.scrollY / (window.document.documentElement.scrollHeight - window.innerHeight)) * 100 || 0\n}\n\nconst interactionTitles: Record<TriggerInteraction[\"type\"], string> = {\n\tdelay: \"Time\",\n\tscrollPercentage: \"Scroll\",\n\texit: \"Exit\",\n}\n\nexport function getTriggerTitle(trigger: Trigger): string {\n\tif (trigger.interactions?.length > 0) {\n\t\treturn trigger.interactions.map(condition => interactionTitles[condition.type]).join(\", \")\n\t}\n\n\tconst param = trigger.urlParams?.rules?.[0]\n\tif (param?.key && param.type !== \"not-set\") {\n\t\treturn `?${param.type === \"equals\" ? `${param.key}=${param.value}` : param.key}`\n\t}\n\n\tconst cookie = trigger.cookies?.rules?.[0]\n\tif (cookie?.key && cookie.type !== \"not-set\") {\n\t\treturn cookie.type === \"equals\" ? `${cookie.key}=${cookie.value}` : cookie.key\n\t}\n\n\tif (trigger.pageCount) {\n\t\treturn trigger.pageCount === 1 ? \"1 page\" : `${trigger.pageCount} pages`\n\t}\n\n\treturn isEmptyTrigger(trigger) ? \"Empty\" : \"Condition\"\n}\n\nexport function isEmptyTrigger(trigger: Trigger): boolean {\n\treturn (\n\t\ttrigger.interactions.length === 0 &&\n\t\t!trigger.cookies?.rules.length &&\n\t\t!trigger.urlParams?.rules.length &&\n\t\t!trigger.pageCount &&\n\t\t!trigger.includeRoutes?.length &&\n\t\t!trigger.excludeRoutes?.length &&\n\t\t!trigger.schedule?.startAt &&\n\t\t!trigger.schedule?.endAt &&\n\t\t// a trigger is still empty if it only has a trigger_invoke event history rule\n\t\t!trigger.eventHistory?.some(rule => rule.eventType !== \"trigger_invoke\")\n\t)\n}\n\nconst targetIdActionSuffixes = {\n\tshowOverlay: \"ovl\",\n\tsetComponentVariant: \"cv\",\n} as const\n\nexport function getTriggerTargetId(nodeId: string, action: TriggerInvokeAction[\"type\"]) {\n\treturn [nodeId, targetIdActionSuffixes[action]].join(\"-\")\n}\n\nfunction parseTriggerTargetId(targetId: string) {\n\tconst [nodeId, actionSuffix] = targetId.split(\"-\")\n\treturn { nodeId, actionSuffix }\n}\n", "export const mainTagId = \"main\"\n\nexport const importMapDataAttr = \"data-framer-importmap\"\nexport const esModuleShimsDataAttr = \"data-framer-es-module-shims\"\n\nexport const bundleDataAttr = \"data-framer-bundle\"\nexport const mainBundleName = \"main\"\n\nexport const hydrateV2DataAttr = \"data-framer-hydrate-v2\"\nexport const hydrateV2DatasetKey = \"framerHydrateV2\"\n\nexport const generatedPageDataAttr = \"data-framer-generated-page\"\nexport const generatedPageDatasetKey = \"framerGeneratedPage\"\n\nexport const searchIndexMetaName = \"framer-search-index\"\nexport const searchIndexMetaSelector = `meta[name=\"${searchIndexMetaName}\"]`\n\nexport const searchIndexFallbackMetaName = \"framer-search-index-fallback\"\n\n// #region Custom HTML\nexport const startOfHeadStartMarker = \"<!-- Start of headStart -->\"\nexport const endOfHeadStartMarker = \"<!-- End of headStart -->\"\n\nexport const startOfHeadEndMarker = \"<!-- Start of headEnd -->\"\nexport const endOfHeadEndMarker = \"<!-- End of headEnd -->\"\n\nexport const startOfBodyStartMarker = \"<!-- Start of bodyStart -->\"\nexport const endOfBodyStartMarker = \"<!-- End of bodyStart -->\"\n\nexport const startOfBodyEndMarker = \"<!-- Start of bodyEnd -->\"\nexport const endOfBodyEndMarker = \"<!-- End of bodyEnd -->\"\n// #endregion\n", "import type { CustomCodePlacement } from \"@framerjs/shared/src/custom-code/types.ts\"\nimport { generatedPageDatasetKey, mainTagId } from \"@framerjs/shared/src/ssg/constants.ts\"\nimport { useCallback } from \"react\"\nimport type { Locale } from \"../../router/types.ts\"\nimport { useSnippets } from \"./context.tsx\"\nimport { loadSnippets } from \"./loadSnippets.ts\"\n\nexport function useLoadSnippets() {\n\tconst loadSnippetsModule = useSnippets()\n\n\treturn useCallback(\n\t\tasync (\n\t\t\tpageId: string,\n\t\t\tpathVariables: Record<string, unknown>,\n\t\t\tactiveLocale: Locale | null,\n\t\t\tisInitialNavigation: boolean,\n\t\t) => {\n\t\t\t// If we don't have a snippets module loader, there's nothing to do\n\t\t\tif (!loadSnippetsModule) return\n\n\t\t\tconst mainTag = document.getElementById(mainTagId)\n\t\t\tconst isGeneratedPage = mainTag && mainTag.dataset[generatedPageDatasetKey] !== undefined\n\n\t\t\t// In this case, the snippets were already loaded via SSG\n\t\t\tif (isInitialNavigation && isGeneratedPage) return\n\n\t\t\tconst { getSnippets, snippetsSorting } = await loadSnippetsModule.readMaybeAsync()\n\n\t\t\tconst snippets = await getSnippets(pageId, pathVariables, activeLocale)\n\n\t\t\tfor (const key in snippets) {\n\t\t\t\tconst placement = key as CustomCodePlacement\n\t\t\t\tconst snippetsForPlacement = snippets[placement]\n\t\t\t\tconst sorting = snippetsSorting[placement]\n\n\t\t\t\tawait loadSnippets(placement, snippetsForPlacement, sorting)\n\t\t\t}\n\t\t},\n\t\t[loadSnippetsModule],\n\t)\n}\n", "import type { SnippetsModule } from \"@framerjs/shared/src/custom-code/types.ts\"\nimport React from \"react\"\nimport type { LazyValue } from \"../LazyValue.ts\"\n\nconst SnippetsContext = /* @__PURE__ */ (() => React.createContext<LazyValue<SnippetsModule> | undefined>(undefined))()\n\nexport function SnippetsProvider({\n\tchildren,\n\tloadSnippetsModule,\n}: {\n\tchildren: React.ReactNode\n\tloadSnippetsModule?: LazyValue<SnippetsModule>\n}) {\n\treturn <SnippetsContext.Provider value={loadSnippetsModule}>{children}</SnippetsContext.Provider>\n}\n\nexport function useSnippets() {\n\treturn React.useContext(SnippetsContext)\n}\n", "export function getSnippetMarkers(id: string) {\n\treturn {\n\t\tstart: `<!-- Snippet: ${id} -->`,\n\t\tend: `<!-- SnippetEnd: ${id} -->`,\n\t}\n}\n", "import { assert, assertNever } from \"./assert.ts\"\n\ntype Position = \"beforebegin\" | \"afterbegin\" | \"beforeend\" | \"afterend\"\n\n/**\n * Inserts `html` into the document relative to `referenceNode`.\n *\n * Will block parsing on sync scripts, mimicking the browser's parser.\n */\nexport async function insertHTML(html: string, referenceNode: Node, position: Position = \"beforeend\") {\n\tlet insertionParent: Node, insertionPoint: Node | null\n\tswitch (position) {\n\t\tcase \"beforebegin\":\n\t\t\tassert(referenceNode.parentNode, \"Can't use 'beforebegin' with a referenceNode at the top level\")\n\t\t\tinsertionParent = referenceNode.parentNode\n\t\t\tinsertionPoint = referenceNode\n\t\t\tbreak\n\t\tcase \"afterend\":\n\t\t\tassert(referenceNode.parentNode, \"Can't use 'afterend' with a referenceNode at the top level\")\n\t\t\tinsertionParent = referenceNode.parentNode\n\t\t\tinsertionPoint = referenceNode.nextSibling\n\t\t\tbreak\n\t\tcase \"afterbegin\":\n\t\t\tinsertionParent = referenceNode\n\t\t\tinsertionPoint = referenceNode.firstChild\n\t\t\tbreak\n\t\tcase \"beforeend\":\n\t\t\tinsertionParent = referenceNode\n\t\t\tinsertionPoint = null // append\n\t\t\tbreak\n\t\tdefault:\n\t\t\tassertNever(position)\n\t}\n\n\tconst range = document.createRange()\n\trange.selectNodeContents(insertionParent) // sets the parser context to e.g. <head>\n\tconst fragment = range.createContextualFragment(html)\n\n\t// Another way to do it, if `createContextualFragment` ever causes issues:\n\t//\n\t//     const template = document.createElement(\"template\")\n\t//     template.innerHTML = html\n\t//     // use `template.content` instead of `fragment`\n\t//\n\t// Keep in mind:\n\t//\n\t// - Template parses the HTML as-is, whereas createContextualFragment will e.g. automatically wrap <tr> in <tbody>,\n\t//   etc., like the browser would when parsing the initial document. We're trying to mimic the latter, so we prefer\n\t//   createContextualFragment.\n\t//\n\t// - Template seems to mark scripts as \"already started\", so cloning and inserting them into the actual document\n\t//   won't run them. So if you need to switch to template, you'll also need to adjust handleScript below to instead\n\t//   create a fresh script element and manually copy its attributes and content.\n\n\t// Depth-first stream of `fragment` into the real DOM.\n\tawait pump(fragment, insertionParent, insertionPoint)\n}\n\nasync function pump(sourceNode: Node, targetParent: Node, beforeNode: Node | null) {\n\tfor (let node = sourceNode.firstChild; node; node = node.nextSibling) {\n\t\tif (node instanceof HTMLScriptElement) {\n\t\t\tconst needsWait = handleScript(node, targetParent, beforeNode)\n\t\t\tif (needsWait !== undefined) {\n\t\t\t\t// In case `needsWait` is undefined, we can skip a microtick.\n\t\t\t\tawait needsWait\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tconst clone = node.cloneNode(false) // shallow copy\n\t\ttargetParent.insertBefore(clone, beforeNode)\n\n\t\tif (node.firstChild) {\n\t\t\t// Recurse into children, keeping them *inside* the freshly-cloned node.\n\t\t\tawait pump(node, clone, null)\n\t\t}\n\t}\n}\n\nfunction handleScript(node: HTMLScriptElement, parent: Node, beforeNode: Node | null) {\n\t// FIXME: JSDOM doesn't execute scripts if not cloned. In browsers, scripts created by `createContextualFragment`\n\t// just work correctly.\n\tconst script = node.cloneNode(true) as HTMLScriptElement\n\n\t// This doesn't work *exactly* like the spec to keep things simple, but it should be close enough.\n\t// For example, we don't check the type \"classic\", or we honor defer/async even on inline scripts, etc.\n\t// See https://html.spec.whatwg.org/multipage/scripting.html#prepare-the-script-element, points 32-34.\n\tif (\n\t\t!node.hasAttribute(\"src\") || // external\n\t\tnode.hasAttribute(\"async\") || // async\n\t\tnode.hasAttribute(\"defer\") || // defer\n\t\tnode.getAttribute(\"type\")?.toLowerCase() === \"module\" // module\n\t) {\n\t\t// Browser should take care of putting async/defer/module scripts in the correct queue, e.g.\n\t\t// - async goes to https://html.spec.whatwg.org/multipage/scripting.html#set-of-scripts-that-will-execute-as-soon-as-possible\n\t\t// - defer goes to https://html.spec.whatwg.org/multipage/scripting.html#list-of-scripts-that-will-execute-in-order-as-soon-as-possible\n\t\t// Noteworthy here is, inline deferred (non-async) module scripts won't synchronously\n\t\t// execute, but they will still execute in-order. This is likely not a problem, as\n\t\t// `<script type=\"module\">console.log(\"foo\")</script><script>console.log(\"bar\")</script>`\n\t\t// logs \"bar\" and \"foo\" in that order when loading the page (= the order of execution is expected).\n\t\t//\n\t\t// Additionally, this implementation slightly differs in how `defer` and `DOMContentLoaded`\n\t\t// usually interact. The reason is, `insertHTML` is most likely to be used after DOMContentLoaded\n\t\t// has run as it depends on hydration. When comparing the browser behavior\n\t\t// (https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) and\n\t\t// our implementation, we have the following differences:\n\t\t// - Deferred scripts will *not* wait for stylesheets to be loaded, and *neither* block the\n\t\t//   DOMContentLoaded event, *nor* execute before right before it.\n\t\t// - Scripts which aren't deferred or async (e.g., <script>) will *not* wait for\n\t\t//   already-parsed stylesheets to load.\n\t\tparent.insertBefore(script, beforeNode)\n\t} else {\n\t\treturn execExternalBlockingScript(script, parent, beforeNode)\n\t}\n}\n\nfunction execExternalBlockingScript(script: HTMLScriptElement, parent: Node, beforeNode: Node | null) {\n\treturn new Promise<Event | OnErrorEventHandler | string>(resolve => {\n\t\t// Errors should not stop us. The browser should log its own error.\n\t\tscript.onload = script.onerror = resolve\n\t\tparent.insertBefore(script, beforeNode)\n\t})\n}\n", "import { getSnippetMarkers } from \"@framerjs/shared/src/custom-code/markers.ts\"\nimport type { CustomCodePlacement } from \"@framerjs/shared/src/custom-code/types.ts\"\nimport {\n\tendOfBodyEndMarker,\n\tendOfBodyStartMarker,\n\tendOfHeadEndMarker,\n\tendOfHeadStartMarker,\n\tstartOfBodyEndMarker,\n\tstartOfBodyStartMarker,\n\tstartOfHeadEndMarker,\n\tstartOfHeadStartMarker,\n} from \"@framerjs/shared/src/ssg/constants.ts\"\n\ninterface CommentMarker {\n\tstart: ChildNode | null\n\tend: ChildNode | null\n}\n\nexport function findMarkers(placement: CustomCodePlacement): CommentMarker {\n\tlet startMarker: string\n\tlet endMarker: string\n\n\tswitch (placement) {\n\t\tcase \"bodyStart\":\n\t\t\tstartMarker = startOfBodyStartMarker\n\t\t\tendMarker = endOfBodyStartMarker\n\t\t\tbreak\n\t\tcase \"bodyEnd\":\n\t\t\tstartMarker = startOfBodyEndMarker\n\t\t\tendMarker = endOfBodyEndMarker\n\t\t\tbreak\n\t\tcase \"headStart\":\n\t\t\tstartMarker = startOfHeadStartMarker\n\t\t\tendMarker = endOfHeadStartMarker\n\t\t\tbreak\n\t\tcase \"headEnd\":\n\t\t\tstartMarker = startOfHeadEndMarker\n\t\t\tendMarker = endOfHeadEndMarker\n\t\t\tbreak\n\t}\n\n\tconst element = placement === \"bodyStart\" || placement === \"bodyEnd\" ? document.body : document.head\n\tlet start: ChildNode | null = null\n\tlet end: ChildNode | null = null\n\n\tfor (const node of element.childNodes) {\n\t\tif (node.nodeType !== Node.COMMENT_NODE) {\n\t\t\tcontinue\n\t\t}\n\n\t\tconst comment = `<!--${node.nodeValue}-->`\n\t\tif (comment === startMarker) {\n\t\t\tstart = node\n\t\t} else if (comment === endMarker) {\n\t\t\tend = node\n\t\t}\n\t}\n\n\treturn { start, end }\n}\n\nexport function findSnippetMarkerNodes(\n\tsnippetId: string,\n\tstartMarker: ChildNode | null,\n\tendMarker: ChildNode | null,\n): CommentMarker {\n\tif (!startMarker || !endMarker) {\n\t\treturn { start: null, end: null }\n\t}\n\n\tlet start: ChildNode | null = null\n\tlet end: ChildNode | null = null\n\n\tconst { start: startComment, end: endComment } = getSnippetMarkers(snippetId)\n\n\tlet node: ChildNode | null = startMarker.nextSibling\n\twhile (node && node !== endMarker) {\n\t\tif (node.nodeType !== Node.COMMENT_NODE) {\n\t\t\tnode = node.nextSibling\n\t\t\tcontinue\n\t\t}\n\n\t\tconst comment = `<!--${node.nodeValue}-->`\n\t\tif (comment === startComment) {\n\t\t\tstart = node\n\t\t} else if (comment === endComment) {\n\t\t\tend = node\n\t\t\tbreak\n\t\t}\n\n\t\tnode = node.nextSibling\n\t}\n\n\treturn { start, end }\n}\n", "import { getSnippetMarkers } from \"@framerjs/shared/src/custom-code/markers.ts\"\nimport type { CustomCodePlacement, Snippet } from \"@framerjs/shared/src/custom-code/types.ts\"\nimport { insertHTML } from \"../../utils/insertHTML.ts\"\nimport { findMarkers, findSnippetMarkerNodes } from \"./markers.ts\"\n\nexport async function loadSnippets(placement: CustomCodePlacement, snippets: Snippet[], sorting: string[]) {\n\tif (snippets.length === 0) return\n\n\tconst { start, end } = findMarkers(placement)\n\tconst placementParent = placement === \"bodyStart\" || placement === \"bodyEnd\" ? document.body : document.head\n\n\tfor (const snippet of snippets) {\n\t\tconst { start: startSnippetMarker, end: endSnippetMarker } = findSnippetMarkerNodes(snippet.id, start, end)\n\t\tconst isLoaded = startSnippetMarker && endSnippetMarker\n\t\tif (isLoaded && snippet.loadMode === \"once\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tremoveSnippetElements(startSnippetMarker, endSnippetMarker)\n\n\t\t// If it's already loaded, insert the snippet content right before its end marker\n\t\tif (isLoaded) {\n\t\t\tawait insertHTML(snippet.code, endSnippetMarker, \"beforebegin\")\n\t\t\tcontinue\n\t\t}\n\n\t\tconst { start: codeStart, end: codeEnd } = getSnippetMarkers(snippet.id)\n\t\tconst code = `${codeStart}\\n${snippet.code}\\n${codeEnd}`\n\n\t\tconst insertReference = findInsertReferece(snippet.id, sorting, start, end)\n\t\tif (insertReference) {\n\t\t\tawait insertHTML(code, insertReference, \"afterend\")\n\t\t} else {\n\t\t\t// If we haven't found the snippet that should be before the current one\n\t\t\t// we insert it at the beginning of its placement marker, with a fallback to the beginning of its parent element\n\t\t\tconst node = start ?? placementParent\n\n\t\t\t// afterend in case we have a comment marker, so we insert after the comment\n\t\t\t// beforeend so that we insert inside the parent, not after and outside of it\n\t\t\tconst position = start ? \"afterend\" : \"beforeend\"\n\n\t\t\tawait insertHTML(code, node, position)\n\t\t}\n\t}\n}\n\nfunction removeSnippetElements(start: ChildNode | null, end: ChildNode | null) {\n\tif (!start || !end) return\n\n\tlet node: ChildNode | null | undefined = start.nextSibling\n\twhile (node && node !== end) {\n\t\tconst nextNode: ChildNode | null | undefined = node.nextSibling\n\t\tif (isRemovableNode(node)) {\n\t\t\tnode.remove()\n\t\t}\n\n\t\tnode = nextNode\n\t}\n}\n\nfunction isRemovableNode(node: ChildNode) {\n\tif (node.nodeType !== Node.ELEMENT_NODE) return true\n\n\tif (node.nodeName === \"SCRIPT\") {\n\t\tconst script = node as HTMLScriptElement\n\t\tconst type = script.type\n\n\t\t// In short, we want to\n\t\t// Keep:\n\t\t//  <script></script>\n\t\t//  <script src>\n\t\t//  <script type=\"application/javascript\">\n\t\t//  <script type=\"module\">\n\t\t// Remove:\n\t\t//  <script type=\"application/ld+json\">\n\t\t//  <script type=\"foo\">\n\t\tif (!type || type === \"text/javascript\" || type === \"module\") return false\n\t}\n\n\treturn true\n}\n\n/**\n * Searches the first reference point in the document for the given snippet id.\n *\n * This is necessary as there might be snippets that aren't loaded yet, but they are the previous items in the sorting array.\n */\nfunction findInsertReferece(snippetId: string, sorting: string[], start: ChildNode | null, end: ChildNode | null) {\n\tconst startIndex = sorting.indexOf(snippetId) - 1\n\tif (startIndex < 0) return null\n\n\tfor (let i = startIndex; i >= 0; i--) {\n\t\tconst item = sorting[i]\n\t\tif (!item) continue\n\n\t\tconst reference = findSnippetMarkerNodes(item, start, end).end\n\t\tif (reference) return reference\n\t}\n\n\treturn null\n}\n", "interface PageDescriptor {\n\trouteId: string\n\tpathVariables?: Record<string, unknown>\n}\n\nexport function isSamePage(a: PageDescriptor, b: PageDescriptor): boolean {\n\tif (a.routeId !== b.routeId) return false\n\tif (a.pathVariables === b.pathVariables) return true\n\n\tconst aPathVariables = a.pathVariables || {}\n\tconst bPathVariables = b.pathVariables || {}\n\treturn (\n\t\taPathVariables.length === bPathVariables.length &&\n\t\tObject.keys(aPathVariables).every(key => aPathVariables[key] === bPathVariables[key])\n\t)\n}\n", "import { useContext, useEffect, useRef } from \"react\"\nimport { useCollectionUtils } from \"../modules/cms/CollectionUtilsCache.tsx\"\nimport { FormContext } from \"../render/presentation/Forms/FormContainer.tsx\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport type { PageviewEventData } from \"../utils/sendTrackingEvent.ts\"\nimport { pageviewEventVersion, sendTrackingEvent } from \"../utils/sendTrackingEvent.ts\"\nimport { isPromise, isString, requestIdleCallback } from \"../utils/utils.ts\"\nimport type { Locale, Route, RouteId } from \"./types.ts\"\n\nlet timezone: string | null = null\nlet visitorLocale: string | null = null\n\nfunction setTimezoneAndLocaleForTracking() {\n\tconst resolvedDateTimeOptions = Intl.DateTimeFormat().resolvedOptions()\n\ttimezone = resolvedDateTimeOptions.timeZone\n\tvisitorLocale = resolvedDateTimeOptions.locale\n}\n// Lazily initialize timezone and locale as `Intl.(...).resolvedOptions()` can be slow at times.\n// `sendTrackingEvent` is in an INP hotpath, so lazily reading it before a user clicks speeds it up.\nrequestIdleCallback(setTimezoneAndLocaleForTracking)\n\nexport const useSendPageView = (\n\tcurrentRoute: Route | undefined,\n\tcurrentRouteId: RouteId,\n\tcurrentPathnameWithHash: string | undefined,\n\tcurrentPathVariables: Record<string, unknown> | undefined,\n\tactiveLocale: Locale | null,\n\tinitialCollectionItemId?: string | null,\n) => {\n\tconst framerSiteId = useContext(FormContext)\n\tconst pageviewEventData = useRef<Promise<PageviewEventData> | PageviewEventData>()\n\tconst collectionUtils = useCollectionUtils()\n\n\t// Used to prevent sending pageview events for the first route\n\t// as the first pageview event is sent from the script generated by `exportToHTML.ts`\n\tconst skipFirstPageView = useRef(true)\n\n\tuseEffect(() => {\n\t\tfunction getFullPageviewEventData(): Promise<PageviewEventData> | PageviewEventData {\n\t\t\tif (!timezone || !visitorLocale) setTimezoneAndLocaleForTracking()\n\n\t\t\t// The current pathname is set when the current route changes.\n\t\t\t// For the initial route, we use the window location.\n\t\t\tconst currentLocation = currentPathnameWithHash\n\t\t\t\t? new URL(safeWindow.location.origin + currentPathnameWithHash)\n\t\t\t\t: safeWindow.location\n\n\t\t\tconst eventData: PageviewEventData = {\n\t\t\t\tversion: pageviewEventVersion,\n\t\t\t\tabTestId: currentRoute?.abTestId,\n\t\t\t\tframerSiteId: framerSiteId ?? null,\n\t\t\t\t// If we are in a variant route, let's use the variant ID as the route ID instead, so that the analytics panel will be able to show the correct tracking data.\n\t\t\t\twebPageId: currentRoute?.abTestingVariantId ?? currentRouteId,\n\t\t\t\troutePath: currentRoute?.path || \"/\",\n\t\t\t\tcollectionItemId: null,\n\t\t\t\tframerLocale: activeLocale?.code || null,\n\t\t\t\treferrer: null, // The first pageview event will always be sent before hydration, in a script in `exportToHTML.ts`.\n\t\t\t\turl: currentLocation.href,\n\t\t\t\thostname: currentLocation.hostname,\n\t\t\t\t// Capture the current location before the user moves to a new page to prevent\n\t\t\t\t// tracking wrong pathnames due to a race condition caused by async operations\n\t\t\t\t// when resolving the collection item ID below\n\t\t\t\tpathname: currentLocation.pathname,\n\t\t\t\tsearch: currentLocation.search || null,\n\t\t\t\thash: currentLocation.hash || null,\n\t\t\t\ttimezone,\n\t\t\t\tlocale: visitorLocale,\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * If the collectionItemId is not provided in the hydration data\n\t\t\t * (undefined), we load the id below.\n\t\t\t * Otherwise, `null` means we don't have a collectionItemId, because this is not a CMS page.\n\t\t\t */\n\t\t\tconst hydratedCollectionItemId =\n\t\t\t\tskipFirstPageView.current && initialCollectionItemId !== undefined ? initialCollectionItemId : undefined\n\t\t\treturn currentRoute?.collectionId && currentPathVariables\n\t\t\t\t? (async () => {\n\t\t\t\t\t\tlet collectionItemId: string | null = hydratedCollectionItemId ?? null\n\t\t\t\t\t\tif (hydratedCollectionItemId === undefined) {\n\t\t\t\t\t\t\tconst utils = currentRoute.collectionId && collectionUtils?.get(currentRoute.collectionId)\n\t\t\t\t\t\t\tconst [slug] = Object.values(currentPathVariables)\n\t\t\t\t\t\t\tif (utils && isString(slug)) {\n\t\t\t\t\t\t\t\tconst maybeCollectionItemId = utils.getRecordIdBySlug(slug, activeLocale || undefined)\n\t\t\t\t\t\t\t\tconst _collectionItemId = isPromise(maybeCollectionItemId)\n\t\t\t\t\t\t\t\t\t? await maybeCollectionItemId\n\t\t\t\t\t\t\t\t\t: maybeCollectionItemId\n\t\t\t\t\t\t\t\tcollectionItemId = _collectionItemId ?? null\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn { ...eventData, collectionItemId }\n\t\t\t\t\t})()\n\t\t\t\t: eventData\n\t\t}\n\n\t\tvoid (async () => {\n\t\t\t// Assign the pageview event data even when not sending the event as we return the ref below, which is used elsewhere in the codebase.\n\t\t\tconst eventDataOrPromise = (pageviewEventData.current = getFullPageviewEventData())\n\t\t\tconst eventData = eventDataOrPromise instanceof Promise ? await eventDataOrPromise : eventDataOrPromise\n\t\t\t// Capture the resolved pageview event data, so that we don't need to await it again when sending tracking events.\n\t\t\tpageviewEventData.current = eventData\n\n\t\t\t// Prevent sending pageview events for the first route as this first pageview event is sent from the script generated by `exportToHTML.ts`\n\t\t\tif (skipFirstPageView.current) {\n\t\t\t\tskipFirstPageView.current = false\n\t\t\t} else {\n\t\t\t\tsendTrackingEvent(\"published_site_pageview\", eventData, \"eager\")\n\t\t\t}\n\t\t})()\n\n\t\tconst listener = async (event: PageTransitionEvent) => {\n\t\t\t// Send another pageview if the page is restored from bfcache.\n\t\t\t// https://web.dev/articles/bfcache#analytics\n\t\t\tif (event.persisted) {\n\t\t\t\t// Assign the pageview event data even when not sending the event as we return the ref below, which is used elsewhere in the codebase.\n\t\t\t\tconst eventDataOrPromise = (pageviewEventData.current = getFullPageviewEventData())\n\t\t\t\tconst eventData = eventDataOrPromise instanceof Promise ? await eventDataOrPromise : eventDataOrPromise\n\t\t\t\t// Capture the resolved pageview event data so that we don't need to await it again when sending tracking events.\n\t\t\t\tpageviewEventData.current = eventData\n\t\t\t\tsendTrackingEvent(\"published_site_pageview\", eventData, \"eager\")\n\t\t\t}\n\t\t}\n\n\t\twindow.addEventListener(\"pageshow\", listener)\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"pageshow\", listener)\n\t\t}\n\t}, [\n\t\tcurrentRoute,\n\t\tcurrentRouteId,\n\t\tcurrentPathnameWithHash,\n\t\tcurrentPathVariables,\n\t\tactiveLocale,\n\t\tframerSiteId,\n\t\tcollectionUtils,\n\t\tinitialCollectionItemId,\n\t])\n\n\treturn pageviewEventData\n}\n", "import React from \"react\"\n\nexport function useForceUpdate() {\n\tconst [_, setForcedRenderCount] = React.useState(0)\n\n\t// useForceUpdate is linted separately by the lint rult\n\t// eslint-disable-next-line framer-studio/no-setstate-without-transition\n\treturn [_, React.useCallback(() => setForcedRenderCount(v => v + 1), [])] as const\n}\n", "import { isBrowser } from \"@framerjs/shared/src/environment.ts\"\nimport type { PropsWithChildren } from \"react\"\nimport * as React from \"react\"\nimport { ControlType } from \"../render/types/PropertyControls.ts\"\nimport { RenderTarget } from \"../render/types/RenderEnvironment.ts\"\nimport { debounce } from \"../render/utils/debounce.ts\"\nimport { isEqual } from \"../render/utils/isEqual.ts\"\nimport { preloadImage } from \"../render/utils/preloadImage.ts\"\nimport { getPropertyByPath } from \"../utils/getPropertyByPath.ts\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport { useMemoOne } from \"../utils/useMemoOne.ts\"\nimport { isBoolean, isNumber, isString, isUndefined } from \"../utils/utils.ts\"\nimport { isValidURL } from \"./Link/urlChecks.tsx\"\n\nexport type FetchResult =\n\t| {\n\t\t\tstatus: \"loading\"\n\t\t\tdata: undefined\n\t  }\n\t| {\n\t\t\tstatus: \"success\"\n\t\t\tdata: unknown\n\t  }\n\t| {\n\t\t\tstatus: \"error\"\n\t\t\terror: unknown\n\t\t\tdata: undefined\n\t  }\n\n// A request can consist of a URL + some options such as credentials (and potentially more in the future such as headers)\n// A combination of these options is used to create a cache key\ntype RequestCacheKey = string\n\nexport function getRequestCacheKey(value: Pick<FetchRequestConfig, \"url\" | \"credentials\">) {\n\treturn `${value.credentials}:${value.url}`\n}\n\n/**\n * This configuration object is serialized during Codegen in\n * `serializeFetchData.ts` It is important that they stay in sync\n */\nexport interface FetchRequestConfig {\n\turl: string\n\tcacheDuration: number\n\tfallbackValue: unknown\n\terrorFallbackValue?: unknown\n\tresultKeyPath: string\n\tresultOutputType:\n\t\t| ControlType.String\n\t\t| ControlType.Boolean\n\t\t| ControlType.Number\n\t\t| ControlType.Image\n\t\t| ControlType.Link\n\t\t| ControlType.Color\n\tcredentials?: RequestCredentials\n}\n\nconst loadingFetchResult: FetchResult = {\n\tstatus: \"loading\",\n\tdata: undefined,\n}\n\nfunction isNumberString(value: unknown) {\n\treturn isString(value) && !Number.isNaN(Number(value))\n}\n\nexport function isValidFetchDataValueResult(type: FetchRequestConfig[\"resultOutputType\"], value: unknown) {\n\tswitch (type) {\n\t\tcase ControlType.String:\n\t\t\treturn isString(value) || isNumber(value)\n\t\tcase ControlType.Color:\n\t\t\treturn isString(value)\n\t\tcase ControlType.Boolean:\n\t\t\treturn isBoolean(value)\n\t\tcase ControlType.Number:\n\t\t\treturn isNumber(value) || isNumberString(value)\n\t\tcase ControlType.Link:\n\t\tcase ControlType.Image:\n\t\t\treturn isString(value) && isValidURL(value, false)\n\t\tdefault: {\n\t\t\tconst _: never = type\n\t\t\treturn false\n\t\t}\n\t}\n}\n\n/** @internal */\nexport function resolveFetchDataValue(\n\tresult: FetchResult,\n\trequest: Pick<FetchRequestConfig, \"resultOutputType\" | \"resultKeyPath\" | \"fallbackValue\">,\n): unknown {\n\tif (result.status === \"loading\") {\n\t\treturn request.fallbackValue\n\t}\n\n\tif (result.status === \"error\") {\n\t\tthrow result.error\n\t}\n\n\tconst resolvedValue = getPropertyByPath(result.data, request.resultKeyPath)\n\n\tif (isUndefined(resolvedValue)) {\n\t\tthrow new Error(`Key '${request.resultKeyPath}' not found in response`)\n\t}\n\n\tif (!isValidFetchDataValueResult(request.resultOutputType, resolvedValue)) {\n\t\tthrow new Error(`Resolved value '${resolvedValue}' is not valid for type '${request.resultOutputType}'`)\n\t}\n\n\treturn resolvedValue\n}\n\ntype CacheEntry = [storedAt: number, cacheDuration: number, data: unknown]\n\n// Fetch requests are cached and keyed by their URL. We cache for a minimum duration to avoid\n// refetching data to the same endpoint for the scenarios where:\n// - Hydration kicks off fetches staggered over time\n// - \"Waterfall\" fetches where a Fetch to the same endpoint is only rendered after a previous fetch\n//   succeeded.\n//\n// We also can't just cache indefinitely because we want fresh data when the user navigates to a new\n// page or opens an overlay on the same route. So we cache for a minimum duration to avoid\n// refetching the same data in the typical \"user loads a page\" scenario\nconst minimumCacheDurationMs = 5000\n\nfunction isCacheExpired(insertionTimestamp: number, cacheDuration: number): boolean {\n\tif (RenderTarget.current() === RenderTarget.canvas) {\n\t\t// On the Canvas we only fetch once per session to keep canvas nodes and components in sync.\n\t\treturn false\n\t}\n\n\tconst cacheDurationMs = Math.max(cacheDuration * 1000, minimumCacheDurationMs)\n\tconst currentTimestamp = Date.now()\n\tconst expirationTimestamp = insertionTimestamp + cacheDurationMs\n\treturn currentTimestamp >= expirationTimestamp\n}\n\nconst noop = /** @__PURE__ */ () => {}\n\nexport class FetchClient {\n\tstatic cacheKey = \"framer-fetch-client-cache\"\n\n\t// A map of FetchResult values for each URL\n\tresponseValues: Map<RequestCacheKey, FetchResult> = new Map()\n\n\t// A map of URLs to their subscribers\n\t#subscribers: Map<RequestCacheKey, Set<VoidFunction>> = new Map()\n\n\t// A set of requests that have been preloaded by a loading variant\n\t#preloadedRequests: Set<RequestCacheKey> = new Set()\n\n\t// Map for how long to cache the response for (in seconds)\n\t#shortestCacheDurations: Map<RequestCacheKey, number> = new Map()\n\n\t// Map containing a timestamp when a URL was inserted into the cache\n\t#cachedAt: Map<RequestCacheKey, number> = new Map()\n\n\t// Map of promises for requests that are currently in flight\n\t#ongoingFetches: Map<RequestCacheKey, Promise<void>> = new Map()\n\n\t// An ID for an interval that checks for stale queries and refetches\n\t#staleQueriesInterval: Map<RequestCacheKey, number> = new Map()\n\n\tunmount() {\n\t\tfor (const [key, interval] of this.#staleQueriesInterval) {\n\t\t\tclearInterval(interval)\n\t\t\tthis.#staleQueriesInterval.delete(key)\n\t\t}\n\t}\n\n\tprivate stopQueryRefetching(request: FetchRequestConfig) {\n\t\tconst cacheKey = getRequestCacheKey(request)\n\t\tconst interval = this.#staleQueriesInterval.get(cacheKey)\n\n\t\tif (interval) {\n\t\t\tclearInterval(interval)\n\t\t\tthis.#staleQueriesInterval.delete(cacheKey)\n\t\t}\n\t}\n\n\t/**\n\t * Start an interval for the given request to refresh the value\n\t * depending on the shortest configured cache duration for that request.\n\t */\n\tprivate startQueryRefetching(request: FetchRequestConfig) {\n\t\tconst cacheKey = getRequestCacheKey(request)\n\n\t\tconst currentIntervalForRequest = this.#staleQueriesInterval.get(cacheKey)\n\t\tconst shortestCacheDuration = this.#shortestCacheDurations.get(cacheKey)\n\n\t\tif (currentIntervalForRequest) return\n\t\tif (!shortestCacheDuration) return\n\n\t\tconst interval = safeWindow.setInterval(() => {\n\t\t\tif (document.visibilityState === \"hidden\") return\n\n\t\t\tconst cachedAt = this.#cachedAt.get(cacheKey)\n\n\t\t\tif (!shortestCacheDuration || !cachedAt) return\n\n\t\t\tvoid this.fetchWithCache({\n\t\t\t\t...request,\n\t\t\t\tcacheDuration: shortestCacheDuration,\n\t\t\t})\n\t\t}, shortestCacheDuration)\n\n\t\tthis.#staleQueriesInterval.set(cacheKey, interval)\n\t}\n\n\thydrateCache() {\n\t\ttry {\n\t\t\tconst rawData = localStorage.getItem(FetchClient.cacheKey)\n\t\t\tif (!rawData) return\n\n\t\t\tconst data = JSON.parse(rawData)\n\t\t\tif (typeof data !== \"object\") throw new Error(\"Invalid cache data\")\n\n\t\t\tfor (const cacheKey in data) {\n\t\t\t\tconst cached = data[cacheKey]\n\t\t\t\tif (!Array.isArray(cached) || cached.length !== 3) throw new Error(\"Invalid cache data\")\n\n\t\t\t\tconst [storedAt, cacheDuration, cachedData] = cached\n\t\t\t\tif (isCacheExpired(storedAt, cacheDuration)) continue\n\n\t\t\t\tthis.#cachedAt.set(cacheKey, storedAt)\n\t\t\t\tthis.#shortestCacheDurations.set(cacheKey, cacheDuration)\n\t\t\t\tthis.responseValues.set(cacheKey, { status: \"success\", data: cachedData })\n\t\t\t}\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tlocalStorage.removeItem(FetchClient.cacheKey)\n\t\t\t} catch {\n\t\t\t\t// Guard just in case. removeItem _should_ not throw but it should always no-op\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate setResponseValue(cacheKey: RequestCacheKey, value: FetchResult) {\n\t\tthis.responseValues.set(cacheKey, value)\n\n\t\tthis.persistCache()\n\n\t\tconst subscribers = this.#subscribers.get(cacheKey)\n\t\tif (!subscribers) return\n\n\t\tfor (const subscriber of subscribers) {\n\t\t\tsubscriber()\n\t\t}\n\t}\n\n\tprivate persistCache = debounce(() => {\n\t\tconst data: Record<string, CacheEntry> = {}\n\n\t\tfor (const [url, responseValue] of this.responseValues) {\n\t\t\tif (!responseValue) continue\n\t\t\tif (responseValue.status !== \"success\") continue\n\n\t\t\tconst cacheConfig = this.#shortestCacheDurations.get(url)\n\t\t\tif (!cacheConfig || cacheConfig === 0) continue\n\n\t\t\tconst storedAt = this.#cachedAt.get(url)\n\t\t\tif (!storedAt) continue\n\n\t\t\tif (storedAt && isCacheExpired(storedAt, cacheConfig)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tdata[url] = [storedAt, cacheConfig, responseValue.data]\n\t\t}\n\n\t\ttry {\n\t\t\tlocalStorage.setItem(FetchClient.cacheKey, JSON.stringify(data))\n\t\t} catch {\n\t\t\t// Guard against QuotaExceededError: https://developer.mozilla.org/en-US/docs/Web/API/Storage/setItem#quotaexceedederror\n\t\t}\n\t}, 500)\n\n\tasync prefetch(request: FetchRequestConfig) {\n\t\t// Fetches are not performed in SSG and render with fallback.\n\t\tif (!isBrowser()) return\n\n\t\tif (!isValidURL(request.url, false)) return\n\n\t\tconst cacheKey = getRequestCacheKey(request)\n\t\tthis.#preloadedRequests.add(cacheKey)\n\n\t\tawait this.fetchWithCache(request)\n\t\tconst result = this.getValue(cacheKey)\n\n\t\tif (!result || result.status === \"loading\") {\n\t\t\tthrow new Error(\"Unexpected result status for prefetch\")\n\t\t}\n\n\t\tconst subscribers = this.#subscribers.get(cacheKey)\n\t\tfor (const subscriber of subscribers ?? []) {\n\t\t\tsubscriber()\n\t\t}\n\n\t\tconst resolvedValue = resolveFetchDataValue(result, request)\n\t\tif (request.resultOutputType === ControlType.Image && isString(resolvedValue)) {\n\t\t\t// Image preloads that result in an error are ignored.\n\t\t\tawait preloadImage(resolvedValue).catch(noop)\n\t\t}\n\n\t\treturn resolvedValue\n\t}\n\n\tasync fetchWithCache(request: Pick<FetchRequestConfig, \"url\" | \"cacheDuration\" | \"credentials\">) {\n\t\t// Fetches are not performed in SSG and render with fallback.\n\t\tif (!isBrowser()) return\n\n\t\tconst cacheKey = getRequestCacheKey(request)\n\n\t\tconst ongoingFetch = this.#ongoingFetches.get(cacheKey)\n\t\tif (ongoingFetch) return ongoingFetch\n\n\t\tconst cachedAt = this.#cachedAt.get(cacheKey)\n\t\tconst hasExpiredCache = cachedAt && isCacheExpired(cachedAt, request.cacheDuration)\n\t\tif (this.responseValues.has(cacheKey) && !hasExpiredCache) {\n\t\t\treturn\n\t\t}\n\n\t\tconst currentValue = this.responseValues.get(cacheKey)\n\t\tif (!currentValue) {\n\t\t\tthis.setResponseValue(cacheKey, loadingFetchResult)\n\t\t}\n\n\t\tconst doFetch = async () => {\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(request.url, {\n\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\tcredentials: request.credentials,\n\t\t\t\t})\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tthis.setResponseValue(cacheKey, {\n\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\terror: new Error(\"Invalid Response Status\"),\n\t\t\t\t\t\tdata: undefined,\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst value = await response.json()\n\n\t\t\t\tthis.setResponseValue(cacheKey, { status: \"success\", data: value })\n\t\t\t\tthis.#cachedAt.set(cacheKey, Date.now())\n\t\t\t} catch (error) {\n\t\t\t\tthis.setResponseValue(cacheKey, { status: \"error\", error, data: undefined })\n\t\t\t}\n\t\t}\n\n\t\tconst promise = doFetch()\n\t\tthis.#ongoingFetches.set(cacheKey, promise)\n\n\t\tvoid promise.finally(() => {\n\t\t\tthis.#ongoingFetches.delete(cacheKey)\n\t\t})\n\n\t\treturn promise\n\t}\n\n\tgetValue(cacheKey: RequestCacheKey, onlyIfPrefetched = false) {\n\t\tif (onlyIfPrefetched && !this.#preloadedRequests.has(cacheKey)) return undefined\n\t\treturn this.responseValues.get(cacheKey)\n\t}\n\n\tsubscribe(request: FetchRequestConfig, callback: VoidFunction, skipFetchRequest = false) {\n\t\tconst { url, cacheDuration } = request\n\t\tif (!isValidURL(url, false)) return noop\n\n\t\tconst cacheKey = getRequestCacheKey(request)\n\n\t\t// In the UI it is possible to have different cache durations for the same URL.\n\t\t// We will use the shortest duration for the cache.\n\t\tconst cacheDurationForUrl = this.#shortestCacheDurations.get(cacheKey)\n\t\tif (!cacheDurationForUrl || cacheDuration < cacheDurationForUrl) {\n\t\t\tthis.#shortestCacheDurations.set(cacheKey, cacheDuration)\n\t\t}\n\n\t\tif (!skipFetchRequest) {\n\t\t\tthis.startQueryRefetching(request)\n\t\t\tvoid this.fetchWithCache(request)\n\t\t}\n\n\t\tconst subscribers = this.#subscribers.get(cacheKey) ?? new Set<VoidFunction>()\n\t\tsubscribers.add(callback)\n\t\tthis.#subscribers.set(cacheKey, subscribers)\n\n\t\treturn () => {\n\t\t\tconst nextSubscribers = this.#subscribers.get(cacheKey)\n\t\t\tif (!nextSubscribers) return\n\n\t\t\tnextSubscribers.delete(callback)\n\t\t\tif (nextSubscribers.size === 0) {\n\t\t\t\tthis.#subscribers.delete(cacheKey)\n\t\t\t}\n\n\t\t\tif (this.#subscribers.size === 0) {\n\t\t\t\tthis.stopQueryRefetching(request)\n\t\t\t}\n\t\t}\n\t}\n}\n\nconst FetchClientContext = /** @__PURE__ */ React.createContext<FetchClient | undefined>(undefined)\nconst IsRestoringCacheContext = /** @__PURE__ */ React.createContext<boolean>(true)\n\nexport const FetchClientProvider = /** @__PURE__ */ ({\n\tchildren,\n\tclient: initialClient,\n}: PropsWithChildren<{ client?: FetchClient }>) => {\n\tconst [client] = React.useState(() => initialClient ?? new FetchClient())\n\tconst [isRestoring, setIsRestoring] = React.useState(true)\n\tReact.useEffect(() => {\n\t\tclient.hydrateCache()\n\n\t\tReact.startTransition(() => {\n\t\t\tsetIsRestoring(false)\n\t\t})\n\t\treturn () => client.unmount()\n\t}, [client])\n\n\treturn (\n\t\t<IsRestoringCacheContext.Provider value={isRestoring}>\n\t\t\t<FetchClientContext.Provider value={client}>{children}</FetchClientContext.Provider>\n\t\t</IsRestoringCacheContext.Provider>\n\t)\n}\n\ninterface RequestsObserverResult {\n\tstatus: FetchResult[\"status\"]\n\tdata: unknown[]\n}\n\ninterface SetRequestsOptions {\n\tonlyPrefetched?: boolean\n}\n\n/**\n * The RequestsObserver is used to track the state of a list of fetch requests.\n * It combines the results into a stable identity and notifies subscribers when\n * any of the requests changee.\n */\nexport class RequestsObserver {\n\t// a map of subscriptions on the FetchClient\n\t#subscriptions: Map<RequestCacheKey, VoidFunction> = new Map()\n\n\t// A set of subscribers to requests of the observer\n\t#subscribers: Set<VoidFunction> = new Set()\n\n\t// The results of the susbcribed requests\n\t#results: RequestsObserverResult\n\n\t// getServerSnapshot is also called on the Client while the tree is hydrating.\n\t// It is important to always return the same value or hydration warnings will occur.\n\treadonly #SSRResults: RequestsObserverResult\n\n\t// When the RequestsObserver mounts we allow reading prefetched values.\n\t// This is to support Text FX on mount for requests that were prefetched.\n\t#onlyPrefetched = true\n\n\tconstructor(\n\t\tprivate client: FetchClient,\n\t\tprivate requests: FetchRequestConfig[],\n\t) {\n\t\tthis.setRequests(requests, { onlyPrefetched: true })\n\n\t\tthis.#SSRResults = { status: \"loading\", data: requests.map(request => request.fallbackValue) }\n\t\tthis.#results = this.#SSRResults\n\t}\n\n\tsetRequests(requests: FetchRequestConfig[], { onlyPrefetched = false }: SetRequestsOptions) {\n\t\tconst lastRequests = this.requests\n\t\tthis.requests = requests\n\t\tconst requestsByCacheKey = new Map(requests.map(request => [getRequestCacheKey(request), request]))\n\t\tconst nextSubscribedKeys = Array.from(requestsByCacheKey.keys())\n\n\t\tconst hasOnlyPrefetchedChange = this.#onlyPrefetched !== onlyPrefetched\n\t\tif (!onlyPrefetched) this.#onlyPrefetched = false\n\n\t\tconst hasSubscriptionChange =\n\t\t\tnextSubscribedKeys.length !== this.#subscriptions.size ||\n\t\t\tnextSubscribedKeys.some(url => !this.#subscriptions.has(url))\n\n\t\tif (!hasSubscriptionChange && !hasOnlyPrefetchedChange) {\n\t\t\t// In the canvas context it is possible that fallback values change.\n\t\t\t// In those cases we want to call getSnapshot again to resolve values with new fallback values\n\t\t\tif (!isEqual(lastRequests, requests)) {\n\t\t\t\tthis.updateResults()\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\tfor (const url of this.#subscriptions.keys()) {\n\t\t\tthis.#subscriptions.get(url)?.()\n\t\t\tthis.#subscriptions.delete(url)\n\t\t}\n\n\t\tfor (const cacheKey of nextSubscribedKeys) {\n\t\t\tconst requestConfig = requestsByCacheKey.get(cacheKey)\n\t\t\tif (!requestConfig) continue\n\n\t\t\tconst unsubscribe = this.client.subscribe(requestConfig, this.updateResults, onlyPrefetched)\n\t\t\tthis.#subscriptions.set(cacheKey, unsubscribe)\n\t\t}\n\n\t\tif (this.#subscribers.size === 0) return\n\n\t\tthis.updateResults()\n\t}\n\n\tupdateResults = () => {\n\t\tconst data: unknown[] = []\n\t\tconst statuses = new Set()\n\t\tconst errors: unknown[] = []\n\n\t\tfor (const request of this.requests) {\n\t\t\tconst cachekey = getRequestCacheKey(request)\n\n\t\t\tconst value = this.client.getValue(cachekey, this.#onlyPrefetched)\n\t\t\tif (!value) {\n\t\t\t\tstatuses.add(\"loading\")\n\t\t\t\tdata.push(request.fallbackValue)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tstatuses.add(value.status)\n\n\t\t\ttry {\n\t\t\t\tconst resolvedValue = resolveFetchDataValue(value, request)\n\t\t\t\tdata.push(resolvedValue)\n\t\t\t} catch (error) {\n\t\t\t\tdata.push(!isUndefined(request.errorFallbackValue) ? request.errorFallbackValue : request.fallbackValue)\n\t\t\t\terrors.push(error)\n\t\t\t}\n\t\t}\n\n\t\tconst status = statuses.has(\"error\") ? \"error\" : statuses.has(\"loading\") ? \"loading\" : \"success\"\n\t\tconst result: RequestsObserverResult = { status: status, data: data }\n\n\t\tif (!isEqual(result, this.#results)) {\n\t\t\tthis.#results = result\n\n\t\t\tif (errors.length > 0 && !statuses.has(\"loading\") && this.#subscribers.size > 0) {\n\t\t\t\t// biome-ignore lint/suspicious/noConsole: Users want to see fetch errors in the console.\n\t\t\t\tconsole.error(\"Fetch failed: \" + errors.join(\"\\n\"))\n\t\t\t}\n\t\t}\n\n\t\tfor (const subscriber of this.#subscribers) {\n\t\t\tsubscriber()\n\t\t}\n\t}\n\n\tunmount() {\n\t\tfor (const unsubscribe of this.#subscribers) {\n\t\t\tunsubscribe()\n\t\t}\n\n\t\tfor (const unsubscribe of this.#subscriptions.values()) {\n\t\t\tunsubscribe()\n\t\t}\n\t}\n\n\tsubscribe = (callback: VoidFunction) => {\n\t\tthis.#subscribers.add(callback)\n\n\t\tthis.updateResults()\n\n\t\treturn () => {\n\t\t\tthis.#subscribers.delete(callback)\n\t\t}\n\t}\n\n\tgetServerResults = () => {\n\t\treturn this.#SSRResults\n\t}\n\n\tgetResults = () => {\n\t\treturn this.#results\n\t}\n}\n\nexport const testing = {\n\tRequestsObserver,\n}\n\nexport interface FetcherProps {\n\trequests: FetchRequestConfig[]\n\tdisabled?: boolean\n\tchildren: (resolvedValues: unknown[], status: FetchResult[\"status\"]) => React.ReactElement\n}\n\nexport function useFetchRequestsForChildren(\n\trequests: FetcherProps[\"requests\"],\n\tdisabled: FetcherProps[\"disabled\"],\n\tchildren: FetcherProps[\"children\"],\n) {\n\tconst fetchClient = React.useContext(FetchClientContext)\n\tif (!fetchClient) {\n\t\tthrow new Error(\"useFetchRequest must be used within a FetchClientProvider\")\n\t}\n\tconst isRestoringCache = React.useContext(IsRestoringCacheContext)\n\tconst [observer] = React.useState(() => new RequestsObserver(fetchClient, requests))\n\n\tReact.useLayoutEffect(() => {\n\t\tif (disabled) return\n\n\t\t// Mainly in the Canvas can request configurations change, for example\n\t\t// fallback values may be updated. This ensures that the component\n\t\t// rerenders with these new values. It also ensures that Fetches that\n\t\t// were not prefetched are only kicked off after the component is\n\t\t// mounted.\n\t\tobserver.setRequests(requests, { onlyPrefetched: false })\n\t}, [requests, observer, disabled])\n\n\tReact.useEffect(() => {\n\t\treturn () => observer.unmount()\n\t}, [observer])\n\n\tconst subscribe = React.useCallback(\n\t\t(onChange: VoidFunction) => {\n\t\t\t// When the observer is restoring cache we don't yet subscribe to\n\t\t\t// any actual values The reason is that during hydration we don't\n\t\t\t// want to receive values from localStorage cache As values changes\n\t\t\t// during hydration will cause hydration warnings Also when the\n\t\t\t// observer is disabled from the outside (such as inside loading\n\t\t\t// variants) we don't subscribe to any values and will always return\n\t\t\t// the fallback value\n\t\t\t//\n\t\t\t// NOTE: Text Effects will not work on Fetches that have a cache\n\t\t\t// time and do not have a loading variant. The recommendation in\n\t\t\t// this case is to use a component with a loading variant. The\n\t\t\t// reason being that we cannot support this without causing\n\t\t\t// hydration errors as the initial render will always be with the fallback value.\n\t\t\tif (isRestoringCache || disabled) return noop\n\n\t\t\treturn observer.subscribe(onChange)\n\t\t},\n\t\t[disabled, observer, isRestoringCache],\n\t)\n\n\tconst synchronousData = React.useSyncExternalStore(subscribe, observer.getResults, observer.getServerResults)\n\tconst deferredData = React.useDeferredValue(synchronousData)\n\n\t// The memo ensures any consumer of the hook only re-renders when the deferred value changes,\n\t// so its rendering is concurrent (suspense safe) even though it depends on an external store.\n\treturn useMemoOne(() => children(deferredData.data, deferredData.status), [deferredData, children])\n}\n\nexport function usePrefetch() {\n\tconst fetchClient = React.useContext(FetchClientContext)\n\tif (!fetchClient) {\n\t\tthrow new Error(\"useFetchRequest must be used within a FetchClientProvider\")\n\t}\n\n\treturn React.useCallback((request: FetchRequestConfig) => fetchClient.prefetch(request), [fetchClient])\n}\n", "/** @internal */\nexport function preloadImage(url: string): Promise<void> {\n\treturn new Promise<void>((resolve, reject) => {\n\t\ttry {\n\t\t\t// Don't attempt to preload images that are not valid URLs.\n\t\t\tnew URL(url)\n\n\t\t\tconst image = new Image()\n\n\t\t\timage.onload = () => resolve()\n\t\t\timage.onerror = reject\n\t\t\timage.src = url\n\t\t} catch (error) {\n\t\t\treject(error)\n\t\t}\n\t})\n}\n", "function isObjectOrArray(value: unknown): value is Record<string, unknown> | unknown[] {\n\treturn typeof value === \"object\" && value !== null\n}\n\nexport function getPropertyByPath(input: unknown, keyPath: string): unknown {\n\tif (keyPath === \"\") {\n\t\treturn input\n\t}\n\n\t// Splits a string like foo.bar[0].baz into [\"foo\", \"bar\", \"0\", \"baz\"]\n\tconst keyParts = keyPath.split(/[.[\\]]+/u).filter(part => part.length > 0)\n\n\tlet current = input\n\tfor (const part of keyParts) {\n\t\tif (!isObjectOrArray(current)) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tcurrent = (current as Record<string, unknown>)[part]\n\t}\n\n\treturn current\n}\n", "import type { ReactElement } from \"react\"\nimport { forwardRef } from \"react\"\nimport { useCloneChildrenWithPropsAndRef } from \"../components/utils/useCloneChildrenWithPropsAndRef.tsx\"\nimport { useRouter } from \"../router/RouterContext.tsx\"\nimport { useLocaleInfo } from \"../router/useLocale.ts\"\nimport { isObject, isString } from \"../utils/utils.ts\"\nimport { withChildrenCanSuspend } from \"./ChildrenCanSuspend.tsx\"\nimport { resolveLinkInternal } from \"./Link/resolveLink.ts\"\nimport { useResolveSlugsWithSuspense } from \"./Link/resolveSlugs.ts\"\nimport type { LinkToWebPage } from \"./LinkToWebPage.ts\"\nimport { isLinkToWebPage } from \"./LinkToWebPage.ts\"\n\nexport interface UnresolvedLink {\n\thref: string | LinkToWebPage\n\timplicitPathVariables?: Record<string, unknown>\n\t/**\n\t * An UnresolvedLink that is a scroll target ref key will only resole the\n\t * hash.\n\t */\n\trefKey?: true\n}\nconst hrefKey = \"href\" satisfies keyof UnresolvedLink\nexport function isUnresolvedLink(value: unknown): value is UnresolvedLink {\n\tif (!isObject(value)) return false\n\treturn hrefKey in value && isLinkToWebPage(value.href)\n}\n\ninterface ResolveLinksProps {\n\tlinks: (UnresolvedLink | string | undefined)[]\n\tchildren: (resolvedLinks: (string | undefined)[]) => ReactElement\n}\n\n/**\n * The ResolveLinks component is given an array of links that have unresolved\n * slug values. The component is responsible for loading the slug values in\n * parallel and suspending until all the values are resolved.\n *\n * During code generation, all links with unresolved slugs will be collected\n * separately and wrapped into a ResolveLinks component. A function as child\n * pattern is used to provide a binding to access the resolved versions of the\n * links.\n * @public\n */\nexport const ResolveLinks = /* @__PURE__ */ withChildrenCanSuspend<unknown, ResolveLinksProps>(\n\t/* @__PURE__ */\n\tforwardRef(function ResolveLinksInner({ links, children, ...rest }: ResolveLinksProps, ref) {\n\t\tconst router = useRouter()\n\t\tconst { activeLocale } = useLocaleInfo()\n\t\tconst cloneWithPropsAndRef = useCloneChildrenWithPropsAndRef(ref)\n\t\tconst resolveSlugsWithSuspense = useResolveSlugsWithSuspense()\n\n\t\tconst promises: Promise<string | undefined>[] = []\n\n\t\tconst resolvedLinks = links.map(link => {\n\t\t\tif (!link) return undefined\n\t\t\tif (isString(link)) return resolveLinkInternal(link, router, undefined, undefined, activeLocale)\n\n\t\t\treturn resolveLinkInternal(\n\t\t\t\tlink.href,\n\t\t\t\trouter,\n\t\t\t\tlink.implicitPathVariables,\n\t\t\t\tlink.refKey,\n\t\t\t\tactiveLocale,\n\t\t\t\t(unresolvedPathSlugs, unresolvedHashSlugs) => {\n\t\t\t\t\treturn resolveSlugsWithSuspense(unresolvedPathSlugs, unresolvedHashSlugs, activeLocale, promises)\n\t\t\t\t},\n\t\t\t)\n\t\t})\n\n\t\tif (promises.length > 0) {\n\t\t\tthrow Promise.allSettled(promises)\n\t\t}\n\n\t\tconst childrenWithLinks = children(resolvedLinks)\n\n\t\treturn cloneWithPropsAndRef(childrenWithLinks, rest)\n\t}),\n)\n", "import * as React from \"react\"\nimport { useCloneChildrenWithPropsAndRef } from \"../components/utils/useCloneChildrenWithPropsAndRef.tsx\"\nimport type { FetcherProps } from \"./FetchClient.tsx\"\nimport { useFetchRequestsForChildren } from \"./FetchClient.tsx\"\n\nexport const Fetcher = /* @__PURE__ */ React.forwardRef(function Fetcher(\n\t{ requests, disabled, children, ...rest }: FetcherProps,\n\tref,\n) {\n\tconst cloneWithPropsAndRef = useCloneChildrenWithPropsAndRef(ref)\n\tconst childrenWithValues = useFetchRequestsForChildren(requests, disabled, children)\n\treturn cloneWithPropsAndRef(childrenWithValues, rest)\n})\n", "/**\n * @internal\n */\nexport const callEach = (...fns: (Function | undefined)[]) => fns.forEach(fn => fn && fn())\n", "import { runtime } from \"./runtimeInjection.ts\"\n\n// We need to proxy the getLogger function as the runtime is not injected when\n// creating the loggers in the module scope.\nexport function getLogger(name: string) {\n\treturn {\n\t\ttrace(...args: unknown[]) {\n\t\t\treturn runtime.getLogger(name)?.trace(...args)\n\t\t},\n\t\tdebug(...args: unknown[]) {\n\t\t\treturn runtime.getLogger(name)?.debug(...args)\n\t\t},\n\t\tinfo(...args: unknown[]) {\n\t\t\treturn runtime.getLogger(name)?.info(...args)\n\t\t},\n\t\twarn(...args: unknown[]) {\n\t\t\treturn runtime.getLogger(name)?.warn(...args)\n\t\t},\n\t\terror(...args: unknown[]) {\n\t\t\treturn runtime.getLogger(name)?.error(...args)\n\t\t},\n\t\tget enabled() {\n\t\t\treturn runtime.getLogger(name) !== undefined\n\t\t},\n\t}\n}\n", "import { assert } from \"../../../utils/assert.ts\"\nimport { isGenerator } from \"../../../utils/utils.ts\"\n\n/**\n * Most of our scalar and relational nodes can be evaluated synchronously. To\n * avoid wrapping everything in promises, we use generators to evaluate nodes.\n * Nodes can be evaluated synchronously, unless they yield a promise. If they\n * yield a promise, we await it and return the result back to the caller. In our\n * experiments, generators are up to 80x faster than async functions for\n * synchronous nodes. The alternative would be to use callbacks everywhere, but\n * that makes the code a lot harder to read and understand.\n */\n// biome-ignore lint/suspicious/noExplicitAny: Unfortunately TypeScript doesn't allow us to type this better.\nexport type Evaluate<Value = unknown> = Generator<unknown, Value, any>\n\ntype MaybeEvaluate<Value = unknown> = Value | Evaluate<Value>\n\ntype UnboxValue<Value> = Value extends Evaluate<infer Return> ? Return : Value\n\ntype Evaluated<Values> = {\n\t[Key in keyof Values]: UnboxValue<Values[Key]>\n}\n\n/**\n * Runs a generator and returns the final value. Throws an error if the\n * generator yields.\n */\nexport function evaluateSync<Value>(generator: Evaluate<Value>) {\n\tconst state = generator.next()\n\tassert(state.done, \"Generator must not yield\")\n\treturn state.value\n}\n\n/**\n * Runs a generator and returns the final value. Any value yielded by the\n * generator will be awaited and returned to the generator.\n */\nexport async function evaluateAsync<Value>(generator: Evaluate<Value>, state = generator.next()) {\n\twhile (!state.done) {\n\t\tconst value = await state.value\n\t\tstate = generator.next(value)\n\t}\n\n\treturn state.value\n}\n\n/**\n * Runs a generator and returns the final value. Returns a promise if the generator yields.\n * Otherwise returns the final value directly.\n */\nexport function evaluateMaybeAsync<Value>(generator: Evaluate<Value>) {\n\tconst state = generator.next()\n\tif (state.done) return state.value\n\n\treturn evaluateAsync(generator, state)\n}\n\n/**\n * Runs multiple generators inside an object concurrently and returns a new\n * object with the returned values.\n */\nexport function* evaluateObject<Values extends Record<string, MaybeEvaluate>>(values: Values) {\n\tconst result: Record<string, unknown> = {}\n\n\tconst keys = Object.keys(values)\n\tconst promises: Promise<unknown>[] = []\n\n\tfor (const key of keys) {\n\t\tconst generator = values[key]\n\n\t\tif (isGenerator(generator)) {\n\t\t\tconst state = generator.next()\n\n\t\t\tif (state.done) {\n\t\t\t\tresult[key] = state.value\n\t\t\t} else {\n\t\t\t\tpromises.push(\n\t\t\t\t\tevaluateAsync(generator, state).then(value => {\n\t\t\t\t\t\tresult[key] = value\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\tresult[key] = generator\n\t\t}\n\t}\n\n\tif (promises.length > 0) {\n\t\tyield Promise.all(promises)\n\t}\n\n\treturn result as Evaluated<Values>\n}\n\n/**\n * Runs multiple generators inside an array concurrently and returns a new array\n * with the returned values.\n */\nexport function* evaluateArray<Values extends MaybeEvaluate[]>(values: Values) {\n\tconst result: unknown[] = []\n\n\tconst keys = values.keys()\n\tconst promises: Promise<unknown>[] = []\n\n\tfor (const key of keys) {\n\t\tconst generator = values[key]\n\n\t\tif (isGenerator(generator)) {\n\t\t\tconst state = generator.next()\n\n\t\t\tif (state.done) {\n\t\t\t\tresult[key] = state.value\n\t\t\t} else {\n\t\t\t\tpromises.push(\n\t\t\t\t\tevaluateAsync(generator, state).then(value => {\n\t\t\t\t\t\tresult[key] = value\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\tresult[key] = generator\n\t\t}\n\t}\n\n\tif (promises.length > 0) {\n\t\tyield Promise.all(promises)\n\t}\n\n\treturn result as Evaluated<Values>\n}\n", "import type { ReactNode } from \"react\"\nimport type { Locale } from \"../../router/types.ts\"\nimport { isArray, isFunction, isObject } from \"../../utils/utils.ts\"\nimport type { DatabaseValue } from \"./DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"./DatabaseValueDefinition.ts\"\n\n/**\n * This file defines query types to query the CMS. The query is defined in an\n * AST form of the SQLite select statement https://sqlite.org/lang_select.html.\n *\n * Currently, not every feature is implemented. When implementing a new feature\n * it's best to look at the SQLite documentation and add the necessary AST\n * nodes.\n *\n * Features that are not supported by SQLite can be implemented by using a\n * function call. For example STARTS_WITH(title, \"Hello\"), ENDS_WITH(title,\n * \"world\"), and CONTAINS(answer, \"42\").\n *\n * WARNING: The types in this file have to be backwards compatible. The types\n * are used by code generation inside GeneratedCollection.ts and\n * serializeDatabase.ts. This means that if we change the types and the code\n * generation we still have to be able to read the old types because the\n * generated code is only updated after a change to the CMS.\n */\n\n/**\n * An identifier that can be resolved within a specific context. Currently, only\n * fields (columns) of an item (row) can be resolved:\n * - id\n * - name\n * - title\n */\nexport interface Identifier {\n\ttype: \"Identifier\"\n\t// There is a special identifier called \"index\" that contains the index of a\n\t// node in the collection.\n\tname: string\n\tcollection?: string\n}\n\n/**\n * A literal value:\n * - true\n * - \"string\"\n * - 123\n */\nexport interface LiteralValue {\n\ttype: \"LiteralValue\"\n\tvalue: unknown\n}\n\n/**\n * A function call:\n * - STARTS_WITH(title, \"Hello\")\n * - ENDS_WITH(title, \"world\")\n * - CONTAINS(name, \"Smith\")\n */\nexport interface FunctionCall {\n\ttype: \"FunctionCall\"\n\tfunctionName: string\n\targuments: Expression[]\n}\n\nexport enum FunctionName {\n\tContains = \"CONTAINS\",\n\tStartsWith = \"STARTS_WITH\",\n\tEndsWith = \"ENDS_WITH\",\n\tLength = \"LENGTH\",\n\tIndexOf = \"INDEX_OF\",\n\tArray = \"ARRAY\",\n\tFlatArray = \"FLAT_ARRAY\",\n\tIntersect = \"INTERSECT\",\n}\n\n/**\n * A case expression:\n * CASE city\n *   WHEN \"Amsterdam\" THEN 921402\n *   WHEN \"Berlin\" THEN 3677472\n *   ELSE 0\n * END\n */\nexport interface Case {\n\ttype: \"Case\"\n\tvalue?: Expression\n\tconditions: Condition[]\n\telse?: Expression\n}\n\nexport interface Condition {\n\ttype: \"Condition\"\n\twhen: Expression\n\tthen: Expression\n}\n\n/**\n * A unary operation:\n * - NOT true\n * - NOT featured\n */\nexport interface UnaryOperation {\n\ttype: \"UnaryOperation\"\n\toperator: UnaryOperator\n\tvalue: Expression\n}\n\nexport enum UnaryOperator {\n\tNot = \"not\",\n}\n\n/**\n * A binary operation:\n * - true AND true\n * - true OR false\n * - true == true.\n * - 13.37 < 1337\n */\nexport interface BinaryOperation {\n\ttype: \"BinaryOperation\"\n\toperator: BinaryOperator\n\tleft: Expression\n\tright: Expression\n}\n\nexport enum BinaryOperator {\n\tAnd = \"and\",\n\tOr = \"or\",\n\tEquals = \"==\",\n\tNotEquals = \"!=\",\n\tLessThan = \"<\",\n\tLessThanOrEqual = \"<=\",\n\tGreaterThan = \">\",\n\tGreaterThanOrEqual = \">=\",\n\tIn = \"in\",\n}\n\n/**\n * A type cast:\n * - CAST(0 as BOOLEAN)\n * - CAST(42 as STRING)\n * - CAST(\"42\" as NUMBER)\n */\nexport interface TypeCast {\n\ttype: \"TypeCast\"\n\tdataType: string\n\tvalue: Expression\n}\n\nexport enum DataType {\n\tBoolean = \"BOOLEAN\",\n\tDate = \"DATE\",\n\tNumber = \"NUMBER\",\n\tString = \"STRING\",\n}\n\nexport type Expression =\n\t| Identifier\n\t| LiteralValue\n\t| FunctionCall\n\t| Case\n\t| UnaryOperation\n\t| BinaryOperation\n\t| TypeCast\n\t| Select\n\nexport type SelectExpression = Expression & {\n\talias?: string\n}\n\nexport enum OrderDirection {\n\tAscending = \"asc\",\n\tDescending = \"desc\",\n}\n\nexport type OrderExpression = Expression & {\n\tdirection?: OrderDirection\n}\n\nexport type AnyCollection = AnyLegacyCollection | AnyDatabaseCollection\n\nexport function isAnyCollection(value: unknown): value is AnyCollection {\n\treturn isAnyLegacyCollection(value) || isAnyDatabaseCollection(value)\n}\n\nexport interface Collection {\n\ttype: \"Collection\"\n\tdata: AnyCollection\n\talias?: string\n}\n\nexport interface Join {\n\ttype: /* \"Join\" | */ \"LeftJoin\" /* | \"RightJoin\" | \"FullJoin\" */\n\tleft: From\n\tright: From\n\tconstraint: Expression\n}\n\nexport type From = Collection | Join\n\nexport interface Select {\n\ttype: \"Select\"\n\tfrom: From\n\tselect: SelectExpression[]\n\twhere?: Expression\n\torderBy?: OrderExpression[]\n\tlimit?: Expression\n\toffset?: Expression\n}\n\nexport type Query = Omit<Select, \"type\">\n\n// Legacy Collections\n\nexport type LegacyCollectionItem = Record<string, unknown>\nexport type LegacyCollectionItems = LegacyCollectionItem[]\n\nexport type LegacyCollection = LegacyCollectionItems & {\n\tdisplayName: string\n}\n\nexport function isLegacyCollection(value: unknown): value is LegacyCollection {\n\treturn isArray(value) && value.every(isObject)\n}\n\nexport interface LegacyLocalizedCollection {\n\tread(locale?: Locale | null): LegacyCollectionItems\n\tpreload(locale?: Locale | null): Promise<void> | undefined\n\tdisplayName: string\n}\n\nexport function isLegacyLocalizedCollection(value: unknown): value is LegacyLocalizedCollection {\n\treturn isObject(value) && isFunction(value.read) && isFunction(value.preload)\n}\n\nexport type AnyLegacyCollection = LegacyCollection | LegacyLocalizedCollection\n\nexport function isAnyLegacyCollection(value: unknown): value is AnyLegacyCollection {\n\treturn isLegacyCollection(value) || isLegacyLocalizedCollection(value)\n}\n\n// Database Collections\n\nexport type DatabaseItemPointer = string\nexport type DatabaseRichTextPointer = unknown\nexport type DatabaseVectorSetItemPointer = unknown\n\nexport interface DatabaseItem {\n\treadonly pointer: DatabaseItemPointer\n\t// This is a partial data item. It doesn't necessarily contain all the\n\t// fields of the item. E.g. an index will only fill out the fields that are\n\t// contained in the index.\n\treadonly data: Record<string, DatabaseValue>\n}\n\nexport interface DatabaseSchema {\n\treadonly [name: string]: DatabaseValueDefinition\n}\n\nexport enum DatabaseCollationType {\n\tCaseInsensitive = 0,\n\tCaseSensitive = 1,\n}\n\nexport type DatabaseCollation =\n\t| {\n\t\t\treadonly type: DatabaseCollationType.CaseSensitive\n\t  }\n\t| {\n\t\t\treadonly type: DatabaseCollationType.CaseInsensitive\n\t  }\n\n// TODO: How to handle null values?\nexport enum DatabaseIndexLookupType {\n\tAll = \"All\",\n\tEquals = \"Equals\",\n\tNotEquals = \"NotEquals\",\n\tLessThan = \"LessThan\",\n\tGreaterThan = \"GreaterThan\",\n\tContains = \"Contains\",\n\tStartsWith = \"StartsWith\",\n\tEndsWith = \"EndsWith\",\n}\n\nexport interface DatabaseIndexLookupAll {\n\treadonly type: DatabaseIndexLookupType.All\n}\n\nexport interface DatabaseIndexLookupEquals {\n\treadonly type: DatabaseIndexLookupType.Equals\n\treadonly value: DatabaseValue\n}\n\nexport interface DatabaseIndexLookupNotEquals {\n\treadonly type: DatabaseIndexLookupType.NotEquals\n\treadonly value: DatabaseValue\n}\n\nexport interface DatabaseIndexLookupLessThan {\n\treadonly type: DatabaseIndexLookupType.LessThan\n\treadonly value: DatabaseValue\n\treadonly inclusive: boolean\n}\n\nexport interface DatabaseIndexLookupGreaterThan {\n\treadonly type: DatabaseIndexLookupType.GreaterThan\n\treadonly value: DatabaseValue\n\treadonly inclusive: boolean\n}\n\nexport interface DatabaseIndexLookupContains {\n\treadonly type: DatabaseIndexLookupType.Contains\n\treadonly value: DatabaseValue\n}\n\nexport interface DatabaseIndexLookupStartsWith {\n\treadonly type: DatabaseIndexLookupType.StartsWith\n\treadonly value: DatabaseValue\n}\n\nexport interface DatabaseIndexLookupEndsWith {\n\treadonly type: DatabaseIndexLookupType.EndsWith\n\treadonly value: DatabaseValue\n}\n\nexport type DatabaseIndexLookup =\n\t| DatabaseIndexLookupAll\n\t| DatabaseIndexLookupEquals\n\t| DatabaseIndexLookupNotEquals\n\t| DatabaseIndexLookupLessThan\n\t| DatabaseIndexLookupGreaterThan\n\t| DatabaseIndexLookupContains\n\t| DatabaseIndexLookupStartsWith\n\t| DatabaseIndexLookupEndsWith\n\nexport interface DatabaseIndex {\n\t/**\n\t * The schema of the fields that are populated on each `DatabaseItem` by\n\t * `lookupItems`. This has to be a subset of `DatabaseCollection.schema`.\n\t */\n\treadonly schema: DatabaseSchema\n\t/**\n\t * The fields that are stored in the index. Lookup queries can query the\n\t * index based on these fields.\n\t */\n\treadonly fields: Expression[]\n\t/**\n\t * Additional constraints that are applied to the index. E.g an index that\n\t * contains the name of all authors from Amsterdam, would have `fields` set\n\t * to [`name`] and `where` set to `city == 'Amsterdam'`.\n\t */\n\treadonly where?: Expression\n\t/**\n\t * The order that items are returned from `lookupItems`. If the field is\n\t * empty the order is not deterministic.\n\t */\n\treadonly orderBy?: OrderExpression[]\n\t/**\n\t * Different indexes support different lookup types. Dictionary indexes\n\t * support all lookup types but future indexes might only support a subset.\n\t */\n\treadonly supportedLookupTypes: DatabaseIndexLookupType[]\n\t/**\n\t * Returns all items that match the given query. The query needs to be the\n\t * same length as the `fields` array.\n\t */\n\tlookupItems(query: DatabaseIndexLookup[]): Promise<DatabaseItem[]>\n}\n\nexport interface DatabaseCollection {\n\treadonly id?: string\n\t/**\n\t * The schema of the DatabaseItem that is returned by `scanItems` and\n\t * `resolveItems`.\n\t */\n\treadonly schema: DatabaseSchema\n\t/**\n\t * All indexes that are available for the collection.\n\t */\n\treadonly indexes: DatabaseIndex[]\n\t/**\n\t * Resolves a rich text by its pointer. We don't directly store rich text in\n\t * the binary files.\n\t */\n\tresolveRichText(pointer: DatabaseRichTextPointer): ReactNode | Promise<ReactNode>\n\t/**\n\t * Resolves a vector set item by its pointer. We don't directly store vector\n\t * set items in the binary files.\n\t */\n\tresolveVectorSetItem?(pointer: DatabaseVectorSetItemPointer): ReactNode | Promise<ReactNode>\n\t/**\n\t * Scans the whole collection and returns all items.\n\t */\n\tscanItems(): Promise<DatabaseItem[]>\n\t/**\n\t * Returns the items at the given pointer. The returned items have to be in\n\t * the same order as the pointers.\n\t */\n\tresolveItems(pointers: DatabaseItemPointer[]): Promise<DatabaseItem[]>\n\t/**\n\t * Compares two items based on the order in the CMS.\n\t */\n\tcompareItems(left: DatabaseItem, right: DatabaseItem): number\n}\n\nexport function isDatabaseCollection(value: unknown): value is DatabaseCollection {\n\treturn isObject(value) && isObject(value.schema)\n}\n\nexport interface DatabaseCollectionByLocaleId {\n\treadonly default: DatabaseCollection\n\treadonly [localeId: string]: DatabaseCollection\n}\n\nexport interface LocalizedDatabaseCollection {\n\treadonly id?: string\n\treadonly displayName: string\n\treadonly collectionByLocaleId: DatabaseCollectionByLocaleId\n}\n\nexport function isLocalizedDatabaseCollection(value: unknown): value is LocalizedDatabaseCollection {\n\treturn isObject(value) && isObject(value.collectionByLocaleId)\n}\n\ntype AnyDatabaseCollection = DatabaseCollection | LocalizedDatabaseCollection\n\nexport function isAnyDatabaseCollection(value: unknown): value is AnyDatabaseCollection {\n\treturn isDatabaseCollection(value) || isLocalizedDatabaseCollection(value)\n}\n", "import { ControlType } from \"../../render/types/PropertyControls.ts\"\nimport { assert, assertNever } from \"../../utils/assert.ts\"\nimport { isArray, isBoolean, isNull, isNumber, isString, isValidDate } from \"../../utils/utils.ts\"\nimport type { LinkToWebPage } from \"../LinkToWebPage.ts\"\nimport type {\n\tDatabaseArrayValueDefinition,\n\tDatabaseObjectValueDefinition,\n\tDatabaseValueDefinition,\n} from \"./DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation, DatabaseRichTextPointer, DatabaseVectorSetItemPointer } from \"./types.ts\"\nimport { DatabaseCollationType } from \"./types.ts\"\n\n// The types in this file are very similar to ControlProps but are used to pass\n// values from the `QueryEngine` to a collection module and back. We have to\n// wrap the values in a type because we need to be able to distinguish between a\n// string that is a date and a string that is an enum value.\n\n/**\n * DatabaseArrayValue\n */\n\nexport interface DatabaseArrayValue {\n\treadonly type: ControlType.Array\n\treadonly value: DatabaseValue[]\n}\n\nfunction compareArray(left: DatabaseArrayValue, right: DatabaseArrayValue, collation: DatabaseCollation): number {\n\tconst leftLength = left.value.length\n\tconst rightLength = right.value.length\n\n\tif (leftLength < rightLength) return -1\n\tif (leftLength > rightLength) return 1\n\n\tfor (let i = 0; i < leftLength; i++) {\n\t\t// biome-ignore lint/style/noNonNullAssertion: Guaranteed by the loop.\n\t\tconst leftItem = left.value[i]!\n\t\t// biome-ignore lint/style/noNonNullAssertion: Guaranteed by the loop.\n\t\tconst rightItem = right.value[i]!\n\n\t\tconst result = compare(leftItem, rightItem, collation)\n\t\tif (result !== 0) return result\n\t}\n\n\treturn 0\n}\n\nfunction castArray(value: DatabaseValue, definition: DatabaseArrayValueDefinition): DatabaseArrayValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.Array: {\n\t\t\tconst result = value.value.map(item => {\n\t\t\t\treturn DatabaseValue.cast(item, definition.definition)\n\t\t\t})\n\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Array,\n\t\t\t\tvalue: result,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseBooleanValue\n */\n\nexport interface DatabaseBooleanValue {\n\treadonly type: ControlType.Boolean\n\treadonly value: boolean\n}\n\nfunction compareBoolean(left: DatabaseBooleanValue, right: DatabaseBooleanValue): number {\n\tif (left.value < right.value) return -1\n\tif (left.value > right.value) return 1\n\treturn 0\n}\n\nfunction castBoolean(value: DatabaseValue): DatabaseBooleanValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.Boolean: {\n\t\t\treturn value\n\t\t}\n\n\t\tcase ControlType.Number:\n\t\tcase ControlType.String: {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Boolean,\n\t\t\t\tvalue: Boolean(value.value),\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null\n}\n\nexport function valueToBoolean(value: DatabaseValue) {\n\tconst cast = castBoolean(value)\n\treturn cast?.value ?? false\n}\n\n/**\n * DatabaseColorValue\n */\n\nexport interface DatabaseColorValue {\n\treadonly type: ControlType.Color\n\treadonly value: string\n}\n\nfunction compareColor(left: DatabaseColorValue, right: DatabaseColorValue): number {\n\tif (left.value < right.value) return -1\n\tif (left.value > right.value) return 1\n\treturn 0\n}\n\nfunction castColor(value: DatabaseValue): DatabaseColorValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.Color: {\n\t\t\treturn value\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseDateValue\n */\n\nexport interface DatabaseDateValue {\n\treadonly type: ControlType.Date\n\treadonly value: string\n}\n\nfunction compareDate(left: DatabaseDateValue, right: DatabaseDateValue): number {\n\tconst leftDate = new Date(left.value)\n\tconst rightDate = new Date(right.value)\n\tif (leftDate < rightDate) return -1\n\tif (leftDate > rightDate) return 1\n\treturn 0\n}\n\nfunction castDate(value: DatabaseValue): DatabaseDateValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.Date: {\n\t\t\treturn value\n\t\t}\n\n\t\tcase ControlType.Number:\n\t\tcase ControlType.String: {\n\t\t\tconst date = new Date(value.value)\n\n\t\t\tif (isValidDate(date)) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: ControlType.Date,\n\t\t\t\t\tvalue: date.toISOString(),\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn null\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseEnumValue\n */\n\nexport interface DatabaseEnumValue {\n\treadonly type: ControlType.Enum\n\treadonly value: string\n}\n\nfunction compareEnum(left: DatabaseEnumValue, right: DatabaseEnumValue): number {\n\tif (left.value < right.value) return -1\n\tif (left.value > right.value) return 1\n\treturn 0\n}\n\nfunction castEnum(value: DatabaseValue): DatabaseEnumValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.Enum: {\n\t\t\treturn value\n\t\t}\n\n\t\tcase ControlType.String: {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Enum,\n\t\t\t\tvalue: value.value,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseFileValue\n */\n\nexport interface DatabaseFileValue {\n\treadonly type: ControlType.File\n\treadonly value: string\n}\n\nfunction compareFile(left: DatabaseFileValue, right: DatabaseFileValue): number {\n\tif (left.value < right.value) return -1\n\tif (left.value > right.value) return 1\n\treturn 0\n}\n\nfunction castFile(value: DatabaseValue): DatabaseFileValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.File: {\n\t\t\treturn value\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseLinkValue\n */\n\nexport interface DatabaseLinkValue {\n\treadonly type: ControlType.Link\n\treadonly value: string | LinkToWebPage\n}\n\nfunction compareLink(left: DatabaseLinkValue, right: DatabaseLinkValue): number {\n\tconst leftEncoded = JSON.stringify(left.value)\n\tconst rightEncoded = JSON.stringify(right.value)\n\tif (leftEncoded < rightEncoded) return -1\n\tif (leftEncoded > rightEncoded) return 1\n\treturn 0\n}\n\nfunction castLink(value: DatabaseValue): DatabaseLinkValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.Link: {\n\t\t\treturn value\n\t\t}\n\n\t\tcase ControlType.String: {\n\t\t\ttry {\n\t\t\t\tconst { protocol } = new URL(value.value)\n\n\t\t\t\tif (protocol === \"http:\" || protocol === \"https:\") {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: ControlType.Link,\n\t\t\t\t\t\tvalue: value.value,\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn null\n\t\t\t} catch {\n\t\t\t\treturn null\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseNumberValue\n */\n\nexport interface DatabaseNumberValue {\n\treadonly type: ControlType.Number\n\treadonly value: number\n}\n\nfunction compareNumber(left: DatabaseNumberValue, right: DatabaseNumberValue): number {\n\tif (left.value < right.value) return -1\n\tif (left.value > right.value) return 1\n\treturn 0\n}\n\nfunction castNumber(value: DatabaseValue): DatabaseNumberValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.Number:\n\t\tcase ControlType.String: {\n\t\t\tconst number = Number(value.value)\n\n\t\t\tif (Number.isFinite(number)) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: ControlType.Number,\n\t\t\t\t\tvalue: number,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn null\n\t\t}\n\t}\n\n\treturn null\n}\n\nexport function valueToNumber(value: DatabaseValue) {\n\tconst cast = castNumber(value)\n\treturn cast?.value ?? null\n}\n\n/**\n * DatabaseObjectValue\n */\n\nexport interface DatabaseObjectValue {\n\treadonly type: ControlType.Object\n\treadonly value: Record<string, DatabaseValue>\n}\n\nfunction compareObject(left: DatabaseObjectValue, right: DatabaseObjectValue, collation: DatabaseCollation): number {\n\tconst leftKeys = Object.keys(left.value).sort()\n\tconst rightKeys = Object.keys(right.value).sort()\n\n\tif (leftKeys.length < rightKeys.length) return -1\n\tif (leftKeys.length > rightKeys.length) return 1\n\n\tfor (let i = 0; i < leftKeys.length; i++) {\n\t\t// biome-ignore lint/style/noNonNullAssertion: Guaranteed by the loop.\n\t\tconst leftKey = leftKeys[i]!\n\t\t// biome-ignore lint/style/noNonNullAssertion: Guaranteed by the loop.\n\t\tconst rightKey = rightKeys[i]!\n\n\t\tif (leftKey < rightKey) return -1\n\t\tif (leftKey > rightKey) return 1\n\n\t\tconst leftValue = left.value[leftKey] ?? null\n\t\tconst rightValue = right.value[rightKey] ?? null\n\n\t\tconst result = compare(leftValue, rightValue, collation)\n\t\tif (result !== 0) return result\n\t}\n\n\treturn 0\n}\n\nfunction castObject(value: DatabaseValue, definition: DatabaseObjectValueDefinition): DatabaseObjectValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.Object: {\n\t\t\tconst result: Record<string, DatabaseValue> = {}\n\t\t\tconst definitionEntries = Object.entries(definition.definitions)\n\n\t\t\tfor (const [key, itemDefinition] of definitionEntries) {\n\t\t\t\tconst item = value.value[key] ?? null\n\t\t\t\tresult[key] = DatabaseValue.cast(item, itemDefinition)\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Object,\n\t\t\t\tvalue: result,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseResponsiveImageValue\n */\n\nexport interface DatabaseResponsiveImageValue {\n\treadonly type: ControlType.ResponsiveImage\n\treadonly value: object\n}\n\nfunction compareResponsiveImage(left: DatabaseResponsiveImageValue, right: DatabaseResponsiveImageValue): number {\n\tconst leftEncoded = JSON.stringify(left.value)\n\tconst rightEncoded = JSON.stringify(right.value)\n\tif (leftEncoded < rightEncoded) return -1\n\tif (leftEncoded > rightEncoded) return 1\n\treturn 0\n}\n\nfunction castResponsiveImage(value: DatabaseValue): DatabaseResponsiveImageValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.ResponsiveImage: {\n\t\t\treturn value\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseRichTextValue\n */\n\nexport interface DatabaseRichTextValue {\n\treadonly type: ControlType.RichText\n\treadonly value: DatabaseRichTextPointer\n}\n\nfunction compareRichText(left: DatabaseRichTextValue, right: DatabaseRichTextValue): number {\n\tconst leftValue = left.value as number\n\tconst rightValue = right.value as number\n\tif (leftValue < rightValue) return -1\n\tif (leftValue > rightValue) return 1\n\treturn 0\n}\n\nfunction castRichText(value: DatabaseValue): DatabaseRichTextValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.RichText: {\n\t\t\treturn value\n\t\t}\n\t}\n\n\treturn null\n}\n\nexport interface DatabaseVectorSetItemValue {\n\treadonly type: ControlType.VectorSetItem\n\treadonly value: DatabaseVectorSetItemPointer\n}\n\nfunction compareVectorSetItem(left: DatabaseVectorSetItemValue, right: DatabaseVectorSetItemValue): number {\n\tconst leftValue = left.value as number\n\tconst rightValue = right.value as number\n\tif (leftValue < rightValue) return -1\n\tif (leftValue > rightValue) return 1\n\treturn 0\n}\n\nfunction castVectorSetItem(value: DatabaseValue): DatabaseVectorSetItemValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.VectorSetItem: {\n\t\t\treturn value\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * DatabaseStringValue\n */\n\nexport interface DatabaseStringValue {\n\treadonly type: ControlType.String\n\treadonly value: string\n}\n\nfunction compareString(left: DatabaseStringValue, right: DatabaseStringValue, collation: DatabaseCollation): number {\n\tlet leftValue = left.value\n\tlet rightValue = right.value\n\n\tif (collation.type === DatabaseCollationType.CaseInsensitive) {\n\t\tleftValue = left.value.toLowerCase()\n\t\trightValue = right.value.toLowerCase()\n\t}\n\n\tif (leftValue < rightValue) return -1\n\tif (leftValue > rightValue) return 1\n\treturn 0\n}\n\nfunction castString(value: DatabaseValue): DatabaseStringValue | null {\n\tswitch (value?.type) {\n\t\tcase ControlType.String: {\n\t\t\treturn value\n\t\t}\n\n\t\tcase ControlType.Number: {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tvalue: String(value.value),\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null\n}\n\nexport function valueToString(value: DatabaseValue) {\n\tconst cast = castString(value)\n\treturn cast?.value ?? null\n}\n\n/**\n * @important Types must be JSON serializable.\n */\nexport type DatabaseValue =\n\t| DatabaseArrayValue\n\t| DatabaseBooleanValue\n\t| DatabaseColorValue\n\t| DatabaseDateValue\n\t| DatabaseEnumValue\n\t| DatabaseFileValue\n\t| DatabaseLinkValue\n\t| DatabaseNumberValue\n\t| DatabaseObjectValue\n\t| DatabaseResponsiveImageValue\n\t| DatabaseRichTextValue\n\t| DatabaseStringValue\n\t| DatabaseVectorSetItemValue\n\t| null\n\nexport const DatabaseValue = {\n\t/**\n\t * Casts a value to a different type.\n\t */\n\tcast(value: DatabaseValue, definition: DatabaseValueDefinition): DatabaseValue {\n\t\tswitch (definition.type) {\n\t\t\tcase ControlType.Array:\n\t\t\t\treturn castArray(value, definition)\n\t\t\tcase ControlType.Boolean:\n\t\t\t\treturn castBoolean(value)\n\t\t\tcase ControlType.Color:\n\t\t\t\treturn castColor(value)\n\t\t\tcase ControlType.Date:\n\t\t\t\treturn castDate(value)\n\t\t\tcase ControlType.Enum:\n\t\t\t\treturn castEnum(value)\n\t\t\tcase ControlType.File:\n\t\t\t\treturn castFile(value)\n\t\t\tcase ControlType.Link:\n\t\t\t\treturn castLink(value)\n\t\t\tcase ControlType.Number:\n\t\t\t\treturn castNumber(value)\n\t\t\tcase ControlType.Object:\n\t\t\t\treturn castObject(value, definition)\n\t\t\tcase ControlType.ResponsiveImage:\n\t\t\t\treturn castResponsiveImage(value)\n\t\t\tcase ControlType.RichText:\n\t\t\t\treturn castRichText(value)\n\t\t\tcase ControlType.String:\n\t\t\t\treturn castString(value)\n\t\t\tcase ControlType.VectorSetItem:\n\t\t\t\treturn castVectorSetItem(value)\n\t\t\tcase \"unknown\":\n\t\t\t\treturn value\n\t\t\tdefault:\n\t\t\t\tassertNever(definition, \"Unsupported cast\")\n\t\t}\n\t},\n\n\t/**\n\t * Parses a JavaScript variable into a DatabaseValue.\n\t */\n\tparse(value: unknown): DatabaseValue {\n\t\tif (isBoolean(value)) {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Boolean,\n\t\t\t\tvalue,\n\t\t\t}\n\t\t}\n\n\t\tif (isValidDate(value)) {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Date,\n\t\t\t\tvalue: value.toISOString(),\n\t\t\t}\n\t\t}\n\n\t\tif (isNumber(value)) {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Number,\n\t\t\t\tvalue,\n\t\t\t}\n\t\t}\n\n\t\tif (isString(value)) {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tvalue,\n\t\t\t}\n\t\t}\n\n\t\tif (isArray(value)) {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Array,\n\t\t\t\tvalue: value.map(DatabaseValue.parse),\n\t\t\t}\n\t\t}\n\n\t\treturn null\n\t},\n\n\t/**\n\t * Checks if the left value is equal to the right value. Returns false if\n\t * the values are not of the same type.\n\t */\n\tequal(left: DatabaseValue, right: DatabaseValue, collation: DatabaseCollation) {\n\t\tif (left?.type !== right?.type) {\n\t\t\treturn false\n\t\t}\n\n\t\treturn compare(left, right, collation) === 0\n\t},\n\n\t/**\n\t * Checks if the left value is less than the right value. Returns false if\n\t * the values are not of the same type.\n\t */\n\tlessThan(left: DatabaseValue, right: DatabaseValue, collation: DatabaseCollation) {\n\t\tif (left?.type !== right?.type) {\n\t\t\treturn false\n\t\t}\n\n\t\treturn compare(left, right, collation) < 0\n\t},\n\n\t/**\n\t * Checks if the left value is less than or equal to the right value.\n\t * Returns false if the values are not of the same type.\n\t */\n\tlessThanOrEqual(left: DatabaseValue, right: DatabaseValue, collation: DatabaseCollation) {\n\t\tif (left?.type !== right?.type) {\n\t\t\treturn false\n\t\t}\n\n\t\treturn compare(left, right, collation) <= 0\n\t},\n\n\t/**\n\t * Checks if the left value is greater than the right value. Returns false\n\t * if the values are not of the same type.\n\t */\n\tgreaterThan(left: DatabaseValue, right: DatabaseValue, collation: DatabaseCollation) {\n\t\tif (left?.type !== right?.type) {\n\t\t\treturn false\n\t\t}\n\n\t\treturn compare(left, right, collation) > 0\n\t},\n\n\t/**\n\t * Checks if the left value is greater than or equal to the right value.\n\t * Returns false if the values are not of the same type.\n\t */\n\tgreaterThanOrEqual(left: DatabaseValue, right: DatabaseValue, collation: DatabaseCollation) {\n\t\tif (left?.type !== right?.type) {\n\t\t\treturn false\n\t\t}\n\n\t\treturn compare(left, right, collation) >= 0\n\t},\n\n\t/**\n\t * Checks if the left value is in the right value. Returns false if the\n\t * right value is not an array.\n\t */\n\tin(left: DatabaseValue, right: DatabaseValue, collation: DatabaseCollation) {\n\t\tif (right?.type !== ControlType.Array) return false\n\n\t\treturn right.value.some(item => {\n\t\t\treturn DatabaseValue.equal(item, left, collation)\n\t\t})\n\t},\n\n\t/**\n\t * Get the index of the first occurrence of `target` in `source`.\n\t *\n\t * If source has duplicates, the index of the first occurrence is always returned.\n\t */\n\tindexOf(source: DatabaseValue, target: DatabaseValue, collation: DatabaseCollation) {\n\t\tif (source?.type !== ControlType.Array) return -1\n\n\t\treturn source.value.findIndex(item => {\n\t\t\treturn DatabaseValue.equal(item, target, collation)\n\t\t})\n\t},\n\n\tcontains(source: DatabaseValue, target: DatabaseValue, collation: DatabaseCollation) {\n\t\tlet sourceValue = valueToString(source)\n\t\tlet targetValue = valueToString(target)\n\n\t\tif (isNull(sourceValue)) return false\n\t\tif (isNull(targetValue)) return false\n\n\t\tif (collation.type === DatabaseCollationType.CaseInsensitive) {\n\t\t\tsourceValue = sourceValue.toLowerCase()\n\t\t\ttargetValue = targetValue.toLowerCase()\n\t\t}\n\n\t\treturn sourceValue.includes(targetValue)\n\t},\n\n\tstartsWith(source: DatabaseValue, target: DatabaseValue, collation: DatabaseCollation) {\n\t\tlet sourceValue = valueToString(source)\n\t\tlet targetValue = valueToString(target)\n\n\t\tif (isNull(sourceValue)) return false\n\t\tif (isNull(targetValue)) return false\n\n\t\tif (collation.type === DatabaseCollationType.CaseInsensitive) {\n\t\t\tsourceValue = sourceValue.toLowerCase()\n\t\t\ttargetValue = targetValue.toLowerCase()\n\t\t}\n\n\t\treturn sourceValue.startsWith(targetValue)\n\t},\n\n\tendsWith(source: DatabaseValue, target: DatabaseValue, collation: DatabaseCollation) {\n\t\tlet sourceValue = valueToString(source)\n\t\tlet targetValue = valueToString(target)\n\n\t\tif (isNull(sourceValue)) return false\n\t\tif (isNull(targetValue)) return false\n\n\t\tif (collation.type === DatabaseCollationType.CaseInsensitive) {\n\t\t\tsourceValue = sourceValue.toLowerCase()\n\t\t\ttargetValue = targetValue.toLowerCase()\n\t\t}\n\n\t\treturn sourceValue.endsWith(targetValue)\n\t},\n\n\tlength(value: DatabaseValue) {\n\t\tswitch (value?.type) {\n\t\t\tcase ControlType.Array:\n\t\t\t\treturn value.value.length\n\t\t}\n\n\t\treturn 0\n\t},\n\n\tstringify(value: DatabaseValue): string {\n\t\tif (value === null) {\n\t\t\treturn \"null\"\n\t\t}\n\n\t\tswitch (value.type) {\n\t\t\tcase ControlType.Array:\n\t\t\t\treturn `[${value.value.map(DatabaseValue.stringify).join(\", \")}]`\n\t\t\tcase ControlType.Boolean:\n\t\t\tcase ControlType.Number:\n\t\t\t\treturn String(value.value)\n\t\t\tcase ControlType.String:\n\t\t\t\treturn `'${value.value}'`\n\t\t\tcase ControlType.Enum:\n\t\t\t\treturn `'${value.value}' /* Enum */`\n\t\t\tcase ControlType.Color:\n\t\t\t\treturn `'${value.value}' /* Color */`\n\t\t\tcase ControlType.Date:\n\t\t\t\treturn `'${value.value}' /* Date */`\n\t\t\tcase ControlType.RichText:\n\t\t\t\treturn \"RichText\"\n\t\t\tcase ControlType.VectorSetItem:\n\t\t\t\treturn \"VectorSetItem\"\n\t\t\tcase ControlType.ResponsiveImage:\n\t\t\t\treturn \"ResponsiveImage\"\n\t\t\tcase ControlType.File:\n\t\t\t\treturn \"File\"\n\t\t\tcase ControlType.Link:\n\t\t\t\treturn isString(value.value) ? `'${value.value}' /* Link */` : \"Link\"\n\t\t\tcase ControlType.Object:\n\t\t\t\treturn \"Object\"\n\t\t\tdefault:\n\t\t\t\tassertNever(value)\n\t\t}\n\t},\n}\n\n/**\n * Compares two DatabaseValue of the same type. Returns a negative number if\n * the left value is less than the right value, a positive number if the\n * left value is greater than the right value, and 0 if they are equal.\n */\nfunction compare(left: DatabaseValue, right: DatabaseValue, collation: DatabaseCollation): number {\n\tif (isNull(left) || isNull(right)) {\n\t\tassert(left === right)\n\t\treturn 0\n\t}\n\n\tswitch (left.type) {\n\t\tcase ControlType.Array: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareArray(left, right, collation)\n\t\t}\n\n\t\tcase ControlType.Boolean: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareBoolean(left, right)\n\t\t}\n\n\t\tcase ControlType.Color: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareColor(left, right)\n\t\t}\n\n\t\tcase ControlType.Date: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareDate(left, right)\n\t\t}\n\n\t\tcase ControlType.Enum: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareEnum(left, right)\n\t\t}\n\n\t\tcase ControlType.File: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareFile(left, right)\n\t\t}\n\n\t\tcase ControlType.Link: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareLink(left, right)\n\t\t}\n\n\t\tcase ControlType.Number: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareNumber(left, right)\n\t\t}\n\n\t\tcase ControlType.Object: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareObject(left, right, collation)\n\t\t}\n\n\t\tcase ControlType.ResponsiveImage: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareResponsiveImage(left, right)\n\t\t}\n\n\t\tcase ControlType.RichText: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareRichText(left, right)\n\t\t}\n\n\t\tcase ControlType.VectorSetItem: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareVectorSetItem(left, right)\n\t\t}\n\n\t\tcase ControlType.String: {\n\t\t\tassert(left.type === right.type)\n\t\t\treturn compareString(left, right, collation)\n\t\t}\n\n\t\tdefault: {\n\t\t\tassertNever(left)\n\t\t}\n\t}\n}\n", "import type { ControlType } from \"../../render/types/PropertyControls.ts\"\n\n// The types in this file are very similar to ControlDescriptions but are used\n// to define the fields of a DatabaseCollectionModule and its indexes.\n\ninterface BaseDatabaseValueDefinition {\n\treadonly isNullable: boolean\n}\n\nexport interface DatabaseArrayValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.Array\n\treadonly definition: DatabaseValueDefinition\n}\n\nexport interface DatabaseBooleanValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.Boolean\n}\n\nexport interface DatabaseColorValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.Color\n}\n\nexport interface DatabaseDateValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.Date\n}\n\nexport interface DatabaseEnumValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.Enum\n}\n\nexport interface DatabaseFileValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.File\n}\n\nexport interface DatabaseLinkValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.Link\n}\n\nexport interface DatabaseNumberValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.Number\n}\n\nexport interface DatabaseObjectValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.Object\n\treadonly definitions: Record<string, DatabaseValueDefinition>\n}\n\nexport interface DatabaseResponsiveImageValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.ResponsiveImage\n}\n\nexport interface DatabaseRichTextValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.RichText\n}\n\nexport interface DatabaseStringValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.String\n}\n\nexport interface DatabaseVectorSetItemValueDefinition extends BaseDatabaseValueDefinition {\n\treadonly type: ControlType.VectorSetItem\n}\n\n/**\n * An internal value definition that is used to represent an unknown value. This\n * is used to represent constants before the `Normalizer` casts them to a more\n * specific type.\n */\nexport interface DatabaseUnknownValueDefinition extends BaseDatabaseValueDefinition {\n\t/** @internal */\n\treadonly type: \"unknown\"\n}\n\nexport const unknownDefinition: DatabaseUnknownValueDefinition = {\n\ttype: \"unknown\",\n\tisNullable: true,\n}\n\nexport type DatabaseValueDefinition =\n\t| DatabaseArrayValueDefinition\n\t| DatabaseBooleanValueDefinition\n\t| DatabaseColorValueDefinition\n\t| DatabaseDateValueDefinition\n\t| DatabaseEnumValueDefinition\n\t| DatabaseFileValueDefinition\n\t| DatabaseLinkValueDefinition\n\t| DatabaseNumberValueDefinition\n\t| DatabaseObjectValueDefinition\n\t| DatabaseResponsiveImageValueDefinition\n\t| DatabaseRichTextValueDefinition\n\t| DatabaseStringValueDefinition\n\t| DatabaseVectorSetItemValueDefinition\n\t// Internal types\n\t| DatabaseUnknownValueDefinition\n", "import type { ReactNode } from \"react\"\nimport { ControlType } from \"../../render/types/PropertyControls.ts\"\nimport type { Mutable } from \"../../utils/Mutable.ts\"\nimport { getPropertyControls } from \"../../utils/addPropertyControls.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport { isNullish, isUndefined } from \"../../utils/utils.ts\"\nimport { LazyValue } from \"../LazyValue.ts\"\nimport type { DatabaseValue } from \"./DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"./DatabaseValueDefinition.ts\"\nimport type { MaybeLocale } from \"./QueryEngine.ts\"\nimport type {\n\tAnyLegacyCollection,\n\tDatabaseCollection,\n\tDatabaseIndex,\n\tDatabaseItem,\n\tDatabaseItemPointer,\n\tDatabaseSchema,\n\tLegacyCollectionItems,\n} from \"./types.ts\"\nimport { isLegacyLocalizedCollection } from \"./types.ts\"\n\nasync function getCollectionItems(\n\tcollection: AnyLegacyCollection,\n\tlocale: MaybeLocale,\n): Promise<LegacyCollectionItems> {\n\tif (isLegacyLocalizedCollection(collection)) {\n\t\tawait collection.preload(locale)\n\t\treturn collection.read(locale)\n\t}\n\n\treturn collection\n}\n\nexport class CompatibilityDatabaseCollection implements DatabaseCollection {\n\treadonly schema: DatabaseSchema\n\treadonly indexes: DatabaseIndex[] = []\n\n\tconstructor(\n\t\treadonly collection: AnyLegacyCollection,\n\t\treadonly locale: MaybeLocale,\n\t) {\n\t\tconst propertyControls = getPropertyControls(collection)\n\t\tassert(propertyControls, \"Collection does not have properties\")\n\n\t\tconst schema: Mutable<DatabaseSchema> = {\n\t\t\tid: {\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tisNullable: false,\n\t\t\t},\n\t\t}\n\n\t\tconst controlEntries = Object.entries(propertyControls)\n\t\tfor (const [key, controlDescription] of controlEntries) {\n\t\t\tif (!controlDescription) continue\n\n\t\t\tconst type = controlDescription.type as DatabaseValueDefinition[\"type\"]\n\n\t\t\tassert(type !== ControlType.Array, \"Array properties are not supported\")\n\t\t\tassert(type !== ControlType.Object, \"Object properties are not supported\")\n\n\t\t\tschema[key] = {\n\t\t\t\ttype,\n\t\t\t\tisNullable: true,\n\t\t\t}\n\t\t}\n\n\t\tthis.schema = schema\n\t}\n\n\tprivate getDatabaseItem(item: Record<string, unknown>, pointer: DatabaseItemPointer) {\n\t\tconst data: Record<string, DatabaseValue> = {}\n\t\tconst itemIndex = Number(pointer)\n\n\t\tfor (const key in this.schema) {\n\t\t\tconst value = item[key]\n\t\t\tif (isNullish(value)) continue\n\n\t\t\tconst definition = this.schema[key]\n\t\t\tif (isUndefined(definition)) continue\n\n\t\t\tassert(definition.type !== \"unknown\", \"Invalid definition type\")\n\n\t\t\t// For rich text, serialize the pointer as a structured object\n\t\t\tif (definition.type === ControlType.RichText) {\n\t\t\t\tdata[key] = {\n\t\t\t\t\ttype: definition.type,\n\t\t\t\t\tvalue: { itemIndex, key },\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tdata[key] = {\n\t\t\t\ttype: definition.type,\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: Existing.\n\t\t\t\tvalue: value as any,\n\t\t\t}\n\t\t}\n\n\t\treturn { pointer, data }\n\t}\n\n\tasync resolveRichText(pointer: { itemIndex: number; key: string }) {\n\t\tconst { itemIndex, key } = pointer\n\t\tconst items = await getCollectionItems(this.collection, this.locale)\n\t\tconst richText = items[itemIndex]?.[key] as ReactNode | LazyValue<ReactNode>\n\n\t\tif (LazyValue.is(richText)) {\n\t\t\treturn richText.readMaybeAsync()\n\t\t}\n\t\treturn richText\n\t}\n\n\tasync scanItems() {\n\t\tconst items = await getCollectionItems(this.collection, this.locale)\n\n\t\treturn items.map((item, index) => {\n\t\t\tconst pointer = String(index)\n\t\t\treturn this.getDatabaseItem(item, pointer)\n\t\t})\n\t}\n\n\tasync resolveItems(pointers: DatabaseItemPointer[]) {\n\t\tconst items = await getCollectionItems(this.collection, this.locale)\n\n\t\treturn pointers.map(pointer => {\n\t\t\tconst index = Number(pointer)\n\t\t\tconst item = items[index]\n\t\t\tassert(item, \"Can't find collection item\")\n\t\t\treturn this.getDatabaseItem(item, pointer)\n\t\t})\n\t}\n\n\tcompareItems(left: DatabaseItem, right: DatabaseItem) {\n\t\treturn Number(left.pointer) - Number(right.pointer)\n\t}\n}\n", "import { type AnyCollection, isAnyDatabaseCollection } from \"./types.ts\"\n\n// The ModulesRuntime can import a collection multiple times, e.g. when a component that is used in the collection changes.\n// In that case, we cannot use the collection id to cache the query, because the e.g. the component could have changed.\n// So we first time we see a different Collection module reference, we start generating random ids in a weak map below.\nconst persistedCollectionIdToSeenCollectionRef = new Map<string, WeakRef<AnyCollection>>()\n// We need stable collection ids so that the query can be cached and we don't suspend infinitely.\n// Only when the reference of the Collection module updates, we store a new id so that e.g. the preview updates correctly.\nconst collectionRefToStableCollectionId = new WeakMap<AnyCollection, string>()\n\nconst prefix = \"$r_\"\n\nexport function hasRandomCollectionId(id: string) {\n\treturn id.includes(prefix)\n}\n\nfunction getPersistedCollectionId(collection: AnyCollection): string | undefined {\n\tif (!isAnyDatabaseCollection(collection)) return undefined\n\tif (!collection.id) return undefined\n\n\tconst existingCollectionRef = persistedCollectionIdToSeenCollectionRef.get(collection.id)\n\tif (!existingCollectionRef) {\n\t\tpersistedCollectionIdToSeenCollectionRef.set(collection.id, new WeakRef(collection))\n\t\treturn collection.id\n\t}\n\n\tif (existingCollectionRef.deref() === collection) {\n\t\treturn collection.id\n\t}\n\n\t// New Collection ref, don't use the persisted id anymore\n\treturn undefined\n}\nexport function getCollectionId(collection: AnyCollection) {\n\tconst persistedId = getPersistedCollectionId(collection)\n\tif (persistedId) return persistedId\n\n\tconst stableCollectionId = collectionRefToStableCollectionId.get(collection)\n\tif (stableCollectionId) return stableCollectionId\n\n\t// Isomorphic way to get a good enough random ID. We don't use a UUID, because crypto.randomUUID is not\n\t// available in all browsers Framer sites support.\n\tconst id = `${prefix}${Math.random().toString(16).slice(2)}`\n\tcollectionRefToStableCollectionId.set(collection, id)\n\treturn id\n}\n", "import { defaultLocaleId } from \"../../router/types.ts\"\nimport { assertNever } from \"../../utils/assert.ts\"\nimport { CompatibilityDatabaseCollection } from \"./CompatibilityDatabaseCollection.ts\"\nimport type { MaybeLocale } from \"./QueryEngine.ts\"\nimport { getCollectionId } from \"./getCollectionId.ts\"\nimport {\n\ttype AnyCollection,\n\ttype DatabaseCollection,\n\tisAnyLegacyCollection,\n\tisDatabaseCollection,\n\tisLocalizedDatabaseCollection,\n} from \"./types.ts\"\n\nconst compatibilityCache = new Map<string, CompatibilityDatabaseCollection>()\n\nexport function getCollectionForLocale(data: AnyCollection, locale: MaybeLocale): DatabaseCollection {\n\tif (isAnyLegacyCollection(data)) {\n\t\tconst collectionId = getCollectionId(data)\n\t\tconst localeId = locale?.id ?? defaultLocaleId\n\t\tconst cacheKey = collectionId + localeId\n\n\t\tconst cached = compatibilityCache.get(cacheKey)\n\t\tif (cached) return cached\n\n\t\tconst collection = new CompatibilityDatabaseCollection(data, locale)\n\t\tcompatibilityCache.set(cacheKey, collection)\n\n\t\treturn collection\n\t}\n\n\tif (isDatabaseCollection(data)) {\n\t\treturn data\n\t}\n\n\tif (isLocalizedDatabaseCollection(data)) {\n\t\twhile (locale) {\n\t\t\tconst collection = data.collectionByLocaleId[locale.id]\n\t\t\tif (collection) return collection\n\t\t\tlocale = locale.fallback\n\t\t}\n\n\t\treturn data.collectionByLocaleId.default\n\t}\n\n\tassertNever(data, \"Unsupported collection type\")\n}\n", "/**\n * Returns the estimated network latency in ms.\n */\nfunction getNetworkLatency() {\n\treturn 25\n}\n\n/**\n * Returns the estimated network speed in bytes per ms.\n */\nfunction getNetworkSpeed() {\n\treturn 100 /* Mbit/s */ * 125\n}\n\nexport const KB = 1_000\nexport const MB = 1_000_000\n\nexport class Cost {\n\tconstructor(\n\t\t/**\n\t\t * The estimated network time required to execute the node in ms.\n\t\t */\n\t\tprivate network: number,\n\t) {}\n\n\tstatic estimate(totalRequests: number, transferredBytes: number) {\n\t\tconst latency = getNetworkLatency()\n\t\tconst speed = getNetworkSpeed()\n\t\tconst network = totalRequests * latency + transferredBytes / speed\n\t\treturn new Cost(network)\n\t}\n\n\tstatic max(left: Cost, right: Cost) {\n\t\tconst network = Math.max(left.network, right.network)\n\t\treturn new Cost(network)\n\t}\n\n\tstatic compare(left: Cost, right: Cost) {\n\t\tif (left.network < right.network) return -1\n\t\tif (left.network > right.network) return 1\n\t\treturn 0\n\t}\n\n\tadd(cost: Cost) {\n\t\tthis.network += cost.network\n\t\treturn this\n\t}\n\n\ttoString() {\n\t\treturn `${this.network}ms`\n\t}\n}\n", "import type { Opaque } from \"../../../utils/Opaque.ts\"\nimport { assert } from \"../../../utils/assert.ts\"\nimport { Cost } from \"./Cost.ts\"\nimport type { Hash } from \"./Hashable.ts\"\nimport type { RelationalProps } from \"./LogicalProps.ts\"\nimport type { RequiredProps } from \"./PhysicalProps.ts\"\nimport type { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\n\nexport type GroupId = Opaque<number, \"GroupId\">\nexport function GroupId(id: number) {\n\treturn id as GroupId\n}\n\n/**\n * A group contains a list of nodes that are logically equivalent. This means\n * that all nodes in the group return the same set of tuples, but the order of\n * the tuples may be different. After a group is optimized for a set of physical\n * props, it stores the best node and its cost in the winners map.\n */\nexport class Group {\n\t/**\n\t * A list of all nodes in the group. All nodes must have compatible\n\t * relational props.\n\t */\n\treadonly nodes: RelationalNode[] = []\n\n\t/**\n\t * A map of all winners in the group by their hash.\n\t */\n\treadonly winners = new Map<Hash, Winner>()\n\n\tconstructor(\n\t\t/**\n\t\t * The id of the group. This is used to uniquely identify the group in\n\t\t * the memo.\n\t\t */\n\t\treadonly id: GroupId,\n\t\t/**\n\t\t * The relational props of the group. All nodes in the group must have\n\t\t * equivalent relational props.\n\t\t */\n\t\treadonly relational: RelationalProps,\n\t) {}\n\n\t/**\n\t * Adds a node to the group. Throws an error if the node is already in a\n\t * group.\n\t */\n\taddNode(node: RelationalNode) {\n\t\tthis.nodes.push(node)\n\t\tnode.setGroup(this)\n\t}\n\n\t/**\n\t * Returns the winner for the given required physical props. The winner\n\t * stores the best node and its cost. This is used to find the best node in\n\t * the group.\n\t */\n\tgetWinner(required: RequiredProps) {\n\t\tconst hash = required.getHash()\n\n\t\tconst existing = this.winners.get(hash)\n\t\tif (existing) return existing\n\n\t\tconst winner = new Winner()\n\t\tthis.winners.set(hash, winner)\n\t\treturn winner\n\t}\n\n\t/**\n\t * Returns the optimized version of the node. The optimized version is the\n\t * node with the lowest cost with all children replaced with their optimized\n\t * versions. This is used to create the final optimized query plan.\n\t */\n\tgetOptimized(required: RequiredProps) {\n\t\tconst winner = this.getWinner(required)\n\t\tassert(winner.node, \"Group not optimized\")\n\n\t\tconst optimizer = winner.node.getOptimized(required)\n\t\toptimizer.setGroup(this)\n\t\treturn optimizer\n\t}\n}\n\n/**\n * The winner stores the best node and its cost of the group for a given set of\n * required physical props.\n */\nexport class Winner {\n\tnode: RelationalNode | undefined\n\tcost = new Cost(Infinity)\n\n\treadonly nodes: RelationalNode[] = []\n\n\tupdate(node: RelationalNode, cost: Cost) {\n\t\tthis.nodes.push(node)\n\n\t\tif (Cost.compare(cost, this.cost) < 0) {\n\t\t\tthis.node = node\n\t\t\tthis.cost = cost\n\t\t}\n\t}\n}\n", "import type { Hash, Hashable } from \"../Hashable.ts\"\n\nexport abstract class AbstractNode implements Hashable {\n\tconstructor(\n\t\t/**\n\t\t * Indicates whether the node can be evaluated synchronously.\n\t\t * Synchronous nodes are not allowed to yield values when they are\n\t\t * evaluated with the `evaluate()` method.\n\t\t */\n\t\treadonly isSynchronous: boolean,\n\t) {}\n\n\t/**\n\t * Returns a \"hash\" that uniquely identifies the node. This hash is used to\n\t * determine if two nodes are equivalent.\n\t */\n\tabstract getHash(): Hash\n}\n", "import { assert } from \"../../../../../utils/assert.ts\"\nimport type { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateAsync, evaluateSync } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport type { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Ordering } from \"../../Ordering.ts\"\nimport type { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation, Tuple } from \"../../Relation.ts\"\nimport { AbstractNode } from \"../AbstractNode.ts\"\n\nexport abstract class RelationalNode extends AbstractNode {\n\tprivate group: Group | undefined\n\n\t/**\n\t * Returns the group that the node belongs to. Throws an error if the node\n\t * is not in a group. This should only happen in the constructor because\n\t * every node is added to a group right after creation.\n\t */\n\tgetGroup() {\n\t\tassert(this.group, \"Node must be in a group\")\n\t\treturn this.group\n\t}\n\n\t/**\n\t * Adds the node to the given group. Throws an error if the node is already\n\t * in a group.\n\t */\n\tsetGroup(group: Group) {\n\t\tassert(!this.group, \"Node is already in a group\")\n\t\tthis.group = group\n\t}\n\n\t/**\n\t * Evaluates the node and all children synchronously. Throws an error if the\n\t * node is not synchronous.\n\t */\n\tevaluateSync() {\n\t\tconst generator = this.evaluate(undefined)\n\t\treturn evaluateSync(generator)\n\t}\n\n\t/**\n\t * Evaluates the node and all children asynchronously.\n\t */\n\tevaluateAsync() {\n\t\tconst generator = this.evaluate(undefined)\n\t\treturn evaluateAsync(generator)\n\t}\n\n\t/**\n\t * Returns the output fields of the node.\n\t */\n\tabstract getOutputFields(): Fields\n\n\t/**\n\t * Checks if the nodes provides the required ordering. If the node can't\n\t * provide the ordering we need to add an `EnforcerSort`.\n\t */\n\tabstract canProvideOrdering(ordering: Ordering): boolean\n\n\t/**\n\t * Checks if the node provides the required resolved fields. If the node\n\t * can't provide the resolved fields we need to add an `EnforcerResolve`.\n\t */\n\tabstract canProvideResolvedFields(resolvedFields: Fields): boolean\n\n\t/**\n\t * Optimizes all children and calculates the cost of the node.\n\t */\n\tabstract optimize(optimizer: Optimizer, required: RequiredProps): Cost\n\n\t/**\n\t * Returns an optimized version of the node with all children replaced by\n\t * their lowest cost alternatives.\n\t */\n\tabstract getOptimized(required: RequiredProps): RelationalNode\n\n\t/**\n\t * Evaluates the node and all children. This returns a generator so the\n\t * implementation can be either synchronous or asynchronous as indicated by\n\t * the `isSynchronous` property.\n\t */\n\tabstract evaluate(context: Tuple | undefined): Evaluate<Relation>\n}\n", "import type { Opaque } from \"../../../utils/Opaque.ts\"\nimport { assert } from \"../../../utils/assert.ts\"\nimport { isFunction, isObject } from \"../../../utils/utils.ts\"\nimport { Group } from \"./Group.ts\"\nimport { CollectionMetadata, FieldMetadata, IndexMetadata } from \"./Metadata.ts\"\nimport { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\n\nexport type Hash = Opaque<string, \"Hash\">\nfunction Hash(value: string): Hash {\n\treturn value as Hash\n}\n\n/**\n * Checks if a value is a hashable object.\n */\nfunction isHashable(value: unknown): value is Hashable {\n\treturn isObject(value) && isFunction(value.getHash)\n}\n\nexport interface Hashable {\n\t/**\n\t * Returns a hash that is used to compare objects for equality. The memo is\n\t * using this to check for duplicate nodes, and the group is using this to\n\t * get the winner for the required physical props.\n\t */\n\tgetHash(): Hash\n}\n\n/**\n * Calculates a hash for a list of values.\n */\nexport function calculateHash(name: string, ...values: unknown[]): Hash {\n\tconst hashes = values.map(value => {\n\t\t// TODO: Can we do this with TypeScript instead?\n\t\tconst isCollectionMetadata = value instanceof CollectionMetadata\n\t\tassert(!isCollectionMetadata, \"Pass CollectionMetadata.id instead\")\n\n\t\tconst isFieldMetadata = value instanceof FieldMetadata\n\t\tassert(!isFieldMetadata, \"Pass FieldMetadata.id instead\")\n\n\t\tconst isIndexMetadata = value instanceof IndexMetadata\n\t\tassert(!isIndexMetadata, \"Pass IndexMetadata.id instead\")\n\n\t\tconst isRelationalNode = value instanceof RelationalNode\n\t\tassert(!isRelationalNode, \"Pass RelationalNode.group.id instead\")\n\n\t\tconst isGroup = value instanceof Group\n\t\tassert(!isGroup, \"Pass Group.id instead\")\n\n\t\tif (isHashable(value)) {\n\t\t\treturn value.getHash()\n\t\t}\n\n\t\treturn JSON.stringify(value)\n\t})\n\n\treturn Hash(`${name}(${hashes.join(\", \")})`)\n}\n", "import type { ReactNode } from \"react\"\nimport { ControlType } from \"../../../render/types/PropertyControls.ts\"\nimport { assert } from \"../../../utils/assert.ts\"\nimport { isArray, isObject, isPromiseLike, isString } from \"../../../utils/utils.ts\"\nimport type {\n\tDatabaseArrayValue,\n\tDatabaseObjectValue,\n\tDatabaseRichTextValue,\n\tDatabaseValue,\n\tDatabaseVectorSetItemValue,\n} from \"../DatabaseValue.ts\"\nimport type { MaybeLocale, QueryExecutionOptions } from \"../QueryEngine.ts\"\nimport { getCollectionForLocale } from \"../getCollectionForLocale.ts\"\nimport { getCollectionId } from \"../getCollectionId.ts\"\nimport {\n\ttype DatabaseCollection,\n\ttype DatabaseRichTextPointer,\n\ttype DatabaseVectorSetItemPointer,\n\ttype Query,\n\tisAnyCollection,\n} from \"../types.ts\"\nimport { type Evaluate, evaluateArray, evaluateObject } from \"./Evaluate.ts\"\n\ninterface WrappedRichTextPointer {\n\tcollectionId: string\n\tpointer: DatabaseRichTextPointer\n}\n\nexport function wrapRichTextPointer(collection: DatabaseCollection, pointer: DatabaseRichTextPointer) {\n\treturn {\n\t\tcollectionId: getCollectionId(collection),\n\t\tpointer,\n\t}\n}\n\nfunction isWrappedRichTextPointer(value: DatabaseRichTextPointer): value is WrappedRichTextPointer {\n\treturn isObject(value) && isString(value.collectionId)\n}\n\ninterface WrappedVectorSetItemPointer {\n\tcollectionId: string\n\tpointer: DatabaseVectorSetItemPointer\n}\n\nexport function wrapVectorSetItemPointer(collection: DatabaseCollection, pointer: DatabaseVectorSetItemPointer) {\n\treturn {\n\t\tcollectionId: getCollectionId(collection),\n\t\tpointer,\n\t}\n}\n\nfunction isWrappedVectorSetItemPointer(value: DatabaseVectorSetItemPointer): value is WrappedVectorSetItemPointer {\n\treturn isObject(value) && isString(value.collectionId)\n}\n\nexport class Resolver {\n\treadonly collections: Map<string, DatabaseCollection>\n\n\tconstructor(\n\t\tquery: Query,\n\t\tlocale: MaybeLocale,\n\t\tprivate readonly options: QueryExecutionOptions = {},\n\t) {\n\t\tthis.collections = getCollectionsFromQuery(query, locale)\n\t}\n\n\tprivate *resolveArrayValue(value: DatabaseArrayValue): Evaluate<unknown[]> {\n\t\treturn yield* evaluateArray(\n\t\t\tvalue.value.map(item => {\n\t\t\t\treturn this.resolveValue(item)\n\t\t\t}),\n\t\t)\n\t}\n\n\tprivate *resolveObjectValue(value: DatabaseObjectValue): Evaluate<Record<string, unknown>> {\n\t\tconst result: Record<string, Evaluate<unknown>> = {}\n\n\t\tfor (const key in value.value) {\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: We are iterating over they keys.\n\t\t\tconst item = value.value[key]!\n\t\t\tresult[key] = this.resolveValue(item)\n\t\t}\n\n\t\treturn yield* evaluateObject(result)\n\t}\n\n\tprivate readonly richTextCache = new WeakMap<\n\t\tDatabaseCollection,\n\t\tMap<DatabaseRichTextPointer, unknown | Promise<unknown>>\n\t>()\n\n\tprivate loadRichTextValue(value: DatabaseRichTextValue): unknown | Promise<unknown> {\n\t\tconst wrapped = value.value\n\t\tassert(isWrappedRichTextPointer(wrapped), \"Rich text pointer must be wrapped\")\n\n\t\tconst collection = this.collections.get(wrapped.collectionId)\n\t\tassert(collection, \"Can't find collection for rich text pointer\")\n\n\t\tconst cache = this.richTextCache.get(collection) ?? new Map()\n\t\tthis.richTextCache.set(collection, cache)\n\n\t\tconst cached = cache.get(wrapped.pointer)\n\t\tif (cached) return cached\n\n\t\tconst result = this.options.richTextMode === \"raw\" ? wrapped.pointer : collection.resolveRichText(wrapped.pointer)\n\t\tcache.set(wrapped.pointer, result)\n\n\t\treturn result\n\t}\n\n\tpreloadRichTextValue(value: DatabaseRichTextValue) {\n\t\tvoid this.loadRichTextValue(value)\n\t}\n\n\tprivate *resolveRichTextValue(value: DatabaseRichTextValue): Evaluate<unknown> {\n\t\tconst result = this.loadRichTextValue(value)\n\t\tif (isPromiseLike(result)) return yield result\n\n\t\treturn result\n\t}\n\n\tprivate readonly vectorSetItemCache = new WeakMap<\n\t\tDatabaseCollection,\n\t\tMap<DatabaseVectorSetItemPointer, ReactNode | Promise<ReactNode>>\n\t>()\n\n\tprivate loadVectorSetItemValue(value: DatabaseVectorSetItemValue): ReactNode | Promise<ReactNode> {\n\t\tconst wrapped = value.value\n\t\tassert(isWrappedVectorSetItemPointer(wrapped), \"Vector set item pointer must be wrapped\")\n\n\t\tconst collection = this.collections.get(wrapped.collectionId)\n\t\tassert(collection, \"Can't find collection for vector set item pointer\")\n\t\tassert(collection.resolveVectorSetItem, \"Can't resolve vector set item pointer\")\n\n\t\tconst cache = this.vectorSetItemCache.get(collection) ?? new Map()\n\t\tthis.vectorSetItemCache.set(collection, cache)\n\n\t\tconst cached = cache.get(wrapped.pointer)\n\t\tif (cached) return cached\n\n\t\tconst result = collection.resolveVectorSetItem(wrapped.pointer)\n\t\tcache.set(wrapped.pointer, result)\n\n\t\treturn result\n\t}\n\n\tpreloadVectorSetItemValue(value: DatabaseVectorSetItemValue) {\n\t\tvoid this.loadVectorSetItemValue(value)\n\t}\n\n\tprivate *resolveVectorSetItemValue(value: DatabaseVectorSetItemValue): Evaluate<ReactNode> {\n\t\tconst result = this.loadVectorSetItemValue(value)\n\t\tif (isPromiseLike(result)) return yield result\n\n\t\treturn result\n\t}\n\n\t*resolveValue(value: DatabaseValue): Evaluate<unknown> {\n\t\tswitch (value?.type) {\n\t\t\tcase ControlType.Array:\n\t\t\t\treturn yield* this.resolveArrayValue(value)\n\n\t\t\tcase ControlType.Object:\n\t\t\t\treturn yield* this.resolveObjectValue(value)\n\n\t\t\tcase ControlType.RichText:\n\t\t\t\treturn yield* this.resolveRichTextValue(value)\n\n\t\t\tcase ControlType.VectorSetItem:\n\t\t\t\treturn yield* this.resolveVectorSetItemValue(value)\n\t\t}\n\n\t\treturn value?.value ?? null\n\t}\n}\n\nfunction getCollectionsFromQuery(query: Query, locale: MaybeLocale) {\n\tconst collections = new Map<string, DatabaseCollection>()\n\n\tfunction collect(value: unknown) {\n\t\tif (isObject(value)) {\n\t\t\tif (value.type === \"Collection\" && isAnyCollection(value.data)) {\n\t\t\t\tconst collection = getCollectionForLocale(value.data, locale)\n\t\t\t\tconst collectionId = getCollectionId(collection)\n\t\t\t\tcollections.set(collectionId, collection)\n\t\t\t} else {\n\t\t\t\tfor (const key in value) {\n\t\t\t\t\tconst property = value[key]\n\t\t\t\t\tcollect(property)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (isArray(value)) {\n\t\t\tfor (const item of value) {\n\t\t\t\tcollect(item)\n\t\t\t}\n\t\t}\n\t}\n\n\tcollect(query)\n\n\treturn collections\n}\n", "import { ControlType } from \"../../../render/types/PropertyControls.ts\"\nimport type { Opaque } from \"../../../utils/Opaque.ts\"\nimport { assert } from \"../../../utils/assert.ts\"\nimport type { DatabaseValue } from \"../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollection, DatabaseIndex, DatabaseItem } from \"../types.ts\"\nimport type { Hashable } from \"./Hashable.ts\"\nimport { calculateHash } from \"./Hashable.ts\"\nimport type { Ordering } from \"./Ordering.ts\"\nimport { wrapRichTextPointer, wrapVectorSetItemPointer } from \"./Resolver.ts\"\nimport type { ScalarNode } from \"./nodes/scalar/ScalarNode.ts\"\n\n/**\n * We have a special identifier called \"index\" to sort items based on the order\n * defined in the CMS. The index can only be used by the `EnforcerSort` node.\n */\nexport const VIRTUAL_INDEX_FIELD = \"index\"\n\nabstract class Metadata<T extends { id: number }> extends Set<T> implements Hashable {\n\tabstract name: string\n\n\tmerge(other: Metadata<T>) {\n\t\tfor (const item of other) {\n\t\t\tthis.add(item)\n\t\t}\n\t}\n\n\tequals(other: Metadata<T>) {\n\t\tif (this === other) return true\n\t\tif (this.size !== other.size) return false\n\n\t\tfor (const item of this) {\n\t\t\tif (!other.has(item)) return false\n\t\t}\n\n\t\treturn true\n\t}\n\n\tsubsetOf(other: Metadata<T>) {\n\t\tif (this === other) return true\n\t\tif (this.size > other.size) return false\n\n\t\tfor (const item of this) {\n\t\t\tif (!other.has(item)) return false\n\t\t}\n\n\t\treturn true\n\t}\n\n\tgetHash() {\n\t\tconst ids: number[] = []\n\n\t\tfor (const item of this) {\n\t\t\tids.push(item.id)\n\t\t}\n\n\t\t// Sort the items to ensure the hash is independent the insertion order.\n\t\tids.sort((a, b) => a - b)\n\n\t\treturn calculateHash(this.name, ...ids)\n\t}\n}\n\nexport type CollectionId = Opaque<number, \"CollectionId\">\nexport function CollectionId(id: number) {\n\treturn id as CollectionId\n}\n\nexport class CollectionMetadata {\n\treadonly indexes = new Indexes()\n\treadonly fields = new Fields()\n\n\tconstructor(\n\t\treadonly id: CollectionId,\n\t\t/**\n\t\t * The name of the field. This is only used for debugging and shouldn't\n\t\t * be used to resolve a field by its collection. To resolve a field by a\n\t\t * collection, use the `ScopeField.collectionName` instead.\n\t\t */\n\t\treadonly name: string | undefined,\n\t\t/**\n\t\t * The data from the CMS module for the collection.\n\t\t */\n\t\treadonly data: DatabaseCollection,\n\t) {}\n}\n\nexport class Collections extends Metadata<CollectionMetadata> {\n\treadonly name = \"Collections\"\n}\n\nexport type IndexId = Opaque<number, \"IndexId\">\nexport function IndexId(id: number) {\n\treturn id as IndexId\n}\n\nexport class IndexMetadata {\n\treadonly resolvedFields = new Fields()\n\n\tconstructor(\n\t\treadonly id: IndexId,\n\t\t/**\n\t\t * The data from the CMS module for the index.\n\t\t */\n\t\treadonly data: DatabaseIndex,\n\t\t/**\n\t\t * The collection that the index belongs to.\n\t\t */\n\t\treadonly collection: CollectionMetadata,\n\t\t/**\n\t\t * The lookup nodes of the index. They are used by the explorer to check\n\t\t * if the index can be used for a `RelationalIndexLookup` or\n\t\t * `RelationalLookupJoin`.\n\t\t */\n\t\treadonly lookupNodes: ScalarNode[],\n\t\t/**\n\t\t * The general constraint of the index. This is used by the explorer to\n\t\t * check if an index can be used instead of a `RelationalScan` or\n\t\t * `RelationalFilter`.\n\t\t */\n\t\treadonly constraint: ScalarNode | undefined,\n\t\t/**\n\t\t * The ordering of the index. This is used to check if an index can\n\t\t * provide the required ordering.\n\t\t */\n\t\treadonly ordering: Ordering,\n\t) {\n\t\t// Find all fields that are returned from the index. This is used to\n\t\t// check if an index can provide the required resolved fields.\n\t\tfor (const fieldName in data.schema) {\n\t\t\tfor (const field of collection.fields) {\n\t\t\t\tif (field.name === fieldName) {\n\t\t\t\t\tthis.resolvedFields.add(field)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport class Indexes extends Metadata<IndexMetadata> {\n\treadonly name = \"Indexes\"\n}\n\nexport type FieldId = Opaque<number, \"FieldId\">\nexport function FieldId(id: number) {\n\treturn id as FieldId\n}\n\nexport class FieldMetadata {\n\tconstructor(\n\t\treadonly id: FieldId,\n\t\t/**\n\t\t * The name of the field. This is only used for debugging and shouldn't\n\t\t * be used to resolve a field by its name. To resolve a field by name,\n\t\t * use the `ScopeField.name` instead.\n\t\t */\n\t\treadonly name: string | undefined,\n\t\t/**\n\t\t * The type definition of the field. Used by the normalizer to cast\n\t\t * constants to a specific type.\n\t\t */\n\t\treadonly definition: DatabaseValueDefinition,\n\t\t/**\n\t\t * The collection that the field belongs to. This is used to resolve a\n\t\t * field by the `EnforcerResolve`.\n\t\t */\n\t\treadonly collection: CollectionMetadata | undefined,\n\t) {}\n\n\tgetValue(item: DatabaseItem): DatabaseValue {\n\t\tassert(this.name, \"Can only get value of field with a name\")\n\t\tconst value = item.data[this.name]\n\n\t\tswitch (value?.type) {\n\t\t\tcase ControlType.RichText: {\n\t\t\t\tassert(this.collection, \"Rich text field must have a collection\")\n\n\t\t\t\treturn {\n\t\t\t\t\ttype: ControlType.RichText,\n\t\t\t\t\tvalue: wrapRichTextPointer(this.collection.data, value.value),\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcase ControlType.VectorSetItem: {\n\t\t\t\tassert(this.collection, \"Vector set item field must have a collection\")\n\n\t\t\t\treturn {\n\t\t\t\t\ttype: ControlType.VectorSetItem,\n\t\t\t\t\tvalue: wrapVectorSetItemPointer(this.collection.data, value.value),\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn value ?? null\n\t}\n}\n\nexport class Fields extends Metadata<FieldMetadata> {\n\treadonly name = \"Fields\"\n}\n", "import { OrderDirection } from \"../types.ts\"\nimport type { Hashable } from \"./Hashable.ts\"\nimport { calculateHash } from \"./Hashable.ts\"\nimport type { FieldMetadata, Fields } from \"./Metadata.ts\"\nimport { VIRTUAL_INDEX_FIELD } from \"./Metadata.ts\"\n\nexport class OrderingField implements Hashable {\n\tconstructor(\n\t\treadonly field: FieldMetadata,\n\t\treadonly direction: OrderDirection = OrderDirection.Ascending,\n\t) {}\n\n\tgetHash() {\n\t\treturn calculateHash(\"OrderingField\", this.field.id, this.direction)\n\t}\n}\n\n/**\n * Ordering describes how a relation should be sorted. If the ordering is empty,\n * the relation can be sorted in any order.\n */\nexport class Ordering implements Hashable {\n\treadonly fields: OrderingField[] = []\n\n\tconstructor(ordering?: Ordering) {\n\t\tif (ordering) {\n\t\t\tthis.merge(ordering)\n\t\t}\n\t}\n\n\tget length() {\n\t\treturn this.fields.length\n\t}\n\n\tgetHash() {\n\t\treturn calculateHash(\"Ordering\", ...this.fields)\n\t}\n\n\tpush(field: OrderingField) {\n\t\tthis.fields.push(field)\n\t}\n\n\tmerge(ordering: Ordering) {\n\t\tthis.fields.push(...ordering.fields)\n\t}\n\n\tequals(other: Ordering) {\n\t\tif (this === other) return true\n\t\tif (this.length !== other.length) return false\n\n\t\treturn this.getHash() === other.getHash()\n\t}\n\n\tprovidedByFields(fields: Fields) {\n\t\tfor (const { field } of this.fields) {\n\t\t\tif (fields.has(field)) continue\n\t\t\tif (field.name === VIRTUAL_INDEX_FIELD) continue\n\n\t\t\treturn false\n\t\t}\n\n\t\treturn true\n\t}\n}\n", "import type { Hashable } from \"./Hashable.ts\"\nimport { calculateHash } from \"./Hashable.ts\"\nimport type { Fields } from \"./Metadata.ts\"\nimport type { Ordering } from \"./Ordering.ts\"\nimport type { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\n\n/**\n * Required props describe the physical properties of the relation returned by a\n * relational node. Physical properties include the ordering of the relation and\n * the set of fields that have to be resolved. When a relational node can't\n * provide a required property, we wrap it with an `EnforcerNode` in the\n * optimizer.\n *\n * Physical properties are built top down. We start with a set of required\n * properties for the root node, and then recursively build up the required\n * properties for the child nodes as we optimize the query plan.\n *\n * Some nodes can pass the required properties to their children, while others\n * will add more to them. For example, a `RelationalFilter` node doesn't change\n * the ordering of the input node, but it requires that all fields referenced by\n * the predicate are resolved.\n */\nexport class RequiredProps implements Hashable {\n\tconstructor(\n\t\treadonly ordering: Ordering,\n\t\treadonly resolvedFields: Fields,\n\t) {}\n\n\tgetHash() {\n\t\treturn calculateHash(\"RequiredProps\", this.ordering, this.resolvedFields)\n\t}\n\n\t/**\n\t * Required props with no ordering and no resolved fields are considered\n\t * minimal. Every node can provide them.\n\t */\n\tget isMinimal() {\n\t\treturn this.ordering.length === 0 && this.resolvedFields.size === 0\n\t}\n\n\t/**\n\t * Checks if the node can provide the required props. If it can't, we need\n\t * to add enforcers that provides them.\n\t *\n\t * Some nodes don't provide the required props directly, but can pass them\n\t * through to their children. E.g. a `RelationalFilter` returns the relation\n\t * in the same order and with the same resolved fields as its input. These\n\t * nodes should return `true` and pass the required props to their children.\n\t */\n\tcanProvide(node: RelationalNode) {\n\t\treturn this.canProvideOrdering(node) && this.canProvideResolvedFields(node)\n\t}\n\n\t/**\n\t * Checks if the given node can provide the required ordering. If it can't,\n\t * we need to add an `EnforcerSort` node that provides it.\n\t */\n\tprivate canProvideOrdering(node: RelationalNode) {\n\t\t// All nodes can provide an arbitrary ordering.\n\t\tif (this.ordering.length === 0) return true\n\t\treturn node.canProvideOrdering(this.ordering)\n\t}\n\n\t/**\n\t * Checks if the given node can provide the required resolved fields. If it\n\t * can't, we need to add an `EnforcerResolve` node that provides it.\n\t */\n\tprivate canProvideResolvedFields(node: RelationalNode) {\n\t\t// All nodes can provide no resolved fields.\n\t\tif (this.resolvedFields.size === 0) return true\n\t\treturn node.canProvideResolvedFields(this.resolvedFields)\n\t}\n}\n", "import { assert } from \"../../../utils/assert.ts\"\nimport type { FieldMetadata } from \"./Metadata.ts\"\nimport { Fields } from \"./Metadata.ts\"\nimport { Ordering } from \"./Ordering.ts\"\nimport { RequiredProps } from \"./PhysicalProps.ts\"\nimport type { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\n\nexport type NamedFields = Record<string, FieldMetadata>\n\ninterface ScopeField {\n\t/**\n\t * The underlying field that is referenced by this scope field.\n\t */\n\treadonly field: FieldMetadata\n\t/**\n\t * The name of the field in the scope. This can be different from the name\n\t * in the `FieldMetadata` because fields can be renamed in the projection.\n\t */\n\treadonly name: string\n\t/**\n\t * The name of the collection that the fields belongs to. This can also be\n\t * different from the name in the `FieldMetadata` because fields can be\n\t * renamed in the projection.\n\t */\n\treadonly collectionName?: string\n}\n\n/**\n * The builder uses the scope to track available fields in the query. It's\n * similar to the concept of a scope in a programming language.\n *\n * Take the following query as an example:\n * ```\n * SELECT id AS article_id FROM articles\n * ORDER BY articles.title, article_id;\n * ```\n *\n * This query has two separate scopes:\n * - The first scope is for the `FROM` clause. The scope contains all fields of\n *   the articles collection.\n * - The second scope is for the `SELECT` clause. It contains the fields in the\n *   select list.\n *\n * Because the `ORDER BY` clause has access to the \"select\" scope, it can\n * resolve the `article_id` field. It can also resolve the `articles.title`\n * field because the \"from\" scope is the parent of the \"select\" scope.\n */\nexport class Scope {\n\t/**\n\t * The last node built in the scope.\n\t */\n\tprivate node: RelationalNode | undefined\n\n\t/**\n\t * Returns the last node built in the scope and removes it from the scope.\n\t * Throws an error if no node was built in the scope yet.\n\t */\n\ttakeNode() {\n\t\tconst node = this.node\n\t\tassert(node, \"Node is missing\")\n\t\tthis.node = undefined\n\t\treturn node\n\t}\n\n\t/**\n\t * Sets the last node built in the scope. Throws an error if there is\n\t * already a node in the scope.\n\t */\n\tsetNode(node: RelationalNode) {\n\t\tassert(!this.node, \"Node already set\")\n\t\tthis.node = node\n\t}\n\n\t/**\n\t * The required ordering of the scope.\n\t */\n\tprivate ordering: Ordering | undefined\n\n\tsetOrdering(ordering: Ordering) {\n\t\tthis.ordering = ordering\n\t}\n\n\t/**\n\t * A list of all fields available in the scope.\n\t */\n\tprivate readonly fields: ScopeField[] = []\n\n\tconstructor(\n\t\t/**\n\t\t * The parent scope of the current scope. All fields available in the\n\t\t * parent scope are also available in the current scope.\n\t\t */\n\t\treadonly parent?: Scope,\n\t) {}\n\n\t/**\n\t * Create a new scope with the this scope as its parent.\n\t */\n\tpush() {\n\t\treturn new Scope(this)\n\t}\n\n\t/**\n\t * Creates a new scope with the parent of the this scope as its parent.\n\t */\n\treplace() {\n\t\treturn new Scope(this.parent)\n\t}\n\n\t/**\n\t * Adds a field to this scope. Any fields that are added will be available\n\t * in the this scope and all of its children.\n\t */\n\taddField(scopeField: ScopeField) {\n\t\tthis.fields.push(scopeField)\n\t}\n\n\t/**\n\t * Merges all fields from the given scope into the this scope.\n\t */\n\taddFieldsFromScope(scope: Scope) {\n\t\tfor (const scopeField of scope.fields) {\n\t\t\tthis.addField(scopeField)\n\t\t}\n\t}\n\n\t/**\n\t * Resolves a field from this scope. If the field is not found, the parent\n\t * scope is checked. If the name of a field is ambiguous, an error is\n\t * thrown.\n\t */\n\tresolveField(name: string, collection: string | undefined): ScopeField | undefined {\n\t\tconst candidates: ScopeField[] = []\n\n\t\tfor (const field of this.fields) {\n\t\t\tif (field.name !== name) continue\n\t\t\tif (collection && field.collectionName !== collection) continue\n\n\t\t\tcandidates.push(field)\n\t\t}\n\n\t\tif (candidates.length === 1) {\n\t\t\treturn candidates[0]\n\t\t}\n\n\t\tif (candidates.length > 1) {\n\t\t\tthrow new Error(\"Ambiguous fields\")\n\t\t}\n\n\t\treturn this.parent?.resolveField(name, collection)\n\t}\n\n\t/**\n\t * Checks if the scope or any parent scope has the given scope field.\n\t */\n\thas(scopeField: ScopeField): boolean {\n\t\tif (this.fields.includes(scopeField)) {\n\t\t\treturn true\n\t\t}\n\n\t\treturn this.parent?.has(scopeField) ?? false\n\t}\n\n\t/**\n\t * Returns the required ordering for the scope.\n\t */\n\tgetRequiredOrdering() {\n\t\treturn this.ordering ?? new Ordering()\n\t}\n\n\t/**\n\t * Returns the required resolved fields for the scope.\n\t */\n\tgetRequiredResolvedFields() {\n\t\tconst resolvedFields = new Fields()\n\n\t\tfor (const { field } of this.fields) {\n\t\t\tif (field.collection) {\n\t\t\t\tresolvedFields.add(field)\n\t\t\t}\n\t\t}\n\n\t\treturn resolvedFields\n\t}\n\n\t/**\n\t * Returns the set of required physical props for this scope. This is used\n\t * to create the required props for the root node in the optimizer.\n\t */\n\tgetRequiredProps() {\n\t\tconst ordering = this.getRequiredOrdering()\n\t\tconst resolvedFields = this.getRequiredResolvedFields()\n\t\treturn new RequiredProps(ordering, resolvedFields)\n\t}\n\n\t/**\n\t * Returns a map of the fields in this scope, with their scope names as\n\t * keys. This is used to create the final `QueryResult` with the correct\n\t * field names.\n\t */\n\tgetNamedFields() {\n\t\tconst namedFields: NamedFields = {}\n\n\t\tfor (const { name, field } of this.fields) {\n\t\t\tnamedFields[name] = field\n\t\t}\n\n\t\treturn namedFields\n\t}\n\n\t/**\n\t * Returns the single field from this scope if it only contains one field.\n\t * Throws an error if there are more than one fields.\n\t */\n\tgetSingleField(): FieldMetadata {\n\t\tassert(this.fields.length === 1, \"Scope must contain exactly one field\")\n\n\t\tconst scopeField = this.fields[0]\n\t\tassert(scopeField, \"Field must exist\")\n\n\t\treturn scopeField.field\n\t}\n}\n", "import type { DatabaseValue } from \"../DatabaseValue.ts\"\nimport type { DatabaseItemPointer } from \"../types.ts\"\nimport type { CollectionMetadata, FieldMetadata } from \"./Metadata.ts\"\nimport { Fields } from \"./Metadata.ts\"\n\n/**\n * A tuple is a single item in a relation. It contains the values for each field\n * and the pointers for each collection.\n */\nexport class Tuple {\n\treadonly pointers = new Map<CollectionMetadata, DatabaseItemPointer>()\n\treadonly values = new Map<FieldMetadata, DatabaseValue>()\n\n\tgetKey() {\n\t\tconst result: string[] = []\n\n\t\tfor (const [collection, pointer] of this.pointers) {\n\t\t\tresult.push(`${collection.id}-${pointer}`)\n\t\t}\n\n\t\treturn result.sort().join(\"-\")\n\t}\n\n\taddValue(field: FieldMetadata, value: DatabaseValue) {\n\t\tthis.values.set(field, value)\n\t}\n\n\tgetValue(field: FieldMetadata) {\n\t\treturn this.values.get(field) ?? null\n\t}\n\n\tmergeValues(tuple: Tuple) {\n\t\tfor (const [field, value] of tuple.values) {\n\t\t\tthis.addValue(field, value)\n\t\t}\n\t}\n\n\taddPointer(collection: CollectionMetadata, pointer: DatabaseItemPointer) {\n\t\tthis.pointers.set(collection, pointer)\n\t}\n\n\tgetPointer(collection: CollectionMetadata) {\n\t\treturn this.pointers.get(collection)\n\t}\n\n\tmergePointers(tuple: Tuple) {\n\t\tfor (const [collection, pointer] of tuple.pointers) {\n\t\t\tthis.addPointer(collection, pointer)\n\t\t}\n\t}\n\n\tmerge(tuple: Tuple) {\n\t\tthis.mergeValues(tuple)\n\t\tthis.mergePointers(tuple)\n\t}\n}\n\n/**\n * A relation is the list of tuples returned by a relational node. We use the\n * name relation to distinguish them from the raw items returned by the CMS\n * module.\n */\nexport class Relation {\n\tconstructor(\n\t\treadonly fields: Fields,\n\t\treadonly tuples: Tuple[] = [],\n\t) {}\n\n\tpush(tuple: Tuple) {\n\t\tthis.tuples.push(tuple)\n\t}\n\n\tfilter(predicate: (tuple: Tuple, index: number) => boolean) {\n\t\tconst tuples = this.tuples.filter(predicate)\n\t\treturn new Relation(this.fields, tuples)\n\t}\n\n\tmap(fields: Fields, callback: (tuple: Tuple, index: number) => Tuple) {\n\t\tconst tuples = this.tuples.map(callback)\n\t\treturn new Relation(fields, tuples)\n\t}\n\n\tsort(callback: (left: Tuple, right: Tuple) => number) {\n\t\tconst tuples = Array.from(this.tuples).sort(callback)\n\t\treturn new Relation(this.fields, tuples)\n\t}\n\n\tslice(start: number, end?: number) {\n\t\tconst tuples = this.tuples.slice(start, end)\n\t\treturn new Relation(this.fields, tuples)\n\t}\n\n\tunion(other: Relation) {\n\t\tconst fields = new Fields()\n\n\t\tfor (const field of this.fields) {\n\t\t\tif (other.fields.has(field)) {\n\t\t\t\tfields.add(field)\n\t\t\t}\n\t\t}\n\n\t\tconst keys = new Set<string>()\n\t\tconst result = new Relation(fields)\n\n\t\tfor (const tuple of this.tuples) {\n\t\t\tconst key = tuple.getKey()\n\t\t\tkeys.add(key)\n\t\t\tresult.push(tuple)\n\t\t}\n\n\t\tfor (const tuple of other.tuples) {\n\t\t\tconst key = tuple.getKey()\n\t\t\tif (keys.has(key)) continue\n\t\t\tresult.push(tuple)\n\t\t}\n\n\t\treturn result\n\t}\n\n\tintersection(other: Relation) {\n\t\tconst fields = new Fields()\n\n\t\tfor (const field of this.fields) {\n\t\t\tif (other.fields.has(field)) {\n\t\t\t\tfields.add(field)\n\t\t\t}\n\t\t}\n\n\t\tconst keys = new Set<string>()\n\t\tconst result = new Relation(fields)\n\n\t\tfor (const tuple of this.tuples) {\n\t\t\tconst key = tuple.getKey()\n\t\t\tkeys.add(key)\n\t\t}\n\n\t\tfor (const tuple of other.tuples) {\n\t\t\tconst key = tuple.getKey()\n\t\t\tif (!keys.has(key)) continue\n\t\t\tresult.push(tuple)\n\t\t}\n\n\t\treturn result\n\t}\n}\n", "import { assert } from \"../../../../../utils/assert.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateArray, evaluateObject } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport type { Hashable } from \"../../Hashable.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { FieldMetadata } from \"../../Metadata.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation } from \"../../Relation.ts\"\nimport { Tuple } from \"../../Relation.ts\"\nimport type { ScalarNode } from \"../scalar/ScalarNode.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class ProjectionField implements Hashable {\n\tconstructor(\n\t\treadonly input: ScalarNode,\n\t\treadonly field: FieldMetadata,\n\t) {}\n\n\tgetHash() {\n\t\treturn calculateHash(\"ProjectionField\", this.input, this.field.id)\n\t}\n}\n\nexport class RelationalProject extends RelationalNode {\n\treadonly inputGroup: Group\n\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly projections: ProjectionField[],\n\t\treadonly passthrough: Fields,\n\t) {\n\t\tlet isSynchronous = input.isSynchronous\n\n\t\tfor (const projection of projections) {\n\t\t\tisSynchronous &&= projection.input.isSynchronous\n\t\t}\n\n\t\tsuper(isSynchronous)\n\n\t\tthis.inputGroup = input.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalProject\", this.inputGroup.id, ...this.projections, this.passthrough)\n\t}\n\n\toverride getOutputFields() {\n\t\tconst fields = new Fields()\n\t\tfields.merge(this.passthrough)\n\n\t\tfor (const projection of this.projections) {\n\t\t\tfields.add(projection.field)\n\t\t}\n\n\t\treturn fields\n\t}\n\n\toverride canProvideOrdering(ordering: Ordering) {\n\t\tconst projectionFields = new Fields()\n\n\t\tfor (const projection of this.projections) {\n\t\t\tprojectionFields.add(projection.field)\n\t\t}\n\n\t\t// If the ordering depends on a projection field, we can't sort before evaluating the projection.\n\t\tfor (const { field } of ordering.fields) {\n\t\t\tif (projectionFields.has(field)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\t}\n\n\toverride canProvideResolvedFields() {\n\t\treturn true\n\t}\n\n\tprivate getInputRequiredProps(required: RequiredProps) {\n\t\tconst resolvedFields = new Fields(required.resolvedFields)\n\n\t\tfor (const projection of this.projections) {\n\t\t\tresolvedFields.merge(projection.input.referencedFields)\n\t\t\tresolvedFields.delete(projection.field)\n\t\t}\n\n\t\treturn new RequiredProps(required.ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst inputCost = optimizer.optimizeGroup(this.inputGroup, inputRequired)\n\n\t\tlet projectionsCost = new Cost(0)\n\t\tfor (const projection of this.projections) {\n\t\t\tconst projectionCost = projection.input.optimize(optimizer)\n\t\t\tprojectionsCost = Cost.max(projectionsCost, projectionCost)\n\t\t}\n\n\t\treturn new Cost(0).add(Cost.max(inputCost, projectionsCost))\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst input = this.inputGroup.getOptimized(inputRequired)\n\n\t\tconst projections = this.projections.map(projection => {\n\t\t\tconst projectionInput = projection.input.getOptimized()\n\t\t\treturn new ProjectionField(projectionInput, projection.field)\n\t\t})\n\n\t\treturn new RelationalProject(input, projections, this.passthrough)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst outputFields = this.getOutputFields()\n\n\t\tconst input = yield* this.input.evaluate(context)\n\n\t\tconst projectedValues = yield* evaluateArray(\n\t\t\tinput.tuples.map(tuple =>\n\t\t\t\tevaluateArray(\n\t\t\t\t\tthis.projections.map(projection =>\n\t\t\t\t\t\tevaluateObject({\n\t\t\t\t\t\t\tfield: projection.field,\n\t\t\t\t\t\t\tvalue: projection.input.evaluate(context, tuple),\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 input.map(outputFields, (tuple, index) => {\n\t\t\tconst result = new Tuple()\n\t\t\tresult.mergePointers(tuple)\n\n\t\t\tfor (const field of this.passthrough) {\n\t\t\t\tconst value = tuple.getValue(field)\n\t\t\t\tresult.addValue(field, value)\n\t\t\t}\n\n\t\t\tconst projections = projectedValues[index]\n\t\t\tassert(projections, \"Projections must exist\")\n\n\t\t\tfor (const { field, value } of projections) {\n\t\t\t\tresult.addValue(field, value)\n\t\t\t}\n\n\t\t\treturn result\n\t\t})\n\t}\n}\n", "import type { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation } from \"../../../types.ts\"\nimport { DatabaseCollationType } from \"../../../types.ts\"\nimport type { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateAsync, evaluateSync } from \"../../Evaluate.ts\"\nimport type { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { AbstractNode } from \"../AbstractNode.ts\"\n\nexport const collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseInsensitive,\n}\n\nexport abstract class ScalarNode extends AbstractNode {\n\tabstract readonly definition: DatabaseValueDefinition\n\n\tconstructor(\n\t\t/**\n\t\t * Contains all fields from the current scope that are referenced by\n\t\t * this node or its descendants.\n\t\t */\n\t\treadonly referencedFields: Fields,\n\t\t/**\n\t\t * Contains all fields from the parent scope that are referenced by this\n\t\t * node or its descendants.\n\t\t */\n\t\treadonly referencedOuterFields: Fields,\n\t\t/**\n\t\t * Most scalar nodes with the exception of `ScalarSubquery` can be\n\t\t * evaluated synchronously. Synchronous nodes can be pre-evaluated in\n\t\t * the normalizer if they don't reference any fields.\n\t\t */\n\t\toverride readonly isSynchronous: boolean,\n\t) {\n\t\tsuper(isSynchronous)\n\t}\n\n\t/**\n\t * Evaluates the node and all children synchronously. Throws an error if the\n\t * node is not synchronous.\n\t */\n\tevaluateSync() {\n\t\tconst generator = this.evaluate(undefined, undefined)\n\t\treturn evaluateSync(generator)\n\t}\n\n\t/**\n\t * Evaluates the node and all children asynchronously.\n\t */\n\tevaluateAsync() {\n\t\tconst generator = this.evaluate(undefined, undefined)\n\t\treturn evaluateAsync(generator)\n\t}\n\n\t/**\n\n     * Optimizes all children and calculates the cost of the node.\n     */\n\tabstract optimize(optimizer: Optimizer): Cost\n\n\t/**\n\t * Returns an optimized version of the node with all children replaced by\n\t * their lowest cost alternatives.\n\t */\n\tabstract getOptimized(): ScalarNode\n\n\t/**\n\t * Evaluates the node and all children. This returns a generator so the\n\t * implementation can be either synchronous or asynchronous as indicated by\n\t * the `isSynchronous` property.\n\t */\n\tabstract evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue>\n}\n", "import { DatabaseValue, valueToBoolean } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation } from \"../../../types.ts\"\nimport { DatabaseCollationType } from \"../../../types.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateArray, evaluateObject } from \"../../Evaluate.ts\"\nimport type { Hashable } from \"../../Hashable.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseInsensitive,\n}\n\nexport class CaseCondition implements Hashable {\n\tconstructor(\n\t\treadonly when: ScalarNode,\n\t\treadonly then: ScalarNode,\n\t) {}\n\n\tgetHash() {\n\t\treturn calculateHash(\"CaseCondition\", this.when, this.then)\n\t}\n}\n\nexport class ScalarCase extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: \"unknown\",\n\t\tisNullable: true,\n\t}\n\n\tconstructor(\n\t\treadonly input: ScalarNode | undefined,\n\t\treadonly conditions: CaseCondition[],\n\t\treadonly otherwise: ScalarNode | undefined,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\tconst referencedOuterFields = new Fields()\n\n\t\tlet isSynchronous = true\n\n\t\tif (input) {\n\t\t\treferencedFields.merge(input.referencedFields)\n\t\t\treferencedOuterFields.merge(input.referencedOuterFields)\n\t\t\tisSynchronous &&= input.isSynchronous\n\t\t}\n\n\t\tfor (const { when, then } of conditions) {\n\t\t\treferencedFields.merge(when.referencedFields)\n\t\t\treferencedOuterFields.merge(when.referencedOuterFields)\n\t\t\tisSynchronous &&= when.isSynchronous\n\n\t\t\treferencedFields.merge(then.referencedFields)\n\t\t\treferencedOuterFields.merge(then.referencedOuterFields)\n\t\t\tisSynchronous &&= then.isSynchronous\n\t\t}\n\n\t\tif (otherwise) {\n\t\t\treferencedFields.merge(otherwise.referencedFields)\n\t\t\treferencedOuterFields.merge(otherwise.referencedOuterFields)\n\t\t\tisSynchronous &&= otherwise.isSynchronous\n\t\t}\n\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarCase\", this.input, ...this.conditions, this.otherwise)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tthis.input?.optimize(optimizer)\n\n\t\tfor (const condition of this.conditions) {\n\t\t\tcondition.when.optimize(optimizer)\n\t\t\tcondition.then.optimize(optimizer)\n\t\t}\n\n\t\tthis.otherwise?.optimize(optimizer)\n\n\t\t// TODO: Calculate cost based on inputs\n\t\treturn new Cost(0)\n\t}\n\n\toverride getOptimized() {\n\t\tconst input = this.input?.getOptimized()\n\n\t\tconst conditions = this.conditions.map(condition => {\n\t\t\tconst when = condition.when.getOptimized()\n\t\t\tconst then = condition.then.getOptimized()\n\t\t\treturn new CaseCondition(when, then)\n\t\t})\n\n\t\tconst otherwise = this.otherwise?.getOptimized()\n\n\t\treturn new ScalarCase(input, conditions, otherwise)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { input, conditions, otherwise } = yield* evaluateObject({\n\t\t\tinput: this.input?.evaluate(context, tuple) ?? null,\n\t\t\tconditions: evaluateArray(\n\t\t\t\tthis.conditions.map(condition =>\n\t\t\t\t\tevaluateObject({\n\t\t\t\t\t\twhen: condition.when.evaluate(context, tuple),\n\t\t\t\t\t\t// biome-ignore lint/suspicious/noThenProperty: Existing name.\n\t\t\t\t\t\tthen: condition.then.evaluate(context, tuple),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t\totherwise: this.otherwise?.evaluate(context, tuple) ?? null,\n\t\t})\n\n\t\tif (this.input) {\n\t\t\tfor (const { when, then } of conditions) {\n\t\t\t\tif (DatabaseValue.equal(input, when, collation)) {\n\t\t\t\t\treturn then\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor (const { when, then } of conditions) {\n\t\t\t\tif (valueToBoolean(when)) {\n\t\t\t\t\treturn then\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn otherwise\n\t}\n}\n", "import { ControlType } from \"../../../render/types/PropertyControls.ts\"\nimport { assert, assertNever } from \"../../../utils/assert.ts\"\nimport { isUndefined } from \"../../../utils/utils.ts\"\nimport { DatabaseValue } from \"../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../DatabaseValueDefinition.ts\"\nimport { unknownDefinition } from \"../DatabaseValueDefinition.ts\"\nimport type { MaybeLocale } from \"../QueryEngine.ts\"\nimport { getCollectionForLocale } from \"../getCollectionForLocale.ts\"\nimport type {\n\tBinaryOperation,\n\tCase,\n\tCollection,\n\tExpression,\n\tFrom,\n\tFunctionCall,\n\tIdentifier,\n\tJoin,\n\tLiteralValue,\n\tQuery,\n\tSelect,\n\tSelectExpression,\n\tTypeCast,\n\tUnaryOperation,\n} from \"../types.ts\"\nimport { BinaryOperator, DataType, FunctionName, UnaryOperator } from \"../types.ts\"\nimport {\n\tCollectionId,\n\tCollectionMetadata,\n\tFieldId,\n\tFieldMetadata,\n\tFields,\n\tIndexId,\n\tIndexMetadata,\n\tVIRTUAL_INDEX_FIELD,\n} from \"./Metadata.ts\"\nimport type { Normalizer } from \"./Normalizer.ts\"\nimport { Ordering, OrderingField } from \"./Ordering.ts\"\nimport { Scope } from \"./Scope.ts\"\nimport type { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\nimport { ProjectionField } from \"./nodes/relational/RelationalProject.ts\"\nimport { CaseCondition } from \"./nodes/scalar/ScalarCase.ts\"\nimport type { ScalarNode } from \"./nodes/scalar/ScalarNode.ts\"\n\n/**\n * The builder creates the initial normalized query plan for a query. While\n * doing that, it populates the memo.\n *\n * Like programming languages, SQL has a concept of \"scope\". The builder is\n * responsible for creating the correct scope for each part in the query.\n *\n * For example, in the following query:\n * ```\n * SELECT articles.title AS title, authors.name AS author\n * FROM articles JOIN authors ON articles.author_id = authors.id\n * ORDER BY author, title;\n * ```\n *\n * The builder will start with the `FROM` clause. It builds the left and right\n * side of the join, and creates a scope for each of the two collections. The\n * fields of both scopes are added to the \"from\" scope. This scope is then used\n * to resolve fields in the `ON` clause of the join.\n *\n * The builder continues with the `SELECT` clause, and creates a new scope for\n * the projection. Because the \"from\" scope is the parent, all fields of it are\n * also available in the \"projection\" scope. Every field in the `SELECT` clause is\n * added to the \"projection\" scope, which is then used to build the `ORDER BY`\n * clause.\n */\nexport class Builder {\n\tprivate collectionId = 0\n\tprivate indexId = 0\n\tprivate fieldId = 0\n\n\t/**\n\t * A stack of the subqueries that are currently being built. We use this to\n\t * calculate fields that come from the enclosing scope or from inside the\n\t * subquery.\n\t */\n\tprivate subqueries: Subquery[] = []\n\n\tconstructor(\n\t\treadonly normalizer: Normalizer,\n\t\treadonly query: Query,\n\t\treadonly locale: MaybeLocale,\n\t) {}\n\n\tbuild() {\n\t\tconst inScope = new Scope()\n\t\treturn this.buildQuery(inScope, this.query)\n\t}\n\n\tprivate buildQuery(inScope: Scope, query: Query) {\n\t\tconst select: Select = { type: \"Select\", ...query }\n\t\treturn this.buildSelect(inScope, select)\n\t}\n\n\tprivate buildSelect(inScope: Scope, select: Select) {\n\t\tconst fromScope = this.buildFrom(inScope, select.from)\n\t\tconst defaultOrdering = fromScope.getRequiredOrdering()\n\n\t\tif (select.where) {\n\t\t\tconst input = fromScope.takeNode()\n\t\t\tconst predicate = this.buildExpression(fromScope, select.where)\n\t\t\tconst node = this.normalizer.newRelationalFilter(input, predicate)\n\t\t\tfromScope.setNode(node)\n\t\t}\n\n\t\tconst orderProjections: ProjectionField[] = []\n\t\tconst orderFields = new Fields()\n\t\tlet ordering: Ordering\n\n\t\tif (select.orderBy) {\n\t\t\tordering = new Ordering()\n\n\t\t\tfor (const order of select.orderBy) {\n\t\t\t\tif (order.type === \"Identifier\") {\n\t\t\t\t\tconst scopeField = fromScope.resolveField(order.name, order.collection)\n\t\t\t\t\tif (isUndefined(scopeField)) continue\n\n\t\t\t\t\torderFields.add(scopeField.field)\n\n\t\t\t\t\tconst orderingField = new OrderingField(scopeField.field, order.direction)\n\t\t\t\t\tordering.push(orderingField)\n\t\t\t\t} else {\n\t\t\t\t\tconst expression = this.buildExpression(fromScope, order)\n\n\t\t\t\t\tconst fieldId = FieldId(this.fieldId++)\n\t\t\t\t\tconst field = new FieldMetadata(fieldId, undefined, expression.definition, undefined)\n\n\t\t\t\t\tconst projection = new ProjectionField(expression, field)\n\t\t\t\t\torderProjections.push(projection)\n\n\t\t\t\t\tconst orderingField = new OrderingField(field, order.direction)\n\t\t\t\t\tordering.push(orderingField)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tordering.merge(defaultOrdering)\n\t\t} else {\n\t\t\tordering = defaultOrdering\n\t\t}\n\n\t\tconst projectionScope = this.buildSelectList(fromScope, select.select, orderFields, orderProjections)\n\t\tprojectionScope.setOrdering(ordering)\n\n\t\tif (select.offset) {\n\t\t\tconst input = projectionScope.takeNode()\n\t\t\tconst offset = this.buildExpression(inScope, select.offset)\n\t\t\tconst node = this.normalizer.newRelationalOffset(input, offset, ordering)\n\t\t\tprojectionScope.setNode(node)\n\t\t}\n\n\t\tif (select.limit) {\n\t\t\tconst input = projectionScope.takeNode()\n\t\t\tconst limit = this.buildExpression(inScope, select.limit)\n\t\t\tconst node = this.normalizer.newRelationalLimit(input, limit, ordering)\n\t\t\tprojectionScope.setNode(node)\n\t\t}\n\n\t\treturn projectionScope\n\t}\n\n\tprivate buildSelectList(\n\t\tinScope: Scope,\n\t\tselects: SelectExpression[],\n\t\torderFields: Fields,\n\t\torderProjections: ProjectionField[],\n\t) {\n\t\tconst outScope = inScope.push()\n\n\t\tconst passthrough = new Fields(orderFields)\n\t\tconst projections: ProjectionField[] = [...orderProjections]\n\n\t\tfor (const select of selects) {\n\t\t\tif (select.type === \"Identifier\") {\n\t\t\t\tconst scopeField = inScope.resolveField(select.name, select.collection)\n\t\t\t\t// TODO: What if the field is not found?\n\t\t\t\tif (isUndefined(scopeField)) continue\n\n\t\t\t\tpassthrough.add(scopeField.field)\n\n\t\t\t\toutScope.addField({ ...scopeField, name: select.alias ?? scopeField.name })\n\t\t\t} else {\n\t\t\t\tconst expression = this.buildExpression(inScope, select)\n\t\t\t\tassert(select.alias, \"Subqueries should have an alias\")\n\n\t\t\t\t// Create a unique id for the field.\n\t\t\t\tconst fieldId = FieldId(this.fieldId++)\n\t\t\t\tconst fieldName = select.alias\n\t\t\t\t// Store the field in the metadata.\n\t\t\t\tconst field = new FieldMetadata(fieldId, fieldName, expression.definition, undefined)\n\n\t\t\t\tconst projection = new ProjectionField(expression, field)\n\t\t\t\tprojections.push(projection)\n\n\t\t\t\t// Add the field to the scope to resolve identifiers later.\n\t\t\t\toutScope.addField({\n\t\t\t\t\tfield,\n\t\t\t\t\tname: fieldName,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tconst input = inScope.takeNode()\n\t\tconst node = this.normalizer.newRelationalProject(input, projections, passthrough)\n\t\toutScope.setNode(node)\n\n\t\treturn outScope\n\t}\n\n\tprivate buildFrom(inScope: Scope, from: From) {\n\t\tswitch (from.type) {\n\t\t\tcase \"Collection\":\n\t\t\t\treturn this.buildCollection(inScope, from)\n\n\t\t\tcase \"LeftJoin\":\n\t\t\t\treturn this.buildJoin(inScope, from)\n\n\t\t\tdefault:\n\t\t\t\tassertNever(from, \"Unsupported from type\")\n\t\t}\n\t}\n\n\tprivate buildCollection(inScope: Scope, from: Collection) {\n\t\tconst outScope = inScope.push()\n\n\t\tconst collectionData = getCollectionForLocale(from.data, this.locale)\n\t\tconst collectionName = from.alias\n\n\t\t// Create a unique id for the collection.\n\t\tconst collectionId = CollectionId(this.collectionId++)\n\t\t// Store the collection in the metadata.\n\t\tconst collection = new CollectionMetadata(collectionId, collectionName, collectionData)\n\n\t\tfor (const [fieldName, definition] of Object.entries(collectionData.schema)) {\n\t\t\t// Create a unique id for the field.\n\t\t\tconst fieldId = FieldId(this.fieldId++)\n\t\t\t// Store the field in the metadata.\n\t\t\tconst field = new FieldMetadata(fieldId, fieldName, definition, collection)\n\n\t\t\t// Add the field to the scope to resolve identifiers later.\n\t\t\toutScope.addField({\n\t\t\t\tfield,\n\t\t\t\tname: fieldName,\n\t\t\t\tcollectionName,\n\t\t\t})\n\n\t\t\t// Add the field to the collection.\n\t\t\tcollection.fields.add(field)\n\t\t}\n\n\t\t// Create a virtual index field that can be only used in the `ORDER BY`\n\t\t// clause by the `EnforcerSort` node.\n\t\t{\n\t\t\tconst definition: DatabaseValueDefinition = { type: ControlType.Number, isNullable: false }\n\t\t\t// Create a unique id for the field.\n\t\t\tconst fieldId = FieldId(this.fieldId++)\n\t\t\t// Store the field in the metadata.\n\t\t\tconst field = new FieldMetadata(fieldId, VIRTUAL_INDEX_FIELD, definition, collection)\n\n\t\t\t// Add the field to the scope to resolve identifiers later.\n\t\t\toutScope.addField({\n\t\t\t\tfield,\n\t\t\t\tname: VIRTUAL_INDEX_FIELD,\n\t\t\t\tcollectionName,\n\t\t\t})\n\n\t\t\t// Store the default ordering of the collection in the scope.\n\t\t\tconst ordering = new Ordering()\n\t\t\tconst orderingField = new OrderingField(field)\n\t\t\tordering.push(orderingField)\n\t\t\toutScope.setOrdering(ordering)\n\t\t}\n\n\t\tfor (const indexData of collectionData.indexes) {\n\t\t\t// Create lookup nodes of the index. They are used by the explorer\n\t\t\t// to check if the index can be used for a `RelationalIndexLookup`\n\t\t\t// or `RelationalLookupJoin`.\n\t\t\tconst lookupNodes: ScalarNode[] = []\n\t\t\tfor (const expression of indexData.fields) {\n\t\t\t\tconst node = this.buildExpression(outScope, expression)\n\t\t\t\tlookupNodes.push(node)\n\t\t\t}\n\n\t\t\t// Create the constraint of the index. This is used by the explorer\n\t\t\t// to check if an index can be used instead of a `RelationalScan` or\n\t\t\t// `RelationalFilter`.\n\t\t\tlet constraint: ScalarNode | undefined\n\t\t\tif (indexData.where) {\n\t\t\t\tconstraint = this.buildExpression(outScope, indexData.where)\n\t\t\t}\n\n\t\t\t// Create the ordering of the index. This is used to check if an\n\t\t\t// index can provide the required ordering.\n\t\t\tconst ordering = new Ordering()\n\t\t\t// TODO: Add ordering to the metadata.\n\n\t\t\t// Create a unique id for the index.\n\t\t\tconst indexId = IndexId(this.indexId++)\n\t\t\t// Store the index in the metadata.\n\t\t\tconst index = new IndexMetadata(indexId, indexData, collection, lookupNodes, constraint, ordering)\n\n\t\t\t// Add the index to the collection.\n\t\t\tcollection.indexes.add(index)\n\t\t}\n\n\t\tconst node = this.normalizer.newRelationalScan(collection)\n\t\toutScope.setNode(node)\n\n\t\treturn outScope\n\t}\n\n\tprivate buildJoin(inScope: Scope, from: Join) {\n\t\tconst leftScope = this.buildFrom(inScope, from.left)\n\t\tconst rightScope = this.buildFrom(inScope, from.right)\n\n\t\t// Store the default ordering of the join in the scope.\n\t\tconst ordering = new Ordering()\n\t\tconst leftOrdering = leftScope.getRequiredOrdering()\n\t\tordering.merge(leftOrdering)\n\t\tconst rightOrdering = rightScope.getRequiredOrdering()\n\t\tordering.merge(rightOrdering)\n\n\t\tconst outScope = inScope.push()\n\t\toutScope.addFieldsFromScope(leftScope)\n\t\toutScope.addFieldsFromScope(rightScope)\n\t\toutScope.setOrdering(ordering)\n\n\t\tconst constraint = this.buildExpression(outScope, from.constraint)\n\n\t\tconst left = leftScope.takeNode()\n\t\tconst right = rightScope.takeNode()\n\n\t\tlet node: RelationalNode\n\n\t\tswitch (from.type) {\n\t\t\tcase \"LeftJoin\":\n\t\t\t\tnode = this.normalizer.newRelationalLeftJoin(left, right, constraint)\n\t\t\t\tbreak\n\n\t\t\tdefault:\n\t\t\t\tassertNever(from.type, \"Unsupported join type\")\n\t\t}\n\n\t\toutScope.setNode(node)\n\n\t\treturn outScope\n\t}\n\n\tprivate buildExpression(inScope: Scope, expression: Expression): ScalarNode {\n\t\tswitch (expression.type) {\n\t\t\tcase \"Identifier\":\n\t\t\t\treturn this.buildIdentifier(inScope, expression)\n\n\t\t\tcase \"LiteralValue\":\n\t\t\t\treturn this.buildLiteralValue(expression)\n\n\t\t\tcase \"FunctionCall\":\n\t\t\t\treturn this.buildFunctionCall(inScope, expression)\n\n\t\t\tcase \"Case\":\n\t\t\t\treturn this.buildCase(inScope, expression)\n\n\t\t\tcase \"UnaryOperation\":\n\t\t\t\treturn this.buildUnaryOperation(inScope, expression)\n\n\t\t\tcase \"BinaryOperation\":\n\t\t\t\treturn this.buildBinaryOperation(inScope, expression)\n\n\t\t\tcase \"TypeCast\":\n\t\t\t\treturn this.buildTypeCast(inScope, expression)\n\n\t\t\tcase \"Select\":\n\t\t\t\tthrow new Error(\"Subqueries are only supported inside subquery function calls\")\n\n\t\t\tdefault:\n\t\t\t\tassertNever(expression, \"Unsupported expression\")\n\t\t}\n\t}\n\n\tprivate buildIdentifier(inScope: Scope, expression: Identifier): ScalarNode {\n\t\tconst scopeField = inScope.resolveField(expression.name, expression.collection)\n\n\t\tif (scopeField) {\n\t\t\tlet isOuterField = false\n\n\t\t\t// TODO: This is a bit wasteful, because we traverse through all\n\t\t\t// parent scopes in `.has()`. This is because every subquery can\n\t\t\t// consist of multiple scopes (the from scope and projection scope).\n\t\t\t// If we reduce this to a single scope, we could avoid walking all\n\t\t\t// parents.\n\t\t\tfor (const subquery of this.subqueries) {\n\t\t\t\tif (isOuterField) {\n\t\t\t\t\tsubquery.referencedOuterFields.add(scopeField.field)\n\t\t\t\t} else {\n\t\t\t\t\tisOuterField = subquery.inScope.has(scopeField)\n\n\t\t\t\t\tif (isOuterField) {\n\t\t\t\t\t\tsubquery.referencedFields.add(scopeField.field)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this.normalizer.newScalarVariable(scopeField.field, isOuterField)\n\t\t}\n\n\t\treturn this.normalizer.newScalarConstant(unknownDefinition, null)\n\t}\n\n\tprivate buildLiteralValue(expression: LiteralValue): ScalarNode {\n\t\tconst value = DatabaseValue.parse(expression.value)\n\n\t\t// Always create a `ScalarConstant` node with an unknown type. They are\n\t\t// cast to a more specific type in `Normalizer.removeUnknown`.\n\t\treturn this.normalizer.newScalarConstant(unknownDefinition, value)\n\t}\n\n\tprivate buildFunctionCall(inScope: Scope, expression: FunctionCall): ScalarNode {\n\t\tconst getArgument = (index: number) => {\n\t\t\tconst argument = expression.arguments[index]\n\t\t\tassert(argument, \"Missing argument\")\n\t\t\treturn this.buildExpression(inScope, argument)\n\t\t}\n\n\t\tconst functionName = expression.functionName as FunctionName\n\n\t\tswitch (functionName) {\n\t\t\tcase FunctionName.Contains: {\n\t\t\t\tconst source = getArgument(0)\n\t\t\t\tconst target = getArgument(1)\n\t\t\t\treturn this.normalizer.newScalarContains(source, target)\n\t\t\t}\n\n\t\t\tcase FunctionName.StartsWith: {\n\t\t\t\tconst source = getArgument(0)\n\t\t\t\tconst target = getArgument(1)\n\t\t\t\treturn this.normalizer.newScalarStartsWith(source, target)\n\t\t\t}\n\n\t\t\tcase FunctionName.EndsWith: {\n\t\t\t\tconst source = getArgument(0)\n\t\t\t\tconst target = getArgument(1)\n\t\t\t\treturn this.normalizer.newScalarEndsWith(source, target)\n\t\t\t}\n\n\t\t\tcase FunctionName.Length: {\n\t\t\t\tconst array = getArgument(0)\n\t\t\t\treturn this.normalizer.newScalarLength(array)\n\t\t\t}\n\n\t\t\tcase FunctionName.IndexOf: {\n\t\t\t\tconst source = getArgument(0)\n\t\t\t\tconst target = getArgument(1)\n\t\t\t\treturn this.normalizer.newScalarIndexOf(source, target)\n\t\t\t}\n\n\t\t\tcase FunctionName.Array: {\n\t\t\t\tconst subquery = expression.arguments[0]\n\t\t\t\tassert(subquery, \"Missing argument\")\n\t\t\t\tassert(subquery.type === \"Select\", \"Subqueries require a select expression\")\n\t\t\t\treturn this.buildSubqueryArray(inScope, subquery)\n\t\t\t}\n\n\t\t\tcase FunctionName.FlatArray: {\n\t\t\t\tconst subquery = expression.arguments[0]\n\t\t\t\tassert(subquery, \"Missing argument\")\n\t\t\t\tassert(subquery.type === \"Select\", \"Subqueries require a select expression\")\n\t\t\t\treturn this.buildSubqueryFlatArray(inScope, subquery)\n\t\t\t}\n\n\t\t\tcase FunctionName.Intersect: {\n\t\t\t\tconst source = getArgument(0)\n\t\t\t\tconst target = getArgument(1)\n\t\t\t\treturn this.normalizer.newScalarIntersection(source, target)\n\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tassertNever(functionName, \"Unsupported function name\")\n\t\t}\n\t}\n\n\tprivate buildSubqueryArray(inScope: Scope, expression: Select): ScalarNode {\n\t\ttry {\n\t\t\tconst subquery = new Subquery(inScope)\n\t\t\tthis.subqueries.push(subquery)\n\n\t\t\tconst outScope = this.buildSelect(inScope, expression)\n\t\t\tconst input = outScope.takeNode()\n\t\t\tconst namedFields = outScope.getNamedFields()\n\t\t\tconst ordering = outScope.getRequiredOrdering()\n\t\t\tconst referencedFields = subquery.referencedFields\n\t\t\tconst referencedOuterFields = subquery.referencedOuterFields\n\n\t\t\treturn this.normalizer.newScalarArray(input, namedFields, ordering, referencedFields, referencedOuterFields)\n\t\t} finally {\n\t\t\tthis.subqueries.pop()\n\t\t}\n\t}\n\n\tprivate buildSubqueryFlatArray(inScope: Scope, expression: Select): ScalarNode {\n\t\ttry {\n\t\t\tconst subquery = new Subquery(inScope)\n\t\t\tthis.subqueries.push(subquery)\n\n\t\t\tconst outScope = this.buildSelect(inScope, expression)\n\t\t\tconst input = outScope.takeNode()\n\t\t\tconst field = outScope.getSingleField()\n\t\t\tconst ordering = outScope.getRequiredOrdering()\n\t\t\tconst referencedFields = subquery.referencedFields\n\t\t\tconst referencedOuterFields = subquery.referencedOuterFields\n\n\t\t\treturn this.normalizer.newScalarFlatArray(input, field, ordering, referencedFields, referencedOuterFields)\n\t\t} finally {\n\t\t\tthis.subqueries.pop()\n\t\t}\n\t}\n\n\tprivate buildCase(inScope: Scope, expression: Case): ScalarNode {\n\t\tlet input: ScalarNode | undefined\n\t\tif (expression.value) {\n\t\t\tinput = this.buildExpression(inScope, expression.value)\n\t\t}\n\n\t\tconst conditions = expression.conditions.map(condition => {\n\t\t\tconst when = this.buildExpression(inScope, condition.when)\n\t\t\tconst then = this.buildExpression(inScope, condition.then)\n\t\t\treturn new CaseCondition(when, then)\n\t\t})\n\n\t\tlet otherwise: ScalarNode | undefined\n\t\tif (expression.else) {\n\t\t\totherwise = this.buildExpression(inScope, expression.else)\n\t\t}\n\n\t\treturn this.normalizer.newScalarCase(input, conditions, otherwise)\n\t}\n\n\tprivate buildUnaryOperation(inScope: Scope, expression: UnaryOperation): ScalarNode {\n\t\tconst input = this.buildExpression(inScope, expression.value)\n\n\t\tswitch (expression.operator) {\n\t\t\tcase UnaryOperator.Not:\n\t\t\t\treturn this.normalizer.newScalarNot(input)\n\n\t\t\tdefault:\n\t\t\t\tassertNever(expression.operator, \"Unsupported unary operator\")\n\t\t}\n\t}\n\n\tprivate buildBinaryOperation(inScope: Scope, expression: BinaryOperation): ScalarNode {\n\t\tconst left = this.buildExpression(inScope, expression.left)\n\t\tconst right = this.buildExpression(inScope, expression.right)\n\n\t\tswitch (expression.operator) {\n\t\t\tcase BinaryOperator.And:\n\t\t\t\treturn this.normalizer.newScalarAnd(left, right)\n\n\t\t\tcase BinaryOperator.Or:\n\t\t\t\treturn this.normalizer.newScalarOr(left, right)\n\n\t\t\tcase BinaryOperator.Equals:\n\t\t\t\treturn this.normalizer.newScalarEquals(left, right)\n\n\t\t\tcase BinaryOperator.NotEquals:\n\t\t\t\treturn this.normalizer.newScalarNotEquals(left, right)\n\n\t\t\tcase BinaryOperator.LessThan:\n\t\t\t\treturn this.normalizer.newScalarLessThan(left, right)\n\n\t\t\tcase BinaryOperator.LessThanOrEqual:\n\t\t\t\treturn this.normalizer.newScalarLessThanOrEqual(left, right)\n\n\t\t\tcase BinaryOperator.GreaterThan:\n\t\t\t\treturn this.normalizer.newScalarGreaterThan(left, right)\n\n\t\t\tcase BinaryOperator.GreaterThanOrEqual:\n\t\t\t\treturn this.normalizer.newScalarGreaterThanOrEqual(left, right)\n\n\t\t\tcase BinaryOperator.In:\n\t\t\t\treturn this.normalizer.newScalarIn(left, right)\n\n\t\t\tdefault:\n\t\t\t\tassertNever(expression.operator, \"Unsupported binary operator\")\n\t\t}\n\t}\n\n\tprivate buildTypeCast(inScope: Scope, expression: TypeCast): ScalarNode {\n\t\tconst input = this.buildExpression(inScope, expression.value)\n\n\t\tswitch (expression.dataType) {\n\t\t\tcase DataType.Boolean: {\n\t\t\t\tconst definition: DatabaseValueDefinition = { type: ControlType.Boolean, isNullable: true }\n\t\t\t\treturn this.normalizer.newScalarCast(input, definition)\n\t\t\t}\n\n\t\t\tcase DataType.Date: {\n\t\t\t\tconst definition: DatabaseValueDefinition = { type: ControlType.Date, isNullable: true }\n\t\t\t\treturn this.normalizer.newScalarCast(input, definition)\n\t\t\t}\n\n\t\t\tcase DataType.Number: {\n\t\t\t\tconst definition: DatabaseValueDefinition = { type: ControlType.Number, isNullable: true }\n\t\t\t\treturn this.normalizer.newScalarCast(input, definition)\n\t\t\t}\n\n\t\t\tcase DataType.String: {\n\t\t\t\tconst definition: DatabaseValueDefinition = { type: ControlType.String, isNullable: true }\n\t\t\t\treturn this.normalizer.newScalarCast(input, definition)\n\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tthrow new Error(\"Unsupported data type\")\n\t\t}\n\t}\n}\n\nclass Subquery {\n\t/**\n\t * A list of fields that are referenced from `inScope` of the subquery.\n\t *\n\t * To evaluate a subquery, we need to know which fields are coming from\n\t * outside the subquery and which fields are coming from inside the\n\t * subquery. For example, in the following query:\n\t *\n\t * ```\n\t * SELECT title, (\n\t *     SELECT name FROM articles\n\t *     WHERE id = author_id\n\t * ) AS author FROM articles\n\t * ```\n\t *\n\t * The `name` and `id` fields are coming from the inside the subquery, but\n\t * the `author_id` field is coming from the parent scope. We need to resolve\n\t * `author_id` before we can evaluate the subquery.\n\t */\n\treadonly referencedFields = new Fields()\n\n\t/**\n\t * A list of fields that are referenced from the `inScope` of the parent\n\t * subquery.\n\t */\n\treadonly referencedOuterFields = new Fields()\n\n\tconstructor(\n\t\t/**\n\t\t * The parent scope of the subquery.\n\t\t */\n\t\treadonly inScope: Scope,\n\t) {}\n}\n", "import { valueToBoolean } from \"../../../DatabaseValue.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateArray } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation, Tuple } from \"../../Relation.ts\"\nimport type { ScalarNode } from \"../scalar/ScalarNode.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class RelationalFilter extends RelationalNode {\n\treadonly inputGroup: Group\n\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly predicate: ScalarNode,\n\t) {\n\t\tsuper(input.isSynchronous && predicate.isSynchronous)\n\n\t\tthis.inputGroup = input.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalFilter\", this.inputGroup.id, this.predicate)\n\t}\n\n\toverride getOutputFields() {\n\t\treturn this.inputGroup.relational.outputFields\n\t}\n\n\toverride canProvideOrdering() {\n\t\treturn true\n\t}\n\n\toverride canProvideResolvedFields() {\n\t\treturn true\n\t}\n\n\tprivate getInputRequiredProps(required: RequiredProps) {\n\t\tconst resolvedFields = new Fields(required.resolvedFields)\n\t\tresolvedFields.merge(this.predicate.referencedFields)\n\n\t\treturn new RequiredProps(required.ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst inputCost = optimizer.optimizeGroup(this.inputGroup, inputRequired)\n\n\t\tconst predicateCost = this.predicate.optimize(optimizer)\n\n\t\treturn new Cost(0).add(Cost.max(inputCost, predicateCost))\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst input = this.inputGroup.getOptimized(inputRequired)\n\n\t\tconst predicate = this.predicate.getOptimized()\n\n\t\treturn new RelationalFilter(input, predicate)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst input = yield* this.input.evaluate(context)\n\n\t\tconst predicates = yield* evaluateArray(\n\t\t\tinput.tuples.map(tuple => {\n\t\t\t\treturn this.predicate.evaluate(context, tuple)\n\t\t\t}),\n\t\t)\n\n\t\treturn input.filter((_, index) => {\n\t\t\tconst predicate = predicates[index] ?? null\n\t\t\treturn valueToBoolean(predicate)\n\t\t})\n\t}\n}\n", "import type { DatabaseIndexLookup, DatabaseItem } from \"../../../types.ts\"\nimport { DatabaseIndexLookupType } from \"../../../types.ts\"\nimport { Cost, KB } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { Fields, IndexMetadata } from \"../../Metadata.ts\"\nimport type { Ordering } from \"../../Ordering.ts\"\nimport { Relation, Tuple } from \"../../Relation.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class RelationalIndexLookup extends RelationalNode {\n\tconstructor(\n\t\treadonly index: IndexMetadata,\n\t\treadonly query: DatabaseIndexLookup[],\n\t) {\n\t\tsuper(false)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalIndexLookup\", this.index.id, ...this.query)\n\t}\n\n\toverride getOutputFields() {\n\t\treturn this.index.collection.fields\n\t}\n\n\toverride canProvideOrdering(ordering: Ordering) {\n\t\treturn ordering.equals(this.index.ordering)\n\t}\n\n\toverride canProvideResolvedFields(resolvedFields: Fields) {\n\t\treturn resolvedFields.subsetOf(this.index.resolvedFields)\n\t}\n\n\toverride optimize() {\n\t\tconst isFullScan = this.query.every(lookup => lookup.type === DatabaseIndexLookupType.All)\n\t\treturn Cost.estimate(1, isFullScan ? 100 * KB : 50 * KB)\n\t}\n\n\toverride getOptimized() {\n\t\treturn new RelationalIndexLookup(this.index, this.query)\n\t}\n\n\toverride *evaluate(): Evaluate<Relation> {\n\t\tconst index = this.index\n\t\tconst collection = index.collection\n\t\tconst outputFields = this.getOutputFields()\n\n\t\tconst items: DatabaseItem[] = yield index.data.lookupItems(this.query)\n\n\t\tconst tuples = items.map(item => {\n\t\t\tconst tuple = new Tuple()\n\n\t\t\tfor (const field of index.resolvedFields) {\n\t\t\t\tconst value = field.getValue(item)\n\t\t\t\ttuple.addPointer(collection, item.pointer)\n\t\t\t\ttuple.addValue(field, value)\n\t\t\t}\n\n\t\t\treturn tuple\n\t\t})\n\n\t\treturn new Relation(outputFields, tuples)\n\t}\n}\n", "import { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation, Tuple } from \"../../Relation.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class RelationalIntersection extends RelationalNode {\n\treadonly leftGroup: Group\n\treadonly rightGroup: Group\n\n\tconstructor(\n\t\treadonly left: RelationalNode,\n\t\treadonly right: RelationalNode,\n\t) {\n\t\tsuper(left.isSynchronous && right.isSynchronous)\n\n\t\tthis.leftGroup = left.getGroup()\n\t\tthis.rightGroup = right.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalIntersection\", this.leftGroup.id, this.rightGroup.id)\n\t}\n\n\toverride getOutputFields() {\n\t\tconst outputFields = new Fields()\n\n\t\tconst leftOutputFields = this.leftGroup.relational.outputFields\n\t\tconst rightOutputFields = this.rightGroup.relational.outputFields\n\n\t\tfor (const field of leftOutputFields) {\n\t\t\tif (rightOutputFields.has(field)) {\n\t\t\t\toutputFields.add(field)\n\t\t\t}\n\t\t}\n\n\t\treturn outputFields\n\t}\n\n\toverride canProvideOrdering() {\n\t\treturn false\n\t}\n\n\toverride canProvideResolvedFields() {\n\t\treturn true\n\t}\n\n\tprivate getChildRequiredProps(required: RequiredProps) {\n\t\tconst ordering = new Ordering()\n\t\treturn new RequiredProps(ordering, required.resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst leftRequired = this.getChildRequiredProps(required)\n\t\tconst leftCost = optimizer.optimizeGroup(this.leftGroup, leftRequired)\n\n\t\tconst rightRequired = this.getChildRequiredProps(required)\n\t\tconst rightCost = optimizer.optimizeGroup(this.rightGroup, rightRequired)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst leftRequired = this.getChildRequiredProps(required)\n\t\tconst left = this.leftGroup.getOptimized(leftRequired)\n\n\t\tconst rightRequired = this.getChildRequiredProps(required)\n\t\tconst right = this.rightGroup.getOptimized(rightRequired)\n\n\t\treturn new RelationalIntersection(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context),\n\t\t\tright: this.right.evaluate(context),\n\t\t})\n\n\t\treturn left.intersection(right)\n\t}\n}\n", "import type { DatabaseItem } from \"../../../types.ts\"\nimport { Cost, KB } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { CollectionMetadata, Fields } from \"../../Metadata.ts\"\nimport { Relation, Tuple } from \"../../Relation.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class RelationalScan extends RelationalNode {\n\tconstructor(readonly collection: CollectionMetadata) {\n\t\tsuper(false)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalScan\", this.collection.id)\n\t}\n\n\toverride getOutputFields() {\n\t\treturn this.collection.fields\n\t}\n\n\toverride canProvideOrdering() {\n\t\treturn false\n\t}\n\n\toverride canProvideResolvedFields(resolvedFields: Fields) {\n\t\treturn resolvedFields.subsetOf(this.collection.fields)\n\t}\n\n\toverride optimize() {\n\t\treturn Cost.estimate(1, 200 * KB)\n\t}\n\n\toverride getOptimized() {\n\t\treturn new RelationalScan(this.collection)\n\t}\n\n\toverride *evaluate(): Evaluate<Relation> {\n\t\tconst collection = this.collection\n\t\tconst outputFields = this.getOutputFields()\n\n\t\tconst items: DatabaseItem[] = yield collection.data.scanItems()\n\n\t\tconst tuples = items.map(item => {\n\t\t\tconst tuple = new Tuple()\n\n\t\t\tfor (const field of outputFields) {\n\t\t\t\tconst value = field.getValue(item)\n\t\t\t\ttuple.addPointer(collection, item.pointer)\n\t\t\t\ttuple.addValue(field, value)\n\t\t\t}\n\n\t\t\treturn tuple\n\t\t})\n\n\t\treturn new Relation(outputFields, tuples)\n\t}\n}\n", "import { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation, Tuple } from \"../../Relation.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class RelationalUnion extends RelationalNode {\n\treadonly leftGroup: Group\n\treadonly rightGroup: Group\n\n\tconstructor(\n\t\treadonly left: RelationalNode,\n\t\treadonly right: RelationalNode,\n\t) {\n\t\tsuper(left.isSynchronous && right.isSynchronous)\n\n\t\tthis.leftGroup = left.getGroup()\n\t\tthis.rightGroup = right.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalUnion\", this.leftGroup.id, this.rightGroup.id)\n\t}\n\n\toverride getOutputFields() {\n\t\tconst outputFields = new Fields()\n\n\t\tconst leftOutputFields = this.leftGroup.relational.outputFields\n\t\tconst rightOutputFields = this.rightGroup.relational.outputFields\n\n\t\tfor (const field of leftOutputFields) {\n\t\t\tif (rightOutputFields.has(field)) {\n\t\t\t\toutputFields.add(field)\n\t\t\t}\n\t\t}\n\n\t\treturn outputFields\n\t}\n\n\toverride canProvideOrdering() {\n\t\treturn false\n\t}\n\n\toverride canProvideResolvedFields() {\n\t\treturn true\n\t}\n\n\tprivate getChildRequiredProps(required: RequiredProps) {\n\t\tconst ordering = new Ordering()\n\t\treturn new RequiredProps(ordering, required.resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst leftRequired = this.getChildRequiredProps(required)\n\t\tconst leftCost = optimizer.optimizeGroup(this.leftGroup, leftRequired)\n\n\t\tconst rightRequired = this.getChildRequiredProps(required)\n\t\tconst rightCost = optimizer.optimizeGroup(this.rightGroup, rightRequired)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst leftRequired = this.getChildRequiredProps(required)\n\t\tconst left = this.leftGroup.getOptimized(leftRequired)\n\n\t\tconst rightRequired = this.getChildRequiredProps(required)\n\t\tconst right = this.rightGroup.getOptimized(rightRequired)\n\n\t\treturn new RelationalUnion(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context),\n\t\t\tright: this.right.evaluate(context),\n\t\t})\n\n\t\treturn left.union(right)\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport type { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport { valueToBoolean } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarAnd extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarAnd\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarAnd(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: valueToBoolean(left) && valueToBoolean(right),\n\t\t}\n\t}\n}\n", "import { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { unknownDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarConstant extends ScalarNode {\n\tconstructor(\n\t\treadonly definition: DatabaseValueDefinition,\n\t\treadonly value: DatabaseValue,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\tconst referencedOuterFields = new Fields()\n\n\t\tsuper(referencedFields, referencedOuterFields, true)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarConstant\", this.definition, this.value)\n\t}\n\n\toverride optimize() {\n\t\treturn new Cost(0)\n\t}\n\n\toverride getOptimized() {\n\t\treturn this\n\t}\n\n\t// biome-ignore lint/correctness/useYield: Required by the super class.\n\toverride *evaluate(): Evaluate<DatabaseValue> {\n\t\treturn this.value\n\t}\n}\n\n/**\n * Creates a `ScalarConstant` node for testing.\n */\nexport function createScalarConstant(value: unknown) {\n\tconst databaseValue = DatabaseValue.parse(value)\n\treturn new ScalarConstant(unknownDefinition, databaseValue)\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation } from \"../../../types.ts\"\nimport { DatabaseCollationType } from \"../../../types.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseInsensitive,\n}\n\nexport class ScalarContains extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly source: ScalarNode,\n\t\treadonly target: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(source.referencedFields)\n\t\treferencedFields.merge(target.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(source.referencedOuterFields)\n\t\treferencedOuterFields.merge(target.referencedOuterFields)\n\n\t\tconst isSynchronous = source.isSynchronous && target.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarContains\", this.source, this.target)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst sourceCost = this.source.optimize(optimizer)\n\t\tconst targetCost = this.target.optimize(optimizer)\n\n\t\treturn Cost.max(sourceCost, targetCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst source = this.source.getOptimized()\n\t\tconst target = this.target.getOptimized()\n\n\t\treturn new ScalarContains(source, target)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { source, target } = yield* evaluateObject({\n\t\t\tsource: this.source.evaluate(context, tuple),\n\t\t\ttarget: this.target.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.contains(source, target, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation } from \"../../../types.ts\"\nimport { DatabaseCollationType } from \"../../../types.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseInsensitive,\n}\n\nexport class ScalarEndsWith extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly source: ScalarNode,\n\t\treadonly target: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(source.referencedFields)\n\t\treferencedFields.merge(target.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(source.referencedOuterFields)\n\t\treferencedOuterFields.merge(target.referencedOuterFields)\n\n\t\tconst isSynchronous = source.isSynchronous && target.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarEndsWith\", this.source, this.target)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst sourceCost = this.source.optimize(optimizer)\n\t\tconst targetCost = this.target.optimize(optimizer)\n\n\t\treturn Cost.max(sourceCost, targetCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst source = this.source.getOptimized()\n\t\tconst target = this.target.getOptimized()\n\n\t\treturn new ScalarEndsWith(source, target)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { source, target } = yield* evaluateObject({\n\t\t\tsource: this.source.evaluate(context, tuple),\n\t\t\ttarget: this.target.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.endsWith(source, target, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode, collation } from \"./ScalarNode.ts\"\n\nexport class ScalarEquals extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarEquals\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarEquals(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.equal(left, right, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode, collation } from \"./ScalarNode.ts\"\n\nexport class ScalarGreaterThan extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarGreaterThan\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarGreaterThan(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.greaterThan(left, right, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode, collation } from \"./ScalarNode.ts\"\n\nexport class ScalarGreaterThanOrEqual extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarGreaterThanOrEqual\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarGreaterThanOrEqual(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.greaterThanOrEqual(left, right, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode, collation } from \"./ScalarNode.ts\"\n\nexport class ScalarLessThan extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarLessThan\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarLessThan(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.lessThan(left, right, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode, collation } from \"./ScalarNode.ts\"\n\nexport class ScalarLessThanOrEqual extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarLessThanOrEqual\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarLessThanOrEqual(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.lessThanOrEqual(left, right, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode, collation } from \"./ScalarNode.ts\"\n\nexport class ScalarNotEquals extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarNotEquals\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarNotEquals(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: !DatabaseValue.equal(left, right, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport type { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport { valueToBoolean } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarOr extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarOr\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarOr(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: valueToBoolean(left) || valueToBoolean(right),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation } from \"../../../types.ts\"\nimport { DatabaseCollationType } from \"../../../types.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseInsensitive,\n}\n\nexport class ScalarStartsWith extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly source: ScalarNode,\n\t\treadonly target: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(source.referencedFields)\n\t\treferencedFields.merge(target.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(source.referencedOuterFields)\n\t\treferencedOuterFields.merge(target.referencedOuterFields)\n\n\t\tconst isSynchronous = source.isSynchronous && target.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarStartsWith\", this.source, this.target)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst sourceCost = this.source.optimize(optimizer)\n\t\tconst targetCost = this.target.optimize(optimizer)\n\n\t\treturn Cost.max(sourceCost, targetCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst source = this.source.getOptimized()\n\t\tconst target = this.target.getOptimized()\n\n\t\treturn new ScalarStartsWith(source, target)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { source, target } = yield* evaluateObject({\n\t\t\tsource: this.source.evaluate(context, tuple),\n\t\t\ttarget: this.target.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.startsWith(source, target, collation),\n\t\t}\n\t}\n}\n", "import type { DatabaseIndexLookup } from \"../types.ts\"\nimport { DatabaseIndexLookupType } from \"../types.ts\"\nimport type { Memo } from \"./Memo.ts\"\nimport type { Normalizer } from \"./Normalizer.ts\"\nimport { RelationalFilter } from \"./nodes/relational/RelationalFilter.ts\"\nimport { RelationalIndexLookup } from \"./nodes/relational/RelationalIndexLookup.ts\"\nimport { RelationalIntersection } from \"./nodes/relational/RelationalIntersection.ts\"\nimport type { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\nimport { RelationalScan } from \"./nodes/relational/RelationalScan.ts\"\nimport { RelationalUnion } from \"./nodes/relational/RelationalUnion.ts\"\nimport { ScalarAnd } from \"./nodes/scalar/ScalarAnd.ts\"\nimport { ScalarConstant } from \"./nodes/scalar/ScalarConstant.ts\"\nimport { ScalarContains } from \"./nodes/scalar/ScalarContains.ts\"\nimport { ScalarEndsWith } from \"./nodes/scalar/ScalarEndsWith.ts\"\nimport { ScalarEquals } from \"./nodes/scalar/ScalarEquals.ts\"\nimport { ScalarGreaterThan } from \"./nodes/scalar/ScalarGreaterThan.ts\"\nimport { ScalarGreaterThanOrEqual } from \"./nodes/scalar/ScalarGreaterThanOrEqual.ts\"\nimport { ScalarLessThan } from \"./nodes/scalar/ScalarLessThan.ts\"\nimport { ScalarLessThanOrEqual } from \"./nodes/scalar/ScalarLessThanOrEqual.ts\"\nimport { ScalarNotEquals } from \"./nodes/scalar/ScalarNotEquals.ts\"\nimport { ScalarOr } from \"./nodes/scalar/ScalarOr.ts\"\nimport { ScalarStartsWith } from \"./nodes/scalar/ScalarStartsWith.ts\"\n\n/**\n * The explorer is responsible for generating non-normalized alternative query plans. For example,\n * the initial normalized query plan can only contain a single filter, but we could split it into\n * multiple filters so we can apply other optimizations to some parts of the query.\n */\nexport class Explorer {\n\treadonly memo: Memo\n\n\tconstructor(readonly normalizer: Normalizer) {\n\t\tthis.memo = normalizer.memo\n\t}\n\n\texplore(before: RelationalNode) {\n\t\tconst group = before.getGroup()\n\n\t\t// Split filters.\n\t\tif (before instanceof RelationalFilter) {\n\t\t\tif (before.predicate instanceof ScalarAnd) {\n\t\t\t\tconst left = this.normalizer.newRelationalFilter(before.input, before.predicate.left)\n\t\t\t\tconst right = this.normalizer.newRelationalFilter(before.input, before.predicate.right)\n\t\t\t\tconst after = new RelationalIntersection(left, right)\n\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t}\n\n\t\t\tif (before.predicate instanceof ScalarOr) {\n\t\t\t\tconst left = this.normalizer.newRelationalFilter(before.input, before.predicate.left)\n\t\t\t\tconst right = this.normalizer.newRelationalFilter(before.input, before.predicate.right)\n\t\t\t\tconst after = new RelationalUnion(left, right)\n\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t}\n\t\t}\n\n\t\t// Generate generic index scans.\n\t\tif (before instanceof RelationalScan) {\n\t\t\tfor (const index of before.collection.indexes) {\n\t\t\t\t// We can't replace the scan with an index lookup if the index\n\t\t\t\t// has a constraint because the index will not return all items.\n\t\t\t\tif (index.constraint) continue\n\n\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t}\n\t\t}\n\n\t\t// Generate index lookups.\n\t\tif (before instanceof RelationalFilter) {\n\t\t\tfor (const input of before.inputGroup.nodes) {\n\t\t\t\tif (input instanceof RelationalScan) {\n\t\t\t\t\tfor (const index of input.collection.indexes) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarEquals &&\n\t\t\t\t\t\t\tbefore.predicate.left === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.right instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.Equals)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\t// NOTE: We have some old collection modules that\n\t\t\t\t\t\t\t// only support the first lookup to be something\n\t\t\t\t\t\t\t// other than `DatabaseIndexLookupType.All`\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.Equals,\n\t\t\t\t\t\t\t\tvalue: before.predicate.right.value,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarNotEquals &&\n\t\t\t\t\t\t\tbefore.predicate.left === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.right instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.NotEquals)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.NotEquals,\n\t\t\t\t\t\t\t\tvalue: before.predicate.right.value,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarLessThan &&\n\t\t\t\t\t\t\tbefore.predicate.left === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.right instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.LessThan)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.LessThan,\n\t\t\t\t\t\t\t\tvalue: before.predicate.right.value,\n\t\t\t\t\t\t\t\tinclusive: false,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarLessThanOrEqual &&\n\t\t\t\t\t\t\tbefore.predicate.left === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.right instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.LessThan)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.LessThan,\n\t\t\t\t\t\t\t\tvalue: before.predicate.right.value,\n\t\t\t\t\t\t\t\tinclusive: true,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarGreaterThan &&\n\t\t\t\t\t\t\tbefore.predicate.left === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.right instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.GreaterThan)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.GreaterThan,\n\t\t\t\t\t\t\t\tvalue: before.predicate.right.value,\n\t\t\t\t\t\t\t\tinclusive: false,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarGreaterThanOrEqual &&\n\t\t\t\t\t\t\tbefore.predicate.left === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.right instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.GreaterThan)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.GreaterThan,\n\t\t\t\t\t\t\t\tvalue: before.predicate.right.value,\n\t\t\t\t\t\t\t\tinclusive: true,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarContains &&\n\t\t\t\t\t\t\tbefore.predicate.source === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.target instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.Contains)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.Contains,\n\t\t\t\t\t\t\t\tvalue: before.predicate.target.value,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarStartsWith &&\n\t\t\t\t\t\t\tbefore.predicate.source === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.target instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.StartsWith)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.StartsWith,\n\t\t\t\t\t\t\t\tvalue: before.predicate.target.value,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbefore.predicate instanceof ScalarEndsWith &&\n\t\t\t\t\t\t\tbefore.predicate.source === index.lookupNodes[0] &&\n\t\t\t\t\t\t\tbefore.predicate.target instanceof ScalarConstant &&\n\t\t\t\t\t\t\tindex.data.supportedLookupTypes.includes(DatabaseIndexLookupType.EndsWith)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst query = createIndexQueryAll(index.lookupNodes.length)\n\n\t\t\t\t\t\t\tquery[0] = {\n\t\t\t\t\t\t\t\ttype: DatabaseIndexLookupType.EndsWith,\n\t\t\t\t\t\t\t\tvalue: before.predicate.target.value,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst after = new RelationalIndexLookup(index, query)\n\t\t\t\t\t\t\tthis.memo.addRelational(after, group)\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\nfunction createIndexQueryAll(length: number) {\n\tconst lookup: DatabaseIndexLookup = { type: DatabaseIndexLookupType.All }\n\treturn new Array(length).fill(lookup)\n}\n", "import type { Fields } from \"./Metadata.ts\"\n\n/**\n * Relational props describe the logical properties of the relation returned by\n * a relational node. While each node in a group can return the fields and\n * tuples in a different order and use a different algorithm to calculate them,\n * all nodes must return the same set of data. For example, a hash join and a\n * merge join will return the same set of tuples, but the order of the tuples\n * may be different.\n */\nexport class RelationalProps {\n\tconstructor(\n\t\t/**\n\t\t * The fields that are returned by the relational node. Fields that are\n\t\t * included in the output are not necessarily resolved yet. The set of\n\t\t * resolved fields are a physical property of the relational node.\n\t\t */\n\t\treadonly outputFields: Fields,\n\t) {}\n\n\t/**\n\t * Checks if the given relational properties are compatible with this.\n\t */\n\tisCompatible(other: RelationalProps) {\n\t\treturn this.outputFields.equals(other.outputFields)\n\t}\n}\n", "import { assert } from \"../../../utils/assert.ts\"\nimport { Group, GroupId } from \"./Group.ts\"\nimport type { Hash } from \"./Hashable.ts\"\nimport { RelationalProps } from \"./LogicalProps.ts\"\nimport type { AbstractNode } from \"./nodes/AbstractNode.ts\"\nimport type { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\nimport type { ScalarNode } from \"./nodes/scalar/ScalarNode.ts\"\n\n/**\n * The memo is a directed acyclic graph of every possible query plan. It\n * contains a list of groups, with all nodes in a group being logically\n * equivalent.\n *\n * The nodes in memo are also known as multi-expressions or memo-expression,\n * because the children of a node can be part of a group themselves.\n *\n * Nodes can be either relational (e.g. scan, join) or scalar (e.g. <, >). A\n * traditional cascades query optimizer differentiates between logical nodes and\n * physical nodes. A logical node is a node that describes what needs to be\n * done, while a physical implementation of the node is the actual algorithm.\n * For example, a logical join can be implemented by a physical nested loop join\n * or physical hash join. We took the same approach as CockroachDB, where every\n * node is both a logical and physical expression. This means even the initial\n * unoptimized query plan can be executed.\n *\n * Scalar nodes are not part of a group, because we don't generate logically\n * equivalent alternatives for them. We only store the normalized version in the\n * memo. This is because the performance difference of two logically equivalent\n * scalar nodes is negligible. But the performance difference of two relation\n * nodes might be significant.\n */\nexport class Memo {\n\t/**\n\t * A map of all nodes in the memo by their hash. This allows to easily find\n\t * duplicated nodes and their groups.\n\t */\n\tprivate readonly nodes = new Map<Hash, AbstractNode>()\n\n\t/**\n\t * A list of all groups in the memo. The id of a group is the index of the\n\t * group in this list.\n\t */\n\tprivate readonly groups: Group[] = []\n\n\t/**\n\t * Adds a new group with the given relational props to the memo. All nodes\n\t * in the group must have the same props. It's expected that the normalized\n\t * node is immediately added to the group after creating it.\n\t */\n\tprivate addGroup(relationalProps: RelationalProps) {\n\t\tconst id = GroupId(this.groups.length)\n\t\tconst group = new Group(id, relationalProps)\n\t\tthis.groups.push(group)\n\t\treturn group\n\t}\n\n\t/**\n\t * Adds a relational node to the memo and the group. If the node is already\n\t * in the memo, it returns the existing node. If no group is given, it\n\t * creates a new group with the given relational props of the node.\n\t */\n\taddRelational<Node extends RelationalNode>(node: Node, group?: Group) {\n\t\tconst hash = node.getHash()\n\n\t\t// If the node is already in the memo, return the existing node.\n\t\tconst existing = this.nodes.get(hash)\n\t\tif (existing) return existing as Node\n\n\t\t// Add the node to the memo.\n\t\tthis.nodes.set(hash, node)\n\n\t\t// Add the node to the group or create a new one if no group is given.\n\t\tconst outputFields = node.getOutputFields()\n\t\tconst relational = new RelationalProps(outputFields)\n\t\tgroup ??= this.addGroup(relational)\n\t\tgroup.addNode(node)\n\n\t\t// Every node in the group must have compatible relational props.\n\t\tassert(relational.isCompatible(group.relational), \"Group has inconsistent relational props\")\n\n\t\treturn node\n\t}\n\n\t/**\n\t * Adds a scalar node to the memo. If the node is already in the memo, it\n\t * returns the existing node.\n\t */\n\taddScalar<Node extends ScalarNode>(node: Node) {\n\t\tconst hash = node.getHash()\n\n\t\t// If the node is already in the memo, return the existing node.\n\t\tconst existing = this.nodes.get(hash)\n\t\tif (existing) return existing as Node\n\n\t\t// Add the node to the memo.\n\t\tthis.nodes.set(hash, node)\n\t\treturn node\n\t}\n}\n", "import { valueToBoolean } from \"../../../DatabaseValue.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport { Relation, Tuple } from \"../../Relation.ts\"\nimport { ScalarEquals } from \"../scalar/ScalarEquals.ts\"\nimport type { ScalarNode } from \"../scalar/ScalarNode.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class RelationalLeftJoin extends RelationalNode {\n\treadonly leftGroup: Group\n\treadonly rightGroup: Group\n\n\tconstructor(\n\t\treadonly left: RelationalNode,\n\t\treadonly right: RelationalNode,\n\t\treadonly constraint: ScalarNode,\n\t) {\n\t\tsuper(left.isSynchronous && right.isSynchronous && constraint.isSynchronous)\n\n\t\tthis.leftGroup = left.getGroup()\n\t\tthis.rightGroup = right.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalLeftJoin\", this.leftGroup.id, this.rightGroup.id, this.constraint)\n\t}\n\n\toverride getOutputFields() {\n\t\tconst outputFields = new Fields()\n\t\toutputFields.merge(this.leftGroup.relational.outputFields)\n\t\toutputFields.merge(this.rightGroup.relational.outputFields)\n\t\treturn outputFields\n\t}\n\n\toverride canProvideOrdering() {\n\t\treturn false\n\t}\n\n\toverride canProvideResolvedFields() {\n\t\treturn true\n\t}\n\n\tprivate getChildRequiredProps(group: Group, required: RequiredProps) {\n\t\tconst resolvedFields = new Fields()\n\t\tconst outputFields = group.relational.outputFields\n\n\t\tfor (const field of required.resolvedFields) {\n\t\t\tif (outputFields.has(field)) {\n\t\t\t\tresolvedFields.add(field)\n\t\t\t}\n\t\t}\n\n\t\tfor (const field of this.constraint.referencedFields) {\n\t\t\tif (outputFields.has(field)) {\n\t\t\t\tresolvedFields.add(field)\n\t\t\t}\n\t\t}\n\n\t\tconst ordering = new Ordering()\n\t\treturn new RequiredProps(ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst leftRequired = this.getChildRequiredProps(this.leftGroup, required)\n\t\tconst leftCost = optimizer.optimizeGroup(this.leftGroup, leftRequired)\n\n\t\tconst rightRequired = this.getChildRequiredProps(this.rightGroup, required)\n\t\tconst rightCost = optimizer.optimizeGroup(this.rightGroup, rightRequired)\n\n\t\tconst constraintCost = this.constraint.optimize(optimizer)\n\n\t\treturn Cost.max(Cost.max(leftCost, rightCost), constraintCost)\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst leftRequired = this.getChildRequiredProps(this.leftGroup, required)\n\t\tconst left = this.leftGroup.getOptimized(leftRequired)\n\n\t\tconst rightRequired = this.getChildRequiredProps(this.rightGroup, required)\n\t\tconst right = this.rightGroup.getOptimized(rightRequired)\n\n\t\tconst constraint = this.constraint.getOptimized()\n\n\t\treturn new RelationalLeftJoin(left, right, constraint)\n\t}\n\n\t/** Optimized path for equality constraints that runs in O(n + m) time. */\n\tprivate *evaluateScalarEquals(\n\t\tleft: Relation,\n\t\tright: Relation,\n\t\tleftConstraint: ScalarNode,\n\t\trightConstraint: ScalarNode,\n\t\tcontext: Tuple | undefined,\n\t) {\n\t\tconst joinKeyMap = new Map<string, Tuple[]>()\n\n\t\tfor (const rightTuple of right.tuples) {\n\t\t\tconst rightValue = yield* rightConstraint.evaluate(context, rightTuple)\n\t\t\tconst key = JSON.stringify(rightValue?.value ?? null)\n\n\t\t\tconst tuplesForKey = joinKeyMap.get(key) ?? []\n\n\t\t\ttuplesForKey.push(rightTuple)\n\t\t\tjoinKeyMap.set(key, tuplesForKey)\n\t\t}\n\n\t\tconst outputFields = this.getOutputFields()\n\t\tconst result = new Relation(outputFields)\n\n\t\tfor (const leftTuple of left.tuples) {\n\t\t\tconst leftValue = yield* leftConstraint.evaluate(context, leftTuple)\n\t\t\tconst key = JSON.stringify(leftValue?.value ?? null)\n\n\t\t\tconst matches = joinKeyMap.get(key) ?? []\n\n\t\t\tif (matches.length === 0) {\n\t\t\t\tresult.push(leftTuple)\n\t\t\t} else {\n\t\t\t\tfor (const rightTuple of matches) {\n\t\t\t\t\tconst joinedTuple = new Tuple()\n\t\t\t\t\tjoinedTuple.merge(leftTuple)\n\t\t\t\t\tjoinedTuple.merge(rightTuple)\n\t\t\t\t\tresult.push(joinedTuple)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context),\n\t\t\tright: this.right.evaluate(context),\n\t\t})\n\n\t\tif (this.constraint instanceof ScalarEquals) {\n\t\t\tif (\n\t\t\t\tthis.constraint.left.referencedFields.subsetOf(this.leftGroup.relational.outputFields) &&\n\t\t\t\tthis.constraint.right.referencedFields.subsetOf(this.rightGroup.relational.outputFields)\n\t\t\t) {\n\t\t\t\treturn yield* this.evaluateScalarEquals(left, right, this.constraint.left, this.constraint.right, context)\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tthis.constraint.right.referencedFields.subsetOf(this.leftGroup.relational.outputFields) &&\n\t\t\t\tthis.constraint.left.referencedFields.subsetOf(this.rightGroup.relational.outputFields)\n\t\t\t) {\n\t\t\t\treturn yield* this.evaluateScalarEquals(left, right, this.constraint.right, this.constraint.left, context)\n\t\t\t}\n\t\t}\n\n\t\tconst outputFields = this.getOutputFields()\n\t\tconst result = new Relation(outputFields)\n\n\t\tfor (const leftTuple of left.tuples) {\n\t\t\tlet hasMatch = false\n\n\t\t\tfor (const rightTuple of right.tuples) {\n\t\t\t\tconst tuple = new Tuple()\n\t\t\t\ttuple.merge(leftTuple)\n\t\t\t\ttuple.merge(rightTuple)\n\n\t\t\t\t// TODO: Run the constraint in parallel\n\t\t\t\tconst value = yield* this.constraint.evaluate(context, tuple)\n\t\t\t\tif (valueToBoolean(value)) {\n\t\t\t\t\tresult.push(tuple)\n\t\t\t\t\thasMatch = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!hasMatch) {\n\t\t\t\tresult.push(leftTuple)\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n}\n", "import { valueToNumber } from \"../../../DatabaseValue.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation, Tuple } from \"../../Relation.ts\"\nimport type { ScalarNode } from \"../scalar/ScalarNode.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class RelationalLimit extends RelationalNode {\n\treadonly inputGroup: Group\n\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly limit: ScalarNode,\n\t\treadonly ordering: Ordering,\n\t) {\n\t\tsuper(input.isSynchronous && limit.isSynchronous)\n\n\t\tthis.inputGroup = input.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalLimit\", this.inputGroup.id, this.limit)\n\t}\n\n\toverride getOutputFields() {\n\t\treturn this.inputGroup.relational.outputFields\n\t}\n\n\toverride canProvideOrdering(ordering: Ordering) {\n\t\treturn ordering.equals(this.ordering)\n\t}\n\n\toverride canProvideResolvedFields() {\n\t\treturn true\n\t}\n\n\tprivate getInputRequiredProps(required: RequiredProps) {\n\t\tconst resolvedFields = new Fields(required.resolvedFields)\n\t\tresolvedFields.merge(this.limit.referencedFields)\n\n\t\treturn new RequiredProps(this.ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst inputCost = optimizer.optimizeGroup(this.inputGroup, inputRequired)\n\n\t\tconst limitCost = this.limit.optimize(optimizer)\n\n\t\treturn new Cost(0).add(Cost.max(inputCost, limitCost))\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst input = this.inputGroup.getOptimized(inputRequired)\n\n\t\tconst limit = this.limit.getOptimized()\n\n\t\treturn new RelationalLimit(input, limit, this.ordering)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst { input, limit } = yield* evaluateObject({\n\t\t\tinput: this.input.evaluate(context),\n\t\t\tlimit: this.limit.evaluate(context, undefined),\n\t\t})\n\n\t\tconst value = valueToNumber(limit) ?? Infinity\n\t\tif (value === Infinity) return input\n\n\t\treturn input.slice(0, value)\n\t}\n}\n", "import { valueToNumber } from \"../../../DatabaseValue.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation, Tuple } from \"../../Relation.ts\"\nimport type { ScalarNode } from \"../scalar/ScalarNode.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nexport class RelationalOffset extends RelationalNode {\n\treadonly inputGroup: Group\n\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly offset: ScalarNode,\n\t\treadonly ordering: Ordering,\n\t) {\n\t\tsuper(input.isSynchronous && offset.isSynchronous)\n\n\t\tthis.inputGroup = input.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"RelationalOffset\", this.inputGroup.id, this.offset)\n\t}\n\n\toverride getOutputFields() {\n\t\treturn this.inputGroup.relational.outputFields\n\t}\n\n\toverride canProvideOrdering(ordering: Ordering) {\n\t\treturn ordering.equals(this.ordering)\n\t}\n\n\toverride canProvideResolvedFields() {\n\t\treturn true\n\t}\n\n\tprivate getInputRequiredProps(required: RequiredProps) {\n\t\tconst resolvedFields = new Fields(required.resolvedFields)\n\t\tresolvedFields.merge(this.offset.referencedFields)\n\n\t\treturn new RequiredProps(this.ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst inputCost = optimizer.optimizeGroup(this.inputGroup, inputRequired)\n\n\t\tconst offsetCost = this.offset.optimize(optimizer)\n\n\t\treturn new Cost(0).add(Cost.max(inputCost, offsetCost))\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst input = this.inputGroup.getOptimized(inputRequired)\n\n\t\tconst offset = this.offset.getOptimized()\n\n\t\treturn new RelationalOffset(input, offset, this.ordering)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst { input, offset } = yield* evaluateObject({\n\t\t\tinput: this.input.evaluate(context),\n\t\t\toffset: this.offset.evaluate(context, undefined),\n\t\t})\n\n\t\tconst value = valueToNumber(offset) ?? 0\n\t\tif (value === 0) return input\n\n\t\treturn input.slice(value)\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { isUndefined } from \"../../../../../utils/utils.ts\"\nimport type { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { FieldId } from \"../../Metadata.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport { Tuple } from \"../../Relation.ts\"\nimport type { NamedFields } from \"../../Scope.ts\"\nimport type { RelationalNode } from \"../relational/RelationalNode.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarArray extends ScalarNode {\n\treadonly inputGroup: Group\n\treadonly definition: DatabaseValueDefinition\n\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly namedFields: NamedFields,\n\t\treadonly ordering: Ordering,\n\t\toverride readonly referencedFields: Fields,\n\t\toverride readonly referencedOuterFields: Fields,\n\t) {\n\t\tsuper(referencedFields, referencedOuterFields, input.isSynchronous)\n\n\t\tthis.inputGroup = input.getGroup()\n\n\t\tconst itemDefinitions: Record<string, DatabaseValueDefinition> = {}\n\n\t\tconst namedFieldEntries = Object.entries(namedFields)\n\t\tfor (const [name, field] of namedFieldEntries) {\n\t\t\titemDefinitions[name] = field.definition\n\t\t}\n\n\t\tthis.definition = {\n\t\t\ttype: ControlType.Array,\n\t\t\tisNullable: false,\n\t\t\tdefinition: {\n\t\t\t\ttype: ControlType.Object,\n\t\t\t\tisNullable: false,\n\t\t\t\tdefinitions: itemDefinitions,\n\t\t\t},\n\t\t}\n\t}\n\n\toverride getHash() {\n\t\tconst namedFieldIds: Record<string, FieldId> = {}\n\t\tconst namedFieldEntries = Object.entries(this.namedFields)\n\n\t\tfor (const [name, field] of namedFieldEntries) {\n\t\t\tnamedFieldIds[name] = field.id\n\t\t}\n\n\t\treturn calculateHash(\n\t\t\t\"ScalarArray\",\n\t\t\tthis.inputGroup.id,\n\t\t\tnamedFieldIds,\n\t\t\tthis.ordering,\n\t\t\tthis.referencedFields,\n\t\t\tthis.referencedOuterFields,\n\t\t)\n\t}\n\n\tprivate getInputRequiredProps() {\n\t\tconst resolvedFields = new Fields()\n\n\t\tconst fields = Object.values(this.namedFields)\n\t\tfor (const field of fields) {\n\t\t\tif (isUndefined(field.collection)) continue\n\t\t\tresolvedFields.add(field)\n\t\t}\n\n\t\treturn new RequiredProps(this.ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst inputRequired = this.getInputRequiredProps()\n\t\tconst inputCost = optimizer.optimizeGroup(this.inputGroup, inputRequired)\n\n\t\treturn new Cost(0).add(inputCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst inputRequired = this.getInputRequiredProps()\n\t\tconst input = this.inputGroup.getOptimized(inputRequired)\n\n\t\treturn new ScalarArray(input, this.namedFields, this.ordering, this.referencedFields, this.referencedOuterFields)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst inputContext = new Tuple()\n\t\tif (context) inputContext.merge(context)\n\t\tif (tuple) inputContext.merge(tuple)\n\n\t\tconst relation = yield* this.input.evaluate(inputContext)\n\t\tconst namedFieldEntries = Object.entries(this.namedFields)\n\n\t\treturn {\n\t\t\ttype: ControlType.Array,\n\t\t\tvalue: relation.tuples.map(relationTuple => {\n\t\t\t\tconst value: Record<string, DatabaseValue> = {}\n\n\t\t\t\tfor (const [name, field] of namedFieldEntries) {\n\t\t\t\t\tvalue[name] = relationTuple.getValue(field)\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\ttype: ControlType.Object,\n\t\t\t\t\tvalue,\n\t\t\t\t}\n\t\t\t}),\n\t\t}\n\t}\n}\n", "import { assert } from \"../../../../../utils/assert.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarCast extends ScalarNode {\n\tconstructor(\n\t\treadonly input: ScalarNode,\n\t\treadonly definition: DatabaseValueDefinition,\n\t) {\n\t\tsuper(input.referencedFields, input.referencedOuterFields, input.isSynchronous)\n\n\t\tassert(definition.isNullable, \"Unsupported non-nullable cast\")\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarCast\", this.input, this.definition)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\treturn this.input.optimize(optimizer)\n\t}\n\n\toverride getOptimized() {\n\t\tconst input = this.input.getOptimized()\n\t\treturn new ScalarCast(input, this.definition)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst input = yield* this.input.evaluate(context, tuple)\n\t\treturn DatabaseValue.cast(input, this.definition)\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { isUndefined } from \"../../../../../utils/utils.ts\"\nimport type { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { FieldMetadata } from \"../../Metadata.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport { Tuple } from \"../../Relation.ts\"\nimport type { RelationalNode } from \"../relational/RelationalNode.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarFlatArray extends ScalarNode {\n\treadonly inputGroup: Group\n\treadonly definition: DatabaseValueDefinition\n\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly field: FieldMetadata,\n\t\treadonly ordering: Ordering,\n\t\toverride readonly referencedFields: Fields,\n\t\toverride readonly referencedOuterFields: Fields,\n\t) {\n\t\tsuper(referencedFields, referencedOuterFields, input.isSynchronous)\n\n\t\tthis.inputGroup = input.getGroup()\n\n\t\tthis.definition = {\n\t\t\ttype: ControlType.Array,\n\t\t\tisNullable: false,\n\t\t\tdefinition: field.definition,\n\t\t}\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\n\t\t\t\"ScalarFlatArray\",\n\t\t\tthis.inputGroup.id,\n\t\t\tthis.field.id,\n\t\t\tthis.ordering,\n\t\t\tthis.referencedFields,\n\t\t\tthis.referencedOuterFields,\n\t\t)\n\t}\n\n\tprivate getInputRequiredProps() {\n\t\tconst resolvedFields = new Fields()\n\n\t\tif (!isUndefined(this.field.collection)) {\n\t\t\tresolvedFields.add(this.field)\n\t\t}\n\n\t\treturn new RequiredProps(this.ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst inputRequired = this.getInputRequiredProps()\n\t\tconst inputCost = optimizer.optimizeGroup(this.inputGroup, inputRequired)\n\n\t\treturn new Cost(0).add(inputCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst inputRequired = this.getInputRequiredProps()\n\t\tconst input = this.inputGroup.getOptimized(inputRequired)\n\n\t\treturn new ScalarFlatArray(input, this.field, this.ordering, this.referencedFields, this.referencedOuterFields)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst inputContext = new Tuple()\n\t\tif (context) inputContext.merge(context)\n\t\tif (tuple) inputContext.merge(tuple)\n\n\t\tconst relation = yield* this.input.evaluate(inputContext)\n\n\t\treturn {\n\t\t\ttype: ControlType.Array,\n\t\t\tvalue: relation.tuples.map(relationTuple => {\n\t\t\t\treturn relationTuple.getValue(this.field)\n\t\t\t}),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation } from \"../../../types.ts\"\nimport { DatabaseCollationType } from \"../../../types.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseInsensitive,\n}\n\nexport class ScalarIn extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarIn\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarIn(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: DatabaseValue.in(left, right, collation),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation } from \"../../../types.ts\"\nimport { DatabaseCollationType } from \"../../../types.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseSensitive,\n}\n\nexport class ScalarIndexOf extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Number,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly source: ScalarNode,\n\t\treadonly target: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(source.referencedFields)\n\t\treferencedFields.merge(target.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(source.referencedOuterFields)\n\t\treferencedOuterFields.merge(target.referencedOuterFields)\n\n\t\tconst isSynchronous = source.isSynchronous && target.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarIndexOf\", this.source, this.target)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst sourceCost = this.source.optimize(optimizer)\n\t\tconst targetCost = this.target.optimize(optimizer)\n\n\t\treturn Cost.max(sourceCost, targetCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst source = this.source.getOptimized()\n\t\tconst target = this.target.getOptimized()\n\n\t\treturn new ScalarIndexOf(source, target)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { source, target } = yield* evaluateObject({\n\t\t\tsource: this.source.evaluate(context, tuple),\n\t\t\ttarget: this.target.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Number,\n\t\t\tvalue: DatabaseValue.indexOf(source, target, collation),\n\t\t}\n\t}\n}\n", "/**\n * Throws an error when the condition is falsy, optionally pass in a message to\n * describe the error.\n *\n * Best to use asserts where data is about to be stored. Then errors are caught\n * early, close to the cause. Otherwise data with broken expectation might hang\n * around, only to cause errors when used later on, with no pointer back to what\n * caused that bad state.\n *\n * Note that when an assert fails, consider that a fatal error caused by buggy\n * code. The program should halt, or perhaps do some kind of high level\n * recovery, and the bug should be reported and fixed. Asserts are not well\n * suited to use as defensive programming, but are good to use to quickly\n * highlight mistakes while writing new code.\n *\n * And finally, both the condition should be cheap, and the message should not\n * do string interpolation, instead you can pass in multiple parts of the\n * message.\n */\nexport function assert(condition: unknown, ...msg: unknown[]): asserts condition {\n\tif (condition) return\n\n\tconst e = Error(\"Assertion Error\" + (msg.length > 0 ? \": \" + msg.join(\" \") : \"\"))\n\t// Hack the stack so the assert call itself disappears. Works in jest and in chrome.\n\tif (e.stack) {\n\t\ttry {\n\t\t\tconst lines = e.stack.split(\"\\n\")\n\t\t\tif (lines[1]?.includes(\"assert\")) {\n\t\t\t\tlines.splice(1, 1)\n\t\t\t\te.stack = lines.join(\"\\n\")\n\t\t\t} else if (lines[0]?.includes(\"assert\")) {\n\t\t\t\tlines.splice(0, 1)\n\t\t\t\te.stack = lines.join(\"\\n\")\n\t\t\t}\n\t\t} catch {\n\t\t\t// nothing\n\t\t}\n\t}\n\tthrow e\n}\n\n/**\n * Asserts that a code path is never entered. Additionally, asserts that the provided\n * value is evaluated to `never` by the type system, which means all possible discrete\n * types have been exhaustively checked by the time this statement is reached.\n */\nexport function assertNever(x: never, error?: unknown): never {\n\tif (error instanceof Error) {\n\t\tthrow error\n\t}\n\tif (error !== undefined) {\n\t\tthrow new Error(String(error))\n\t}\n\tthrow new Error(x ? `Unexpected value: ${x}` : \"Application entered invalid state\")\n}\n", "import { assert } from \"@framerjs/shared/src/assert.ts\"\nimport { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport type { DatabaseStringValue, DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport type { Hash } from \"../../Hashable.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarIntersection extends ScalarNode {\n\toverride readonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Array,\n\t\tdefinition: {\n\t\t\ttype: ControlType.String,\n\t\t\tisNullable: false,\n\t\t},\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\tpublic readonly left: ScalarNode,\n\t\tpublic readonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash(): Hash {\n\t\treturn calculateHash(\"ScalarIntersection\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer): Cost {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarIntersection(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\tconst leftSet = databaseValueToSet(left)\n\t\tconst rightSet = databaseValueToSet(right)\n\t\tconst intersection: DatabaseStringValue[] = []\n\n\t\tconst shortestSet = leftSet.size < rightSet.size ? leftSet : rightSet\n\t\tconst longestSet = shortestSet === leftSet ? rightSet : leftSet\n\n\t\tfor (const item of shortestSet) {\n\t\t\tif (longestSet.has(item)) {\n\t\t\t\tintersection.push({\n\t\t\t\t\ttype: ControlType.String,\n\t\t\t\t\tvalue: item,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\ttype: ControlType.Array,\n\t\t\tvalue: intersection,\n\t\t}\n\t}\n}\n\nfunction databaseValueToSet(value: DatabaseValue) {\n\tconst set = new Set<string>()\n\n\tif (!value) return set\n\tassert(value.type === ControlType.Array, \"ScalarIntersection expects an array, got:\", value.type)\n\n\tfor (const item of value.value) {\n\t\tif (!item) continue\n\t\tassert(\n\t\t\titem.type === ControlType.String,\n\t\t\t\"ScalarIntersection expects an array of strings, got an array with:\",\n\t\t\titem.type,\n\t\t)\n\n\t\tset.add(item.value)\n\t}\n\n\treturn set\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarLength extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Number,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(readonly input: ScalarNode) {\n\t\tsuper(input.referencedFields, input.referencedOuterFields, input.isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarLength\", this.input)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\treturn this.input.optimize(optimizer)\n\t}\n\n\toverride getOptimized() {\n\t\tconst input = this.input.getOptimized()\n\t\treturn new ScalarLength(input)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst input = yield* this.input.evaluate(context, tuple)\n\n\t\treturn {\n\t\t\ttype: ControlType.Number,\n\t\t\tvalue: DatabaseValue.length(input),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport type { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport { valueToBoolean } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarNot extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(readonly input: ScalarNode) {\n\t\tsuper(input.referencedFields, input.referencedOuterFields, input.isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarNot\", this.input)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\treturn this.input.optimize(optimizer)\n\t}\n\n\toverride getOptimized() {\n\t\tconst input = this.input.getOptimized()\n\t\treturn new ScalarNot(input)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst input = yield* this.input.evaluate(context, tuple)\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: !valueToBoolean(input),\n\t\t}\n\t}\n}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport type { DatabaseCollation } from \"../../../types.ts\"\nimport { DatabaseCollationType } from \"../../../types.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { evaluateObject } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseInsensitive,\n}\n\nexport class ScalarNotIn extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition = {\n\t\ttype: ControlType.Boolean,\n\t\tisNullable: false,\n\t}\n\n\tconstructor(\n\t\treadonly left: ScalarNode,\n\t\treadonly right: ScalarNode,\n\t) {\n\t\tconst referencedFields = new Fields()\n\t\treferencedFields.merge(left.referencedFields)\n\t\treferencedFields.merge(right.referencedFields)\n\n\t\tconst referencedOuterFields = new Fields()\n\t\treferencedOuterFields.merge(left.referencedOuterFields)\n\t\treferencedOuterFields.merge(right.referencedOuterFields)\n\n\t\tconst isSynchronous = left.isSynchronous && right.isSynchronous\n\t\tsuper(referencedFields, referencedOuterFields, isSynchronous)\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarNotIn\", this.left, this.right)\n\t}\n\n\toverride optimize(optimizer: Optimizer) {\n\t\tconst leftCost = this.left.optimize(optimizer)\n\t\tconst rightCost = this.right.optimize(optimizer)\n\n\t\treturn Cost.max(leftCost, rightCost)\n\t}\n\n\toverride getOptimized() {\n\t\tconst left = this.left.getOptimized()\n\t\tconst right = this.right.getOptimized()\n\n\t\treturn new ScalarNotIn(left, right)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tconst { left, right } = yield* evaluateObject({\n\t\t\tleft: this.left.evaluate(context, tuple),\n\t\t\tright: this.right.evaluate(context, tuple),\n\t\t})\n\n\t\treturn {\n\t\t\ttype: ControlType.Boolean,\n\t\t\tvalue: !DatabaseValue.in(left, right, collation),\n\t\t}\n\t}\n}\n", "import { assert } from \"../../../../../utils/assert.ts\"\nimport type { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { unknownDefinition } from \"../../../DatabaseValueDefinition.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { FieldId, FieldMetadata, Fields, VIRTUAL_INDEX_FIELD } from \"../../Metadata.ts\"\nimport type { Tuple } from \"../../Relation.ts\"\nimport { ScalarNode } from \"./ScalarNode.ts\"\n\nexport class ScalarVariable extends ScalarNode {\n\treadonly definition: DatabaseValueDefinition\n\n\tconstructor(\n\t\treadonly field: FieldMetadata,\n\t\treadonly isOuterField: boolean,\n\t) {\n\t\t// The virtual index field can only be used for ordering.\n\t\tassert(field.name !== VIRTUAL_INDEX_FIELD, \"Invalid field name\")\n\n\t\tconst referencedFields = new Fields()\n\t\tconst referencedOuterFields = new Fields()\n\n\t\tif (isOuterField) {\n\t\t\treferencedOuterFields.add(field)\n\t\t} else {\n\t\t\treferencedFields.add(field)\n\t\t}\n\n\t\tsuper(referencedFields, referencedOuterFields, true)\n\n\t\tthis.definition = field.definition\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"ScalarVariable\", this.field.id, this.isOuterField)\n\t}\n\n\toverride optimize() {\n\t\treturn new Cost(0)\n\t}\n\n\toverride getOptimized() {\n\t\treturn this\n\t}\n\n\t// biome-ignore lint/correctness/useYield: Required by the super class.\n\toverride *evaluate(context: Tuple | undefined, tuple: Tuple | undefined): Evaluate<DatabaseValue> {\n\t\tif (this.isOuterField) {\n\t\t\tassert(context, \"Context must exist\")\n\t\t\treturn context.getValue(this.field)\n\t\t}\n\n\t\tassert(tuple, \"Tuple must exist\")\n\t\treturn tuple.getValue(this.field)\n\t}\n}\n\nexport function createScalarVariable(fieldId: number, isOuterField: boolean = true) {\n\treturn new ScalarVariable(new FieldMetadata(FieldId(fieldId), \"Field\", unknownDefinition, undefined), isOuterField)\n}\n", "import { ControlType } from \"../../../render/types/PropertyControls.ts\"\nimport type { DatabaseValue } from \"../DatabaseValue.ts\"\nimport type { DatabaseValueDefinition } from \"../DatabaseValueDefinition.ts\"\nimport type { DatabaseIndexLookup } from \"../types.ts\"\nimport type { Memo } from \"./Memo.ts\"\nimport type { CollectionMetadata, FieldMetadata, Fields, IndexMetadata } from \"./Metadata.ts\"\nimport type { Ordering } from \"./Ordering.ts\"\nimport type { NamedFields } from \"./Scope.ts\"\nimport { RelationalFilter } from \"./nodes/relational/RelationalFilter.ts\"\nimport { RelationalIndexLookup } from \"./nodes/relational/RelationalIndexLookup.ts\"\nimport { RelationalLeftJoin } from \"./nodes/relational/RelationalLeftJoin.ts\"\nimport { RelationalLimit } from \"./nodes/relational/RelationalLimit.ts\"\nimport type { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\nimport { RelationalOffset } from \"./nodes/relational/RelationalOffset.ts\"\nimport type { ProjectionField } from \"./nodes/relational/RelationalProject.ts\"\nimport { RelationalProject } from \"./nodes/relational/RelationalProject.ts\"\nimport { RelationalScan } from \"./nodes/relational/RelationalScan.ts\"\nimport { ScalarAnd } from \"./nodes/scalar/ScalarAnd.ts\"\nimport { ScalarArray } from \"./nodes/scalar/ScalarArray.ts\"\nimport { CaseCondition, ScalarCase } from \"./nodes/scalar/ScalarCase.ts\"\nimport { ScalarCast } from \"./nodes/scalar/ScalarCast.ts\"\nimport { ScalarConstant } from \"./nodes/scalar/ScalarConstant.ts\"\nimport { ScalarContains } from \"./nodes/scalar/ScalarContains.ts\"\nimport { ScalarEndsWith } from \"./nodes/scalar/ScalarEndsWith.ts\"\nimport { ScalarEquals } from \"./nodes/scalar/ScalarEquals.ts\"\nimport { ScalarFlatArray } from \"./nodes/scalar/ScalarFlatArray.ts\"\nimport { ScalarGreaterThan } from \"./nodes/scalar/ScalarGreaterThan.ts\"\nimport { ScalarGreaterThanOrEqual } from \"./nodes/scalar/ScalarGreaterThanOrEqual.ts\"\nimport { ScalarIn } from \"./nodes/scalar/ScalarIn.ts\"\nimport { ScalarIndexOf } from \"./nodes/scalar/ScalarIndexOf.ts\"\nimport { ScalarIntersection } from \"./nodes/scalar/ScalarIntersection.ts\"\nimport { ScalarLength } from \"./nodes/scalar/ScalarLength.ts\"\nimport { ScalarLessThan } from \"./nodes/scalar/ScalarLessThan.ts\"\nimport { ScalarLessThanOrEqual } from \"./nodes/scalar/ScalarLessThanOrEqual.ts\"\nimport type { ScalarNode } from \"./nodes/scalar/ScalarNode.ts\"\nimport { ScalarNot } from \"./nodes/scalar/ScalarNot.ts\"\nimport { ScalarNotEquals } from \"./nodes/scalar/ScalarNotEquals.ts\"\nimport { ScalarNotIn } from \"./nodes/scalar/ScalarNotIn.ts\"\nimport { ScalarOr } from \"./nodes/scalar/ScalarOr.ts\"\nimport { ScalarStartsWith } from \"./nodes/scalar/ScalarStartsWith.ts\"\nimport { ScalarVariable } from \"./nodes/scalar/ScalarVariable.ts\"\n\n/**\n * The normalizer converts nodes into their normalized form and inserts them\n * into the memo. This is the most common way to insert a node into the memo.\n *\n * If a normalized node is already in the memo, it will be returned instead.\n * Otherwise, a new memo group is created and the node is inserted into it as\n * its first and only child. The explorer will then create logically equivalent\n * nodes and add them into the same group.\n */\nexport class Normalizer {\n\tconstructor(readonly memo: Memo) {}\n\n\tprivate finishRelational(node: RelationalNode) {\n\t\treturn this.memo.addRelational(node)\n\t}\n\n\tnewRelationalScan(collection: CollectionMetadata): RelationalNode {\n\t\tconst node = new RelationalScan(collection)\n\t\treturn this.finishRelational(node)\n\t}\n\n\tnewRelationalIndexLookup(index: IndexMetadata, query: DatabaseIndexLookup[]): RelationalNode {\n\t\tconst node = new RelationalIndexLookup(index, query)\n\t\treturn this.finishRelational(node)\n\t}\n\n\tnewRelationalLeftJoin(left: RelationalNode, right: RelationalNode, constraint: ScalarNode): RelationalNode {\n\t\tconst node = new RelationalLeftJoin(left, right, constraint)\n\t\treturn this.finishRelational(node)\n\t}\n\n\tnewRelationalRightJoin(left: RelationalNode, right: RelationalNode, constraint: ScalarNode): RelationalNode {\n\t\t// Replace `RelationalRightJoin` with `RelationalLeftJoin`.\n\t\treturn this.newRelationalLeftJoin(right, left, constraint)\n\t}\n\n\tnewRelationalFilter(input: RelationalNode, predicate: ScalarNode): RelationalNode {\n\t\t// Ignore filters that are always true.\n\t\tif (\n\t\t\tpredicate instanceof ScalarConstant &&\n\t\t\tpredicate.value?.type === ControlType.Boolean &&\n\t\t\tpredicate.value.value === true\n\t\t) {\n\t\t\treturn input\n\t\t}\n\n\t\t// Push `RelationalFilter` through `RelationalLeftJoin`.\n\t\tif (\n\t\t\tinput instanceof RelationalLeftJoin &&\n\t\t\t// Check that the predicate doesn't depend on any joined field.\n\t\t\tpredicate.referencedFields.subsetOf(input.leftGroup.relational.outputFields)\n\t\t) {\n\t\t\tconst pushedFilter = this.newRelationalFilter(input.left, predicate)\n\t\t\treturn this.newRelationalLeftJoin(pushedFilter, input.right, input.constraint)\n\t\t}\n\n\t\tconst node = new RelationalFilter(input, predicate)\n\t\treturn this.finishRelational(node)\n\t}\n\n\tnewRelationalProject(input: RelationalNode, projections: ProjectionField[], passthrough: Fields): RelationalNode {\n\t\tconst node = new RelationalProject(input, projections, passthrough)\n\t\treturn this.finishRelational(node)\n\t}\n\n\tnewRelationalLimit(input: RelationalNode, limit: ScalarNode, ordering: Ordering): RelationalNode {\n\t\t// Push `RelationalLimit` through `RelationalProject`.\n\t\tif (\n\t\t\tinput instanceof RelationalProject &&\n\t\t\t// Check that the limit doesn't depend on any projected field.\n\t\t\tlimit.referencedFields.subsetOf(input.inputGroup.relational.outputFields) &&\n\t\t\t// Check that the ordering doesn't depend on any projected field.\n\t\t\tordering.providedByFields(input.inputGroup.relational.outputFields)\n\t\t) {\n\t\t\tconst pushedLimit = this.newRelationalLimit(input.input, limit, ordering)\n\t\t\treturn this.newRelationalProject(pushedLimit, input.projections, input.passthrough)\n\t\t}\n\n\t\tconst node = new RelationalLimit(input, limit, ordering)\n\t\treturn this.finishRelational(node)\n\t}\n\n\tnewRelationalOffset(input: RelationalNode, offset: ScalarNode, ordering: Ordering): RelationalNode {\n\t\tconst node = new RelationalOffset(input, offset, ordering)\n\t\treturn this.finishRelational(node)\n\t}\n\n\tprivate finishScalar(node: ScalarNode) {\n\t\tconst isConstant = node instanceof ScalarConstant\n\n\t\t// Pre-compute nodes that don't depend on any variable.\n\t\tif (\n\t\t\t!isConstant &&\n\t\t\tnode.isSynchronous &&\n\t\t\tnode.referencedFields.size === 0 &&\n\t\t\tnode.referencedOuterFields.size === 0\n\t\t) {\n\t\t\tconst value = node.evaluateSync()\n\t\t\treturn this.newScalarConstant(node.definition, value)\n\t\t}\n\n\t\treturn this.memo.addScalar(node)\n\t}\n\n\t/**\n\t * When we create `ScalarConstant` nodes, we always give them an unknown\n\t * type definition. Before we compare them to other nodes, we need to cast\n\t * them to a specific type.\n\t *\n\t * For example, in the following query:\n\t * ```\n\t * SELECT id FROM cars WHERE type = \"coupe\"\n\t * ```\n\t *\n\t * If the `type` field is an enum, and we parse the `\"coupe\"` constant as a\n\t * string, the where clause will always be false because an enum can't be\n\t * equal to a string. But if we cast the string to an enum type first, the\n\t * where clause will work as expected.\n\t */\n\tprivate removeUnknown(node: ScalarNode, definition: DatabaseValueDefinition) {\n\t\t// The node already has a specific type.\n\t\tif (node.definition.type !== \"unknown\") return node\n\t\t// We don't know a more specific type.\n\t\tif (definition.type === \"unknown\") return node\n\n\t\tconst nullableDefinition: DatabaseValueDefinition = { ...definition, isNullable: true }\n\t\treturn this.newScalarCast(node, nullableDefinition)\n\t}\n\n\tnewScalarVariable(field: FieldMetadata, isOuterField: boolean): ScalarNode {\n\t\tconst node = new ScalarVariable(field, isOuterField)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarConstant(definition: DatabaseValueDefinition, value: DatabaseValue): ScalarNode {\n\t\tconst node = new ScalarConstant(definition, value)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarNot(input: ScalarNode): ScalarNode {\n\t\t// Normalize `NOT NOT $1` to `CAST($1 AS BOOLEAN)`\n\t\tif (input instanceof ScalarNot) {\n\t\t\tif (input.input.definition.type === ControlType.Boolean) {\n\t\t\t\treturn input.input\n\t\t\t}\n\n\t\t\tconst definition: DatabaseValueDefinition = { type: ControlType.Boolean, isNullable: true }\n\t\t\treturn this.newScalarCast(input.input, definition)\n\t\t}\n\n\t\t// Normalize `NOT $1 == $2` to `$1 != $2`\n\t\tif (input instanceof ScalarEquals) {\n\t\t\treturn this.newScalarNotEquals(input.left, input.right)\n\t\t}\n\n\t\t// Normalize `NOT $1 != $2` to `$1 == $2`\n\t\tif (input instanceof ScalarNotEquals) {\n\t\t\treturn this.newScalarEquals(input.left, input.right)\n\t\t}\n\n\t\t// Normalize `NOT $1 < $2` to `$1 >= $2`\n\t\tif (input instanceof ScalarLessThan) {\n\t\t\treturn this.newScalarGreaterThanOrEqual(input.left, input.right)\n\t\t}\n\n\t\t// Normalize `NOT $1 <= $2` to `$1 > $2`\n\t\tif (input instanceof ScalarLessThanOrEqual) {\n\t\t\treturn this.newScalarGreaterThan(input.left, input.right)\n\t\t}\n\n\t\t// Normalize `NOT $1 > $2` to `$1 <= $2`\n\t\tif (input instanceof ScalarGreaterThan) {\n\t\t\treturn this.newScalarLessThanOrEqual(input.left, input.right)\n\t\t}\n\n\t\t// Normalize `NOT $1 >= $2` to `$1 < $2`\n\t\tif (input instanceof ScalarGreaterThanOrEqual) {\n\t\t\treturn this.newScalarLessThan(input.left, input.right)\n\t\t}\n\n\t\t// Normalize `NOT ($1 AND $2)` to `(NOT $1) OR (NOT $2)`\n\t\tif (input instanceof ScalarAnd) {\n\t\t\tconst left = this.newScalarNot(input.left)\n\t\t\tconst right = this.newScalarNot(input.right)\n\t\t\treturn this.newScalarOr(left, right)\n\t\t}\n\n\t\t// Normalize `NOT ($1 OR $2)` to `(NOT $1) AND (NOT $2)`\n\t\tif (input instanceof ScalarOr) {\n\t\t\tconst left = this.newScalarNot(input.left)\n\t\t\tconst right = this.newScalarNot(input.right)\n\t\t\treturn this.newScalarAnd(left, right)\n\t\t}\n\n\t\tconst node = new ScalarNot(input)\n\t\treturn this.finishScalar(node)\n\t}\n\n\t// TODO: Normalize `$1 AND ($2 AND $c)` to `($1 AND $2) AND $c`\n\tnewScalarAnd(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\t// Normalize `$1 AND true` to `$1`\n\t\tif (right instanceof ScalarConstant && right.value?.type === ControlType.Boolean && right.value.value === true) {\n\t\t\treturn left\n\t\t}\n\n\t\t// Normalize `true AND $1` to `$1`\n\t\tif (left instanceof ScalarConstant && left.value?.type === ControlType.Boolean && left.value.value === true) {\n\t\t\treturn right\n\t\t}\n\n\t\t// Normalize `$1 AND false` to `false`\n\t\tif (right instanceof ScalarConstant && right.value?.type === ControlType.Boolean && right.value.value === false) {\n\t\t\treturn right\n\t\t}\n\n\t\t// Normalize `false AND $1` to `false`\n\t\tif (left instanceof ScalarConstant && left.value?.type === ControlType.Boolean && left.value.value === false) {\n\t\t\treturn left\n\t\t}\n\n\t\tconst node = new ScalarAnd(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\t// TODO: Normalize `$1 OR ($2 OR $c)` to `($1 OR $2) OR $c`\n\tnewScalarOr(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\t// Normalize `$1 OR true` to `true`\n\t\tif (right instanceof ScalarConstant && right.value?.type === ControlType.Boolean && right.value.value === true) {\n\t\t\treturn right\n\t\t}\n\n\t\t// Normalize `true OR $1` to `true`\n\t\tif (left instanceof ScalarConstant && left.value?.type === ControlType.Boolean && left.value.value === true) {\n\t\t\treturn left\n\t\t}\n\n\t\t// Normalize `$1 OR false` to `$1`\n\t\tif (right instanceof ScalarConstant && right.value?.type === ControlType.Boolean && right.value.value === false) {\n\t\t\treturn left\n\t\t}\n\n\t\t// Normalize `false OR $1` to `$1`\n\t\tif (left instanceof ScalarConstant && left.value?.type === ControlType.Boolean && left.value.value === false) {\n\t\t\treturn right\n\t\t}\n\n\t\tconst node = new ScalarOr(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarEquals(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tconst isLeftVariable = left instanceof ScalarVariable\n\t\tconst isRightVariable = right instanceof ScalarVariable\n\n\t\t// Normalize `$1 == a` to `a == $1`\n\t\tif (isRightVariable && !isLeftVariable) {\n\t\t\treturn this.newScalarEquals(right, left)\n\t\t}\n\n\t\tleft = this.removeUnknown(left, right.definition)\n\t\tright = this.removeUnknown(right, left.definition)\n\n\t\tconst node = new ScalarEquals(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarNotEquals(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tconst isLeftVariable = left instanceof ScalarVariable\n\t\tconst isRightVariable = right instanceof ScalarVariable\n\n\t\t// Normalize `$1 != a` to `a != $1`\n\t\tif (isRightVariable && !isLeftVariable) {\n\t\t\treturn this.newScalarNotEquals(right, left)\n\t\t}\n\n\t\tleft = this.removeUnknown(left, right.definition)\n\t\tright = this.removeUnknown(right, left.definition)\n\n\t\tconst node = new ScalarNotEquals(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarLessThan(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tconst isLeftVariable = left instanceof ScalarVariable\n\t\tconst isRightVariable = right instanceof ScalarVariable\n\n\t\t// Normalize `$1 < a` to `a > $1`\n\t\tif (isRightVariable && !isLeftVariable) {\n\t\t\treturn this.newScalarGreaterThan(right, left)\n\t\t}\n\n\t\tleft = this.removeUnknown(left, right.definition)\n\t\tright = this.removeUnknown(right, left.definition)\n\n\t\tconst node = new ScalarLessThan(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarLessThanOrEqual(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tconst isLeftVariable = left instanceof ScalarVariable\n\t\tconst isRightVariable = right instanceof ScalarVariable\n\n\t\t// Normalize `$1 <= a` to `a >= $1`\n\t\tif (isRightVariable && !isLeftVariable) {\n\t\t\treturn this.newScalarGreaterThanOrEqual(right, left)\n\t\t}\n\n\t\tleft = this.removeUnknown(left, right.definition)\n\t\tright = this.removeUnknown(right, left.definition)\n\n\t\tconst node = new ScalarLessThanOrEqual(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarGreaterThan(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tconst isLeftVariable = left instanceof ScalarVariable\n\t\tconst isRightVariable = right instanceof ScalarVariable\n\n\t\t// Normalize `$1 > a` to `a < $1`\n\t\tif (isRightVariable && !isLeftVariable) {\n\t\t\treturn this.newScalarLessThan(right, left)\n\t\t}\n\n\t\tleft = this.removeUnknown(left, right.definition)\n\t\tright = this.removeUnknown(right, left.definition)\n\n\t\tconst node = new ScalarGreaterThan(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarGreaterThanOrEqual(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tconst isLeftVariable = left instanceof ScalarVariable\n\t\tconst isRightVariable = right instanceof ScalarVariable\n\n\t\t// Normalize `$1 >= a` to `a <= $1`\n\t\tif (isRightVariable && !isLeftVariable) {\n\t\t\treturn this.newScalarLessThanOrEqual(right, left)\n\t\t}\n\n\t\tleft = this.removeUnknown(left, right.definition)\n\t\tright = this.removeUnknown(right, left.definition)\n\n\t\tconst node = new ScalarGreaterThanOrEqual(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarIn(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tif (right.definition.type === ControlType.Array) {\n\t\t\tleft = this.removeUnknown(left, right.definition.definition)\n\t\t}\n\n\t\tconst arrayDefinition: DatabaseValueDefinition = {\n\t\t\ttype: ControlType.Array,\n\t\t\tisNullable: true,\n\t\t\tdefinition: left.definition,\n\t\t}\n\n\t\tright = this.removeUnknown(right, arrayDefinition)\n\n\t\tconst node = new ScalarIn(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarNotIn(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tif (right.definition.type === ControlType.Array) {\n\t\t\tleft = this.removeUnknown(left, right.definition.definition)\n\t\t}\n\n\t\tconst arrayDefinition: DatabaseValueDefinition = {\n\t\t\ttype: ControlType.Array,\n\t\t\tisNullable: true,\n\t\t\tdefinition: left.definition,\n\t\t}\n\n\t\tright = this.removeUnknown(right, arrayDefinition)\n\n\t\tconst node = new ScalarNotIn(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarCase(\n\t\tinput: ScalarNode | undefined,\n\t\tconditions: CaseCondition[],\n\t\totherwise: ScalarNode | undefined,\n\t): ScalarNode {\n\t\tif (input) {\n\t\t\tconst castConditions: CaseCondition[] = []\n\n\t\t\tfor (const { when, then } of conditions) {\n\t\t\t\tconst castWhen = this.removeUnknown(when, input.definition)\n\t\t\t\tconst castCondition = new CaseCondition(castWhen, then)\n\t\t\t\tcastConditions.push(castCondition)\n\t\t\t}\n\n\t\t\tconditions = castConditions\n\t\t}\n\n\t\tconst node = new ScalarCase(input, conditions, otherwise)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarContains(source: ScalarNode, target: ScalarNode): ScalarNode {\n\t\tconst node = new ScalarContains(source, target)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarStartsWith(source: ScalarNode, target: ScalarNode): ScalarNode {\n\t\tconst node = new ScalarStartsWith(source, target)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarEndsWith(source: ScalarNode, target: ScalarNode): ScalarNode {\n\t\tconst node = new ScalarEndsWith(source, target)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarLength(array: ScalarNode): ScalarNode {\n\t\tconst node = new ScalarLength(array)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarIndexOf(source: ScalarNode, target: ScalarNode): ScalarNode {\n\t\tconst node = new ScalarIndexOf(source, target)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarArray(\n\t\tinput: RelationalNode,\n\t\tnamedFields: NamedFields,\n\t\tordering: Ordering,\n\t\treferencedFields: Fields,\n\t\treferencedOuterFields: Fields,\n\t): ScalarNode {\n\t\tconst node = new ScalarArray(input, namedFields, ordering, referencedFields, referencedOuterFields)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarFlatArray(\n\t\tinput: RelationalNode,\n\t\tfield: FieldMetadata,\n\t\tordering: Ordering,\n\t\treferencedFields: Fields,\n\t\treferencedOuterFields: Fields,\n\t): ScalarNode {\n\t\tconst node = new ScalarFlatArray(input, field, ordering, referencedFields, referencedOuterFields)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarIntersection(left: ScalarNode, right: ScalarNode): ScalarNode {\n\t\tconst node = new ScalarIntersection(left, right)\n\t\treturn this.finishScalar(node)\n\t}\n\n\tnewScalarCast(input: ScalarNode, definition: DatabaseValueDefinition): ScalarNode {\n\t\t// Replace `CAST($1 AS TYPE)` with `$1`\n\t\tif (input.definition.type === definition.type) {\n\t\t\treturn input\n\t\t}\n\n\t\tconst node = new ScalarCast(input, definition)\n\t\treturn this.finishScalar(node)\n\t}\n}\n", "import { RelationalNode } from \"../relational/RelationalNode.ts\"\n\n/**\n * An enforcer node is a node that can always provide a specific physical\n * property. This is used by the optimizer to ensure physical properties for\n * nodes that don't provide them already.\n */\nexport abstract class EnforcerNode extends RelationalNode {}\n", "import { ControlType } from \"../../../../../render/types/PropertyControls.ts\"\nimport { assert } from \"../../../../../utils/assert.ts\"\nimport type { DatabaseItem, DatabaseItemPointer } from \"../../../types.ts\"\nimport { Cost, KB } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport type { CollectionMetadata } from \"../../Metadata.ts\"\nimport { Fields } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation } from \"../../Relation.ts\"\nimport { Tuple } from \"../../Relation.ts\"\nimport type { Resolver } from \"../../Resolver.ts\"\nimport type { RelationalNode } from \"../relational/RelationalNode.ts\"\nimport { EnforcerNode } from \"./EnforcerNode.ts\"\n\n/**\n * The resolve enforcer is used to resolved fields that are required by its\n * parent node. For example, a `RelationalIndexLookup` returns fields that are\n * not resolved. This means some fields are theoretically available, but they\n * are not loaded yet because they are not stored in the index. If required,\n * these fields can be resolved by fetching them from the database collection.\n */\nexport class EnforcerResolve extends EnforcerNode {\n\treadonly inputGroup: Group\n\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly fields: Fields,\n\t\treadonly resolver: Resolver,\n\t) {\n\t\tsuper(false)\n\n\t\tthis.inputGroup = input.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"EnforcerResolve\", this.inputGroup.id, this.fields)\n\t}\n\n\toverride getOutputFields() {\n\t\treturn this.inputGroup.relational.outputFields\n\t}\n\n\toverride canProvideOrdering() {\n\t\treturn true\n\t}\n\n\toverride canProvideResolvedFields(resolvedFields: Fields) {\n\t\treturn resolvedFields.subsetOf(this.fields)\n\t}\n\n\tprivate getInputRequiredProps(required: RequiredProps) {\n\t\tconst resolvedFields = new Fields()\n\t\treturn new RequiredProps(required.ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst inputCost = optimizer.optimizeGroup(this.inputGroup, inputRequired)\n\n\t\treturn Cost.estimate(0, 100 * KB).add(inputCost)\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst input = this.inputGroup.getOptimized(inputRequired)\n\n\t\treturn new EnforcerResolve(input, this.fields, this.resolver)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst input = yield* this.input.evaluate(context)\n\n\t\t// Resolve can't add any new fields to the input because that would\n\t\t// change the relational props. It can only resolve fields that are\n\t\t// already in the input but not resolved yet.\n\t\tassert(this.fields.subsetOf(input.fields), \"Fields can't be resolved\")\n\n\t\t// Collect all collections for the fields that have to be resolved.\n\t\tconst collections = new Set<CollectionMetadata>()\n\t\tfor (const field of this.fields) {\n\t\t\tassert(field.collection, \"Collection required to resolve field\")\n\t\t\tcollections.add(field.collection)\n\t\t}\n\n\t\t// Optimistically start resolving rich text and vector set item values for fields that are\n\t\t// required. This allows us to parallelize resolving rich text and vectors, with resolving\n\t\t// items.\n\t\tfor (const tuple of input.tuples) {\n\t\t\tfor (const field of this.fields) {\n\t\t\t\tconst value = tuple.getValue(field)\n\t\t\t\tif (value?.type === ControlType.RichText) {\n\t\t\t\t\tthis.resolver.preloadRichTextValue(value)\n\t\t\t\t} else if (value?.type === ControlType.VectorSetItem) {\n\t\t\t\t\tthis.resolver.preloadVectorSetItemValue(value)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Resolve all items for the collections. The items should include all\n\t\t// fields that have to be resolved.\n\t\tconst collectionItems: [CollectionMetadata, DatabaseItem[]][] = yield Promise.all(\n\t\t\tArray.from(collections).map(async collection => {\n\t\t\t\t// Collect all pointers for the input tuples.\n\t\t\t\tconst pointers: DatabaseItemPointer[] = []\n\t\t\t\tfor (const tuple of input.tuples) {\n\t\t\t\t\tconst pointer = tuple.getPointer(collection)\n\t\t\t\t\t// If the condition of a left or right join wasn't met, the\n\t\t\t\t\t// tuple will not have a pointer for the collection.\n\t\t\t\t\tif (pointer) pointers.push(pointer)\n\t\t\t\t}\n\n\t\t\t\t// Resolve all items for the pointers.\n\t\t\t\tconst items = await collection.data.resolveItems(pointers)\n\t\t\t\tassert(items.length === pointers.length, \"Invalid number of items\")\n\n\t\t\t\treturn [collection, items] as const\n\t\t\t}),\n\t\t)\n\n\t\t// Merge the resolved items into the existing tuples.\n\t\treturn input.map(input.fields, tuple => {\n\t\t\tconst result = new Tuple()\n\t\t\tresult.merge(tuple)\n\n\t\t\tfor (const [collection, items] of collectionItems) {\n\t\t\t\tconst pointer = tuple.getPointer(collection)\n\t\t\t\tif (!pointer) continue\n\n\t\t\t\tconst item = items.shift()\n\t\t\t\tassert(item, \"Item not found\")\n\n\t\t\t\t// Check if the pointer matches the item pointer.\n\t\t\t\tassert(item.pointer === pointer, \"Pointer mismatch\")\n\n\t\t\t\t// Merge the resolved values into the tuple.\n\t\t\t\tfor (const field of collection.fields) {\n\t\t\t\t\tconst value = field.getValue(item)\n\t\t\t\t\tresult.addValue(field, value)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result\n\t\t})\n\t}\n}\n", "import { assert } from \"../../../../../utils/assert.ts\"\nimport { isNull, isUndefined } from \"../../../../../utils/utils.ts\"\nimport { DatabaseValue } from \"../../../DatabaseValue.ts\"\nimport type { DatabaseCollation, DatabaseItem } from \"../../../types.ts\"\nimport { DatabaseCollationType, OrderDirection } from \"../../../types.ts\"\nimport { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport type { Group } from \"../../Group.ts\"\nimport { calculateHash } from \"../../Hashable.ts\"\nimport { Fields, VIRTUAL_INDEX_FIELD } from \"../../Metadata.ts\"\nimport type { Optimizer } from \"../../Optimizer.ts\"\nimport { Ordering } from \"../../Ordering.ts\"\nimport { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation, Tuple } from \"../../Relation.ts\"\nimport type { RelationalNode } from \"../relational/RelationalNode.ts\"\nimport { EnforcerNode } from \"./EnforcerNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseInsensitive,\n}\n\nexport class EnforcerSort extends EnforcerNode {\n\treadonly inputGroup: Group\n\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly ordering: Ordering,\n\t) {\n\t\tsuper(input.isSynchronous)\n\n\t\tthis.inputGroup = input.getGroup()\n\t}\n\n\toverride getHash() {\n\t\treturn calculateHash(\"EnforcerSort\", this.inputGroup.id, this.ordering)\n\t}\n\n\toverride getOutputFields() {\n\t\treturn this.inputGroup.relational.outputFields\n\t}\n\n\toverride canProvideOrdering(ordering: Ordering) {\n\t\treturn ordering.equals(this.ordering)\n\t}\n\n\toverride canProvideResolvedFields() {\n\t\treturn true\n\t}\n\n\tprivate getInputRequiredProps(required: RequiredProps) {\n\t\tconst resolvedFields = new Fields(required.resolvedFields)\n\n\t\tfor (const { field } of this.ordering.fields) {\n\t\t\tif (field.name === VIRTUAL_INDEX_FIELD) continue\n\t\t\tif (isUndefined(field.collection)) continue\n\t\t\tresolvedFields.add(field)\n\t\t}\n\n\t\tconst ordering = new Ordering()\n\t\treturn new RequiredProps(ordering, resolvedFields)\n\t}\n\n\toverride optimize(optimizer: Optimizer, required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst inputCost = optimizer.optimizeGroup(this.inputGroup, inputRequired)\n\n\t\treturn new Cost(0).add(inputCost)\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst inputRequired = this.getInputRequiredProps(required)\n\t\tconst input = this.inputGroup.getOptimized(inputRequired)\n\n\t\treturn new EnforcerSort(input, this.ordering)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst input = yield* this.input.evaluate(context)\n\n\t\treturn input.sort((leftTuple, rightTuple) => {\n\t\t\tfor (const { field, direction } of this.ordering.fields) {\n\t\t\t\tconst isAscending = direction === OrderDirection.Ascending\n\n\t\t\t\tif (field.name === VIRTUAL_INDEX_FIELD) {\n\t\t\t\t\tconst collection = field.collection\n\t\t\t\t\tassert(collection, \"Collection required for sorting\")\n\n\t\t\t\t\tconst leftPointer = leftTuple.getPointer(collection)\n\t\t\t\t\tassert(leftPointer, \"Pointer required for sorting\")\n\t\t\t\t\tconst leftItem: DatabaseItem = { pointer: leftPointer, data: {} }\n\n\t\t\t\t\tconst rightPointer = rightTuple.getPointer(collection)\n\t\t\t\t\tassert(rightPointer, \"Pointer required for sorting\")\n\t\t\t\t\tconst rightItem: DatabaseItem = { pointer: rightPointer, data: {} }\n\n\t\t\t\t\tconst order = collection.data.compareItems(leftItem, rightItem)\n\t\t\t\t\treturn isAscending ? order : -order\n\t\t\t\t}\n\n\t\t\t\tconst leftValue = leftTuple.getValue(field)\n\t\t\t\tconst rightValue = rightTuple.getValue(field)\n\n\t\t\t\tif (DatabaseValue.equal(leftValue, rightValue, collation)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (isNull(leftValue) || DatabaseValue.lessThan(leftValue, rightValue, collation)) {\n\t\t\t\t\treturn isAscending ? -1 : 1\n\t\t\t\t}\n\n\t\t\t\tif (isNull(rightValue) || DatabaseValue.greaterThan(leftValue, rightValue, collation)) {\n\t\t\t\t\treturn isAscending ? 1 : -1\n\t\t\t\t}\n\n\t\t\t\tthrow new Error(\"Invalid comparison\")\n\t\t\t}\n\n\t\t\treturn 0\n\t\t})\n\t}\n}\n", "import { assert } from \"../../../../../utils/assert.ts\"\nimport { DatabaseValue } from \"../../../../cms/DatabaseValue.ts\"\nimport type { DatabaseCollation } from \"../../../../cms/types.ts\"\nimport { DatabaseCollationType } from \"../../../../cms/types.ts\"\nimport type { Cost } from \"../../Cost.ts\"\nimport type { Evaluate } from \"../../Evaluate.ts\"\nimport type { Hash } from \"../../Hashable.ts\"\nimport type { Fields } from \"../../Metadata.ts\"\nimport type { RequiredProps } from \"../../PhysicalProps.ts\"\nimport type { Relation, Tuple } from \"../../Relation.ts\"\nimport { RelationalNode } from \"./RelationalNode.ts\"\n\nconst collation: DatabaseCollation = {\n\ttype: DatabaseCollationType.CaseSensitive,\n}\n\n/**\n * This node is only used for testing. It ensures that all nodes in a group\n * return the same result.\n */\nexport class RelationalAssert extends RelationalNode {\n\tconstructor(\n\t\treadonly input: RelationalNode,\n\t\treadonly required: RequiredProps,\n\t\treadonly cache: Map<string | undefined, Relation>,\n\t) {\n\t\tsuper(input.isSynchronous)\n\t}\n\n\toverride getHash(): Hash {\n\t\tthrow new Error(\"Not implemented\")\n\t}\n\n\toverride getOutputFields(): Fields {\n\t\tthrow new Error(\"Not implemented\")\n\t}\n\n\toverride canProvideOrdering(): boolean {\n\t\tthrow new Error(\"Not implemented\")\n\t}\n\n\toverride canProvideResolvedFields(): boolean {\n\t\tthrow new Error(\"Not implemented\")\n\t}\n\n\toverride optimize(): Cost {\n\t\tthrow new Error(\"Not implemented\")\n\t}\n\n\toverride getOptimized(required: RequiredProps) {\n\t\tconst input = this.input.getOptimized(required)\n\n\t\treturn new RelationalAssert(input, this.required, this.cache)\n\t}\n\n\toverride *evaluate(context: Tuple | undefined): Evaluate<Relation> {\n\t\tconst cacheKey = context?.getKey()\n\t\tconst cached = this.cache.get(cacheKey)\n\t\tif (cached) return cached\n\n\t\tconst expected = yield* this.input.evaluate(context)\n\t\tthis.cache.set(cacheKey, expected)\n\n\t\tconst tuples = new Map<string, Tuple>()\n\t\tconst indexes = new Map<string, number>()\n\n\t\tfor (const [index, tuple] of expected.tuples.entries()) {\n\t\t\tconst key = tuple.getKey()\n\n\t\t\ttuples.set(key, tuple)\n\t\t\tindexes.set(key, index)\n\t\t}\n\n\t\tconst group = this.getGroup()\n\t\tconst winner = group.getWinner(this.required)\n\n\t\tfor (const node of winner.nodes) {\n\t\t\tconst optimized = node.getOptimized(this.required)\n\t\t\tconst received = yield* optimized.evaluate(context)\n\n\t\t\tassert(expected.fields.equals(received.fields), \"Different fields\")\n\t\t\tassert(expected.tuples.length === received.tuples.length, \"Different tuples\")\n\n\t\t\tfor (const [receivedIndex, receivedTuple] of received.tuples.entries()) {\n\t\t\t\tconst key = receivedTuple.getKey()\n\n\t\t\t\tconst expectedTuple = tuples.get(key)\n\t\t\t\tassert(expectedTuple, \"Missing tuple\")\n\n\t\t\t\tfor (const field of this.required.resolvedFields) {\n\t\t\t\t\tconst receivedValue = receivedTuple.getValue(field)\n\t\t\t\t\tconst expectedValue = expectedTuple.getValue(field)\n\n\t\t\t\t\tassert(DatabaseValue.equal(receivedValue, expectedValue, collation), \"Different value\")\n\t\t\t\t}\n\n\t\t\t\tif (this.required.ordering.length > 0) {\n\t\t\t\t\tconst expectedIndex = indexes.get(key)\n\t\t\t\t\tassert(receivedIndex === expectedIndex, \"Different order\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn expected\n\t}\n}\n", "import { assert } from \"../../../utils/assert.ts\"\nimport type { MaybeLocale } from \"../QueryEngine.ts\"\nimport type { Query } from \"../types.ts\"\nimport { Builder } from \"./Builder.ts\"\nimport type { Cost } from \"./Cost.ts\"\nimport { Explorer } from \"./Explorer.ts\"\nimport type { Group, Winner } from \"./Group.ts\"\nimport { Memo } from \"./Memo.ts\"\nimport { Normalizer } from \"./Normalizer.ts\"\nimport type { RequiredProps } from \"./PhysicalProps.ts\"\nimport type { Relation } from \"./Relation.ts\"\nimport type { Resolver } from \"./Resolver.ts\"\nimport { EnforcerResolve } from \"./nodes/enforcer/EnforcerResolve.ts\"\nimport { EnforcerSort } from \"./nodes/enforcer/EnforcerSort.ts\"\nimport { RelationalAssert } from \"./nodes/relational/RelationalAssert.ts\"\nimport type { RelationalNode } from \"./nodes/relational/RelationalNode.ts\"\n\n/**\n * The optimizer is responsible for creating the best query plan for a given\n * query. It is heavily inspired by the CockroachDB query optimizer and you will\n * find a lot of similarities between the two.\n *\n * This optimizer and the Cockroach optimizer are based on the Cascades query\n * optimizer which itself is based on the Volcano query optimizer. To learn more\n * about query optimizers here is a list of resources that helped me:\n * - The first 30 pages of this paper:\n *   https://15721.courses.cs.cmu.edu/spring2020/papers/20-optimizer2/xu-columbia-thesis1998.pdf\n * - This YouTube video starting at 1:00:01 and the next video:\n *   https://www.youtube.com/watch?v=DwX0X8CyBSg\n * - This blog post but unfortunately the series looks abandoned:\n *   https://xuanwo.io/2024/02-what-i-talk-about-when-i-talk-about-query-optimizer-part-1/\n * - The Cockroach repo (some code is auto generated by the build process):\n *   https://github.com/cockroachdb/cockroach\n * - This walkthrough of the Cockroach optimizer:\n *   https://github.com/cockroachdb/cockroach/blob/master/docs/tech-notes/life_of_a_query.md#logical-planning-and-optimization\n * - The EvaDB repo which is written in Python:\n *   https://github.com/georgia-tech-db/evadb\n *\n * This is how the optimizer works:\n *\n * We start by creating an initial query plan for a given query in the builder.\n * The query plan is a tree of different nodes (Cascades calls them expressions)\n * that describe what needs to be done to execute the query.\n *\n * For example, the following query:\n * ```\n * SELECT articles.title, authors.name\n * FROM articles\n * LEFT JOIN authors\n * ON articles.author_id = authors.id\n * WHERE articles.published = true\n * ORDER BY articles.title\n * ```\n *\n * Can be represented by the following query plan:\n * ```\n *      Filter(articles.published = true)\n *                      |\n *  LeftJoin(articles.author_id = authors.id)\n *        /                          \\\n *  Scan(articles)              Scan(authors)\n * ```\n *\n * Notice that the query plan doesn't include a node for the `ORDER BY` clause.\n * This is because ordering is a physical property of the relational node. Two\n * nodes can be logically equivalent if they return the same result, but in a\n * different order. The physical properties then describe additional properties\n * of the result.\n *\n * The general idea of the optimizer is to create alternative versions of the\n * initial query plan and finding the best one with a cost function. The hard\n * part is to avoid exponential complexity.\n *\n *\n * The main data structure of the optimizer is the memo. It's a directed acyclic\n * graph of all possible query plans. Because it's a graph, we can avoid\n * optimizing nodes that have already been optimized. This works by grouping\n * nodes that return the same result. It's called a memo because it memoizes the\n * optimization results. If a group was already optimized, we can return the\n * previous optimization result.\n *\n * The nodes in the memo are also known as multi-expressions because their\n * children are part of a group themselves. This means a single node is actually\n * representing multiple different query plans.\n *\n * The builder adds the normalized nodes of the initial query plan to the memo.\n * For example, the query plan above is represented by the following groups in\n * the memo:\n * ```\n * G1: Filter(G2)\n * G2: LeftJoin(G3, G4)\n * G3: Scan(articles)\n * G4: Scan(authors)\n * ```\n *\n * After the initial query plan is created, the optimizer starts by optimizing\n * the root group #1 with the root required physical props. In our case, the\n * physical props require the result to be sorted by the `articles.title` field.\n *\n * To optimize the root group, the optimizer iterates over all the nodes in the\n * group. For each node, the optimizer checks if it can provide the required\n * physical props. Because the filter node doesn't change the ordering of its\n * input, it can pass down the required ordering to it. But the cost of the\n * filter node can't be calculated yet without knowing the cost of its input, so\n * we need to recursively optimize the input group #2 of the filter.\n *\n * To optimize it, the same steps are applied. However, the left join cannot\n * provide the ordering, so the optimizer needs to add a sort enforcer. An\n * enforcer is a node that can always provide the required properties. The sort\n * enforcer recursively optimizes the group #2 again, but this time without the\n * required ordering. The left join can meet the reduced requirements, but to\n * calculate the cost, we again need to optimize the inputs of it.\n *\n * To optimize the input groups #3 and #4, the optimizer applies the same steps\n * again. Because the scan operator doesn't have any inputs, we can cost it and\n * store the result in the memo:\n * ```\n * G1: Filter(G2)\n * G2: LeftJoin(G3, G4)\n * G3: Scan(articles)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(articles)\n *     \u2514\u2500\u2500 cost: 10\n * G4: Scan(authors)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(authors)\n *     \u2514\u2500\u2500 cost: 10\n * ```\n *\n * After optimizing the inputs of the left join and costing it, the optimizer\n * creates alternative nodes that are logically equivalent to the original node.\n * In the case of the left join, the explorer creates a logically equivalent\n * right join. The new node is added to the same group as the original node:\n * ```\n * G1: Filter(G2)\n * G2: LeftJoin(G3, G4), RightJoin(G4, G3)\n * G3: Scan(articles)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(articles)\n *     \u2514\u2500\u2500 cost: 10\n * G4: Scan(authors)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(authors)\n *     \u2514\u2500\u2500 cost: 10\n * ```\n *\n * To cost the right join, the optimizer needs to optimize its inputs first.\n * Luckily, the inputs are already optimized, so we don't need to do anything\n * and can return the memoized best node and its cost instead.\n *\n * After the optimizer has optimized all nodes in the group #2, it can store the\n * best node in the memo:\n * ```\n * G1: Filter(G2)\n * G2: LeftJoin(G3, G4), RightJoin(G4, G3)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: LeftJoin(G3, G4)\n *     \u2514\u2500\u2500 cost: 20\n * G3: Scan(articles)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(articles)\n *     \u2514\u2500\u2500 cost: 10\n * G4: Scan(authors)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(authors)\n *     \u2514\u2500\u2500 cost: 10\n * ```\n *\n * But remember that the filter node passed down the ordering requirement. We\n * need to finish optimization of the group #2 with the additional ordering\n * requirement:\n * ```\n * G1: Filter(G2)\n * G2: LeftJoin(G3, G4), RightJoin(G4, G3)\n * \u251C\u2500\u2500 [ordering: articles.title]\n * \u2502   \u251C\u2500\u2500 best: Sort(G2)\n * \u2502   \u2514\u2500\u2500 cost: 30\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: LeftJoin(G3, G4)\n *     \u2514\u2500\u2500 cost: 25\n * G3: Scan(articles)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(articles)\n *     \u2514\u2500\u2500 cost: 10\n * G4: Scan(authors)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(authors)\n *     \u2514\u2500\u2500 cost: 10\n * ```\n *\n * Now we can bubble up again and also finish optimization of the root group #1:\n * ```\n * G1: Filter(G2)\n * \u2514\u2500\u2500 [ordering: articles.title]\n *     \u251C\u2500\u2500 best: Filter(G2)\n *     \u2514\u2500\u2500 cost: 40\n * G2: LeftJoin(G3, G4), RightJoin(G4, G3)\n * \u251C\u2500\u2500 [ordering: articles.title]\n * \u2502   \u251C\u2500\u2500 best: Sort(G2)\n * \u2502   \u2514\u2500\u2500 cost: 35\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: LeftJoin(G3, G4)\n *     \u2514\u2500\u2500 cost: 25\n * G3: Scan(articles)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(articles)\n *     \u2514\u2500\u2500 cost: 10\n * G4: Scan(authors)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(authors)\n *     \u2514\u2500\u2500 cost: 10\n * ```\n *\n * But the optimizer is not done yet. It also tries a top level sort enforcer\n * because that could be a better plan. It does so by recursively optimizing the\n * root group #1 without the ordering requirement:\n * ```\n * G1: Filter(G2)\n * \u251C\u2500\u2500 [ordering: articles.title]\n * \u2502   \u251C\u2500\u2500 best: Filter(G2)\n * \u2502   \u2514\u2500\u2500 cost: 40\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Filter(G2)\n *     \u2514\u2500\u2500 cost: 25\n * G2: LeftJoin(G3, G4), RightJoin(G4, G3)\n * \u251C\u2500\u2500 [ordering: articles.title]\n * \u2502   \u251C\u2500\u2500 best: Sort(G2)\n * \u2502   \u2514\u2500\u2500 cost: 35\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: LeftJoin(G3, G4)\n *     \u2514\u2500\u2500 cost: 25\n * G3: Scan(articles)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(articles)\n *     \u2514\u2500\u2500 cost: 10\n * G4: Scan(authors)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(authors)\n *     \u2514\u2500\u2500 cost: 10\n * ```\n *\n * Turns out that the sort enforcer of group #1 has to sort fewer items than the\n * sort enforcer of group #2. So the overall cost of the query plan with the top\n * level sort enforcer is lower than the query plan without it:\n * ```\n * G1: Filter(G2)\n * \u251C\u2500\u2500 [ordering: articles.title]\n * \u2502   \u251C\u2500\u2500 best: Sort(G1)\n * \u2502   \u2514\u2500\u2500 cost: 40\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Filter(G2)\n *     \u2514\u2500\u2500 cost: 25\n * G2: LeftJoin(G3, G4), RightJoin(G4, G3)\n * \u251C\u2500\u2500 [ordering: articles.title]\n * \u2502   \u251C\u2500\u2500 best: Sort(G2)\n * \u2502   \u2514\u2500\u2500 cost: 35\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: LeftJoin(G3, G4)\n *     \u2514\u2500\u2500 cost: 25\n * G3: Scan(articles)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(articles)\n *     \u2514\u2500\u2500 cost: 10\n * G4: Scan(authors)\n * \u2514\u2500\u2500 []\n *     \u251C\u2500\u2500 best: Scan(authors)\n *     \u2514\u2500\u2500 cost: 10\n * ```\n *\n * As the final step, the optimizer creates the optimized root node, with all\n * its children replaced by their best nodes.\n */\nexport class Optimizer {\n\treadonly memo = new Memo()\n\treadonly normalizer = new Normalizer(this.memo)\n\treadonly explorer = new Explorer(this.normalizer)\n\n\tconstructor(\n\t\treadonly query: Query,\n\t\treadonly locale: MaybeLocale,\n\t\treadonly resolver: Resolver,\n\t) {}\n\n\toptimize() {\n\t\tconst builder = new Builder(this.normalizer, this.query, this.locale)\n\t\tconst outScope = builder.build()\n\n\t\tconst root = outScope.takeNode()\n\t\tconst group = root.getGroup()\n\t\tconst required = outScope.getRequiredProps()\n\n\t\tthis.optimizeGroup(group, required)\n\n\t\tconst optimized = group.getOptimized(required)\n\t\tconst namedFields = outScope.getNamedFields()\n\n\t\treturn [optimized, namedFields] as const\n\t}\n\n\toptimizeGroup(group: Group, required: RequiredProps): Cost {\n\t\tconst winner = group.getWinner(required)\n\t\tif (winner.node) return winner.cost\n\n\t\t// Create enforcers for the group. This is needed in case no node in the\n\t\t// group can provide all required props. It can also happen that adding\n\t\t// an enforcer will create a better plan.\n\t\tconst normalized = group.nodes[0]\n\n\t\tassert(normalized, \"Normalized node not found\")\n\t\tthis.createEnforcer(winner, normalized, required)\n\n\t\tfor (const node of group.nodes) {\n\t\t\t// Only optimize the node when it can provide all required props.\n\t\t\tif (required.canProvide(node)) {\n\t\t\t\tconst cost = node.optimize(this, required)\n\t\t\t\twinner.update(node, cost)\n\t\t\t}\n\n\t\t\t// Only explore the node when `optimizeGroup` will not recurse\n\t\t\t// through `createEnforcer`.\n\t\t\tif (required.isMinimal) {\n\t\t\t\tthis.explorer.explore(node)\n\t\t\t}\n\t\t}\n\n\t\t// In tests we wrap each group in a `RelationalAssert` to ensure that\n\t\t// every node in the group returns the same result.\n\t\tif (process.env.NODE_ENV === \"test\") {\n\t\t\tassert(winner.node, \"Group not optimized\")\n\t\t\tconst cache = new Map<string | undefined, Relation>()\n\t\t\twinner.node = new RelationalAssert(winner.node, required, cache)\n\t\t}\n\n\t\treturn winner.cost\n\t}\n\n\tcreateEnforcer(winner: Winner, node: RelationalNode, required: RequiredProps) {\n\t\tif (required.resolvedFields.size > 0) {\n\t\t\tconst enforcer = new EnforcerResolve(node, required.resolvedFields, this.resolver)\n\t\t\tconst cost = enforcer.optimize(this, required)\n\t\t\twinner.update(enforcer, cost)\n\t\t}\n\n\t\tif (required.ordering.length > 0) {\n\t\t\tconst enforcer = new EnforcerSort(node, required.ordering)\n\t\t\tconst cost = enforcer.optimize(this, required)\n\t\t\twinner.update(enforcer, cost)\n\t\t}\n\t}\n}\n", "import { assertNever } from \"../../utils/assert.ts\"\nimport type {\n\tBinaryOperation,\n\tCase,\n\tCollection,\n\tExpression,\n\tFrom,\n\tFunctionCall,\n\tIdentifier,\n\tJoin,\n\tLiteralValue,\n\tQuery,\n\tTypeCast,\n\tUnaryOperation,\n} from \"./types.ts\"\nimport { OrderDirection, isDatabaseCollection } from \"./types.ts\"\n\nfunction stringifyIdentifier(expression: Identifier) {\n\tif (expression.collection) {\n\t\treturn `\"${expression.collection}\".\"${expression.name}\"`\n\t}\n\n\treturn `\"${expression.name}\"`\n}\n\nfunction stringifyLiteralValue(expression: LiteralValue) {\n\tif (typeof expression.value === \"string\") {\n\t\treturn `'${expression.value}'`\n\t}\n\n\treturn expression.value\n}\n\nfunction stringifyFunctionCall(expression: FunctionCall) {\n\treturn `${expression.functionName}(${expression.arguments.map(argument => stringifyExpression(argument)).join(\", \")})`\n}\n\nfunction stringifyCaseExpression(expression: Case) {\n\tlet caseString = \"CASE\"\n\n\tif (expression.value) {\n\t\tcaseString += ` ${stringifyExpression(expression.value)}`\n\t}\n\n\tfor (const condition of expression.conditions) {\n\t\tcaseString += ` WHEN ${stringifyExpression(condition.when)} THEN ${stringifyExpression(condition.then)}`\n\t}\n\n\tif (expression.else) {\n\t\tcaseString += ` ELSE ${stringifyExpression(expression.else)}`\n\t}\n\n\tcaseString += \" END\"\n\n\treturn caseString\n}\n\nfunction stringifyUnaryOperation(expression: UnaryOperation) {\n\tconst value = stringifyExpression(expression.value)\n\tconst operator = expression.operator.toUpperCase()\n\n\treturn `${operator} ${value}`\n}\n\n// Note that this does not add any brackets for nested binary operations. We\n// don't currently support creating nested queries like that, but if we ever do\n// then we'll need to do work out operator precedence and add brackets as\n// necessary.\nfunction stringifyBinaryOperation(expression: BinaryOperation) {\n\tconst left = stringifyExpression(expression.left)\n\tconst right = stringifyExpression(expression.right)\n\tconst operator = expression.operator.toUpperCase()\n\n\treturn `${left} ${operator} ${right}`\n}\n\nfunction stringifyTypeCast(expression: TypeCast) {\n\treturn `CAST(${stringifyExpression(expression.value)} as ${expression.dataType})`\n}\n\nexport function stringifyExpression(expression: Expression): unknown {\n\tswitch (expression.type) {\n\t\tcase \"Identifier\":\n\t\t\treturn stringifyIdentifier(expression)\n\t\tcase \"LiteralValue\":\n\t\t\treturn stringifyLiteralValue(expression)\n\t\tcase \"FunctionCall\":\n\t\t\treturn stringifyFunctionCall(expression)\n\t\tcase \"Case\":\n\t\t\treturn stringifyCaseExpression(expression)\n\t\tcase \"UnaryOperation\":\n\t\t\treturn stringifyUnaryOperation(expression)\n\t\tcase \"BinaryOperation\":\n\t\t\treturn stringifyBinaryOperation(expression)\n\t\tcase \"TypeCast\":\n\t\t\treturn stringifyTypeCast(expression)\n\t\tcase \"Select\":\n\t\t\treturn `${stringifyQuery(expression)}`\n\t\tdefault: {\n\t\t\tassertNever(expression)\n\t\t}\n\t}\n}\n\nfunction stringifyCollection(collection: Collection) {\n\tif (isDatabaseCollection(collection.data)) {\n\t\treturn \"Collection\"\n\t}\n\n\tif (collection.alias) {\n\t\treturn `\"${collection.data.displayName}\" AS \"${collection.alias}\"`\n\t}\n\n\treturn `\"${collection.data.displayName}\"`\n}\n\nfunction stringifyJoin(join: Join) {\n\tlet result = `${stringifyFrom(join.left)} LEFT JOIN ${stringifyFrom(join.right)}`\n\n\tif (join.constraint) {\n\t\tresult += ` ON ${stringifyExpression(join.constraint)}`\n\t}\n\n\treturn result\n}\n\nfunction stringifyFrom(from: From): string {\n\tswitch (from.type) {\n\t\tcase \"Collection\":\n\t\t\treturn stringifyCollection(from)\n\t\tcase \"LeftJoin\":\n\t\t\treturn stringifyJoin(from)\n\t\tdefault:\n\t\t\tassertNever(from)\n\t}\n}\n\nfunction autoIndentSql(sql: string) {\n\tlet formattedSql = \"\"\n\tconst tokens = sql.split(/\\s+/u)\n\n\ttokens.forEach(token => {\n\t\tif (token === \"\") return\n\n\t\tif ([\"SELECT\", \"FROM\", \"WHERE\", \"ORDER\", \"LIMIT\", \"OFFSET\"].includes(token)) {\n\t\t\tformattedSql += `\\n${token}`\n\t\t} else if ([\"AND\", \"OR\"].includes(token)) {\n\t\t\tformattedSql += `\\n\\t${token}`\n\t\t} else {\n\t\t\tformattedSql += ` ${token}`\n\t\t}\n\t})\n\n\treturn formattedSql.trim()\n}\n\nexport function stringifyQuery(query: Query) {\n\tlet queryString = \"\"\n\n\tqueryString += `SELECT ${query.select\n\t\t.map(selectExpression => {\n\t\t\tconst expressionString = stringifyExpression(selectExpression)\n\t\t\tif (selectExpression.alias) {\n\t\t\t\treturn `${expressionString} AS \"${selectExpression.alias}\"`\n\t\t\t}\n\n\t\t\treturn expressionString\n\t\t})\n\t\t.join(\", \")}`\n\n\tqueryString += ` FROM ${stringifyFrom(query.from)}`\n\n\tif (query.where) {\n\t\tqueryString += ` WHERE ${stringifyExpression(query.where)}`\n\t}\n\n\tif (query.orderBy) {\n\t\tqueryString += ` ORDER BY ${query.orderBy\n\t\t\t.map(orderExpression => {\n\t\t\t\treturn `${stringifyExpression(orderExpression)} ${orderExpression.direction ?? OrderDirection.Ascending}`\n\t\t\t})\n\t\t\t.join(\", \")}`\n\t}\n\n\tif (query.limit) {\n\t\tqueryString += ` LIMIT ${stringifyExpression(query.limit)}`\n\t}\n\n\tif (query.offset) {\n\t\tqueryString += ` OFFSET ${stringifyExpression(query.offset)}`\n\t}\n\n\treturn autoIndentSql(queryString)\n}\n", "import type { Locale } from \"../../router/types.ts\"\nimport { getLogger } from \"../../utils/getLogger.ts\"\nimport { isPromise } from \"../../utils/utils.ts\"\nimport type { DatabaseValue } from \"./DatabaseValue.ts\"\nimport { type Evaluate, evaluateArray, evaluateMaybeAsync, evaluateObject } from \"./optimizer/Evaluate.ts\"\nimport { Optimizer } from \"./optimizer/Optimizer.ts\"\nimport { Resolver } from \"./optimizer/Resolver.ts\"\nimport { stringifyQuery } from \"./stringifyQuery.ts\"\nimport type { Query } from \"./types.ts\"\n\nconst log = /* @__PURE__ */ getLogger(\"query-engine\")\n\nexport type QueryResult = Record<string, unknown>[]\nexport type MaybeLocale = Locale | null | undefined\nexport type SerializableQueryResult = Record<string, DatabaseValue>[]\n\nexport type QueryRichTextMode =\n\t/** The default mode is to resolve rich text as React Nodes. */\n\t| \"react-node\"\n\t/** The raw mode returns the collection-defined raw pointer value for rich text */\n\t| \"raw\"\n\nexport interface QueryExecutionOptions {\n\trichTextMode?: QueryRichTextMode\n}\n\nexport class QueryEngine {\n\tprivate async evalQuery(\n\t\tquery: Query,\n\t\tlocale: MaybeLocale,\n\t\tincludeRaw: false,\n\t\toptions?: QueryExecutionOptions,\n\t): Promise<QueryResult>\n\tprivate async evalQuery(\n\t\tquery: Query,\n\t\tlocale: MaybeLocale,\n\t\tincludeRaw: true,\n\t\toptions?: QueryExecutionOptions,\n\t): Promise<[QueryResult, SerializableQueryResult]>\n\tprivate async evalQuery(\n\t\tquery: Query,\n\t\tlocale: MaybeLocale,\n\t\tincludeRaw: boolean,\n\t\toptions: QueryExecutionOptions = {},\n\t): Promise<[QueryResult, SerializableQueryResult] | QueryResult> {\n\t\tif (log.enabled) {\n\t\t\tlog.debug(`Query:\\n${stringifyQuery(query)}`)\n\t\t}\n\n\t\tconst resolver = new Resolver(query, locale, options)\n\t\tconst optimizer = new Optimizer(query, locale, resolver)\n\t\tconst [root, namedFields] = optimizer.optimize()\n\n\t\tconst relation = await root.evaluateAsync()\n\t\tconst namedFieldEntries = Object.entries(namedFields)\n\t\tconst rawResults: SerializableQueryResult = []\n\n\t\tconst maybeEvaluatedPromise = evaluateMaybeAsync(\n\t\t\tevaluateArray(\n\t\t\t\trelation.tuples.map(tuple => {\n\t\t\t\t\tconst object: Record<string, Evaluate<unknown>> = {}\n\t\t\t\t\tconst rawObject: Record<string, DatabaseValue> = {}\n\n\t\t\t\t\tfor (const [fieldName, field] of namedFieldEntries) {\n\t\t\t\t\t\tconst value = tuple.getValue(field)\n\t\t\t\t\t\tobject[fieldName] = resolver.resolveValue(value)\n\n\t\t\t\t\t\tif (includeRaw) {\n\t\t\t\t\t\t\trawObject[fieldName] = value\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (includeRaw) {\n\t\t\t\t\t\trawResults.push(rawObject)\n\t\t\t\t\t}\n\t\t\t\t\treturn evaluateObject(object)\n\t\t\t\t}),\n\t\t\t),\n\t\t)\n\n\t\tif (includeRaw) {\n\t\t\treturn [isPromise(maybeEvaluatedPromise) ? await maybeEvaluatedPromise : maybeEvaluatedPromise, rawResults]\n\t\t}\n\t\treturn maybeEvaluatedPromise\n\t}\n\n\tasync serializeableQuery(query: Query, locale: MaybeLocale): Promise<[QueryResult, SerializableQueryResult]> {\n\t\treturn this.evalQuery(query, locale, true)\n\t}\n\n\tasync query(query: Query, locale: MaybeLocale, options?: QueryExecutionOptions): Promise<QueryResult> {\n\t\treturn this.evalQuery(query, locale, false, options)\n\t}\n\n\tresolveSerializableQueryResult(\n\t\traw: SerializableQueryResult,\n\t\tquery: Query,\n\t\tlocale: MaybeLocale,\n\t): QueryResult | Promise<QueryResult> {\n\t\t// TODO: This is used for the handover. We need JSON.stringify to get the cache key, so we could\n\t\t// process the query upfront, replace collections with their ids and then call the query.\n\t\t// This way JSON.stringify would be faster:\n\t\t// https://v8.dev/blog/json-stringify#:~:text=expensive%20copy%20operations.-,Limitations,-The%20new%20fast\n\t\t// and we would only need to iterate through the collections once instead of 2x (server) or 3x (client).\n\t\tconst resolver = new Resolver(query, locale)\n\n\t\treturn evaluateMaybeAsync(\n\t\t\tevaluateArray(\n\t\t\t\traw.map(item => {\n\t\t\t\t\tconst object: Record<string, Evaluate<unknown>> = {}\n\n\t\t\t\t\tlet key: keyof typeof item\n\t\t\t\t\tfor (key in item) {\n\t\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: by design, accessing existing key\n\t\t\t\t\t\tconst value = item[key]!\n\t\t\t\t\t\tobject[key] = resolver.resolveValue(value)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn evaluateObject(object)\n\t\t\t\t}),\n\t\t\t),\n\t\t)\n\t}\n}\n", "import { isObject } from \"../../utils/utils.ts\"\nimport { LazyValue } from \"../LazyValue.ts\"\nimport {\n\tHandoverDataType,\n\tgetHandoverData,\n\thandleHydrationError,\n\thandoverCollector,\n} from \"../dataHandover/dataHandover.ts\"\nimport type { MaybeLocale, QueryEngine, QueryResult, SerializableQueryResult } from \"./QueryEngine.ts\"\nimport { getCollectionId, hasRandomCollectionId } from \"./getCollectionId.ts\"\nimport type { Collection, Query } from \"./types.ts\"\nimport { isAnyCollection } from \"./types.ts\"\n\nconst handoverDataType = /* @__PURE__ */ (() => HandoverDataType.QueryCache)()\n\nfunction isCollection(value: unknown): value is Collection {\n\treturn isObject(value) && value.type === \"Collection\"\n}\n\n/**\n * Every instance manages its own cache and size.\n */\nexport class QueryCache {\n\tprivate readonly cache = new Map<string, LazyValue<QueryResult>>()\n\t/** Server-only cache for serialized results to avoid re-serializing on cache hits */\n\tprivate readonly serializedCache =\n\t\thandoverCollector !== undefined ? new Map<string, SerializableQueryResult>() : undefined\n\n\tconstructor(\n\t\tprivate readonly queryEngine: QueryEngine,\n\t\tprivate readonly maxSize = Infinity,\n\t) {}\n\n\tprivate prune() {\n\t\tif (this.cache.size <= this.maxSize) return\n\n\t\tfor (const [key, value] of this.cache) {\n\t\t\tif (this.cache.size <= this.maxSize) break\n\t\t\tif (value.state === \"pending\") continue\n\n\t\t\tthis.cache.delete(key)\n\t\t\tthis.serializedCache?.delete(key)\n\t\t}\n\t}\n\n\tget(query: Query, locale: MaybeLocale) {\n\t\tconst key = getCacheKey(query, locale)\n\n\t\tconst existing = this.cache.get(key)\n\t\tif (existing) {\n\t\t\t// Re-insert the item at the end of the cache.\n\t\t\tthis.cache.delete(key)\n\t\t\tthis.cache.set(key, existing)\n\n\t\t\t// On cache hit during SSR, populate handover collector with cached value. We only need\n\t\t\t// to do this for non-pending promises. For pending ones, the `then()` from `resolver()`\n\t\t\t// will populate the handover collector.\n\t\t\tif (\n\t\t\t\thandoverCollector !== undefined &&\n\t\t\t\tthis.serializedCache !== undefined &&\n\t\t\t\t!hasRandomCollectionId(key) &&\n\t\t\t\texisting.state === \"fulfilled\"\n\t\t\t) {\n\t\t\t\tconst cachedSerialized = this.serializedCache.get(key)\n\t\t\t\tif (cachedSerialized !== undefined) {\n\t\t\t\t\thandoverCollector.set(handoverDataType, key, cachedSerialized)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn existing\n\t\t}\n\n\t\tconst resolver = (): QueryResult | Promise<QueryResult> => {\n\t\t\tconst containsRandomCollectionId = hasRandomCollectionId(key)\n\n\t\t\t// We exclude collections with random ids, because we cannot hand them over\n\t\t\t// (as the id on the server won't match the id on the client).\n\t\t\tconst handoverResult = containsRandomCollectionId ? undefined : getHandoverData(handoverDataType, key)\n\t\t\tif (handoverResult) {\n\t\t\t\ttry {\n\t\t\t\t\treturn this.queryEngine.resolveSerializableQueryResult(handoverResult, query, locale)\n\t\t\t\t} catch (error) {\n\t\t\t\t\thandleHydrationError(error, key)\n\t\t\t\t\t// Fall through to network (as handoverResult stays null)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// We do not hand over slug or recordId queries, because we also hand them over in CollectionUtilsCache.\n\t\t\tif (handoverCollector !== undefined && !containsRandomCollectionId) {\n\t\t\t\treturn this.queryEngine.serializeableQuery(query, locale).then(([queryResult, serializableResult]) => {\n\t\t\t\t\tthis.serializedCache?.set(key, serializableResult)\n\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: handoverCollector is only undefined in the browser\n\t\t\t\t\thandoverCollector!.set(handoverDataType, key, serializableResult)\n\t\t\t\t\treturn queryResult\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn this.queryEngine.query(query, locale)\n\t\t}\n\t\tconst value = new LazyValue(resolver)\n\t\tthis.cache.set(key, value)\n\t\tthis.prune()\n\t\treturn value\n\t}\n}\n\nfunction replaceCollection(_: string, value: unknown) {\n\tif (isCollection(value) && isAnyCollection(value.data)) return getCollectionId(value.data)\n\n\treturn value\n}\n\nfunction getCacheKey(query: Query, locale: MaybeLocale): string {\n\tconst localeId = locale?.id ?? \"default\"\n\n\treturn JSON.stringify(query, replaceCollection) + localeId\n}\n\nexport const testing = {\n\tgetCacheKey,\n}\n", "import type { ServerDatabaseQueryResponse } from \"../types.ts\"\n\n/**\n * @internal\n */\nexport async function executeServerDatabaseQuery(sql: string): Promise<ServerDatabaseQueryResponse> {\n\tconst { executeServerDatabaseQuery: executeServerDatabaseQueryWithSqlite } = await import(\"./SqliteDatabase.ts\")\n\treturn executeServerDatabaseQueryWithSqlite(sql)\n}\n", "import { type ChangeEvent, startTransition, useCallback, useMemo, useRef } from \"react\"\nimport type { FormSelectOption } from \"../../render/presentation/Forms/FormSelect.tsx\"\nimport { ControlType } from \"../../render/types/PropertyControls.ts\"\nimport type { OptionalFlag, OptionalValue } from \"../../router/queryParameters.tsx\"\nimport type { Locale } from \"../../router/types.ts\"\nimport { useLocaleInfo } from \"../../router/useLocale.ts\"\nimport { isBoolean, isString } from \"../../utils/utils.ts\"\nimport { useQueryData } from \"../useQueryData.ts\"\nimport type { AnyCollection, Query } from \"./types.ts\"\n\nconst ALL_ELEMENTS_VALUE = \"__all__\"\nconst BOOLEAN_TRUE_VALUE = \"__true__\"\nconst BOOLEAN_FALSE_VALUE = \"__false__\"\n\ntype FormSelectVariableType = ControlType.CollectionReference | ControlType.Boolean | ControlType.Enum\n\ntype WithAllItemsLabel<Optional extends OptionalFlag> = Optional extends true\n\t? { allItemsLabel: string }\n\t: { allItemsLabel?: never }\n\ntype FormSelectVariableBindingBaseOptions<Optional extends OptionalFlag> = {\n\tsetValue: (nextValue: OptionalValue<string | boolean, Optional>) => void\n\tvalue: string | boolean | undefined\n\tvariableType: FormSelectVariableType\n} & WithAllItemsLabel<Optional>\n\ntype FormSelectVariableBindingCollectionOptions<Optional extends OptionalFlag> =\n\tFormSelectVariableBindingBaseOptions<Optional> & {\n\t\tvariableType: ControlType.CollectionReference\n\t\tcollectionData: AnyCollection\n\t\tisOptional: Optional\n\t\tslugId: string\n\t\ttitleId?: string\n\t}\n\ntype FormSelectVariableBindingBooleanOptions<Optional extends OptionalFlag> =\n\tFormSelectVariableBindingBaseOptions<Optional> & {\n\t\tvariableType: ControlType.Boolean\n\t\tbooleanTrueLabel?: string\n\t\tbooleanFalseLabel?: string\n\t\tisOptional: Optional\n\t}\n\ntype FormSelectVariableBindingEnumOptions<Optional extends OptionalFlag> =\n\tFormSelectVariableBindingBaseOptions<Optional> & {\n\t\tvariableType: ControlType.Enum\n\t\toptions: readonly string[] | undefined\n\t\tgetOptionTitle: ((id: string, locale: Locale | null) => string | undefined) | undefined\n\t\tisOptional: Optional\n\t}\n\ntype FormSelectVariableBindingOptions<Optional extends OptionalFlag> =\n\t| FormSelectVariableBindingCollectionOptions<Optional>\n\t| FormSelectVariableBindingBooleanOptions<Optional>\n\t| FormSelectVariableBindingEnumOptions<Optional>\n\ntype FormSelectVariableBindingResult = [\n\tselectValue: string,\n\tselectOptions: FormSelectOption[] | undefined,\n\tonChange: (event: ChangeEvent) => void,\n]\n\nconst variableBindingHooks = {\n\t[ControlType.Boolean]: useFormSelectBooleanVariableBinding,\n\t[ControlType.CollectionReference]: useFormSelectCollectionVariableBinding,\n\t[ControlType.Enum]: useFormSelectEnumVariableBinding,\n}\n\nexport function useFormSelectVariableBinding<Optional extends OptionalFlag>(\n\toptions: FormSelectVariableBindingOptions<Optional>,\n): FormSelectVariableBindingResult {\n\tconst variableTypeRef = useRef(options.variableType)\n\ttype HookOptions = FormSelectVariableBindingBooleanOptions<Optional> &\n\t\tFormSelectVariableBindingCollectionOptions<Optional> &\n\t\tFormSelectVariableBindingEnumOptions<Optional>\n\treturn variableBindingHooks[variableTypeRef.current](options as HookOptions)\n}\n\nfunction useFormSelectBooleanVariableBinding<Optional extends OptionalFlag>({\n\tallItemsLabel,\n\tbooleanTrueLabel,\n\tbooleanFalseLabel,\n\tisOptional,\n\tsetValue,\n\tvalue,\n}: FormSelectVariableBindingBooleanOptions<Optional>): FormSelectVariableBindingResult {\n\tconst selectValue = useMemo(() => {\n\t\tif (value === true) return BOOLEAN_TRUE_VALUE\n\t\tif (value === false) return BOOLEAN_FALSE_VALUE\n\t\treturn isOptional ? ALL_ELEMENTS_VALUE : BOOLEAN_TRUE_VALUE\n\t}, [isOptional, value])\n\n\tconst selectOptions = useMemo(\n\t\t() =>\n\t\t\twithAllOption(\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tdisabled: false,\n\t\t\t\t\t\ttitle: booleanTrueLabel,\n\t\t\t\t\t\ttype: \"option\",\n\t\t\t\t\t\tvalue: BOOLEAN_TRUE_VALUE,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisabled: false,\n\t\t\t\t\t\ttitle: booleanFalseLabel,\n\t\t\t\t\t\ttype: \"option\",\n\t\t\t\t\t\tvalue: BOOLEAN_FALSE_VALUE,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tisOptional,\n\t\t\t\tallItemsLabel,\n\t\t\t\tfalse,\n\t\t\t),\n\t\t[allItemsLabel, booleanTrueLabel, booleanFalseLabel, isOptional],\n\t)\n\n\tconst onChange = useCallback(\n\t\t(event: ChangeEvent) => {\n\t\t\tif (!(event.target instanceof HTMLSelectElement)) return\n\n\t\t\tconst selectedValue = event.target.value\n\t\t\tstartTransition(() => {\n\t\t\t\tif (selectedValue === ALL_ELEMENTS_VALUE) {\n\t\t\t\t\tsetValue(undefined as OptionalValue<boolean, Optional>)\n\t\t\t\t} else if (selectedValue === BOOLEAN_TRUE_VALUE) {\n\t\t\t\t\tsetValue(true as OptionalValue<boolean, Optional>)\n\t\t\t\t} else if (selectedValue === BOOLEAN_FALSE_VALUE) {\n\t\t\t\t\tsetValue(false as OptionalValue<boolean, Optional>)\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\t[setValue],\n\t)\n\n\treturn [selectValue, selectOptions, onChange]\n}\n\nfunction useFormSelectCollectionVariableBinding<Optional extends OptionalFlag>({\n\tallItemsLabel,\n\tcollectionData,\n\tisOptional,\n\tslugId,\n\ttitleId,\n\tsetValue,\n\tvalue: rawValue,\n}: FormSelectVariableBindingCollectionOptions<Optional>): FormSelectVariableBindingResult {\n\tconst selectOptions = useCollectionSelectOptions({\n\t\tcollectionData,\n\t\tslugId,\n\t\ttitleId,\n\t})\n\n\tconst value = isBoolean(rawValue) ? undefined : rawValue\n\n\treturn useStringSelectBinding({\n\t\tallItemsLabel,\n\t\tisOptional,\n\t\tselectOptions,\n\t\tsetValue,\n\t\tvalue,\n\t})\n}\n\nfunction useFormSelectEnumVariableBinding<Optional extends OptionalFlag>({\n\tallItemsLabel,\n\toptions: enumOptions,\n\tgetOptionTitle,\n\tisOptional,\n\tsetValue,\n\tvalue: rawValue,\n}: FormSelectVariableBindingEnumOptions<Optional>): FormSelectVariableBindingResult {\n\tconst { activeLocale } = useLocaleInfo()\n\n\tconst selectOptions = useMemo(() => {\n\t\tif (!enumOptions) return undefined\n\n\t\treturn enumOptions.map(\n\t\t\t(enumId): FormSelectOption => ({\n\t\t\t\ttype: \"option\",\n\t\t\t\tvalue: enumId,\n\t\t\t\ttitle: getOptionTitle?.(enumId, activeLocale) ?? \"\",\n\t\t\t}),\n\t\t)\n\t}, [activeLocale, enumOptions, getOptionTitle])\n\n\tconst value = isString(rawValue) ? rawValue : undefined\n\n\treturn useStringSelectBinding({\n\t\tallItemsLabel,\n\t\tisOptional,\n\t\tselectOptions,\n\t\tsetValue,\n\t\tvalue,\n\t})\n}\n\nfunction useCollectionSelectOptions({\n\tcollectionData,\n\tslugId,\n\ttitleId,\n}: {\n\tcollectionData: AnyCollection\n\tslugId: string\n\ttitleId?: string\n}): FormSelectOption[] | undefined {\n\tconst query: Query = useMemo(\n\t\t() => ({\n\t\t\tfrom: {\n\t\t\t\ttype: \"Collection\",\n\t\t\t\tdata: collectionData,\n\t\t\t},\n\t\t\tselect: [\n\t\t\t\t{ type: \"Identifier\", name: \"id\" },\n\t\t\t\t{ type: \"Identifier\" as const, name: slugId },\n\t\t\t\t...(titleId ? [{ type: \"Identifier\" as const, name: titleId }] : []),\n\t\t\t],\n\t\t}),\n\t\t[collectionData, slugId, titleId],\n\t)\n\n\tconst records = useQueryData(query)\n\n\treturn useMemo(() => {\n\t\tif (!Array.isArray(records) || records.length === 0) return undefined\n\n\t\treturn records\n\t\t\t.filter(record => typeof record?.id === \"string\")\n\t\t\t.flatMap(record => {\n\t\t\t\tconst id = record.id as string\n\n\t\t\t\tconst title = titleId && isString(record[titleId]) ? record[titleId] : undefined\n\t\t\t\tconst slug = isString(record[slugId]) ? record[slugId] : undefined\n\n\t\t\t\tconst displayTitle = title || slug\n\t\t\t\tif (!displayTitle) return []\n\n\t\t\t\treturn [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"option\",\n\t\t\t\t\t\tvalue: id,\n\t\t\t\t\t\ttitle: displayTitle,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t})\n\t}, [records, titleId, slugId])\n}\n\nfunction useStringSelectBinding<Optional extends OptionalFlag>({\n\tallItemsLabel,\n\tisOptional,\n\tselectOptions,\n\tsetValue,\n\tvalue,\n}: {\n\tallItemsLabel: string | undefined\n\tisOptional: Optional\n\tselectOptions: FormSelectOption[] | undefined\n\tsetValue: (nextValue: OptionalValue<string, Optional>) => void\n\tvalue: string | undefined\n}): FormSelectVariableBindingResult {\n\tconst selectValue = value === undefined ? ALL_ELEMENTS_VALUE : value\n\n\tconst selectOptionsIncludingOptional = useMemo(\n\t\t() => withAllOption(selectOptions, isOptional, allItemsLabel),\n\t\t[allItemsLabel, isOptional, selectOptions],\n\t)\n\n\tconst onChange = useCallback(\n\t\t(event: ChangeEvent) => {\n\t\t\tif (!(event.target instanceof HTMLSelectElement)) return\n\n\t\t\tconst selectedValue = event.target.value\n\t\t\tstartTransition(() => {\n\t\t\t\tif (selectedValue === ALL_ELEMENTS_VALUE) {\n\t\t\t\t\tsetValue(undefined as OptionalValue<string, Optional>)\n\t\t\t\t} else {\n\t\t\t\t\tsetValue(selectedValue as OptionalValue<string, Optional>)\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\t[setValue],\n\t)\n\n\treturn [selectValue, selectOptionsIncludingOptional, onChange]\n}\n\nfunction withAllOption(\n\toptions: FormSelectOption[] | undefined,\n\tisOptional: OptionalFlag,\n\tallItemsLabel: string | undefined,\n\tincludeDivider = true,\n): FormSelectOption[] | undefined {\n\tif (isOptional !== true || !allItemsLabel) return options\n\n\tconst allOption: FormSelectOption = {\n\t\ttitle: allItemsLabel,\n\t\ttype: \"option\",\n\t\tvalue: ALL_ELEMENTS_VALUE,\n\t}\n\n\tif (!options || options.length === 0) return [allOption]\n\n\tif (includeDivider) return [allOption, { type: \"divider\" }, ...options]\n\n\treturn [allOption, ...options]\n}\n", "import { useCallback } from \"react\"\nimport type { MaybePromise } from \"../router/types.ts\"\nimport { useLocaleInfo } from \"../router/useLocale.ts\"\nimport { isObject, isUndefined } from \"../utils/utils.ts\"\nimport { QueryCache } from \"./cms/QueryCache.ts\"\nimport { QueryEngine, type QueryResult } from \"./cms/QueryEngine.ts\"\nimport type { Expression, Query } from \"./cms/types.ts\"\nimport { BinaryOperator, DataType } from \"./cms/types.ts\"\n\nconst queryEngine = /* @__PURE__ */ new QueryEngine()\n\n/**\n * Singleton query cache used by useQueryData and loaders.\n * @internal\n */\nexport const queryCache = /* @__PURE__ */ new QueryCache(queryEngine)\n\n/** @internal */\nexport function useQueryData(query: Query) {\n\tconst { activeLocale } = useLocaleInfo()\n\tconst cached = queryCache.get(query, activeLocale)\n\n\treturn cached.use()\n}\n\n/** @internal */\nexport function useQueryCount(query: Query) {\n\tconst countQuery = { ...query, select: [] }\n\tconst collection = useQueryData(countQuery)\n\treturn collection.length\n}\n\n/**\n * @internal\n */\nexport function usePreloadQuery(): (query: Query) => MaybePromise<QueryResult> {\n\tconst { activeLocale } = useLocaleInfo()\n\n\treturn useCallback(\n\t\t(query: Query) => {\n\t\t\treturn queryCache.get(query, activeLocale).readMaybeAsync()\n\t\t},\n\t\t[activeLocale],\n\t)\n}\n\n/** Utility function to create a WHERE expression from path variables. */\nexport function getWhereExpressionFromPathVariables(\n\tpathVariables: Record<string, unknown> | undefined,\n\tcollection?: string,\n): Expression {\n\tconst entries = Object.entries(pathVariables ?? {}).filter(([, value]) => {\n\t\tif (isUndefined(value)) return false\n\t\tif (isObject(value)) return false\n\t\treturn true\n\t})\n\n\tconst expressions = entries.map(\n\t\t([name, value]): Expression => ({\n\t\t\ttype: \"BinaryOperation\",\n\t\t\toperator: BinaryOperator.Equals,\n\t\t\tleft: {\n\t\t\t\ttype: \"TypeCast\",\n\t\t\t\tvalue: {\n\t\t\t\t\ttype: \"Identifier\",\n\t\t\t\t\tname,\n\t\t\t\t\tcollection,\n\t\t\t\t},\n\t\t\t\tdataType: DataType.String,\n\t\t\t},\n\t\t\tright: {\n\t\t\t\ttype: \"LiteralValue\",\n\t\t\t\tvalue: String(value),\n\t\t\t},\n\t\t}),\n\t)\n\n\tif (expressions.length === 0) {\n\t\treturn {\n\t\t\ttype: \"LiteralValue\",\n\t\t\tvalue: false,\n\t\t}\n\t}\n\n\treturn expressions.reduce(\n\t\t(result: Expression, expression: Expression): Expression => ({\n\t\t\ttype: \"BinaryOperation\",\n\t\t\toperator: BinaryOperator.And,\n\t\t\tleft: result,\n\t\t\tright: expression,\n\t\t}),\n\t)\n}\n", "import type { Trigger } from \"./triggerActions.ts\"\nimport { TriggerActionsStorageSymbol } from \"./triggerActionsStorage.ts\"\n\nexport interface WindowWithTriggerEvents extends Window {\n\t[TriggerActionsStorageSymbol]?: Set<string>\n}\n\n/**\n * Trigger definitions are wrapped in this function so any dependent events are collected when the module is imported.\n * The function has no usage when used in any other way because the events will have been used to create TriggerActionsStorage already.\n * This allows us to collect all tracking events that we need to consume for all triggers in the bundle.\n */\nexport function createTrigger(input: Trigger): Trigger {\n\tif (typeof window === \"undefined\" || !window.document) return input\n\tconst safeWindow = window as WindowWithTriggerEvents\n\n\tfor (const rule of input.eventHistory ?? []) {\n\t\tif (!rule.eventId) continue\n\n\t\tsafeWindow[TriggerActionsStorageSymbol] ??= new Set()\n\t\tsafeWindow[TriggerActionsStorageSymbol].add(`${rule.eventType}:${rule.eventId}`)\n\t}\n\n\treturn input\n}\n", "import { startTransition, useEffect, useMemo, useState } from \"react\"\nimport type { Trigger } from \"../utils/triggerActions.ts\"\nimport { useStableCallback } from \"../utils/useStableCallback.ts\"\nimport { noop } from \"../utils/utils.ts\"\nimport { useTriggerState } from \"./TriggerStateContext.tsx\"\n\ninterface TriggerSubscriptionProps {\n\ttriggerId: string\n\ttargetId: string\n\ttrigger: Trigger\n\t/**\n\t * Callback to call when the trigger is triggered.\n\t */\n\tcallback?: () => void\n\t/**\n\t * If this prop becomes true at any point the trigger is considered to be triggered manually.\n\t * For example if an overlay is manually opened we don't want the trigger to open the overlay again,\n\t * so we pass the overlay visibility in to this prop.\n\t */\n\ttriggeredExternally?: boolean\n}\nexport function TriggerSubscription({\n\ttriggerId,\n\ttargetId,\n\ttrigger,\n\tcallback,\n\ttriggeredExternally,\n}: TriggerSubscriptionProps) {\n\tconst triggerState = useTriggerState()\n\tconst stableCallback = useStableCallback(callback ?? noop)\n\n\tuseEffect(() => {\n\t\tconst unsubscribe = triggerState?.subscribe(triggerId, targetId, trigger, stableCallback)\n\t\treturn unsubscribe\n\t}, [triggerState?.subscribe, triggerId, targetId, trigger, stableCallback])\n\tuseEffect(() => {\n\t\tif (triggeredExternally) {\n\t\t\ttriggerState?.invoke(triggerId, { callCallback: false })\n\t\t}\n\t}, [triggerState, triggerId, triggeredExternally])\n\treturn null\n}\n\nexport function useTriggers() {\n\tconst triggerState = useTriggerState()\n\tconst [invokedTriggers, setInvokedTriggers] = useState<Set<string>>(() => triggerState?.invokedTriggers ?? new Set())\n\tuseEffect(() => {\n\t\tif (!triggerState) return\n\n\t\tconst onTrigger = () => {\n\t\t\tstartTransition(() => {\n\t\t\t\tsetInvokedTriggers(triggerState.invokedTriggers)\n\t\t\t})\n\t\t}\n\t\ttriggerState.addOnTriggerListener(onTrigger)\n\n\t\t// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect -- catch triggers invoked before first effect call\n\t\tstartTransition(() => {\n\t\t\tsetInvokedTriggers(current =>\n\t\t\t\tcurrent.size !== triggerState.invokedTriggers.size ? triggerState.invokedTriggers : current,\n\t\t\t)\n\t\t})\n\n\t\treturn () => {\n\t\t\ttriggerState.removeOnTriggerListener(onTrigger)\n\t\t}\n\t}, [triggerState])\n\n\tconst result = useMemo(\n\t\t() => ({\n\t\t\thasTriggered: (triggerId: string) => {\n\t\t\t\treturn invokedTriggers.has(triggerId)\n\t\t\t},\n\t\t}),\n\t\t[invokedTriggers],\n\t)\n\n\treturn result\n}\n", "import { useInsertionEffect, useRef } from \"react\"\nimport { useCallbackOne } from \"./useMemoOne.ts\"\n\n/**\n * Creates a callback that remains stable across re-renders while allowing the callback argument to update.\n * The callback can be passed to effects or memoised components without triggering rerenders or re-executions.\n * NOTE: Values captured by the callback may lag *if* the callback is called during render\n *\n * @example\n * const someContext = useContext(SomeContext)\n * const doSomething = useStableCallback((reactiveValue) => {\n *   do(someContext.importantValue, reactiveValue)\n * })\n * // only reevalutes when props.reactiveValue changes\n * useEffect(() => {\n *   doSomething(props.reactiveValue)\n * }, [props.reactiveValue])\n */\nexport function useStableCallback<Args extends unknown[], Result>(\n\tcallback: (...args: Args) => Result,\n): (...args: Args) => Result {\n\tconst ref = useRef(callback)\n\n\tuseInsertionEffect(() => {\n\t\tref.current = callback\n\t}, [callback])\n\n\treturn useCallbackOne((...args: Args) => {\n\t\tconst latestFn = ref.current\n\t\treturn latestFn(...args)\n\t}, [])\n}\n", "import { useEffect, useRef } from \"react\"\nimport { useOnCurrentTargetChange } from \"../components/NavigationTargetContext.tsx\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\n\ntype Timer = ReturnType<typeof globalThis.setTimeout>\n\ntype RejectCallback = (reason: string) => void\n\nfunction rejectPending(pendingTimers: Set<Timer>, pendingPromises: Set<RejectCallback>) {\n\tpendingTimers.forEach(t => clearTimeout(t))\n\tpendingTimers.clear()\n\n\tpendingPromises.forEach(reject => reject?.(\"Callback cancelled by variant change\"))\n\tpendingPromises.clear()\n}\n\nfunction createSet<T>() {\n\treturn new Set<T>()\n}\n\n/**\n * Create callbacks that can be cancelled if the component is unmounted, the\n * active variant changes, or the component moves out of the target screen in a\n * Framer prototype.\n *\n * @public\n */\nexport function useActiveVariantCallback(baseVariant: string | undefined) {\n\tconst pendingPromises = useConstant<Set<RejectCallback>>(createSet)\n\tconst pendingTimers = useConstant<Set<Timer>>(createSet)\n\n\t// If the component moves out of the current screen in a Framer prototype,\n\t// or the current screen is being unmounted via an AnimatePresence animation\n\t// cancel all pending events.\n\tuseOnCurrentTargetChange(() => {\n\t\treturn () => rejectPending(pendingTimers, pendingPromises)\n\t})\n\n\t// If the component is unmounted, cancel all pending events.\n\tuseEffect(() => {\n\t\treturn () => rejectPending(pendingTimers, pendingPromises)\n\t}, [])\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: If the base variant of the component changes, cancel all pending events.\n\tuseEffect(() => {\n\t\trejectPending(pendingTimers, pendingPromises)\n\t}, [baseVariant])\n\n\treturn useRef({\n\t\t/**\n\t\t * Create a callback that can be cancelled if the base variant changes.\n\t\t */\n\t\tactiveVariantCallback:\n\t\t\t(callback: (...args: unknown[]) => Promise<boolean | undefined>) =>\n\t\t\tasync (...args: unknown[]) => {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tpendingPromises.add(reject)\n\t\t\t\t\tvoid callback(...args).then(resolve)\n\t\t\t\t}).catch(() => {\n\t\t\t\t\t// Swallow errors caused by rejecting this promise. It doesn't catch errors caused by the callback.\n\t\t\t\t})\n\t\t\t},\n\n\t\t/**\n\t\t * Execute a callback after a defined period of time. The callback will not\n\t\t * be called if pending events are cancelled because the timeout will be\n\t\t * cancelled.\n\t\t */\n\t\tdelay: async (callback: () => void, msDelay: number) => {\n\t\t\tawait new Promise(resolve => {\n\t\t\t\tpendingTimers.add(globalThis.setTimeout(() => resolve(true), msDelay))\n\t\t\t})\n\t\t\tcallback()\n\t\t},\n\t}).current\n}\n\n/**\n * Create callbacks that can be cancelled if the component is unmounted, or the\n * component moves out of the target screen in a Framer prototype.\n *\n * @internal\n */\nexport function useActiveTargetCallback() {\n\tconst value = useActiveVariantCallback(undefined)\n\n\treturn useRef({\n\t\tactiveTargetCallback: value.activeVariantCallback,\n\t\tdelay: value.delay,\n\t}).current\n}\n", "import React from \"react\"\n\n/**\n * Variant / Node Id / React Prop / Val\n *\n * @public\n */\nexport type VariantProps = Record<string, Record<string, Record<string, unknown>>>\n\n/**\n * Returns combines React props from a hash map based on the active variants.\n *\n * @public\n */\nexport function useAddVariantProps(\n\tbaseVariant: string | undefined,\n\tgestureVariant: string | undefined,\n\tvariantProps: VariantProps,\n): (id: string) => Record<string, unknown> {\n\treturn React.useCallback(\n\t\t(id: string) => {\n\t\t\tif (!variantProps) return {}\n\t\t\tif (!baseVariant) return {}\n\n\t\t\t// Create an object with all valid props for the target node. Values\n\t\t\t// in higher priority variants override same values in lower\n\t\t\t// priority variants.\n\t\t\tif (gestureVariant) {\n\t\t\t\treturn Object.assign({}, variantProps[baseVariant]?.[id], variantProps[gestureVariant]?.[id])\n\t\t\t}\n\n\t\t\treturn variantProps[baseVariant]?.[id] || {}\n\t\t},\n\t\t[baseVariant, gestureVariant, variantProps],\n\t)\n}\n", "import { isBrowser } from \"@framerjs/shared/src/environment.ts\"\nimport { useInstantTransition } from \"framer-motion\"\nimport { startTransition, useCallback, useContext, useEffect, useRef } from \"react\"\nimport { IsInitialNavigationContext } from \"../components/Navigation.tsx\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { isScreenshotFramerHost } from \"../render/types/RenderEnvironment.ts\"\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect.ts\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport { supportsRequestIdleCallback } from \"../utils/utils.ts\"\nimport { useForceUpdate } from \"./useForceUpdate.ts\"\nimport { useIsStaticRenderer } from \"./useIsStaticRenderer.ts\"\n\n/** @internal */\ninterface Breakpoint {\n\tmin?: number\n\tmax?: number\n}\n\n/**\n * Breakpoint as it's defined in the metadata module for a web page.\n */\ninterface MetadataBreakpoint {\n\thash: string\n\tmediaQuery?: string\n}\n\nfunction createMediaQueriesFromBreakpoints(breakpoints: Record<string, Breakpoint>): Record<string, string> {\n\tconst mediaQueries: Record<string, string> = {}\n\tfor (const [variant, query] of Object.entries(breakpoints)) {\n\t\tconst { min = 0, max } = query\n\t\tconst mediaQuery: string[] = []\n\t\tif (min) mediaQuery.push(`(min-width: ${min}px)`)\n\t\tif (max) mediaQuery.push(`(max-width: ${max}px)`)\n\t\tif (mediaQuery.length) mediaQueries[variant] = mediaQuery.join(\" and \")\n\t}\n\n\treturn mediaQueries\n}\n\nfunction activeMediaQueryFromWindow(mediaQueries: Record<string, string>) {\n\tfor (const [variant, query] of Object.entries(mediaQueries)) {\n\t\tconst mql = safeWindow.matchMedia(query)\n\t\tif (mql.matches) return variant\n\t}\n}\n\nfunction activeBreakpointHashesFromWindow(breakpoints: MetadataBreakpoint[]): string[] | undefined {\n\tconst matches: string[] = []\n\tfor (const { hash, mediaQuery } of breakpoints) {\n\t\tif (!mediaQuery) continue\n\t\tconst mql = safeWindow.matchMedia(mediaQuery)\n\t\tif (mql.matches) matches.push(hash)\n\t}\n\n\tif (matches.length > 0) return matches\n\n\tconst defaultHash = breakpoints[0]?.hash\n\tif (!defaultHash) return undefined\n\n\t// Fall back to the first (primary) breakpoint. This generally happens when\n\t// breakpoints.length === 1, in which case the only breakpoint doesn't have\n\t// a media query.\n\treturn [defaultHash]\n}\n\n/**\n * @internal\n *\n * Return the active breakpoint variant based on javascript media queries.\n * Additionally, initially return the primary breakpoint value, and update to\n * the active breakpoint in a layout effect to avoid hydration errors for\n * components whose react props differ from the primary breakpoint.\n */\nexport function useHydratedBreakpointVariants(\n\tinitial: string,\n\tmediaQueries: Record<string, string>,\n\thydratedWithInitial = true,\n): [string | undefined, string | undefined] {\n\tconst isInitialNavigation = useContext(IsInitialNavigationContext)\n\tconst isStaticRenderer = useIsStaticRenderer()\n\tconst isScreenshotHost = isScreenshotFramerHost()\n\tconst usesMediaQueries = isBrowser() && (!isStaticRenderer || isScreenshotHost)\n\tconst baseVariant = useRef(usesMediaQueries ? (activeMediaQueryFromWindow(mediaQueries) ?? initial) : initial)\n\tconst basePropsVariant = useRef(hydratedWithInitial && isInitialNavigation ? initial : baseVariant.current)\n\tconst forceUpdate = useForceUpdate()\n\n\tconst instantTransition = useInstantTransition()\n\tconst setActiveVariantInstant = useCallback(\n\t\t(variant: string) => {\n\t\t\t// Make sure we're actually changing the variant.\n\t\t\t//\n\t\t\t// If we were to re-render with no variant change, React will bail\n\t\t\t// out of re-rendering, and instantTransition will instead apply to\n\t\t\t// the _next_ transition.\n\t\t\tif (variant !== baseVariant.current || variant !== basePropsVariant.current) {\n\t\t\t\tfunction updateStateAndRerender() {\n\t\t\t\t\tbaseVariant.current = basePropsVariant.current = variant\n\t\t\t\t\t// When switching between breakpoints that feature a\n\t\t\t\t\t// collection, it's possible that `useQueryData` needs to\n\t\t\t\t\t// load more data (by throwing a promise). We don't use the\n\t\t\t\t\t// React Suspense component, because we don't show a loading\n\t\t\t\t\t// spinner, so we need to start a transition.\n\t\t\t\t\tstartTransition(() => {\n\t\t\t\t\t\tforceUpdate()\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\tif (isStaticRenderer) {\n\t\t\t\t\t// There's no root projection node on the canvas, so instantTransition won't fire the callback.\n\t\t\t\t\tupdateStateAndRerender()\n\t\t\t\t} else {\n\t\t\t\t\tinstantTransition(() => {\n\t\t\t\t\t\tupdateStateAndRerender()\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[instantTransition, forceUpdate, isStaticRenderer],\n\t)\n\n\t// On the canvas, updates the internal state when the external variant variant changes. This is particularly\n\t// necessary for layout template instances with nested components that change variants in different breakpoints.\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (!isStaticRenderer) return\n\t\tif (isScreenshotHost) {\n\t\t\tsetActiveVariantInstant(activeMediaQueryFromWindow(mediaQueries) ?? initial)\n\t\t\treturn\n\t\t}\n\t\tsetActiveVariantInstant(initial)\n\t}, [initial, isScreenshotHost, isStaticRenderer, mediaQueries, setActiveVariantInstant])\n\n\t// If this is an initial navigation, we started with the initial breakpoint\n\t// to avoid hydration errors, but then we want to immediately re-render with\n\t// the correct breakpoint.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: This hook should only ever run once.\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (!hydratedWithInitial || isInitialNavigation !== true) return\n\n\t\tsetActiveVariantInstant(baseVariant.current)\n\t}, [])\n\n\t// In the preview, after mount, add event listeners to media queries to\n\t// update the active variant when they match. Finally, cleanup the listeners\n\t// when the component is unmounted.\n\tuseEffect(() => {\n\t\tif (!usesMediaQueries || isScreenshotHost) return\n\n\t\tconst callbacks: [MediaQueryList, (event: MediaQueryListEvent) => void][] = []\n\t\tfor (const [variant, query] of Object.entries(mediaQueries)) {\n\t\t\tconst mql = safeWindow.matchMedia(query)\n\n\t\t\tconst callback = (event: MediaQueryListEvent) => {\n\t\t\t\tif (event.matches) setActiveVariantInstant(variant)\n\t\t\t}\n\n\t\t\taddMQLCallback(mql, callback)\n\n\t\t\tcallbacks.push([mql, callback])\n\t\t}\n\n\t\treturn () => callbacks.forEach(([mql, callback]) => removeMQLCallback(mql, callback))\n\t}, [isScreenshotHost, mediaQueries, setActiveVariantInstant, usesMediaQueries])\n\n\treturn [baseVariant.current, basePropsVariant.current]\n}\n\nfunction addMQLCallback(mql: MediaQueryList, callback: (event: MediaQueryListEvent) => void) {\n\tif (mql.addEventListener) {\n\t\tmql.addEventListener(\"change\", callback)\n\t} else {\n\t\t// Safari < 14 doesn't support addEventListener on MediaQueryList\n\t\tmql.addListener(callback)\n\t}\n}\n\nfunction removeMQLCallback(mql: MediaQueryList, callback: (event: MediaQueryListEvent) => void) {\n\tif (mql.removeEventListener) {\n\t\tmql.removeEventListener(\"change\", callback)\n\t} else {\n\t\t// Safari < 14 doesn't support removeEventListener on MediaQueryList\n\t\tmql.removeListener(callback)\n\t}\n}\n\n/**\n * @internal\n *\n * Compatibility wrapper for old generated screens which pass an unused second\n * width argument, breakpoints as maps of raw number values, and expect to\n * receive a single return value.\n */\nexport function useBreakpointVariants(\n\tinitial: string,\n\t_width: number | undefined,\n\tbreakpoints: Record<string, Breakpoint>,\n) {\n\tconst mediaQueries = useConstant(() => createMediaQueriesFromBreakpoints(breakpoints))\n\n\tconst [initialVariant] = useHydratedBreakpointVariants(initial, mediaQueries, true)\n\n\treturn initialVariant\n}\n\n/**\n * @internal\n *\n * @deprecated This function used to be called at the top level of old generated web page components, so we need to keep\n * it for backward compatibility. These days, it does nothing, and we instead remove hidden breakpoint layers using the\n * \"v2\" function below, which is being called in the main site script, right before hydration.\n */\nexport function removeHiddenBreakpointLayers(\n\t_initial: string,\n\t_mediaQueries: Record<string, string>,\n\t_variantClassNames: Record<string, string>,\n) {}\n\nconst framerBreakpointCSSSelector = \"style[data-framer-breakpoint-css]\"\n\n/** A fallback for when requestIdleCallback is not available (as of 2024, all Safari versions). */\nfunction requestIdleCallbackFallback(callback: () => void) {\n\tsetTimeout(callback, 1)\n}\n\n/**\n * During SSR, if a component differs between breakpoints in a way that can't be expressed purely with CSS, we render\n * (via PropertyOverrides) all its variants into the HTML, with a bit of CSS so that at runtime the browser only shows\n * the correct breakpoint.\n *\n * But then, we need to clean this up before hydration kicks in, otherwise we'll get a hydration error, because the\n * client doesn't expect all those extra (hidden) breakpoints that are still in the DOM.\n *\n * This is expected to be called in the main site script, right before hydration, see exportToHTML.ts.\n */\nexport function removeHiddenBreakpointLayersV2(breakpoints: MetadataBreakpoint[]) {\n\tconst suspenseBoundaries = new Set<Node>()\n\tconst activeBreakpointHashes = activeBreakpointHashesFromWindow(breakpoints)\n\tif (activeBreakpointHashes) {\n\t\tfor (const hash of activeBreakpointHashes) {\n\t\t\tfor (const hiddenLayer of document.querySelectorAll(\".hidden-\" + hash)) {\n\t\t\t\tif (isSuspenseBoundaryStart(hiddenLayer.previousSibling)) {\n\t\t\t\t\tsuspenseBoundaries.add(hiddenLayer.previousSibling)\n\t\t\t\t}\n\t\t\t\thiddenLayer.parentNode?.removeChild(hiddenLayer)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Make all .hidden-* classes no-op because breakpoint switching will be handled solely by React now.\n\t// If we don\u2019t do that, we might experience brief flashes when a breakpoint changes: https://github.com/framer/company/issues/30202\n\tconst requestIdleCallback = supportsRequestIdleCallback ? safeWindow.requestIdleCallback : requestIdleCallbackFallback\n\trequestIdleCallback(() => {\n\t\tdocument.querySelector(framerBreakpointCSSSelector)?.remove()\n\t})\n\n\t// We need to remove empty ssr-variant containers, to support overrides on elements that are hidden in certain\n\t// breakpoints. This is because PropertyOverrides and per-breakpoint visibility are handled by two separate\n\t// mechanisms, so we may end up in a situation where we have e.g. a desktop ssr-variant for an element that's hidden\n\t// on desktop. After removing the hidden layer, we end up with an empty ssr-variant container that's not expected to\n\t// be there on the client.\n\t//\n\t// In the generated code, it looks somewhat like this:\n\t//\n\t//     const isDisplayed () => { return variant === \"MOBILE\" || !isBrowser() }\n\t//     ...\n\t//     {isDisplayed() &&\n\t//       <PropertyOverrides overrides={{MOBILE: { ... }}}>\n\t//         <div className=\"hidden-DESKTOP\">...</div>\n\t//       </PropertyOverrides>}\n\t//\n\t// During SSR, this will render:\n\t//\n\t//     <!-- desktop -->\n\t//     <div class=\"ssr-variant hidden-MOBILE\"><div className=\"hidden-DESKTOP\">...</div></div>\n\t//     <!-- mobile -->\n\t//     <div class=\"ssr-variant hidden-DESKTOP\"><div className=\"hidden-DESKTOP\">...</div></div>\n\t//\n\t// If you now load this on desktop, and we remove all the hidden-DESKTOP layers, we'd be left with an empty\n\t// \"ssr-variant hidden-MOBILE\" container that we won't expect during hydration due to the isDisplayed check.\n\t//\n\t// Real-world example: (look for the Ellipse 191 layer)\n\t// https://framerusercontent.com/modules/gQYlHwIfnAKA7DBb0Yx7/NOL46sZ1lI4d4dQelccR/augiA20Il.tsx\n\tfor (const ssrVariant of document.querySelectorAll(\".ssr-variant:empty\")) {\n\t\tif (isSuspenseBoundaryStart(ssrVariant.previousSibling)) {\n\t\t\tsuspenseBoundaries.add(ssrVariant.previousSibling)\n\t\t}\n\t\tssrVariant.parentNode?.removeChild(ssrVariant)\n\t}\n\n\t// Remove empty suspense boundaries comment nodes\n\tfor (const suspenseBoundary of suspenseBoundaries) {\n\t\tif (isSuspenseBoundaryEnd(suspenseBoundary.nextSibling)) {\n\t\t\tsuspenseBoundary.parentNode?.removeChild(suspenseBoundary.nextSibling)\n\t\t\tsuspenseBoundary.parentNode?.removeChild(suspenseBoundary)\n\t\t}\n\t}\n}\n\nfunction isSuspenseBoundaryStart(node: Node | null): node is Node {\n\treturn node?.nodeType === Node.COMMENT_NODE && node.textContent === \"$\"\n}\n\nfunction isSuspenseBoundaryEnd(node: Node | null): node is Node {\n\treturn node?.nodeType === Node.COMMENT_NODE && node.textContent === \"/$\"\n}\n", "import { useMemo } from \"react\"\nimport { isObject } from \"../utils/utils.ts\"\n\n/**\n * Returns a record from the collection which matches all the given variables.\n *\n * @internal\n * @deprecated Use useQueryData instead.\n */\nexport function useDataRecord(\n\tcollection: Record<string, unknown>[],\n\tvariables: Record<string, unknown> | undefined,\n): Record<string, unknown> | null {\n\treturn useMemo(() => {\n\t\tif (!Array.isArray(collection)) {\n\t\t\treturn null\n\t\t}\n\t\tif (!variables) {\n\t\t\treturn null\n\t\t}\n\t\tconst pageRecord = collection.find(record => {\n\t\t\treturn Object.entries(variables).every(([key, value]) => {\n\t\t\t\tconst recordValue = record[key]\n\t\t\t\t// null, undefined, and objects never match\n\t\t\t\tif (value === undefined || recordValue === undefined || isObject(value) || isObject(recordValue)) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\treturn String(value) === String(recordValue)\n\t\t\t})\n\t\t})\n\t\treturn pageRecord ?? null\n\t}, [collection, variables])\n}\n", "import React, { createRef, useMemo } from \"react\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { getPathForRoute } from \"../router/history.ts\"\nimport { useCurrentRoute } from \"../router/useCurrentRoute.tsx\"\nimport { useLocaleInfo } from \"../router/useLocale.ts\"\n\nexport function useDynamicRefs<T>(): (key: string) => React.RefObject<T> {\n\tconst map = useConstant(() => new Map<string, React.RefObject<T>>())\n\treturn React.useCallback((key: string): React.RefObject<T> => {\n\t\tconst existing = map.get(key)\n\t\tif (existing) return existing\n\t\tconst ref = createRef<T>()\n\t\tmap.set(key, ref)\n\t\treturn ref\n\t}, [])\n}\n\nconst map = new Map<string, React.RefObject<HTMLElement>>()\n\n/**\n * When a Scroll Section is provided to a Layout Template as a property by a Web\n * Page, we need to create the ref on a context so that it is available in the\n * parent Layout Template.\n */\nexport function useSiteRefs<T extends HTMLElement>(): (key: string) => React.RefObject<T> | undefined {\n\tconst route = useCurrentRoute()\n\tconst { activeLocale } = useLocaleInfo()\n\tconst path = useMemo(() => {\n\t\treturn getPathForRoute(route, {\n\t\t\tcurrentRoutePath: route?.path,\n\t\t\tcurrentRoutePathLocalized: route?.pathLocalized,\n\t\t\tcurrentPathVariables: route?.pathVariables,\n\t\t\tpreserveQueryParams: false,\n\t\t\trelative: false,\n\t\t\tsiteCanonicalURL: undefined,\n\t\t\tlocaleId: activeLocale?.id,\n\t\t})\n\t}, [route, activeLocale?.id])\n\n\treturn React.useCallback(\n\t\t(key: string | undefined): React.RefObject<T> | undefined => {\n\t\t\tif (!key) return\n\t\t\tconst computedKey = `${path}-${key}`\n\t\t\tconst existing = map.get(computedKey)\n\t\t\tif (existing) return existing as React.RefObject<T>\n\t\t\tconst ref = createRef<T>()\n\t\t\tmap.set(computedKey, ref)\n\t\t\treturn ref\n\t\t},\n\t\t[path],\n\t)\n}\n", "import React from \"react\"\nimport { useOnCurrentTargetChange } from \"../components/NavigationTargetContext.tsx\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport { isObject } from \"../utils/utils.ts\"\n\n/** @internal */\nexport interface FramerGamepadKeydownData {\n\tinputs: string[]\n\tid: string\n\tmapping: Gamepad[\"mapping\"]\n}\n\n/** @internal */\nexport function isFramerGamepadKeydownData(value: unknown): value is FramerGamepadKeydownData {\n\treturn isObject(value) && value.mapping !== undefined\n}\n\n/** @internal */\nexport type GamepadKeydownHandler = (data: FramerGamepadKeydownData) => void\n\nfunction gamepadInputsHaveChanged(previous: string[], current: string[]) {\n\tif (previous.length !== current.length) return true\n\tif (!previous.every((item, i) => current[i] === item)) return true\n\treturn false\n}\n\n/**\n * Exported for testing.\n * @internal\n */\nexport function createGamepadPoller() {\n\tconst handlers = new Set<GamepadKeydownHandler>()\n\n\tlet isConnected = false\n\tlet isPolling: number | null = null\n\tlet lastKeys: string[] = []\n\n\tconst startPolling = () => {\n\t\tconst input = getGamepadInputs()\n\t\t// Don't do anything if no gamepad is connected\n\t\tif (!input) return\n\n\t\tconst { gamepad, inputs } = input\n\t\tconst { mapping, id } = gamepad\n\n\t\t// Each frame only knows its own last pressed key. If two continuous\n\t\t// frames both have gamepad events binding on the same key, we don't\n\t\t// want to fire two events in a row.\n\t\tif (gamepadInputsHaveChanged(lastKeys, inputs)) handlers.forEach(handler => handler({ inputs, mapping, id }))\n\n\t\tlastKeys = inputs\n\t\tisPolling = safeWindow.requestAnimationFrame(startPolling)\n\t}\n\n\tconst handleConnection = () => {\n\t\tif (isConnected || isPolling) return\n\t\tstartPolling()\n\t\tisConnected = true\n\t}\n\n\tconst stopPolling = () => {\n\t\tif (!isPolling) return\n\t\tsafeWindow.cancelAnimationFrame(isPolling)\n\t\tisPolling = null\n\t}\n\n\tconst handleDisconnection = () => {\n\t\tif (!isConnected) return\n\t\tstopPolling()\n\t\tisConnected = false\n\t}\n\n\tconst setupAndStartPolling = () => {\n\t\tif (isPolling) return\n\n\t\tconst gamepad = getGamepadInputs()\n\t\tif (!gamepad) {\n\t\t\t// @NOTE: gamepadconnected only exists on window\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Window/gamepadconnected_event\n\t\t\tsafeWindow.addEventListener(\"gamepadconnected\", handleConnection)\n\t\t\treturn\n\t\t}\n\n\t\t// Even if we haven't connected yet, we need to make sure we disconnect\n\t\t// in the future.\n\t\tsafeWindow.addEventListener(\"gamepaddisconnected\", handleDisconnection)\n\n\t\tisConnected = true\n\t\tstartPolling()\n\t}\n\n\tconst cleanupAndStopPolling = () => {\n\t\tif (!isPolling) return\n\n\t\t// If the gamepad is already connected, then this event has no use\n\t\t// anymore; if the gamepad is not connected yet, we will only listen to\n\t\t// it when start polling. So we should remove the event listener anyway.\n\t\tsafeWindow.removeEventListener(\"gamepadconnected\", handleConnection)\n\t\tsafeWindow.removeEventListener(\"gamepaddisconnected\", handleDisconnection)\n\n\t\tstopPolling()\n\t}\n\n\treturn {\n\t\tregister(callback: (input: FramerGamepadKeydownData) => void) {\n\t\t\tif (handlers.size === 0) setupAndStartPolling()\n\t\t\thandlers.add(callback)\n\t\t},\n\t\tunregister(callback: (input: FramerGamepadKeydownData) => void) {\n\t\t\thandlers.delete(callback)\n\t\t\tif (handlers.size === 0) cleanupAndStopPolling()\n\t\t},\n\t}\n}\n\nconst gamepadPoller = /* @__PURE__ */ createGamepadPoller()\n\n/** @internal */\nexport const GamepadContext = /* @__PURE__ */ React.createContext(gamepadPoller)\n\n/**\n * Return the first gamepad that has input together with the input keys. If\n * there's no input, return the first available gamepad. If there's no gamepad\n * connected, return null.\n */\nfunction getGamepadInputs(): { gamepad: Gamepad; inputs: string[] } | null {\n\tlet firstConnectedGamepad: Gamepad | null = null\n\tconst gamepads = navigator.getGamepads()\n\tfor (const gamepad of gamepads) {\n\t\tif (!gamepad) continue\n\n\t\tif (!firstConnectedGamepad) firstConnectedGamepad = gamepad\n\n\t\tconst inputs = [...scanPressedAxis(gamepad), ...scanPressedButtons(gamepad)]\n\n\t\tif (inputs.length > 0) return { gamepad, inputs }\n\t}\n\n\tif (firstConnectedGamepad) return { gamepad: firstConnectedGamepad, inputs: [] }\n\treturn null\n}\n\nfunction scanPressedAxis(gamepad: Gamepad): string[] {\n\tconst axes: string[] = []\n\tfor (const [idx, axis] of gamepad.axes.entries()) {\n\t\t// Normally axis 0&1 are allocated for the left stick, and 3&4 for the\n\t\t// right stick. Depending on the browser, some controllers can have more\n\t\t// than 4 axes. For example, in safari, a PS5 Dualsense controller has\n\t\t// its axis 4&5 for the left/right triggers, that are set to -1 when\n\t\t// idling. We don't want these axes to be taken as pressed.\n\t\tif (idx > 3) continue\n\t\tif (axis <= -0.5) axes.push(`Axis ${idx}-`)\n\t\tif (axis > 0.5) axes.push(`Axis ${idx}+`)\n\t}\n\n\treturn axes\n}\n\nfunction scanPressedButtons(gamepad: Gamepad): string[] {\n\tconst buttons: string[] = []\n\tfor (const [idx, button] of gamepad.buttons.entries()) {\n\t\tif (isButtonPressed(button)) buttons.push(`Button ${idx}`)\n\t}\n\treturn buttons\n}\n\nfunction isButtonPressed(button: GamepadButton): boolean {\n\t// button.value represents the current state of analog buttons\n\treturn button.pressed === true || button.value > 0\n}\n\n/**\n * Register a callback to be executed when a gamepad button is pressed and the\n * registering component is in the current Framer navigation target. Optionally\n * provide a specific gamepad mapping, or flag the hook to operate on keyup.\n *\n *  @public\n */\nexport function useGamepad(\n\tinput: string,\n\tcallback: () => void,\n\t{ mapping, on }: { mapping?: string; on?: \"keyup\" | \"keydown\" } = {},\n) {\n\tconst context = React.useContext(GamepadContext)\n\tconst settings = useConstant(() => ({\n\t\tmapping: mapping ?? \"standard\",\n\t\ton: on ?? \"keydown\",\n\t}))\n\tconst stateRef = React.useRef({\n\t\tpressed: false,\n\t\thandler: callback,\n\t})\n\n\tconst cb = React.useCallback(\n\t\t(gamepad: FramerGamepadKeydownData) => {\n\t\t\tconst { pressed, handler } = stateRef.current\n\t\t\tif (gamepad.inputs.includes(input) && settings.mapping === gamepad.mapping) {\n\t\t\t\tsettings.on === \"keydown\" && handler()\n\t\t\t\tstateRef.current.pressed = true\n\t\t\t} else if (pressed) {\n\t\t\t\tsettings.on === \"keyup\" && handler()\n\t\t\t\tstateRef.current.pressed = false\n\t\t\t}\n\t\t},\n\t\t[input, settings],\n\t)\n\n\tuseOnCurrentTargetChange((isInTarget, isOverlayed) => {\n\t\tconst isActive = isInTarget && !isOverlayed\n\t\tif (isActive) {\n\t\t\tcontext.register(cb)\n\t\t} else {\n\t\t\tcontext.unregister(cb)\n\t\t}\n\n\t\t// Unregister the callback when the screen unmounts. This is probably\n\t\t// unnecessary since we unregister the callback when the component\n\t\t// unmounts, but may catch instances where the screen is being unmounted\n\t\t// with AnimatePresence and hasn't yet been removed from the react tree.\n\t\treturn () => context.unregister(cb)\n\t}, [])\n\n\t// Unregister the callback when unmounted.\n\tReact.useEffect(() => {\n\t\treturn () => context.unregister(cb)\n\t}, [cb, context])\n\n\t// Maintain an up to date reference to the provided callback. This prevents\n\t// users from being forced to create a memoized callback with useCallback\n\t// and React refs.\n\tReact.useEffect(() => {\n\t\tstateRef.current.handler = callback\n\t}, [callback])\n}\n", "import React from \"react\"\nimport { useOnCurrentTargetChange } from \"../components/NavigationTargetContext.tsx\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { asRecord } from \"../utils/asRecord.ts\"\n\ninterface Modifiers {\n\taltKey: boolean\n\tctrlKey: boolean\n\tmetaKey: boolean\n\tshiftKey: boolean\n\t[key: string]: unknown\n}\n\ninterface Shortcut extends Modifiers {\n\tkey: string\n}\n\nconst modifierDefaults: Modifiers = {\n\taltKey: false,\n\tctrlKey: false,\n\tmetaKey: false,\n\tshiftKey: false,\n}\n\nfunction createShortcutDefinition(shortcut: string): Shortcut | undefined {\n\tconst keys = shortcut.split(\"+\")\n\tconst key = keys.pop()\n\n\tif (!key) return undefined\n\n\tconst modifiers: Partial<Modifiers> = {}\n\n\tfor (const modifier of keys) {\n\t\tmodifiers[`${modifier}Key`] = true\n\t}\n\n\treturn {\n\t\t...modifierDefaults,\n\t\t...modifiers,\n\t\tkey,\n\t}\n}\n\n/** @internal */\nexport function useHotkey(shortcut: string, callback: () => void) {\n\tconst inTarget = React.useRef<boolean>(true)\n\tconst shortcutDefinition = useConstant(() => createShortcutDefinition(shortcut))\n\n\tuseOnCurrentTargetChange((isCurrentTarget, isOverlayed) => {\n\t\tinTarget.current = isCurrentTarget && !isOverlayed\n\t\treturn () => (inTarget.current = false)\n\t})\n\n\tconst eventHandler = React.useCallback(\n\t\t(event: KeyboardEvent) => {\n\t\t\tif (!shortcutDefinition) return\n\t\t\tif (!inTarget.current) return\n\t\t\tif (!Object.keys(shortcutDefinition).every(key => shortcutDefinition[key] === asRecord(event)[key])) return\n\n\t\t\tevent.preventDefault()\n\t\t\tcallback()\n\t\t},\n\t\t[shortcutDefinition, callback],\n\t)\n\n\tReact.useEffect(() => {\n\t\tdocument.addEventListener(\"keydown\", eventHandler)\n\t\treturn () => document.removeEventListener(\"keydown\", eventHandler)\n\t}, [eventHandler])\n}\n", "import { useRouter } from \"../router/RouterContext.tsx\"\nimport { useIsOnFramerCanvas } from \"./useIsOnFramerCanvas.ts\"\n\n/**\n * A wrapper around the Router API to provide backwards compatibilty for\n * generated components that depend on the `useNavigate` export from \"framer\",\n * instead of the `useRoute` that is currently used\n *\n * @internal\n */\nexport function useNavigate() {\n\tconst { navigate } = useRouter()\n\tconst onCanvas = useIsOnFramerCanvas()\n\n\tif (!navigate) return () => {}\n\n\treturn (target: string) => {\n\t\tif (onCanvas) return\n\t\tnavigate(target)\n\t\t// Return false to prevent smart components from proceeding with their event execution.\n\t\treturn false\n\t}\n}\n", "// rules-of-hooks is disabled for this file so that we avoid calling pointless\n// useEffects on the framer canvas.\n/* eslint-disable react-hooks/rules-of-hooks */\nimport React from \"react\"\nimport { useOnCurrentTargetChange } from \"../components/NavigationTargetContext.tsx\"\nimport { isStaticRenderer } from \"./useIsStaticRenderer.ts\"\n\ntype CallbackMap = Record<string, (() => void) | undefined>\nfunction callbackForVariant(map: CallbackMap, variant: string) {\n\tif (map[variant]) return map[variant]\n\tif (variant in map) return undefined\n\treturn map.default\n}\n\n/**\n * Executes a callback when the base variant changes. Events will not be\n * executed on the Framer canvas.\n *\n * @public\n */\nexport function useOnVariantChange(variant: string, callbackMap: CallbackMap) {\n\tconst isRenderingStaticContent = isStaticRenderer()\n\tif (isRenderingStaticContent) return\n\n\t// It is safe to call hooks conditionally here because the check above will never change.\n\t// Disabled rule for file in biome.jsonc.\n\tconst isActiveScreenRef = React.useRef(true)\n\t// Prevent the callback map from unintentionally triggering useEffect calls.\n\tconst callbackMapRef = React.useRef(callbackMap)\n\n\tuseOnCurrentTargetChange((isCurrent, isOverlayed) => {\n\t\tconst isActiveScreen = isCurrent && !isOverlayed\n\t\tif (!isActiveScreenRef.current && isActiveScreen) {\n\t\t\tconst callback = callbackForVariant(callbackMapRef.current, variant)\n\t\t\tif (callback) callback()\n\t\t}\n\t\tisActiveScreenRef.current = isActiveScreen\n\t}, [])\n\n\tReact.useEffect(() => {\n\t\tif (isActiveScreenRef.current) {\n\t\t\tconst callback = callbackForVariant(callbackMapRef.current, variant)\n\t\t\tif (callback) callback()\n\t\t}\n\t}, [variant])\n}\n\n/**\n * A simplified version of useOnVariantChange, that takes a single callback,\n * cancelling it only if the navigation target changes.\n *\n * @internal\n */\nexport function useOnAppear(callback: () => void) {\n\tuseOnVariantChange(\"default\", { default: callback })\n}\n", "import { frame } from \"framer-motion\"\nimport React, { startTransition } from \"react\"\nimport { safeWindow } from \"../utils/safeWindow.ts\"\nimport { yieldToMain } from \"../utils/yield.ts\"\n\nfunction setOverflow(blockDocumentScrolling: boolean, show: boolean) {\n\tif (blockDocumentScrolling === false) return\n\n\t// Even if we yield before, we still want to make sure the DOM update happens at the end of the rAF queue,\n\t// so that if any other rAF reads from the DOM, it won't force a reflow (= which makes the operation more expensive).\n\tframe.render(() => {\n\t\tconst htmlStyle = document.documentElement.style\n\t\tif (show) {\n\t\t\thtmlStyle.setProperty(\"overflow\", \"hidden\")\n\t\t} else {\n\t\t\thtmlStyle.removeProperty(\"overflow\")\n\t\t}\n\t})\n}\n\n/**\n * When managing hiding/showing overlays, we want to prevent accidental body\n * scrolling beneath the overlay. This hook decorates a normal React useState\n * hook with solving this problem.\n *\n * Additionally, we allow the overlay to be dismissed by the escape key\n * when explicitly enabled.\n *\n * @public\n */\nexport function useOverlayState({\n\tblockDocumentScrolling = true,\n\tdismissWithEsc = false,\n}: { blockDocumentScrolling?: boolean; dismissWithEsc?: boolean } = {}): readonly [\n\tboolean,\n\t(show: boolean) => Promise<void>,\n] {\n\tconst [showOverlay, setShowOverlay] = React.useState(false)\n\n\tconst callback = React.useCallback(\n\t\tasync (show: boolean) => {\n\t\t\t// Await paint in response to user interaction to improve INP\n\t\t\tawait yieldToMain({ priority: \"user-blocking\", continueAfter: \"paint\" })\n\n\t\t\tstartTransition(() => setShowOverlay(show))\n\n\t\t\tsetOverflow(blockDocumentScrolling, show)\n\t\t},\n\t\t[blockDocumentScrolling],\n\t)\n\n\t// Ensure overflow is cleaned up when the hook is destroyed.\n\tReact.useEffect(\n\t\t() => () => {\n\t\t\t// Unmounting might happen in response to an user interaction, so we await the next paint\n\t\t\tvoid yieldToMain({ priority: \"user-blocking\", continueAfter: \"paint\" }).then(() => {\n\t\t\t\tsetOverflow(blockDocumentScrolling, false)\n\t\t\t})\n\t\t},\n\t\t[blockDocumentScrolling],\n\t)\n\n\t// Ensure the overlay is dismissed when the escape key is pressed.\n\tReact.useEffect(() => {\n\t\tif (!dismissWithEsc) return\n\n\t\tconst handleEscapeKeyDown = (event: KeyboardEvent) => {\n\t\t\tif (event.key !== \"Escape\") return\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tvoid callback(false)\n\t\t}\n\n\t\tsafeWindow.addEventListener(\"keydown\", handleEscapeKeyDown)\n\t\treturn () => safeWindow.removeEventListener(\"keydown\", handleEscapeKeyDown)\n\t}, [dismissWithEsc, callback])\n\n\treturn [showOverlay, callback] as const\n}\n", "import type { Transition } from \"framer-motion\"\nimport React from \"react\"\nimport { useNavigation } from \"../components/useNavigation.ts\"\nimport { useRouter } from \"../router/RouterContext.tsx\"\nimport { isRoute } from \"../router/isRoute.ts\"\nimport type { ComponentWithPreload, Route, RouteComponent } from \"../router/types.ts\"\nimport { isObject, isString } from \"../utils/utils.ts\"\nimport { useIsOnFramerCanvas } from \"./useIsOnFramerCanvas.ts\"\n\n/**\n * @internal\n */\nexport interface NavigateOptions {\n\ttransition?: \"push\" | \"instant\" | \"fade\" | \"modal\" | \"overlay\" | \"flip\" | \"magicMotion\"\n\tappearsFrom?: \"left\" | \"right\" | \"top\" | \"bottom\"\n\tbackdropColor?: string\n\tanimation?: Transition\n}\n\ninterface Options {\n\t/**\n\t * useNavigate allows preloading targets of the calling component. These\n\t * targets can either be strings that are valid keys in the `routes` prop of\n\t * a wrapping Navigation component, or a React Component type reference.\n\t *\n\t * If the entry is a string, useNavigate will attempt to retrieve a\n\t * reference to a React component from the Navigation context.\n\t */\n\tpreload?: (string | RouteComponent)[]\n}\n\n/**\n * If it is a lazy import, we need to call React.createElement to ensure it is\n * mountable. The value returned from the router can either be a valid React\n * element, for instance if created with React.createElement or written in JSX,\n * or it can be a React.ComponentType, in which case we have to explicitly call\n * React.CreateElement before returning.\n */\nasync function componentForRoute(\n\troute: Route | undefined,\n\t// biome-ignore lint/suspicious/noExplicitAny: outdated component\n): Promise<React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined> {\n\tif (!isRoute(route)) return\n\tconst { page: routeComponent } = route\n\tif (!routeComponent) return\n\n\tif (React.isValidElement(routeComponent)) return routeComponent\n\n\tif (withPreload(routeComponent)) await routeComponent.preload()\n\n\t// @ts-expect-error to figure out how to type this properly, as tests are using different $$typeof symbol and\n\t// isValidElement fails\n\treturn React.createElement(routeComponent, { key: route.path })\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: outdated component\nconst preloadKey: keyof ComponentWithPreload<any> = \"preload\"\nexport function withPreload(component: unknown): component is ComponentWithPreload<React.ComponentType> {\n\treturn !!component && isObject(component) && preloadKey in component\n}\n\n/**\n * A relative duplicate of useNavigate from runtime to support navigation in\n * combined screens. Additionally supports a preload argument that allows target\n * screens that are lazy imported to be requested before they are navigated to.\n *\n * @internal\n */\nexport function usePrototypeNavigate({ preload }: Options = {}) {\n\tconst navigation = useNavigation()\n\tconst { getRoute } = useRouter()\n\tconst onCanvas = useIsOnFramerCanvas()\n\n\t// On mount, attempt to preload future navigation targets. If the target is\n\t// a route string, first retrieve the component for that route from the\n\t// routes context.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: outdated component\n\tReact.useEffect(() => {\n\t\tif (!navigation || onCanvas) return\n\t\tpreload?.forEach(componentOrRoute => {\n\t\t\tlet component: RouteComponent | undefined\n\t\t\tif (isString(componentOrRoute)) {\n\t\t\t\tconst route = getRoute?.(componentOrRoute)\n\t\t\t\tif (isRoute(route)) {\n\t\t\t\t\tcomponent = route.page\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcomponent = componentOrRoute\n\t\t\t}\n\t\t\tif (component && withPreload(component)) void component.preload()\n\t\t})\n\t}, [])\n\n\tif (!navigation) return () => {}\n\n\treturn async (target: React.ReactElement | string | \"previous\", options: NavigateOptions = {}) => {\n\t\tif (onCanvas) return\n\n\t\tif (target === \"previous\") {\n\t\t\tnavigation.goBack()\n\t\t\treturn false\n\t\t}\n\n\t\t// If we are navigating to a route by an id, retrieve the React\n\t\t// component, and ensure it is a React element.\n\t\tconst Component =\n\t\t\ttypeof target === \"string\"\n\t\t\t\t? await componentForRoute(getRoute?.(target)).catch(() => {}) // Swallow any errors.\n\t\t\t\t: React.isValidElement(target)\n\t\t\t\t\t? target\n\t\t\t\t\t: null\n\n\t\tif (!Component) return\n\n\t\tconst { appearsFrom, backdropColor, animation } = options\n\n\t\tconst transitionType = options.transition || \"instant\"\n\t\tswitch (transitionType) {\n\t\t\tcase \"instant\":\n\t\t\t\tnavigation.instant(Component)\n\t\t\t\tbreak\n\t\t\tcase \"fade\":\n\t\t\t\tnavigation.fade(Component, { animation })\n\t\t\t\tbreak\n\t\t\tcase \"push\":\n\t\t\t\tnavigation.push(Component, { appearsFrom, animation })\n\t\t\t\tbreak\n\t\t\tcase \"flip\":\n\t\t\t\tnavigation.flip(Component, { appearsFrom, animation })\n\t\t\t\tbreak\n\t\t\tcase \"magicMotion\":\n\t\t\t\tnavigation.magicMotion(Component, { animation })\n\t\t\t\tbreak\n\t\t\t// Overlay stack navigation doesn't support updating the browser's\n\t\t\t// path.\n\t\t\tcase \"modal\":\n\t\t\t\tnavigation.modal(Component, { backdropColor, animation })\n\t\t\t\tbreak\n\t\t\tcase \"overlay\":\n\t\t\t\tnavigation.overlay(Component, { appearsFrom, backdropColor, animation })\n\t\t\t\tbreak\n\t\t}\n\n\t\t// Return false to prevent smart components from proceeding with their event execution.\n\t\treturn false\n\t}\n}\n", "import { isObject } from \"../utils/utils.ts\"\nimport type { Route } from \"./types.ts\"\n\nconst key: keyof Route = \"page\"\n\n/**\n * @internal\n */\nexport function isRoute(route: unknown): route is Route {\n\treturn isObject(route) && key in route && route.page !== undefined\n}\n", "import { useMemo } from \"react\"\nimport type { Query } from \"../../modules/cms/types.ts\"\nimport { useQueryCount } from \"../../modules/useQueryData.ts\"\nimport { useLoadMorePagination } from \"./useLoadMorePagination.tsx\"\n\nexport function useLoadMorePaginatedQuery(query: Query, pageSize: number, hash: string) {\n\tconst count = useQueryCount(query)\n\n\tconst { paginationInfo, loadMore } = useLoadMorePagination(count, pageSize, hash, true)\n\n\tconst paginatedQuery = useMemo<Query>(() => {\n\t\tlet limit = pageSize * paginationInfo.currentPage\n\n\t\tif (query.limit) {\n\t\t\tif (query.limit.type !== \"LiteralValue\" || typeof query.limit.value !== \"number\") {\n\t\t\t\tthrow new Error(\"Unexpected type for query limit\")\n\t\t\t}\n\t\t\tlimit = Math.min(limit, query.limit.value)\n\t\t}\n\n\t\treturn { ...query, limit: { type: \"LiteralValue\", value: limit } }\n\t}, [query, pageSize, paginationInfo])\n\n\treturn { paginatedQuery, paginationInfo, loadMore }\n}\n", "import { startTransition, useCallback, useEffect, useMemo, useRef, useState, useTransition } from \"react\"\nimport { useIsOnFramerCanvas } from \"../../modules/useIsOnFramerCanvas.ts\"\nimport { pushLoadMoreHistory } from \"../../router/history.ts\"\nimport type { PaginationInfo } from \"../../router/types.ts\"\nimport { yieldToMain } from \"../../utils/yield.ts\"\nimport type { UseInfiniteScrollProps } from \"../Pagination/InfiniteScroll.tsx\"\n\nexport function useLoadMorePagination(\n\ttotalSize: number,\n\tpageSize: number,\n\thash: string,\n\tpaginateWithSuspendedLoadingState: boolean = false,\n): {\n\tpaginationInfo: PaginationInfo\n\tloadMore: UseInfiniteScrollProps[\"loadMore\"]\n} {\n\tconst [isPending, startLoadingTransition] = useTransition()\n\tconst totalPages = Math.ceil(totalSize / pageSize)\n\n\tconst [currentPage, setCurrentPage] = useState<number>(\n\t\tglobalThis?.history?.state?.paginationInfo?.[hash]?.currentPage ?? 1,\n\t)\n\t// The ref is used to prevent a race-condition, where `loadMore` is called before the component\n\t// unsuspends, because React would discard the render and re-start the transition if state is\n\t// set during the transition.\n\t// This prevents a loop if `setCurrentPage(maxPage)` is called multiple times.\n\tconst currentPageRef = useRef<number>(currentPage)\n\n\tconst paginationInfo = useMemo<PaginationInfo>(() => {\n\t\treturn {\n\t\t\tcurrentPage,\n\t\t\ttotalPages,\n\t\t\tisLoading: isPending,\n\t\t}\n\t}, [currentPage, totalPages, isPending])\n\n\tuseEffect(() => {\n\t\tpushLoadMoreHistory(hash, paginationInfo)\n\t}, [hash, paginationInfo])\n\n\tconst onCanvas = useIsOnFramerCanvas()\n\tconst loadMore = useCallback(async () => {\n\t\tif (onCanvas) return\n\t\tif (currentPageRef.current >= totalPages) return\n\n\t\t// Await next paint before doing more stuff -> improves INP\n\t\tawait yieldToMain({ priority: \"user-blocking\", continueAfter: \"paint\" })\n\t\tif (currentPageRef.current >= totalPages) return // check again after yielding\n\n\t\tconst renderNextPage = (startTransition: typeof startLoadingTransition) => {\n\t\t\tstartTransition(() => {\n\t\t\t\tsetCurrentPage(_currentPage => {\n\t\t\t\t\tconst nextPage = Math.min(_currentPage + 1, totalPages)\n\t\t\t\t\tcurrentPageRef.current = nextPage\n\t\t\t\t\treturn nextPage\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\n\t\t// We explicitly don't use `startLoadingTransition` here, because we can skip the `isPending` update when not using Suspense.\n\t\tif (!paginateWithSuspendedLoadingState) return renderNextPage(startTransition)\n\t\treturn renderNextPage(startLoadingTransition)\n\t}, [totalPages, paginateWithSuspendedLoadingState])\n\n\treturn { paginationInfo, loadMore }\n}\n", "import type { TapHandlers, Transition } from \"framer-motion\"\nimport { type DOMAttributes, startTransition, useCallback, useContext, useEffect, useMemo, useRef } from \"react\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { assert } from \"../utils/assert.ts\"\nimport { isBot } from \"../utils/utils.ts\"\nimport { yieldToMain } from \"../utils/yield.ts\"\nimport { useLibraryFeatures } from \"./LibraryFeaturesContext.ts\"\nimport { cx } from \"./cx.ts\"\nimport type { VariantProps } from \"./useAddVariantProps.ts\"\nimport { useAddVariantProps } from \"./useAddVariantProps.ts\"\nimport { useForceUpdate } from \"./useForceUpdate.ts\"\nimport { useIsOnFramerCanvas } from \"./useIsOnFramerCanvas.ts\"\nimport { SharedIntersectionObserverContext, observeElement } from \"./useSharedIntersectionObserver.ts\"\n\nfunction createGestureVariant(variant: string, type: \"hover\" | \"pressed\" | \"loading\" | \"error\") {\n\treturn `${variant}-${type}`\n}\n\nfunction nextVariant(allVariants: string[], currentVariant: string): string {\n\tconst index = allVariants.indexOf(currentVariant)\n\tlet nextIndex = index + 1\n\tif (nextIndex >= allVariants.length) {\n\t\tnextIndex = 0\n\t}\n\t// We ensure the index could not go out of bound with the code above, the\n\t// assert here is just to appease Typescript.\n\tconst nextVariant = allVariants[nextIndex]\n\tassert(nextVariant !== undefined, \"nextVariant should be defined\")\n\treturn nextVariant\n}\n\nfunction activeTransition(transitions: Record<string, Partial<Transition>> | undefined, variant: string) {\n\tif (!transitions) return undefined\n\n\tif (variant) {\n\t\tconst variantTransition = transitions[variant]\n\t\tif (variantTransition) return variantTransition\n\t}\n\n\treturn transitions.default\n}\n\ntype GestureState = Partial<{\n\tisHovered: boolean\n\tisPressed: boolean\n\tisLoading: boolean\n\tisError: boolean\n}>\n\n// EnabledGestures and EnabledVariantGestures are mirrored from Framer in VariantsStore.ts\ninterface EnabledGestures {\n\thover: boolean\n\tpressed: boolean\n\tloading: boolean\n\terror: boolean\n}\n\nexport type GestureHandlers = Pick<\n\tTapHandlers & DOMAttributes<HTMLDivElement>,\n\t\"onTap\" | \"onTapStart\" | \"onTapCancel\" | \"onMouseEnter\" | \"onMouseLeave\"\n>\n\ntype EnabledVariantGestures = Record<string, EnabledGestures>\ntype VariantNames = string[]\ninterface VariantState {\n\tvariants: VariantNames\n\tbaseVariant: string | undefined\n\tgestureVariant: string | undefined\n\tclassNames: string\n\ttransition: Partial<Transition> | undefined\n\tgestureHandlers: GestureHandlers\n\tsetVariant: (variant: string | typeof CycleVariantState, pauseOffscreen?: boolean) => void\n\tsetGestureState: (gestureState: GestureState) => void\n\tclearLoadingGesture: () => void\n\taddVariantProps?: (id: string) => Record<string, unknown>\n}\n\n/**\n * @internal\n */\nexport const enum VariantSelector {\n\tVariant = \"v\",\n}\n\nfunction getGesture(\n\tenabledGestures: EnabledGestures | undefined,\n\tisHovered: boolean,\n\tisPressed: boolean,\n\tisLoading: boolean,\n\tisError: boolean,\n): \"hover\" | \"pressed\" | \"loading\" | \"error\" | undefined {\n\tconst { hover, pressed, loading, error } = enabledGestures || {}\n\tif (error && isError) return \"error\"\n\tif (loading && isLoading) return \"loading\"\n\tif (pressed && isPressed) return \"pressed\"\n\tif (hover && isHovered) return \"hover\"\n}\n\nfunction createVariantClassName(baseVariant: string, variantClassNames: Record<string, string>) {\n\tconst mappedClassName = variantClassNames[baseVariant]\n\tif (mappedClassName) return mappedClassName\n\n\treturn `framer-${VariantSelector.Variant}-${baseVariant}`\n}\n\nfunction safeBaseVariant(targetVariant: string | undefined, fallbackVariant: string, validBaseVariants: Set<string>) {\n\tif (!targetVariant) return fallbackVariant\n\tif (validBaseVariants.has(targetVariant)) return targetVariant\n\treturn fallbackVariant\n}\n\ninterface InternalState {\n\tisHovered: boolean\n\tisHoveredHasUpdated: boolean\n\tisPressed: boolean\n\tisPressedHasUpdated: boolean\n\tisError: boolean\n\thasPressedVariants: boolean\n\tbaseVariant: string\n\tdefaultVariant: string\n\tlastVariant?: string\n\tgestureVariant?: string\n\tenabledGestures?: EnabledVariantGestures\n\tcycleOrder?: string[]\n\ttransitions?: Record<string, Partial<Transition>>\n\tloadedBaseVariant: Record<string, boolean>\n}\n\n/**\n * Flag setVariantState as cycling variants.\n * @public\n */\nexport const CycleVariantState = /* @__PURE__ */ Symbol(\"cycle\")\n\n/**\n * Runs the specified callback if the page is visible. If not, it will wait until the page becomes visible.\n */\nfunction useRunCallbackIfPageIsVisible(): (callback: VoidFunction) => void {\n\tconst listenerRef = useRef<() => void>()\n\tconst callbackRef = useRef<VoidFunction>()\n\n\tconst clean = useCallback(() => {\n\t\tif (!listenerRef.current) return\n\t\tdocument.removeEventListener(\"visibilitychange\", listenerRef.current)\n\t\tlistenerRef.current = undefined\n\t\tcallbackRef.current = undefined\n\t}, [])\n\n\tuseEffect(() => {\n\t\t// cleanup effect for the event listener\n\t\treturn () => {\n\t\t\tclean()\n\t\t}\n\t}, [clean])\n\n\treturn useCallback(\n\t\tcallback => {\n\t\t\tif (!document.hidden) {\n\t\t\t\tcallback()\n\t\t\t\tclean()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcallbackRef.current = callback // update the callback\n\t\t\tif (listenerRef.current) return // Don't add duplicate listeners\n\n\t\t\tconst listenerFn = () => {\n\t\t\t\tif (document.hidden) return\n\t\t\t\tcallbackRef.current?.()\n\t\t\t\tclean()\n\t\t\t}\n\t\t\tlistenerRef.current = listenerFn\n\t\t\tdocument.addEventListener(\"visibilitychange\", listenerFn)\n\t\t},\n\t\t[clean],\n\t)\n}\n\n/**\n * Runs the specified callback if the element is in view. If not, it will wait until the element comes into view.\n */\nfunction useRunCallbackIfElementIsInView(): (callback: VoidFunction, ref: React.RefObject<HTMLElement>) => void {\n\tconst observerRefCleanup = useRef<() => void>()\n\tconst isInViewRef = useRef(false)\n\tconst callbackRef = useRef<VoidFunction>()\n\tconst observers = useContext(SharedIntersectionObserverContext)\n\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tobserverRefCleanup.current?.()\n\t\t\tcallbackRef.current = undefined\n\t\t\tobserverRefCleanup.current = undefined\n\t\t}\n\t}, [])\n\n\treturn useCallback(\n\t\t(callback, ref) => {\n\t\t\tif (!ref?.current || isInViewRef.current) {\n\t\t\t\t// we don't have a ref (yet) or the ref is visible, so we can just call the callback immediately\n\t\t\t\tcallback()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcallbackRef.current = callback // update the callback\n\n\t\t\t// observer exists already\n\t\t\tif (observerRefCleanup.current) return\n\n\t\t\t// By observing the element only when `setVariant` is called,\n\t\t\t// we avoid some overhead of observing potentially 1000s of elements initially.\n\t\t\tlet queuedMicrotask = false\n\t\t\tconst observerCallback = (entry: IntersectionObserverEntry) => {\n\t\t\t\tisInViewRef.current = entry.isIntersecting\n\n\t\t\t\t// when rapidly scrolling, the entries can contain multiple intersection states\n\t\t\t\t// we want the last one to 'win' (= be the one that determines if the element is in view)\n\t\t\t\tif (queuedMicrotask) return\n\t\t\t\tqueuedMicrotask = true\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tqueuedMicrotask = false\n\n\t\t\t\t\tif (!isInViewRef.current) return\n\t\t\t\t\tcallbackRef.current?.()\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// \"undefined\" is the key the entry where no root margin has been passed -> all elements that have no root margin share that observer.\n\t\t\t// null is the document root.\n\t\t\tobserverRefCleanup.current = observeElement(observers, \"undefined\", ref.current, null, observerCallback)\n\t\t},\n\t\t[observers],\n\t)\n}\n\nfunction useUpdateIfVisible(ref?: React.RefObject<HTMLElement>) {\n\tconst runUpdateIfPageIsVisible = useRunCallbackIfPageIsVisible()\n\tconst runUpdateIfElementIsInView = useRunCallbackIfElementIsInView()\n\n\treturn useCallback(\n\t\t(callback: VoidFunction, checkViewport = false) => {\n\t\t\tif (isBot) {\n\t\t\t\t// don't intercept variant updates for bots.\n\t\t\t\tcallback()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst runUpdate = checkViewport && ref ? () => runUpdateIfElementIsInView(callback, ref) : callback\n\t\t\trunUpdateIfPageIsVisible(runUpdate)\n\t\t},\n\t\t[runUpdateIfPageIsVisible, runUpdateIfElementIsInView, ref],\n\t)\n}\n\nlet globalWaitingForClickPromise: Promise<void> | undefined\nlet globalWaitingForClickResolve: (() => void) | undefined\n\nasync function getPromiseWithFallback() {\n\treturn new Promise<void>(resolve => {\n\t\tlet resolveFn: (() => void) | undefined = resolve\n\t\t// Safety fallback in case `click` never fires, where 150ms ensures the delay isn't noticeable by users\n\t\t// TODO: Add a log here when `yieldOnTap` ships to stable, so we understand how often this occurs.\n\t\tsetTimeout(() => {\n\t\t\tif (!resolveFn) return\n\t\t\tperformance.mark(\"wait-for-click-fallback\")\n\t\t\tresolveFn()\n\t\t}, 150)\n\n\t\tglobalWaitingForClickResolve = () => {\n\t\t\tresolve()\n\t\t\tresolveFn = undefined\n\t\t}\n\t})\n}\n\nfunction globalWaitForClickListener(event: PointerEvent) {\n\tif (event.button === 0 /* primary / left mouse button */) {\n\t\t// Only after a left mouse button click (or any pointer up on mobile), a `click` event will fire.\n\t\t// So we only want to set `globalWaitingForClick` to `true` in that case.\n\t\tperformance.mark(\"pointerdown-listener\")\n\t\tglobalWaitingForClickPromise = getPromiseWithFallback()\n\t}\n}\n\nfunction globalClickReceivedListener() {\n\tperformance.mark(\"click-received-listener\")\n\tglobalWaitingForClickPromise = undefined\n\tglobalWaitingForClickResolve?.()\n\tglobalWaitingForClickResolve = undefined\n}\n\nfunction useWaitForGlobalClick(enabled = false) {\n\t// TODO: Make this a non-react-hook when `yieldOnTap` ships to stable, so we can skip the `useEffect` calls after initializing once.\n\tuseEffect(() => {\n\t\tif (!enabled) return\n\n\t\tdocument.addEventListener(\"pointerup\", globalWaitForClickListener, true)\n\t\t// @ts-expect-error TS(2339): We use `__proto__` here to bypass any overrides of the global `addEventListener` function (like from GTM).\n\t\tdocument.__proto__.addEventListener.call(document, \"click\", globalClickReceivedListener, true)\n\n\t\t// No cleanup, as those listeners should stay active for the lifetime of the page.\n\t\t// If one unmounting component would remove them, another component might still need them (= results in a bug).\n\t}, [enabled])\n}\n\n/**\n * Handle stateful logic in Framer Canvas Components.\n *\n * @public\n */\nexport function useVariantState({\n\tvariant,\n\tdefaultVariant: externalDefaultVariant,\n\ttransitions: externalTransitions,\n\tenabledGestures: externalEnabledGestures,\n\tcycleOrder: externalCycleOrder = [],\n\tvariantProps = {},\n\tvariantClassNames = {},\n\tref,\n}: {\n\tdefaultVariant: string\n\tcycleOrder: string[]\n\tvariant?: string\n\ttransitions?: Record<string, Partial<Transition>>\n\tenabledGestures?: EnabledVariantGestures\n\tvariantProps?: VariantProps\n\tvariantClassNames?: Record<string, string>\n\tref?: React.RefObject<HTMLElement>\n}): VariantState {\n\tconst forceUpdate = useForceUpdate()\n\tconst isCanvas = useIsOnFramerCanvas()\n\tconst validBaseVariants = useConstant(() => new Set(externalCycleOrder))\n\tconst { yieldOnTap: yieldOnTapFeatureOn } = useLibraryFeatures()\n\tuseWaitForGlobalClick(yieldOnTapFeatureOn)\n\n\tconst runUpdateIfVisible = useUpdateIfVisible(ref)\n\n\tconst internalState = useRef<InternalState>({\n\t\tisHovered: false,\n\t\tisHoveredHasUpdated: false,\n\t\tisPressed: false,\n\t\tisPressedHasUpdated: false,\n\t\tisError: false,\n\t\thasPressedVariants: true,\n\t\tbaseVariant: safeBaseVariant(variant, externalDefaultVariant, validBaseVariants),\n\t\tlastVariant: variant,\n\t\tgestureVariant: undefined,\n\t\tloadedBaseVariant: {},\n\n\t\t// When used in generated components, these are static values defined\n\t\t// outside of the component function that also need to not result in\n\t\t// memorized values being recalculated, so we dump them into the ref.\n\t\tdefaultVariant: externalDefaultVariant,\n\t\tenabledGestures: externalEnabledGestures,\n\t\tcycleOrder: externalCycleOrder,\n\t\ttransitions: externalTransitions,\n\t})\n\n\tconst resolveNextVariant = useCallback((targetBaseVariant: string | undefined): [string, string | undefined] => {\n\t\tconst { isHovered, isPressed, isError, enabledGestures, defaultVariant } = internalState.current\n\n\t\tconst nextBaseVariant = safeBaseVariant(targetBaseVariant, defaultVariant, validBaseVariants)\n\t\tconst gesture = getGesture(enabledGestures?.[nextBaseVariant], isHovered, isPressed, false, isError)\n\t\tconst nextGestureVariant = gesture ? createGestureVariant(nextBaseVariant, gesture) : undefined\n\n\t\treturn [nextBaseVariant, nextGestureVariant]\n\t}, [])\n\n\tconst updateIfNeeded = useCallback(\n\t\tasync (\n\t\t\tbaseVariant: string | undefined,\n\t\t\tgestureVariant: string | undefined,\n\t\t\tdefaultVariant: string,\n\t\t\tnextBaseVariant: string | undefined,\n\t\t\tcheckViewport = false,\n\t\t\tclearError = false,\n\t\t) => {\n\t\t\tconst [nextBase, nextGesture] = resolveNextVariant(nextBaseVariant)\n\n\t\t\t// Only force a render if the new active variants have changed\n\t\t\tif (nextBase === baseVariant && nextGesture === gestureVariant) return\n\n\t\t\tif (clearError) internalState.current.isError = false\n\t\t\tinternalState.current.baseVariant = nextBase || defaultVariant\n\t\t\tinternalState.current.gestureVariant = nextGesture\n\n\t\t\tconst yieldOnTap = yieldOnTapFeatureOn && internalState.current.isPressedHasUpdated\n\n\t\t\tif (yieldOnTap && globalWaitingForClickPromise) {\n\t\t\t\tperformance.mark(\"wait-for-tap-start\")\n\t\t\t\t// If `isPress` has updated and we've received a pointerup event, we know a click event is imminent.\n\t\t\t\t// To optimize INP, we do nothing until the click event - even a React transition would not suffice\n\t\t\t\t// as motion runs expensive synchronous stuff when we `forceUpdate`: https://framer-team.slack.com/archives/C08292HA17Z/p1745935667452839\n\t\t\t\tawait globalWaitingForClickPromise\n\t\t\t\tperformance.measure(\"wait-for-tap\", \"wait-for-tap-start\")\n\t\t\t}\n\n\t\t\tif (yieldOnTap) {\n\t\t\t\tperformance.mark(\"yield-on-tap-start\")\n\t\t\t\t// We still want to yield here to improve INP on any press interaction (pointerdown/pointerup/click)\n\t\t\t\t// user-blocking, because we want to potentially start the React transition asap\n\t\t\t\tawait yieldToMain({ priority: \"user-blocking\", continueAfter: \"paint\" })\n\t\t\t\tperformance.measure(\"yield-on-tap\", \"yield-on-tap-start\")\n\t\t\t}\n\n\t\t\tconst { isHovered, isPressed, isHoveredHasUpdated, isPressedHasUpdated } = internalState.current\n\n\t\t\t// If the component is hovered or pressed, we don't need to check for visibility\n\t\t\tif (isHovered || isHoveredHasUpdated || isPressed || isPressedHasUpdated) {\n\t\t\t\tstartTransition(forceUpdate)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If the tab/element isn't visible, we wait until it is visible again before doing the update.\n\t\t\t// We still accept calls to `updateIfNeeded` and we de-dupe the update calls in the hooks.\n\t\t\t// This ensures the last update wins, similar to how React's transitions work (transitions are batched by time, not by visibility).\n\t\t\t// Avoiding updates reduces CPU & GPU and prevents memory leaks due to queued\n\t\t\t// requestAnimationFrames (from motion effects) that don't run when the tab is in background.\n\t\t\trunUpdateIfVisible(() => startTransition(forceUpdate), checkViewport)\n\t\t},\n\t\t[resolveNextVariant, forceUpdate, runUpdateIfVisible, yieldOnTapFeatureOn],\n\t)\n\n\tconst setGestureState: VariantState[\"setGestureState\"] = useCallback(\n\t\t({ isHovered, isPressed, isError }) => {\n\t\t\tconst isPressedHasUpdated = isPressed !== internalState.current.isPressed\n\t\t\tconst isHoveredHasUpdated = isHovered !== internalState.current.isHovered\n\t\t\tif (isHovered !== undefined) internalState.current.isHovered = isHovered\n\t\t\tif (isPressed !== undefined) internalState.current.isPressed = isPressed\n\t\t\tif (isError !== undefined) internalState.current.isError = isError\n\n\t\t\tconst { baseVariant, gestureVariant, defaultVariant } = internalState.current\n\n\t\t\tinternalState.current.isPressedHasUpdated = isPressedHasUpdated\n\t\t\tinternalState.current.isHoveredHasUpdated = isHoveredHasUpdated\n\t\t\tvoid updateIfNeeded(baseVariant, gestureVariant, defaultVariant, baseVariant, false)\n\t\t},\n\t\t[updateIfNeeded],\n\t)\n\n\tconst setVariant: VariantState[\"setVariant\"] = useCallback(\n\t\t(proposedVariant?: typeof CycleVariantState | string, pauseOffscreen = false) => {\n\t\t\tconst { defaultVariant, cycleOrder, baseVariant, gestureVariant } = internalState.current\n\t\t\tconst nextBaseVariant =\n\t\t\t\tproposedVariant === CycleVariantState\n\t\t\t\t\t? nextVariant(cycleOrder || [], baseVariant || defaultVariant)\n\t\t\t\t\t: proposedVariant\n\n\t\t\tvoid updateIfNeeded(baseVariant, gestureVariant, defaultVariant, nextBaseVariant, pauseOffscreen, true)\n\t\t},\n\t\t[updateIfNeeded],\n\t)\n\n\tconst clearLoadingGesture: VariantState[\"clearLoadingGesture\"] = useCallback(() => {\n\t\tconst { baseVariant } = internalState.current\n\t\tinternalState.current.loadedBaseVariant[baseVariant] = true\n\n\t\t// Clearing the loading state is always a low priority update as there is no user interaction that can cause it.\n\t\trunUpdateIfVisible(() => startTransition(forceUpdate), true)\n\t}, [forceUpdate, runUpdateIfVisible])\n\n\tif (variant !== internalState.current.lastVariant) {\n\t\tconst [nextBase, nextGesture] = resolveNextVariant(variant)\n\t\tinternalState.current.lastVariant = nextBase\n\t\tif (nextBase !== internalState.current.baseVariant || nextGesture !== internalState.current.gestureVariant) {\n\t\t\tinternalState.current.baseVariant = nextBase\n\t\t\tinternalState.current.gestureVariant = nextGesture\n\t\t}\n\t}\n\n\tconst {\n\t\tbaseVariant,\n\t\tgestureVariant,\n\t\tdefaultVariant,\n\t\tenabledGestures,\n\t\tisHovered,\n\t\tisPressed,\n\t\tisError,\n\t\tloadedBaseVariant,\n\t} = internalState.current\n\n\t// Backwards compatibility for old components generated before\n\t// addVariantProps was extracted to it's own hook.\n\tconst addVariantProps: VariantState[\"addVariantProps\"] = useAddVariantProps(\n\t\tinternalState.current.baseVariant,\n\t\tinternalState.current.gestureVariant,\n\t\tvariantProps,\n\t)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: @TODO should `isError` be a dependency?\n\treturn useMemo<VariantState>(() => {\n\t\tconst variants: VariantNames = []\n\n\t\tif (baseVariant !== defaultVariant) variants.push(baseVariant)\n\n\t\tconst hasLoadingVariant = enabledGestures?.[baseVariant]?.loading\n\t\tconst isLoading = !isError && !isCanvas && !!hasLoadingVariant && !loadedBaseVariant[baseVariant]\n\t\tconst gesture = isLoading ? createGestureVariant(baseVariant, \"loading\") : gestureVariant\n\t\tif (gesture) variants.push(gesture)\n\n\t\tconst gestures = enabledGestures?.[baseVariant]\n\t\tconst gestureHandlers: GestureHandlers = {\n\t\t\tonMouseEnter: () => setGestureState({ isHovered: true }),\n\t\t\tonMouseLeave: () => setGestureState({ isHovered: false }),\n\t\t}\n\n\t\t// Only assign pressed gestures if the gesture is enabled for the\n\t\t// current base variant. This avoids motion automatically adding\n\t\t// tabIndex to the element.\n\t\tif (gestures?.pressed) {\n\t\t\tObject.assign(gestureHandlers, {\n\t\t\t\tonTapStart: () => setGestureState({ isPressed: true }),\n\t\t\t\tonTapCancel: () => setGestureState({ isPressed: false }),\n\t\t\t\tonTap: () => setGestureState({ isPressed: false }),\n\t\t\t})\n\t\t}\n\n\t\treturn {\n\t\t\tvariants,\n\t\t\tbaseVariant,\n\t\t\tgestureVariant: gesture,\n\t\t\tisLoading,\n\t\t\ttransition: activeTransition(internalState.current.transitions, baseVariant),\n\t\t\tsetVariant,\n\t\t\tsetGestureState,\n\t\t\tclearLoadingGesture,\n\t\t\taddVariantProps,\n\t\t\tgestureHandlers,\n\t\t\tclassNames: cx(\n\t\t\t\tcreateVariantClassName(baseVariant, variantClassNames),\n\t\t\t\tgetGesture(gestures, isHovered, isPressed, isLoading, isError),\n\t\t\t),\n\t\t}\n\t}, [\n\t\tbaseVariant,\n\t\tgestureVariant,\n\t\tisHovered,\n\t\tisPressed,\n\t\tloadedBaseVariant,\n\t\taddVariantProps,\n\t\tsetVariant,\n\t\tdefaultVariant,\n\t\tenabledGestures,\n\t\tsetGestureState,\n\t\tclearLoadingGesture,\n\t\tvariantClassNames,\n\t])\n}\n", "import { isString } from \"../utils/utils.ts\"\n\nconst reUnsafeCharacters = /[}{<>&;]/u\nexport function safeCSSValue(value: unknown): string | \"none\" {\n\t// Return \"none\" for invalid types\n\tif (!isString(value)) return \"none\"\n\n\t// Check for unsafe characters\n\tif (reUnsafeCharacters.test(value)) return \"none\"\n\n\t// Return only safe strings\n\treturn value\n}\n", "import type { ComponentType, ForwardedRef } from \"react\"\n// The React import is required by TypeScript: https://typescript.tv/errors/#ts2686\nimport React from \"react\"\nimport { useLibraryFeatures } from \"../LibraryFeaturesContext.ts\"\nimport { NodeIdContext } from \"../NodeIdContext.tsx\"\nimport { CodeComponentBoundary } from \"./CodeComponentBoundary.tsx\"\nimport { useNearestExternalComponent } from \"./ExternalComponentContext.tsx\"\nimport { collectErrorToAnalytics } from \"./collectErrorToAnalytics.tsx\"\nimport { getErrorMessageForOverride } from \"./errorMessages.ts\"\nimport { logError } from \"./logger.ts\"\nimport { shouldEnableCodeBoundaries } from \"./shouldEnableCodeBoundaries.ts\"\nimport { shouldWrapOverrideWithBoundary } from \"./shouldWrapWithBoundary.ts\"\n\ntype OverrideType<Props> = (Component: ComponentType<Props>) => ComponentType<Props>\n\nexport interface WithCodeBoundaryForOverridesParams<Props> {\n\toverride: OverrideType<Props>\n\t/** The ID of the scope (web page or smart component) where the override is applied. */\n\tscopeId: string\n\t/** The ID of the node that is wrapped with the override. */\n\tnodeId: string\n\t/** Whether the component is inside another component\u2019s slot. (Undefined if false.) */\n\tinComponentSlot?: true\n}\n\n/**\n * A code boundary for code overrides. Ensures any errors thrown by overrides\n * (either during SSR, or during client render) don\u2019t crash the whole page \u2013 and, instead,\n * just disable the override.\n *\n * Unlike code components (which might only throw during rendering), a code override might throw\n * in several situations:\n *\n * 1) in the override HOC:\n *\n *    ```tsx\n *    const withBlue = (Component) => {\n *      doSomething() // this throws\n *      return (props) => <Component {...props} color=\"blue\" />\n *    }\n *    ```\n *\n * 2) in the component created by the override:\n *\n *    ```tsx\n *    const withBlue = (Component) => {\n *      return (props) => {\n *        doSomething() // this throws\n *        return <Component {...props} color=\"blue\" />\n *      }\n *    }\n *    ```\n *\n * This means we have to try/catch both when applying the override, and when rendering the overridden component.\n */\nexport function withCodeBoundaryForOverrides<Props extends object>(\n\tComponent: ComponentType<Props>,\n\t{ scopeId, nodeId, override, inComponentSlot }: WithCodeBoundaryForOverridesParams<Props>,\n) {\n\tif (!shouldEnableCodeBoundaries()) {\n\t\treturn override(Component)\n\t}\n\n\t// If an override fails during the application time, we can\u2019t throw the error just yet.\n\t// That\u2019s because we don\u2019t know what exactly must be disabled in response to the error:\n\t// - only this override,\n\t// - or the whole external component that the override is inside of (https://www.notion.so/framer/Code-Boundaries-153adf6e8c96803dbd27ffe5cfd1e874?pvs=4#153adf6e8c96801d8a0ee6a7f7a3670f)\n\t//\n\t// Thus, we store the error and throw it only when the override is actually rendered.\n\tconst appliedOverride = tryToApplyOverride(Component, override)\n\n\tlet hasErrorBeenLogged = false\n\n\tfunction CodeBoundaryForOverrides(props: Props, ref: ForwardedRef<unknown>) {\n\t\tconst { disableCustomCode } = useLibraryFeatures()\n\t\tconst nearestExternalComponent = useNearestExternalComponent()\n\n\t\t// FIXME(upcoming debug mode): this will still execute some override code (in tryToApplyOverride) even if disableCustomCode is true\n\t\tif (disableCustomCode) {\n\t\t\treturn <Component {...props} ref={ref} />\n\t\t}\n\n\t\tconst shouldWrapWithBoundary = shouldWrapOverrideWithBoundary(\n\t\t\tscopeId,\n\t\t\tnearestExternalComponent?.scopeId,\n\t\t\tnearestExternalComponent?.level,\n\t\t\tinComponentSlot ?? false,\n\t\t)\n\n\t\t// If the override should be wrapped in a code boundary, do that:\n\t\t// - if it was applied successfully, return the overridden component wrapped in a code boundary\n\t\t// - if it failed, act as a code boundary and log the error\n\t\tif (shouldWrapWithBoundary) {\n\t\t\tif (appliedOverride.status === \"success\") {\n\t\t\t\t// \u201CShouldn\u2019t the fallback also be wrapped in the CodeComponentBoundary, in case it\u2019s a code component\n\t\t\t\t// that also throws?\u201D, you ask. \u201CNo,\u201D I answer, because if Component is a code component that might throw,\n\t\t\t\t// then this whole wrapper is already wrapped in a CodeComponentBoundary.\n\t\t\t\t//\n\t\t\t\t// That is, as of Nov 2024, codegen for code components that also have overrides looks like this:\n\t\t\t\t//\n\t\t\t\t//   import { CodeComponent } from \"../codeFile/CodeComponent.tsx\";\n\t\t\t\t//\n\t\t\t\t//   // Apply the override:\n\t\t\t\t//   const CodeComponentWithCodeBoundaryForOverridesAbc123 =\n\t\t\t\t//     withCodeBoundaryForOverrides(CodeComponent, ...);\n\t\t\t\t//\n\t\t\t\t//   ...\n\t\t\t\t//\n\t\t\t\t//   // Render the component:\n\t\t\t\t//   <Container> {/* \u2190 This wrapper part contains another code boundary */}\n\t\t\t\t//     <CodeComponentWithCodeBoundaryForOverridesAbc123 /> {/* \u2190 This is where the code boundary from withCodeBoundaryForOverrides lives */}\n\t\t\t\t//   </Container>\n\t\t\t\t//\n\t\t\t\t// which means the code boundary in Container will catch any errors thrown by the fallback Component.\n\t\t\t\treturn (\n\t\t\t\t\t<NodeIdContext.Provider value={nodeId}>\n\t\t\t\t\t\t<CodeComponentBoundary\n\t\t\t\t\t\t\tgetErrorMessage={getErrorMessageForOverride.bind(null, scopeId, nodeId)}\n\t\t\t\t\t\t\tfallback={<Component {...props} ref={ref} />}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<appliedOverride.Component {...props} ref={ref} />\n\t\t\t\t\t\t</CodeComponentBoundary>\n\t\t\t\t\t</NodeIdContext.Provider>\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tif (!hasErrorBeenLogged) {\n\t\t\t\t\tlogError(appliedOverride.error)\n\t\t\t\t\tlogError(getErrorMessageForOverride(scopeId, nodeId))\n\t\t\t\t\tcollectErrorToAnalytics(appliedOverride.error)\n\t\t\t\t\thasErrorBeenLogged = true\n\t\t\t\t}\n\n\t\t\t\treturn <Component {...props} ref={ref} />\n\t\t\t}\n\t\t}\n\n\t\t// If the override shouldn\u2019t be wrapped in a code boundary, then\n\t\t// - if it was applied successfully, return the overridden component without a code boundary\n\t\t// - if it failed, throw the error and let the parent (external smart component\u2019s) code boundary handle it\n\t\telse {\n\t\t\tif (appliedOverride.status === \"success\") {\n\t\t\t\treturn (\n\t\t\t\t\t<NodeIdContext.Provider value={nodeId}>\n\t\t\t\t\t\t<appliedOverride.Component {...props} ref={ref} />\n\t\t\t\t\t</NodeIdContext.Provider>\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tthrow appliedOverride.error\n\t\t\t}\n\t\t}\n\t}\n\n\treturn React.forwardRef(CodeBoundaryForOverrides)\n}\n\n/** Try to apply passed overrides, and return the error if that fails. */\nfunction tryToApplyOverride<Props>(\n\tComponent: ComponentType<Props>,\n\toverride: OverrideType<Props>,\n): { status: \"success\"; Component: ComponentType<Props> } | { status: \"error\"; error: unknown } {\n\ttry {\n\t\tconst ComponentWithOverrides = override(Component)\n\n\t\treturn { status: \"success\", Component: ComponentWithOverrides }\n\t} catch (error: unknown) {\n\t\treturn { status: \"error\", error }\n\t}\n}\n", "import type { MotionProps, Transition } from \"framer-motion\"\nimport { animate, frame, useMotionValue, useTransform, wrap } from \"framer-motion\"\nimport type React from \"react\"\nimport { forwardRef, useEffect } from \"react\"\nimport { useConstant } from \"../components/utils/useConstant.ts\"\nimport { isStaticRenderer } from \"./useIsStaticRenderer.ts\"\n\nexport interface Props {\n\tstrokeEffectLength: number\n\tstrokeEffectGap: number\n\tstrokeEffectOffset: number\n\tstrokeEffectTotalLength: number\n\tstrokeEffectLoop: boolean\n\tstrokeEffectLoopType: \"repeat\" | \"mirror\" | \"continuous\"\n\tpathLengthTransition: Omit<Transition, \"from\">\n}\n\nfunction valueWithMirroring(value: number, mirror: boolean) {\n\treturn mirror ? wrap(0, 2, value) : value\n}\n\nfunction singleFrame(): Promise<void> {\n\treturn new Promise(resolve => {\n\t\tframe.postRender(() => resolve())\n\t})\n}\n\nexport const withV1StrokeFX = <T extends MotionProps>(Component: React.ComponentType<T>) =>\n\tforwardRef((props: Props & T, forwardedRef: React.RefObject<SVGElement> | null) => {\n\t\tconst {\n\t\t\tstrokeEffectLength,\n\t\t\tstrokeEffectGap,\n\t\t\tstrokeEffectOffset,\n\t\t\tstrokeEffectLoop,\n\t\t\tstrokeEffectTotalLength,\n\t\t\tstrokeEffectLoopType,\n\t\t\tpathLengthTransition,\n\t\t\t...restProps\n\t\t} = props\n\n\t\tconst isCanvas = isStaticRenderer()\n\n\t\tconst offset = useMotionValue<number>(0)\n\t\tconst { length, gap } = useConstant(() => ({\n\t\t\tlength: strokeEffectTotalLength * strokeEffectLength,\n\t\t\tgap: strokeEffectTotalLength * strokeEffectGap,\n\t\t}))\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: Stroke Effects run on mount only.\n\t\tuseEffect(() => {\n\t\t\tif (isCanvas) return\n\n\t\t\tconst signal = new AbortController()\n\n\t\t\tasync function loop() {\n\t\t\t\tlet index = 0\n\t\t\t\twhile (true) {\n\t\t\t\t\tif (signal.signal.aborted) break\n\n\t\t\t\t\tconst mirror = strokeEffectLoop && strokeEffectLoopType === \"mirror\"\n\n\t\t\t\t\tconst from = valueWithMirroring(index, mirror)\n\t\t\t\t\tconst to = valueWithMirroring(index + 1, mirror)\n\n\t\t\t\t\t// Wait at least one frame to prevent infinite animations. When the browser\n\t\t\t\t\t// changes pages/breakpoints, Motion enters instant animation mode, which causes\n\t\t\t\t\t// all motion animations to resolve to their end state instantly.\n\t\t\t\t\tawait Promise.all([animate(offset, [from, to], pathLengthTransition), singleFrame()])\n\n\t\t\t\t\t// If we are not looping break after the animation runs.\n\t\t\t\t\tif (!strokeEffectLoop) break\n\n\t\t\t\t\t// If we are looping but not mirroring or continuously animating, continue the\n\t\t\t\t\t// loop, don't increment the index.\n\t\t\t\t\tif (strokeEffectLoop && strokeEffectLoopType === \"repeat\") continue\n\n\t\t\t\t\tindex++\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvoid loop()\n\n\t\t\treturn () => {\n\t\t\t\tsignal.abort()\n\t\t\t}\n\t\t}, [])\n\n\t\tconst value = useTransform(offset, v => {\n\t\t\treturn (\n\t\t\t\tstrokeEffectOffset * strokeEffectTotalLength +\n\t\t\t\t(strokeEffectTotalLength - Math.max(v, 0.001) * strokeEffectTotalLength)\n\t\t\t)\n\t\t})\n\n\t\tconst effect = !isCanvas\n\t\t\t? {\n\t\t\t\t\t// These are static values, but they are set via js so that they are ignored\n\t\t\t\t\t// unless in the preview/published site.\n\t\t\t\t\tstrokeDasharray: `${length} ${gap}`,\n\t\t\t\t\tstrokeDashoffset: value,\n\t\t\t\t}\n\t\t\t: undefined\n\n\t\treturn <Component {...(restProps as unknown as T)} {...effect} ref={forwardedRef} />\n\t})\n", "import type { HTMLMotionProps, MotionStyle } from \"framer-motion\"\nimport { type PropsWithChildren, forwardRef, useState } from \"react\"\nimport { useIsStaticRenderer } from \"../../modules/useIsStaticRenderer.ts\"\nimport { isString } from \"../../utils/utils.ts\"\nimport { isFiniteNumber } from \"../utils/isFiniteNumber.ts\"\nimport { flattenChildrenToTickerItems } from \"../utils/tickerUtils.ts\"\nimport { BasicTicker } from \"./BasicTicker.tsx\"\nimport { DraggableTicker } from \"./DraggableTicker.tsx\"\nimport { TickerContextProvider, type TickerPlayState } from \"./TickerContext.tsx\"\n\nexport interface TickerEffectProps {\n\ttickerEffectVelocity?: number\n\t/** 0-100 percentage modifier stored as integer */\n\ttickerEffectHoverModifier?: number\n\ttickerEffectDirectionModifier?: \"default\" | \"reverse\"\n\ttickerEffectDraggable?: boolean\n\ttickerEffectAlign?: \"start\" | \"center\" | \"end\"\n\ttickerEffectStackDirection?: \"column\" | \"row\" | \"column-reverse\" | \"row-reverse\"\n\ttickerEffectGap?: number | string\n\ttickerEffectXOverflow?: \"auto\" | \"visible\" | \"hidden\" | \"clip\"\n\ttickerEffectYOverflow?: \"auto\" | \"visible\" | \"hidden\" | \"clip\"\n\ttickerEffectOverflow?: \"auto\" | \"visible\" | \"hidden\" | \"clip\"\n\ttickerEffectPosition?: \"relative\" | \"absolute\" | \"sticky\" | \"fixed\"\n\ttickerEffectIsDataRepeater?: boolean\n}\n\nexport interface TickerProps extends HTMLMotionProps<\"div\">, TickerEffectProps {\n\tas?: React.ElementType<HTMLMotionProps<\"div\">>\n}\n\nexport interface TickerSubComponentProps extends Omit<\n\tTickerProps,\n\t| \"tickerEffectDraggable\"\n\t| \"tickerEffectStackDirection\"\n\t| \"tickerEffectXOverflow\"\n\t| \"tickerEffectYOverflow\"\n\t| \"tickerEffectOverflow\"\n\t| \"tickerEffectItemWidth\"\n\t| \"tickerEffectItemHeight\"\n\t| \"tickerEffectGap\"\n\t| \"tickerEffectDirectionModifier\"\n\t| \"tickerEffectHoverModifier\"\n> {\n\titems: React.ReactNode[]\n\taxis: \"x\" | \"y\"\n\tdirectionModifier: -1 | 1\n\thoverModifier: number\n\tgap?: number\n\toverflow?: boolean\n\tplayState: TickerPlayState\n}\n\ninterface MotionStyleWithDynamicTickerCustomProperties extends MotionStyle {\n\t\"--ticker-cms-total-children\": number | undefined\n}\n\nexport const Ticker = /* @__PURE__ */ forwardRef(function Ticker(\n\tprops: PropsWithChildren<TickerProps>,\n\tref: React.RefObject<HTMLDivElement>,\n) {\n\tconst {\n\t\tchildren,\n\t\ttickerEffectDraggable,\n\t\ttickerEffectStackDirection,\n\t\ttickerEffectXOverflow,\n\t\ttickerEffectYOverflow,\n\t\ttickerEffectOverflow,\n\t\ttickerEffectGap,\n\t\ttickerEffectDirectionModifier,\n\t\ttickerEffectHoverModifier,\n\t\ttickerEffectPosition,\n\t\ttickerEffectIsDataRepeater,\n\t\tstyle: styleProps,\n\t\t...rest\n\t} = props\n\tconst isStatic = useIsStaticRenderer()\n\tconst [playState, setPlayState] = useState<TickerPlayState>(\"running\")\n\n\tconst axis = tickerEffectStackDirection?.startsWith(\"column\") ? \"y\" : \"x\"\n\tconst directionModifier = tickerEffectDirectionModifier === \"reverse\" ? -1 : 1\n\tconst hoverModifier = isFiniteNumber(tickerEffectHoverModifier) ? tickerEffectHoverModifier / 100 : 1\n\tconst xOverflowWithFallback = tickerEffectXOverflow ?? tickerEffectOverflow ?? \"visible\"\n\tconst yOverflowWithFallback = tickerEffectYOverflow ?? tickerEffectOverflow ?? \"visible\"\n\tconst overflow = (axis === \"x\" ? xOverflowWithFallback : yOverflowWithFallback) === \"visible\"\n\tconst gap = getGap(tickerEffectGap, axis)\n\tconst items = flattenChildrenToTickerItems(children)\n\tconst tickerStyle: MotionStyleWithDynamicTickerCustomProperties = {\n\t\t...styleProps,\n\t\t// Enable fractional unit fallback for dynamic numbers of CMS items\n\t\t\"--ticker-cms-total-children\": tickerEffectIsDataRepeater ? items.length : undefined,\n\t\t// collected position is not present on canvas and would be overridden when codegenned into a class\n\t\t// so we have to add it here to avoid it being set to relative by the underlying ticker component\n\t\tposition: tickerEffectPosition,\n\t}\n\n\tif (isStatic || !tickerEffectDraggable) {\n\t\treturn (\n\t\t\t<TickerContextProvider onPlayStateChange={setPlayState}>\n\t\t\t\t<BasicTicker\n\t\t\t\t\t{...rest}\n\t\t\t\t\tstyle={tickerStyle}\n\t\t\t\t\tref={ref}\n\t\t\t\t\taxis={axis}\n\t\t\t\t\tgap={gap}\n\t\t\t\t\toverflow={overflow}\n\t\t\t\t\tdirectionModifier={directionModifier}\n\t\t\t\t\thoverModifier={hoverModifier}\n\t\t\t\t\titems={items}\n\t\t\t\t\tplayState={playState}\n\t\t\t\t/>\n\t\t\t</TickerContextProvider>\n\t\t)\n\t}\n\n\treturn (\n\t\t<TickerContextProvider onPlayStateChange={setPlayState}>\n\t\t\t<DraggableTicker\n\t\t\t\t{...rest}\n\t\t\t\tstyle={tickerStyle}\n\t\t\t\tref={ref}\n\t\t\t\taxis={axis}\n\t\t\t\tgap={gap}\n\t\t\t\toverflow={overflow}\n\t\t\t\tdirectionModifier={directionModifier}\n\t\t\t\thoverModifier={hoverModifier}\n\t\t\t\titems={items}\n\t\t\t\tplayState={playState}\n\t\t\t/>\n\t\t</TickerContextProvider>\n\t)\n})\n\nfunction getGap(gap: number | string | undefined, axis: \"x\" | \"y\") {\n\tif (isFiniteNumber(gap)) return gap\n\tif (!isString(gap)) return undefined\n\n\tconst gaps = gap.split(\" \")\n\tconst rowGap = gaps[0]\n\tconst columnGap = gaps[1] ?? gaps[0]\n\n\tif (axis === \"x\" && columnGap) return naNToUndefined(parseInt(columnGap))\n\tif (axis === \"y\" && rowGap) return naNToUndefined(parseInt(rowGap))\n\n\treturn undefined\n}\n\nfunction naNToUndefined(value: number) {\n\treturn Number.isNaN(value) ? undefined : value\n}\n", "import { Children, Fragment, isValidElement } from \"react\"\n\n/**\n * Turns the react children prop into an array of react nodes to be consumed by the Ticker.\n * We flatten children of fragments to ensure the ticker can wrap the individual children even if they\n * were supplied like <><Child1 /> <Child2 /></><Child3 /> (this happens for cms items in the canvas).\n */\nexport function flattenChildrenToTickerItems(children: React.ReactNode): React.ReactNode[] {\n\tconst result: React.ReactNode[] = []\n\n\tChildren.forEach(children, child => {\n\t\tif (isValidElement(child) && child.type === Fragment) {\n\t\t\tresult.push(...flattenChildrenToTickerItems(child.props.children))\n\t\t} else if (child) {\n\t\t\tresult.push(child)\n\t\t}\n\t})\n\n\treturn result\n}\n", "import { motion } from \"framer-motion\"\nimport { type PropsWithChildren, forwardRef } from \"react\"\nimport { useIsStaticRenderer } from \"../../modules/useIsStaticRenderer.ts\"\nimport type { TickerSubComponentProps } from \"./Ticker.tsx\"\nimport { Ticker as MotionPlusTicker } from \"./motionplus/Ticker.tsx\"\n\nexport const BasicTicker = /* @__PURE__ */ forwardRef(function BasicTicker(\n\tprops: PropsWithChildren<TickerSubComponentProps>,\n\tref: React.RefObject<HTMLDivElement>,\n) {\n\tconst {\n\t\tchildren,\n\t\tas: asProp,\n\t\ttickerEffectVelocity,\n\t\ttickerEffectAlign,\n\t\taxis,\n\t\tdirectionModifier,\n\t\thoverModifier,\n\t\tgap,\n\t\toverflow,\n\t\tplayState,\n\t\t...rest\n\t} = props\n\tconst Component = asProp ?? motion.div\n\n\tconst isStatic = useIsStaticRenderer()\n\n\tconst baseVelocity = playState === \"paused\" ? 0 : (tickerEffectVelocity ?? 100)\n\tconst velocity = baseVelocity * directionModifier\n\n\treturn (\n\t\t<MotionPlusTicker\n\t\t\tref={ref}\n\t\t\tas={Component}\n\t\t\t{...rest}\n\t\t\tgap={gap}\n\t\t\taxis={axis}\n\t\t\talign={tickerEffectAlign ?? \"center\"}\n\t\t\tisStatic={isStatic}\n\t\t\tvelocity={velocity}\n\t\t\thoverFactor={hoverModifier}\n\t\t\titemSize=\"manual\"\n\t\t\toverflow={overflow}\n\t\t/>\n\t)\n})\n", "// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\n// This file is generated from motion-plus/react without types so we disable typechecking\nimport {\n\tanimate,\n\tclamp,\n\tframe,\n\tHTMLMotionProps,\n\tHTMLElements,\n\tLayoutGroup,\n\tmotion,\n\tMotionStyle,\n\tMotionValue,\n\tnoop,\n\tPanInfo,\n\tresize,\n\tTransition,\n\tuseAnimationFrame,\n\tuseComposedRefs,\n\tuseInView,\n\tuseIsomorphicLayoutEffect,\n\tuseMotionValue,\n\tuseMotionValueEvent,\n\tusePageInView,\n\tuseReducedMotion,\n\tuseTransform,\n\twrap,\n} from \"framer-motion\"\nimport React, {\n\tcreateContext,\n\tforwardRef,\n\tPropsWithChildren,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from \"react\"\n\nexport type ItemSize = \"auto\" | \"fill\" | \"manual\"\n\ntype Axis = \"x\" | \"y\"\n\ntype Direction = \"ltr\" | \"rtl\"\n\ninterface ItemPosition {\n\tstart: number\n\tend: number\n}\n\ninterface LayoutStrategy {\n\tsign: 1 | -1\n\tdirection: \"left\" | \"top\" | \"right\" | \"bottom\"\n\tlengthProp: \"offsetWidth\" | \"offsetHeight\"\n\tviewportLengthProp: \"innerWidth\" | \"innerHeight\"\n\tpaddingStartProp: \"paddingLeft\" | \"paddingTop\" | \"paddingRight\"\n\tmeasureItem: (item: HTMLElement, container: HTMLElement) => ItemPosition\n\tgetCumulativeInset: (element: HTMLElement) => number\n}\n\ninterface TickerState {\n\tdirection: Direction\n\tvisibleLength: number\n\tinset: number\n\tcontainerLength: number\n\ttotalItemLength: number\n\titemPositions: ItemPosition[]\n\tisMeasured: boolean\n\tmaxInset: number | null\n}\n\ninterface TickerInfo extends TickerState {\n\tgap: number\n\tclampOffset: (offset: number) => number\n\toffset: MotionValue<number>\n\trenderedOffset: MotionValue<number>\n}\n\ninterface TickerItemContextType {\n\toffset: MotionValue<number>\n\tprojection: MotionValue<number>\n\tprops: {\n\t\tclassName: string\n\t\tstyle: MotionStyle\n\t\t\"aria-hidden\"?: boolean | undefined\n\t\t\"aria-posinset\"?: number | undefined\n\t\t\"aria-setsize\"?: number | undefined\n\t}\n\titemIndex: number\n\tcloneIndex: number | undefined\n\tstart: number\n\tend: number\n}\n\n/**\n * Props for the Ticker component.\n */\nexport interface TickerProps<TagName extends keyof HTMLElements = \"div\"> {\n\t/**\n\t * An array of React nodes to be rendered as ticker items.\n\t */\n\titems: React.ReactNode[]\n\n\t/**\n\t * The axis along which the ticker scrolls.\n\t *\n\t * @default \"x\"\n\t */\n\taxis?: \"x\" | \"y\"\n\n\t/**\n\t * The velocity of the ticker scroll in pixels per second. Defaults to 50.\n\t */\n\tvelocity?: number // pixels per second\n\n\t/**\n\t * Factor by which the velocity is multiplied when the ticker is hovered. Defaults to 1 (no change).\n\t */\n\thoverFactor?: number // 0-1\n\n\t/**\n\t * The gap between ticker items in pixels. Defaults to 10.\n\t */\n\tgap?: number // gap between items\n\n\t/**\n\t * Alignment of items within the ticker. Defaults to \"center\".\n\t */\n\talign?: \"start\" | \"center\" | \"end\" | \"stretch\"\n\n\t/**\n\t * An optional MotionValue to control the ticker's offset externally.\n\t */\n\toffset?: MotionValue<number>\n\n\t/**\n\t * Whether the ticker should be static. This is a display mode suitable for\n\t * design canvases that disables animations, measurements and viewport tracking.\n\t * Defaults to false. **Must** remain static for the duration of the component's lifecycle.\n\t */\n\tisStatic?: boolean\n\n\t/**\n\t * The size of the ticker items.\n\t *\n\t * @default \"auto\"\n\t */\n\titemSize?: ItemSize\n\n\t/**\n\t * Show items that overflow the container.\n\t *\n\t * @default false\n\t */\n\toverflow?: boolean\n\n\t/**\n\t * Allow the carousel to loop through its items.\n\t * If this is disabled, the carousel will not clone\n\t * any additional children.\n\t *\n\t * @default true\n\t */\n\tloop?: boolean\n\n\t/**\n\t * By default, ticker items that disappear off the start of the visible area\n\t * will be reprojected to the end of the ticker items to reduce or eliminate\n\t * cloned items.\n\t *\n\t * The calculation for this is based on an item's layout. If for some reason\n\t * the item is transformed back within the visible area, this reprojection\n\t * might be visible. By setting a safe margin, you can extend the effective\n\t * visible area.\n\t *\n\t * @default 0\n\t */\n\tsafeMargin?: number\n\n\t/**\n\t * The element type to render as the root container. Defaults to \"div\".\n\t */\n\tas?: TagName\n\n\t/**\n\t * The length of the fade at each end of the container.\n\t *\n\t * When looping is disabled, the fade will automatically animate\n\t * away when the content is scrolled to each end of the container.\n\t *\n\t * @default 0\n\t */\n\tfade?: number | `${number}%`\n\n\t/**\n\t * The transition to use when fading the edges of the container.\n\t */\n\tfadeTransition?: Transition\n\n\t/**\n\t * The transition to use when paginating the container.\n\t *\n\t * @default { type: \"spring\", stiffness: 400, damping: 40 }\n\t */\n\tpageTransition?: Transition\n}\n\nfunction findCurrentIndexFromInset(\n\tcurrentInset: number,\n\titemPositions: ItemPosition[],\n\twrapInset: number\n): number {\n\tconst iteration = Math.floor(currentInset / wrapInset)\n\tconst transform = iteration * wrapInset\n\n\tlet itemIndex = 0\n\tfor (let i = 0; i < itemPositions.length; i++) {\n\t\tconst { end } = itemPositions[i]\n\t\titemIndex = i\n\n\t\tif (end + transform > currentInset) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Return the iteration-adjusted index\n\treturn itemIndex + iteration * itemPositions.length\n}\n\nfunction findNextItemInset(\n\tcurrentInset: number,\n\titemPositions: ItemPosition[],\n\tgap: number,\n\ttargetInset?: number\n): number {\n\tif (itemPositions.length === 0) return 0\n\n\tconst totalItemLength = itemPositions[itemPositions.length - 1].end\n\tconst wrapInset = totalItemLength + gap\n\tconst idealInset =\n\t\ttargetInset ?? currentInset + (itemPositions[0]?.end ?? 0)\n\n\t/**\n\t * First, find the index of the item closest to the current\n\t * inset. We do this to ensure we paginate by at least one\n\t * item in the event that the items are larger than the\n\t * viewable container.\n\t */\n\tconst currentItemIndex = findCurrentIndexFromInset(\n\t\tcurrentInset,\n\t\titemPositions,\n\t\twrapInset\n\t)\n\n\tlet index = currentItemIndex + 1\n\tlet nextItemInset = 0\n\tlet hasFoundNextInset = false\n\twhile (!hasFoundNextInset) {\n\t\tconst { start, end } =\n\t\t\titemPositions[wrap(0, itemPositions.length, index)]\n\t\tconst iteration = Math.floor(index / itemPositions.length)\n\t\tconst transformInset = iteration * wrapInset\n\t\tconst transformedStart = start + transformInset\n\n\t\tnextItemInset = transformedStart\n\n\t\tif (end + transformInset > idealInset) {\n\t\t\thasFoundNextInset = true\n\t\t} else {\n\t\t\tindex++\n\t\t}\n\t}\n\n\treturn nextItemInset\n}\n\nfunction findPrevItemInset(\n\tcurrentInset: number,\n\titemPositions: ItemPosition[],\n\tgap: number,\n\ttargetInset?: number,\n\tcontainerLength?: number\n): number {\n\tif (itemPositions.length === 0) return 0\n\n\tconst totalItemLength = itemPositions[itemPositions.length - 1].end\n\tconst wrapInset = totalItemLength + gap\n\tconst idealInset = targetInset ?? currentInset - (containerLength ?? 0)\n\n\t/**\n\t * First, find the index of the item closest to the current\n\t * inset. We do this to ensure we paginate by at least one\n\t * item in the event that the items are larger than the\n\t * viewable container.\n\t */\n\tconst currentItemIndex = findCurrentIndexFromInset(\n\t\tcurrentInset,\n\t\titemPositions,\n\t\twrapInset\n\t)\n\n\tlet index = currentItemIndex\n\tlet prevItemInset = currentInset\n\tlet hasFoundPrevInset = false\n\twhile (!hasFoundPrevInset) {\n\t\tconst { start, end } =\n\t\t\titemPositions[wrap(0, itemPositions.length, index)]\n\t\tconst itemSize = end - start\n\t\tconst iteration = Math.floor(index / itemPositions.length)\n\t\tconst transformInset = iteration * wrapInset\n\t\tconst transformedStart = start + transformInset\n\n\t\tif (\n\t\t\tidealInset <= transformedStart + gap ||\n\t\t\ttransformedStart >= currentInset\n\t\t) {\n\t\t\tprevItemInset = transformedStart\n\t\t\tindex--\n\t\t} else if (idealInset <= transformedStart) {\n\t\t\tprevItemInset = transformedStart\n\t\t\thasFoundPrevInset = true\n\t\t} else {\n\t\t\tif (\n\t\t\t\t(containerLength && itemSize > containerLength) ||\n\t\t\t\t(prevItemInset === currentInset &&\n\t\t\t\t\tidealInset >= transformedStart)\n\t\t\t) {\n\t\t\t\tprevItemInset = transformedStart\n\t\t\t}\n\t\t\thasFoundPrevInset = true\n\t\t}\n\t}\n\n\treturn prevItemInset\n}\n\nconst TickerContext = /* @__PURE__ */ (() => {const Context = createContext(null)\n\tContext.displayName = \"TickerContext\";\n\treturn Context;\n})();\n\nfunction useTicker(): TickerInfo {\n\tconst context = useContext(TickerContext)\n\n\tinvariant(Boolean(context), \"useTicker must be used within a Ticker component\")\n\n\treturn context as TickerInfo\n}\n\nconst TickerItemContext = /* @__PURE__ */ (() => {const Context = createContext(undefined)\n\tContext.displayName = \"TickerItemContext\";\n\treturn Context;\n})();\n\nexport function useTickerItem(): TickerItemContextType {\n\tconst itemContext = useContext(TickerItemContext)\n\n\tinvariant(Boolean(itemContext), \"useTickerItem must be used within a TickerItem\")\n\n\treturn itemContext as TickerItemContextType\n}\n\nconst ltrStrategy = (\n\tinsetProp: \"offsetLeft\" | \"offsetTop\",\n\tlengthProp: \"offsetWidth\" | \"offsetHeight\",\n\tviewportLengthProp: \"innerWidth\" | \"innerHeight\",\n\tpaddingStartProp: \"paddingLeft\" | \"paddingTop\" | \"paddingRight\",\n\tdirection: \"left\" | \"top\" | \"right\" | \"bottom\"\n): LayoutStrategy => {\n\treturn {\n\t\tsign: 1,\n\t\tdirection,\n\t\tlengthProp,\n\t\tviewportLengthProp,\n\t\tpaddingStartProp,\n\t\tmeasureItem: (item: HTMLElement) => {\n\t\t\treturn {\n\t\t\t\tstart: item[insetProp],\n\t\t\t\tend: item[insetProp] + item[lengthProp],\n\t\t\t}\n\t\t},\n\t\tgetCumulativeInset: (element: HTMLElement) => {\n\t\t\tlet offset = 0\n\t\t\tlet el: HTMLElement | null = element\n\t\t\twhile (el) {\n\t\t\t\toffset += el[insetProp]\n\t\t\t\tel = el.offsetParent as HTMLElement\n\t\t\t}\n\t\t\treturn offset\n\t\t},\n\t}\n}\n\nconst xStrategy = /* @__PURE__ */(() => ltrStrategy(\n\t\"offsetLeft\",\n\t\"offsetWidth\",\n\t\"innerWidth\",\n\t\"paddingLeft\",\n\t\"right\"\n))()\n\nconst yStrategy = /* @__PURE__ */(() => ltrStrategy(\n\t\"offsetTop\",\n\t\"offsetHeight\",\n\t\"innerHeight\",\n\t\"paddingTop\",\n\t\"bottom\"\n))()\n\nfunction offsetRight(element: HTMLElement, container?: HTMLElement) {\n\tconst containerWidth = container?.offsetWidth ?? window.innerWidth\n\treturn containerWidth - (element.offsetLeft + element.offsetWidth)\n}\n\nconst xRtlStrategy: LayoutStrategy = /* @__PURE__ */(() => ({\n\t...xStrategy,\n\tsign: -1,\n\tdirection: \"left\",\n\tpaddingStartProp: \"paddingRight\",\n\tmeasureItem: (item: HTMLElement, container: HTMLElement) => {\n\t\tconst length = item.offsetWidth\n\t\tconst start = offsetRight(item, container)\n\t\treturn { start, end: start + length }\n\t},\n\tgetCumulativeInset: (element: HTMLElement) => {\n\t\tlet offset = 0\n\t\tlet el: HTMLElement | null = element\n\t\twhile (el) {\n\t\t\toffset += offsetRight(el, el.offsetParent as HTMLElement)\n\t\t\tel = el.offsetParent as HTMLElement\n\t\t}\n\t\treturn offset\n\t},\n}))()\n\nfunction getLayoutStrategy(axis: Axis, direction: Direction): LayoutStrategy {\n\treturn axis === \"y\" ? yStrategy : direction === \"ltr\" ? xStrategy : xRtlStrategy\n}\n\n/**\n * Represents an individual item within the Ticker.\n *\n * This component handles the logic for repositioning items to create the infinite scroll effect.\n *\n * @param offset - The current scroll offset of the ticker.\n * @param axis - The scroll axis (\"x\" or \"y\").\n * @param listSize - The total size of the list including all clones.\n * @param itemIndex - The original index of the item.\n * @param cloneIndex - The index of the clone, if this is a cloned item.\n * @param props - HTML attributes to pass to the list item li element.\n * @returns A ListItem React component.\n */\nfunction TickerItemWrapper({\n\tchildren,\n\toffset,\n\taxis,\n\tlistSize = 0,\n\tnumItems = 0,\n\titemIndex,\n\tcloneIndex,\n\tbounds,\n\talignItems,\n\treproject = true,\n\tsize = \"auto\",\n\tsafeMargin,\n}: HTMLMotionProps<\"li\"> & {\n\toffset: MotionValue<number>\n\taxis: \"x\" | \"y\"\n\tlistSize?: number\n\tbounds: { start: number; end: number }\n\tnumItems: number\n\titemIndex: number\n\tcloneIndex?: number\n\talignItems: \"flex-start\" | \"center\" | \"flex-end\" | \"stretch\"\n\tsize?: ItemSize\n\tsafeMargin: number\n\treproject?: boolean\n\tchildren: React.ReactNode\n}) {\n\tconst { start, end } = bounds\n\tconst { visibleLength, direction, inset } = useTicker()\n\tconst { sign } = getLayoutStrategy(axis, direction)\n\n\tconst projection = useTransform(() => {\n\t\tif (!reproject) return 0\n\n\t\tconst currentOffset = offset.get()\n\t\tif ((!start && !end) || !listSize) return 0\n\n\t\tif (currentOffset * sign + bounds.end <= -inset - safeMargin) {\n\t\t\treturn listSize * sign\n\t\t}\n\n\t\t/**\n\t\t * If we've defined a safeMargin, also project items backwards if they\n\t\t * fall outside the right boundary (+ margin). This fills-in the start area\n\t\t * without affecting the alignment of items.\n\t\t */\n\t\tif (safeMargin > 0) {\n\t\t\tconst rightBoundary = visibleLength - safeMargin - inset\n\t\t\tif (currentOffset * sign + bounds.start >= rightBoundary) {\n\t\t\t\treturn -listSize * sign\n\t\t\t}\n\t\t}\n\n\t\treturn 0\n\t})\n\n\tconst itemOffset = useTransform(() => {\n\t\tconst currentOffset = offset.get()\n\t\tconst currentTransform = projection.get()\n\t\tif ((!start && !end) || !listSize) return 0\n\n\t\treturn currentOffset * sign + start + currentTransform * sign\n\t})\n\n\tconst ariaProps =\n\t\tcloneIndex === undefined\n\t\t\t? {\n\t\t\t\t  [\"aria-hidden\"]: false,\n\t\t\t\t  [\"aria-posinset\"]: itemIndex + 1,\n\t\t\t\t  [\"aria-setsize\"]: numItems,\n\t\t\t  }\n\t\t\t: {\n\t\t\t\t  [\"aria-hidden\"]: true,\n\t\t\t  }\n\n\tconst isFill = size === \"fill\"\n\tconst offAxisSize = alignItems === \"stretch\" ? \"100%\" : \"fit-content\"\n\n\tconst props = {\n\t\tclassName: cloneIndex === undefined ? \"ticker-item\" : \"clone-item\",\n\t\tstyle: {\n\t\t\tflexGrow: 0,\n\t\t\tflexShrink: 0,\n\t\t\tposition: \"relative\",\n\t\t\tflexBasis: size === \"fill\" ? \"100%\" : undefined,\n\t\t\tdisplay: isFill ? \"grid\" : undefined,\n\t\t\tgridTemplateColumns: isFill ? \"1fr\" : undefined,\n\t\t\tgridTemplateRows: isFill ? \"1fr\" : undefined,\n\t\t\tminWidth: isFill ? 0 : undefined,\n\t\t\tminHeight: isFill ? 0 : undefined,\n\t\t\theight: axis === \"x\" ? offAxisSize : undefined,\n\t\t\twidth: axis === \"y\" ? offAxisSize : undefined,\n\t\t\tx: axis === \"x\" ? projection : 0,\n\t\t\ty: axis === \"y\" ? projection : 0,\n\t\t},\n\t\t...ariaProps,\n\t} as const\n\n\treturn (\n\t\t<TickerItemContext.Provider\n\t\t\tvalue={{\n\t\t\t\tstart,\n\t\t\t\tend,\n\t\t\t\toffset: itemOffset,\n\t\t\t\tprojection,\n\t\t\t\titemIndex,\n\t\t\t\tcloneIndex,\n\t\t\t\tprops,\n\t\t\t}}\n\t\t>\n\t\t\t{size === \"manual\" ? (\n\t\t\t\tchildren\n\t\t\t) : (\n\t\t\t\t<DefaultTickerItem>{children}</DefaultTickerItem>\n\t\t\t)}\n\t\t</TickerItemContext.Provider>\n\t)\n}\n\nfunction DefaultTickerItem({ children }: { children: React.ReactNode }) {\n\tconst { props } = useTickerItem()\n\n\treturn <motion.li {...props}>{children}</motion.li>\n}\n\nfunction useFocusNavigation(\n\tcontainerRef: React.RefObject<HTMLElement | null>,\n\taxis: \"x\" | \"y\",\n\tfocusOffset: MotionValue<number>,\n\toffset: MotionValue<number>,\n\tsetHasFocus: (hasFocus: boolean) => void\n) {\n\tconst isFocusTrapped = useRef(false)\n\n\tuseEffect(() => {\n\t\tconst container = containerRef.current\n\n\t\tif (!container) return\n\n\t\tlet detectionEnabled = false\n\n\t\tconst abortController = new AbortController()\n\t\tconst eventOptions: EventListenerOptions = {\n\t\t\tsignal: abortController.signal,\n\t\t} as any\n\t\tconst eventOptionsWithCapture = {\n\t\t\t...eventOptions,\n\t\t\tcapture: true,\n\t\t}\n\n\t\tconst scrollProp = axis === \"x\" ? \"scrollLeft\" : \"scrollTop\"\n\t\tconst offsetProp = axis === \"x\" ? \"offsetLeft\" : \"offsetTop\"\n\t\tconst leftKey = axis === \"x\" ? \"ArrowLeft\" : \"ArrowUp\"\n\t\tconst rightKey = axis === \"x\" ? \"ArrowRight\" : \"ArrowDown\"\n\n\t\tlet focusableElements: HTMLElement[] = []\n\t\tlet focusIndex = 0\n\n\t\tconst applyFocusOffset = () => {\n\t\t\tconst nextFocusableElement = focusableElements[focusIndex]\n\n\t\t\tif (!nextFocusableElement) return\n\n\t\t\tnextFocusableElement.focus({ preventScroll: true })\n\n\t\t\t// Move the ticker offset to the focused item\n\t\t\tfocusOffset.set(-nextFocusableElement[offsetProp])\n\n\t\t\t// Override the default browser scroll into view behaviour\n\t\t\tcontainer[scrollProp] = 0\n\t\t\tframe.render(() => {\n\t\t\t\tcontainer[scrollProp] = 0\n\t\t\t})\n\t\t}\n\n\t\tconst handleFocusNavigation = (event: KeyboardEvent) => {\n\t\t\tif (event.key === \"Tab\") {\n\t\t\t\tevent.preventDefault()\n\n\t\t\t\t// Focus the next selectable element in the DOM outside the container\n\t\t\t\tendFocusTrap()\n\n\t\t\t\t// Find the next focusable element after the container\n\t\t\t\tconst allFocusableElements = Array.from(\n\t\t\t\t\tdocument.querySelectorAll(\n\t\t\t\t\t\t'a, button, input, textarea, select, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]'\n\t\t\t\t\t)\n\t\t\t\t).filter(isHTMLElement)\n\n\t\t\t\t// Sort the focusable elements by their tabIndex\n\t\t\t\tallFocusableElements.sort(compareTabIndexes)\n\n\t\t\t\tconst lastFocusableElement =\n\t\t\t\t\tallFocusableElements[\n\t\t\t\t\t\tevent.shiftKey ? 0 : allFocusableElements.length - 1\n\t\t\t\t\t]\n\n\t\t\t\tconst initialIndex = event.shiftKey\n\t\t\t\t\t? allFocusableElements.length - 1\n\t\t\t\t\t: 0\n\n\t\t\t\t/**\n\t\t\t\t * If the last focusable element in the DOM is inside the container\n\t\t\t\t * then we want to set focus on the first DOM element\n\t\t\t\t */\n\t\t\t\tif (container.contains(lastFocusableElement)) {\n\t\t\t\t\tallFocusableElements[initialIndex].focus()\n\t\t\t\t\treturn\n\t\t\t\t} else {\n\t\t\t\t\tconst indexOfCurrentElement = allFocusableElements.indexOf(\n\t\t\t\t\t\tfocusableElements[focusIndex]\n\t\t\t\t\t)\n\n\t\t\t\t\tconst delta = event.shiftKey ? -1 : 1\n\n\t\t\t\t\tfor (\n\t\t\t\t\t\tlet i = indexOfCurrentElement;\n\t\t\t\t\t\ti < allFocusableElements.length && i >= 0;\n\t\t\t\t\t\ti += delta\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst element = allFocusableElements[i]\n\n\t\t\t\t\t\tif (!container.contains(element)) {\n\t\t\t\t\t\t\telement.focus()\n\t\t\t\t\t\t\treturn\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} else if (event.key === leftKey) {\n\t\t\t\tfocusIndex--\n\t\t\t} else if (event.key === rightKey) {\n\t\t\t\tfocusIndex++\n\t\t\t}\n\n\t\t\tfocusIndex = wrap(0, focusableElements.length, focusIndex)\n\n\t\t\tapplyFocusOffset()\n\t\t}\n\n\t\tconst startFocusTrap = () => {\n\t\t\tif (isFocusTrapped.current) return\n\n\t\t\t// Get all focusable elements within .ticker-item elements\n\t\t\tfocusableElements = Array.from(\n\t\t\t\tcontainer.querySelectorAll(\n\t\t\t\t\t'.ticker-item a, .ticker-item button, .ticker-item input, .ticker-item textarea, .ticker-item select, .ticker-item [tabindex]:not([tabindex=\"-1\"]), .ticker-item [contenteditable=\"true\"]'\n\t\t\t\t)\n\t\t\t).filter(isHTMLElement)\n\n\t\t\tfocusIndex = 0\n\n\t\t\tif (!focusableElements.length) return\n\n\t\t\tsetHasFocus(true)\n\n\t\t\tisFocusTrapped.current = true\n\n\t\t\tapplyFocusOffset()\n\n\t\t\twindow.addEventListener(\n\t\t\t\t\"focus\",\n\t\t\t\tdetectTrapEnd,\n\t\t\t\teventOptionsWithCapture\n\t\t\t)\n\t\t\twindow.addEventListener(\n\t\t\t\t\"blur\",\n\t\t\t\tdetectTrapEnd,\n\t\t\t\teventOptionsWithCapture\n\t\t\t)\n\t\t\tcontainer.addEventListener(\n\t\t\t\t\"keydown\",\n\t\t\t\thandleFocusNavigation,\n\t\t\t\teventOptions\n\t\t\t)\n\t\t}\n\n\t\tconst detectTrapEnd = (event: FocusEvent) => {\n\t\t\tif (\n\t\t\t\t!event.target ||\n\t\t\t\t!(event.target instanceof HTMLElement) ||\n\t\t\t\t!container.contains(event.target)\n\t\t\t) {\n\t\t\t\tendFocusTrap()\n\t\t\t}\n\t\t}\n\n\t\tconst endFocusTrap = () => {\n\t\t\tif (!isFocusTrapped.current) return\n\n\t\t\tisFocusTrapped.current = false\n\n\t\t\tsetHasFocus(false)\n\t\t\toffset.set(focusOffset.get())\n\n\t\t\twindow.removeEventListener(\"focus\", detectTrapEnd)\n\t\t\twindow.removeEventListener(\"blur\", detectTrapEnd)\n\t\t\tcontainer.removeEventListener(\"keydown\", handleFocusNavigation)\n\t\t}\n\n\t\tconst handleFocus = (event: FocusEvent) => {\n\t\t\tconst { target } = event\n\n\t\t\tif (!isHTMLElement(target)) return\n\n\t\t\tif (!isFocusTrapped.current) {\n\t\t\t\tstartFocusTrap()\n\t\t\t}\n\t\t}\n\n\t\tconst detectFocusTrapEnable = () => {\n\t\t\tif (detectionEnabled) return\n\n\t\t\tdetectionEnabled = true\n\n\t\t\tcontainer.addEventListener(\n\t\t\t\t\"focus\",\n\t\t\t\thandleFocus,\n\t\t\t\teventOptionsWithCapture\n\t\t\t)\n\t\t\twindow.addEventListener(\n\t\t\t\t\"pointermove\",\n\t\t\t\thandlePointerMove,\n\t\t\t\teventOptions\n\t\t\t)\n\t\t}\n\n\t\tconst handlePointerMove = () => {\n\t\t\tif (!detectionEnabled) return\n\n\t\t\tdetectionEnabled = false\n\t\t\tcontainer.removeEventListener(\"focus\", handleFocus, true)\n\t\t\twindow.removeEventListener(\n\t\t\t\t\"pointermove\",\n\t\t\t\thandlePointerMove,\n\t\t\t\teventOptions\n\t\t\t)\n\t\t}\n\n\t\tconst handleAriaHiddenClicks = (event: PointerEvent) => {\n\t\t\tconst target = event.target as HTMLElement\n\n\t\t\t// Check if target is a descendant of an element with aria-hidden=\"true\"\n\t\t\tconst ariaHiddenAncestor = target.closest('[aria-hidden=\"true\"]')\n\t\t\tif (ariaHiddenAncestor) {\n\t\t\t\tariaHiddenAncestor.removeAttribute(\"aria-hidden\")\n\t\t\t}\n\t\t}\n\n\t\tconst resetScroll = () => {\n\t\t\tcontainer.scrollLeft = 0\n\t\t\tcontainer.scrollTop = 0\n\t\t}\n\n\t\twindow.addEventListener(\"keydown\", detectFocusTrapEnable, eventOptions)\n\t\tcontainer.addEventListener(\n\t\t\t\"pointerdown\",\n\t\t\thandleAriaHiddenClicks,\n\t\t\teventOptions\n\t\t)\n\t\tcontainer.addEventListener(\"scroll\", resetScroll, eventOptions)\n\n\t\treturn () => {\n\t\t\tabortController.abort()\n\t\t\tendFocusTrap()\n\t\t}\n\t}, [])\n}\n\nfunction compareTabIndexes(a: HTMLElement, b: HTMLElement) {\n\t// Elements with tabIndex >= 1 come first, ordered by tabIndex value\n\tif (a.tabIndex >= 1 && b.tabIndex >= 1) {\n\t\treturn a.tabIndex - b.tabIndex\n\t}\n\n\t// Elements with tabIndex >= 1 come before tabIndex 0 or -1\n\tif (a.tabIndex >= 1 && b.tabIndex <= 0) {\n\t\treturn -1\n\t}\n\n\tif (b.tabIndex >= 1 && a.tabIndex <= 0) {\n\t\treturn 1\n\t}\n\n\t// Both have tabIndex 0 or -1, maintain document order (return 0)\n\t// tabIndex -1 elements are focusable programmatically but not via tab navigation\n\treturn 0\n}\n\nfunction isHTMLElement(element: unknown): element is HTMLElement {\n\treturn element instanceof HTMLElement\n}\n\nfunction calcItemLength(itemPosition: ItemPosition) {\n\treturn itemPosition.end - itemPosition.start\n}\n\nfunction calcTotalItemLength(itemPositions: ItemPosition[]) {\n\treturn itemPositions[itemPositions.length - 1].end - itemPositions[0].start\n}\n\nfunction calcNumClones(\n\tvisibleLength: number,\n\titemPositions: ItemPosition[],\n\tgap: number\n) {\n\tconst totalItemLength = calcTotalItemLength(itemPositions)\n\tconst maxItemLength = Math.max(...itemPositions.map(calcItemLength))\n\n\tlet count = 0\n\n\t/**\n\t * A length where the largest item is out of the visible area.\n\t */\n\tlet safeFillLength = 0\n\n\twhile (safeFillLength < visibleLength) {\n\t\tsafeFillLength = (totalItemLength + gap) * (count + 1) - maxItemLength\n\t\tcount++\n\t}\n\n\treturn Math.max(count - 1, 0)\n}\n\nconst alignAlias = {\n\tstart: \"flex-start\",\n\tend: \"flex-end\",\n} as const\n\n/**\n * A performant, accessible, and infinitely scrolling ticker component.\n */\nfunction TickerComponent<TagName extends keyof HTMLElements = \"div\">(\n\t{\n\t\titems,\n\t\tvelocity = 50,\n\t\thoverFactor = 1,\n\t\tgap = 10,\n\t\taxis = \"x\",\n\t\talign = \"center\",\n\t\toffset,\n\t\tisStatic = false,\n\t\titemSize = \"auto\",\n\t\toverflow = false,\n\t\tloop = true,\n\t\tchildren,\n\t\tas = \"div\",\n\t\tsnap,\n\t\tsafeMargin = 0,\n\t\tfade = 0,\n\t\tfadeTransition,\n\t\tpageTransition,\n\t\t...props\n\t}: TickerProps<TagName> & PropsWithChildren & Record<string, any>,\n\tref: React.Ref<HTMLElement>\n) {\n\tconst internalContainerRef = useRef<HTMLElement>(null)\n\tconst containerRef = useComposedRefs(ref, internalContainerRef)\n\tconst listRef = useRef<HTMLUListElement>(null)\n\tconst [state, setState] = useState<TickerState>({\n\t\tdirection: \"ltr\",\n\t\tvisibleLength: 0,\n\t\tinset: 0,\n\t\ttotalItemLength: 0,\n\t\tcontainerLength: 0,\n\t\titemPositions: [],\n\t\tisMeasured: false,\n\t\tmaxInset: null,\n\t})\n\n\tconst alignItems = alignAlias[align as keyof typeof alignAlias] || align\n\tconst { sign } = getLayoutStrategy(axis, state.direction)\n\n\tif (isStatic) {\n\t\tconst renderedOffset = useMotionValue(0)\n\t\treturn (\n\t\t\t<TickerContext.Provider\n\t\t\t\tvalue={{\n\t\t\t\t\t...state,\n\t\t\t\t\tgap,\n\t\t\t\t\tclampOffset: noop,\n\t\t\t\t\toffset: renderedOffset,\n\t\t\t\t\trenderedOffset,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<ListView<TagName>\n\t\t\t\t\tcontainerProps={props}\n\t\t\t\t\tcontainerRef={containerRef}\n\t\t\t\t\tchildren={children}\n\t\t\t\t\tgap={gap}\n\t\t\t\t\taxis={axis}\n\t\t\t\t\talignItems={alignItems}\n\t\t\t\t\toffset={renderedOffset}\n\t\t\t\t\trenderedOffset={renderedOffset}\n\t\t\t\t\titems={items}\n\t\t\t\t\titemSize={itemSize}\n\t\t\t\t\tstate={state}\n\t\t\t\t\toverflow={overflow}\n\t\t\t\t\tsafeMargin={safeMargin}\n\t\t\t\t\tisStatic\n\t\t\t\t\tas={as}\n\t\t\t\t\tfade={fade}\n\t\t\t\t\tsign={sign}\n\t\t\t\t/>\n\t\t\t</TickerContext.Provider>\n\t\t)\n\t}\n\n\tconst [hasFocus, setHasFocus] = useState(false)\n\n\tconst velocityFactor = useMotionValue(1)\n\tconst defaultOffset = useMotionValue(0)\n\toffset ??= defaultOffset\n\n\tconst wrappedOffset = useTransform(() => {\n\t\t// TODO: Move to strategy\n\t\tif (state.direction === \"rtl\" && axis === \"x\") {\n\t\t\treturn wrap(\n\t\t\t\tstate.totalItemLength + gap + state.inset,\n\t\t\t\tstate.inset,\n\t\t\t\toffset.get()\n\t\t\t)\n\t\t}\n\t\treturn wrap(\n\t\t\t-state.totalItemLength - gap - state.inset,\n\t\t\t-state.inset,\n\t\t\toffset.get()\n\t\t)\n\t})\n\tconst focusOffset = useMotionValue(0)\n\n\tconst renderedOffset = hasFocus\n\t\t? focusOffset\n\t\t: loop\n\t\t? wrappedOffset\n\t\t: offset\n\n\tconst isInViewport = useInView(internalContainerRef, { margin: \"100px\" })\n\tconst isPageInView = usePageInView()\n\tconst isInView = isInViewport && isPageInView\n\tconst isReducedMotion = useReducedMotion()\n\n\tconst updateMeasurements = () => {\n\t\tif (!internalContainerRef.current || !listRef.current) return\n\n\t\tconst direction = window.getComputedStyle(internalContainerRef.current)\n\t\t\t.direction as \"ltr\" | \"rtl\"\n\t\tconst {\n\t\t\tmeasureItem,\n\t\t\tlengthProp,\n\t\t\tviewportLengthProp,\n\t\t\tgetCumulativeInset,\n\t\t} = getLayoutStrategy(axis, direction)\n\n\t\tconst paddingStartProp = axis === \"x\" ? \"paddingLeft\" : \"paddingTop\"\n\t\tconst paddingEndProp = axis === \"x\" ? \"paddingRight\" : \"paddingBottom\"\n\n\t\tconst container = internalContainerRef.current\n\t\tconst list = listRef.current\n\t\tconst allItems = list.querySelectorAll(\".ticker-item\")\n\n\t\tif (!allItems.length) return\n\n\t\tlet hasItemSizeChanged = false\n\t\tconst itemPositions: ItemPosition[] = []\n\n\t\tfor (let i = 0; i < allItems.length; i++) {\n\t\t\tconst size = measureItem(allItems[i] as HTMLElement, container)\n\t\t\titemPositions.push(size)\n\n\t\t\tconst prevSize = state.itemPositions[i]\n\t\t\tif (\n\t\t\t\t!prevSize ||\n\t\t\t\tsize.start !== prevSize.start ||\n\t\t\t\tsize.end !== prevSize.end\n\t\t\t) {\n\t\t\t\thasItemSizeChanged = true\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Cap to viewport size to prevent infinite or wasteful cloning in the event that the\n\t\t * container width is reactive to the number of children rendered within it.\n\t\t */\n\t\tconst containerLength = Math.min(\n\t\t\tcontainer[lengthProp],\n\t\t\twindow[viewportLengthProp]\n\t\t)\n\n\t\tlet visibleLength = overflow\n\t\t\t? window[viewportLengthProp]\n\t\t\t: containerLength\n\n\t\tif (safeMargin > 0) {\n\t\t\tvisibleLength += safeMargin * 2\n\t\t}\n\n\t\tconst totalItemLength = calcTotalItemLength(itemPositions)\n\n\t\tconst computedContainerStyle = window.getComputedStyle(container)\n\t\tconst containerPaddingStart = parseInt(\n\t\t\tcomputedContainerStyle[paddingStartProp] ?? 0\n\t\t)\n\t\tconst containerPaddingEnd = parseInt(\n\t\t\tcomputedContainerStyle[paddingEndProp] ?? 0\n\t\t)\n\n\t\tconst inset = overflow\n\t\t\t? getCumulativeInset(allItems[0] as HTMLElement)\n\t\t\t: containerPaddingStart\n\n\t\tconst maxInset =\n\t\t\tloop === false\n\t\t\t\t? Math.max(\n\t\t\t\t\t  0,\n\t\t\t\t\t  totalItemLength -\n\t\t\t\t\t\t  containerLength +\n\t\t\t\t\t\t  containerPaddingStart +\n\t\t\t\t\t\t  containerPaddingEnd\n\t\t\t\t  )\n\t\t\t\t: null\n\n\t\tif (\n\t\t\tvisibleLength !== state.visibleLength ||\n\t\t\ttotalItemLength !== state.totalItemLength ||\n\t\t\tinset !== state.inset ||\n\t\t\tstate.itemPositions.length !== itemPositions.length ||\n\t\t\thasItemSizeChanged\n\t\t) {\n\t\t\tsetState({\n\t\t\t\tdirection,\n\t\t\t\tvisibleLength,\n\t\t\t\titemPositions,\n\t\t\t\ttotalItemLength,\n\t\t\t\tinset,\n\t\t\t\tcontainerLength,\n\t\t\t\tmaxInset,\n\t\t\t\tisMeasured: true,\n\t\t\t})\n\t\t}\n\t}\n\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (!isInView || !internalContainerRef.current) return\n\t\tupdateMeasurements()\n\n\t\tconst trackViewport = overflow ? resize(updateMeasurements) : undefined\n\n\t\tconst trackContainer = resize(\n\t\t\tinternalContainerRef.current,\n\t\t\tupdateMeasurements\n\t\t)\n\n\t\treturn () => {\n\t\t\ttrackViewport?.()\n\t\t\ttrackContainer()\n\t\t}\n\t}, [items, isInView, overflow])\n\n\tconst isMeasured = state.totalItemLength > 0\n\n\tuseAnimationFrame(\n\t\tisMeasured && isInView && offset === defaultOffset && !isReducedMotion\n\t\t\t? (_time: number, delta: number) => {\n\t\t\t\t  const frameOffset =\n\t\t\t\t\t  (delta / 1000) * (velocity * sign * velocityFactor.get())\n\t\t\t\t  offset.set(offset.get() - frameOffset)\n\t\t\t  }\n\t\t\t: noop\n\t)\n\n\tconst cloneCount = useMemo(() => {\n\t\tif (!isMeasured || !state.visibleLength) return 0\n\n\t\treturn calcNumClones(state.visibleLength, state.itemPositions, gap)\n\t}, [isMeasured, state])\n\n\tconst totalListSize =\n\t\tstate.totalItemLength === 0\n\t\t\t? 0\n\t\t\t: (state.totalItemLength + gap) * (cloneCount + 1)\n\n\tconst clonedItemGroups: React.ReactNode[] = []\n\n\tif (loop) {\n\t\tfor (let i = 0; i < cloneCount; i++) {\n\t\t\tconst clonedItems: React.ReactNode[] = []\n\t\t\titems.forEach((item: React.ReactNode, itemIndex: number) => {\n\t\t\t\tconst originalBounds = state.itemPositions[itemIndex]\n\t\t\t\tconst cloneOffset = (state.totalItemLength + gap) * (i + 1)\n\t\t\t\tconst cloneBounds = originalBounds\n\t\t\t\t\t? {\n\t\t\t\t\t\t  start: originalBounds.start + cloneOffset,\n\t\t\t\t\t\t  end: originalBounds.end + cloneOffset,\n\t\t\t\t\t  }\n\t\t\t\t\t: defaultBounds\n\n\t\t\t\tclonedItems.push(\n\t\t\t\t\t<TickerItemWrapper\n\t\t\t\t\t\tkey={`clone-${i}-${itemIndex}`}\n\t\t\t\t\t\toffset={renderedOffset}\n\t\t\t\t\t\taxis={axis}\n\t\t\t\t\t\tlistSize={totalListSize}\n\t\t\t\t\t\titemIndex={itemIndex}\n\t\t\t\t\t\tcloneIndex={itemIndex}\n\t\t\t\t\t\tbounds={cloneBounds}\n\t\t\t\t\t\talignItems={alignItems}\n\t\t\t\t\t\tsize={itemSize}\n\t\t\t\t\t\tsafeMargin={safeMargin}\n\t\t\t\t\t\tnumItems={items.length}\n\t\t\t\t\t>\n\t\t\t\t\t\t{item}\n\t\t\t\t\t</TickerItemWrapper>\n\t\t\t\t)\n\t\t\t})\n\n\t\t\tconst id = `ticker-group-${i}`\n\t\t\tclonedItemGroups.push(\n\t\t\t\t<LayoutGroup key={id} id={id}>\n\t\t\t\t\t{clonedItems}\n\t\t\t\t</LayoutGroup>\n\t\t\t)\n\t\t}\n\t}\n\n\tuseFocusNavigation(\n\t\tinternalContainerRef,\n\t\taxis,\n\t\tfocusOffset,\n\t\toffset,\n\t\tsetHasFocus\n\t)\n\n\tconst clampOffset = useCallback(\n\t\t(offset: number) => {\n\t\t\treturn state.maxInset !== null\n\t\t\t\t? clamp(-state.maxInset, 0, offset)\n\t\t\t\t: offset\n\t\t},\n\t\t[state.maxInset]\n\t)\n\n\treturn (\n\t\t<TickerContext.Provider\n\t\t\tvalue={{ ...state, gap, clampOffset, offset, renderedOffset }}\n\t\t>\n\t\t\t<ListView<TagName>\n\t\t\t\tcontainerProps={props}\n\t\t\t\tchildren={children}\n\t\t\t\tcontainerRef={containerRef}\n\t\t\t\tlistRef={listRef}\n\t\t\t\tgap={gap}\n\t\t\t\taxis={axis}\n\t\t\t\talignItems={alignItems}\n\t\t\t\tisMeasured={isMeasured}\n\t\t\t\tisInView={isInView}\n\t\t\t\toffset={offset}\n\t\t\t\trenderedOffset={renderedOffset}\n\t\t\t\titems={items}\n\t\t\t\titemSize={itemSize}\n\t\t\t\tclonedItems={clonedItemGroups}\n\t\t\t\tclampOffset={clampOffset}\n\t\t\t\tsnap={snap}\n\t\t\t\tsafeMargin={safeMargin}\n\t\t\t\tonPointerEnter={() => {\n\t\t\t\t\tanimate(velocityFactor, hoverFactor)\n\t\t\t\t}}\n\t\t\t\tonPointerLeave={() => {\n\t\t\t\t\tanimate(velocityFactor, 1)\n\t\t\t\t}}\n\t\t\t\ttotalListSize={totalListSize}\n\t\t\t\tstate={state}\n\t\t\t\toverflow={overflow}\n\t\t\t\tloop={loop}\n\t\t\t\tas={as}\n\t\t\t\tfade={fade}\n\t\t\t\tsign={sign}\n\t\t\t\tfadeTransition={fadeTransition}\n\t\t\t\tpageTransition={pageTransition}\n\t\t\t/>\n\t\t</TickerContext.Provider>\n\t)\n}\n\nexport const Ticker = /** @__PURE__ */ forwardRef(TickerComponent)\n\nfunction ListView<TagName extends keyof HTMLElements>({\n\tchildren,\n\tcontainerProps,\n\tcontainerRef,\n\tlistRef,\n\tgap,\n\taxis,\n\talignItems,\n\tisMeasured,\n\tisInView,\n\tisStatic,\n\titems,\n\toffset,\n\tclonedItems,\n\tclampOffset,\n\trenderedOffset,\n\tonPointerEnter,\n\tonPointerLeave,\n\ttotalListSize,\n\titemSize,\n\toverflow,\n\tstate,\n\tsafeMargin,\n\tsnap,\n\tloop,\n\tas,\n\tfade,\n\tsign,\n\tfadeTransition = defaultFadeTransition,\n\tpageTransition,\n}: {\n\tchildren?: React.ReactNode\n\tcontainerProps: any\n\tcontainerRef: React.RefCallback<HTMLElement>\n\tlistRef?: React.RefObject<HTMLUListElement | null>\n\tgap: number\n\taxis: \"x\" | \"y\"\n\talignItems: \"flex-start\" | \"center\" | \"flex-end\" | \"stretch\"\n\toffset: MotionValue<number>\n\trenderedOffset: MotionValue<number>\n\tisMeasured?: boolean\n\tisInView?: boolean\n\tisStatic?: boolean\n\tonPointerEnter?: () => void\n\tonPointerLeave?: () => void\n\titems: React.ReactNode[]\n\tclonedItems?: React.ReactNode[]\n\tclampOffset?: (offset: number) => number\n\ttotalListSize?: number\n\titemSize: ItemSize\n\toverflow: boolean\n\tstate: TickerState\n\tsnap?: \"page\" | \"loose\" | false\n\tloop?: boolean\n\tsafeMargin: number\n\tas: TagName\n\tfade: number | `${number}%`\n\tsign: 1 | -1\n\tfadeTransition?: Transition\n\tpageTransition?: Transition\n}) {\n\tconst MotionComponent = useMemo(() => motion.create(as), [as]) as any\n\n\t/**\n\t * Derive drag constraints based on measurements.\n\t */\n\tlet dragConstraints: Record<string, number> = {}\n\tconst { maxInset } = state\n\tif (maxInset !== null) {\n\t\tif (axis === \"x\") {\n\t\t\tdragConstraints =\n\t\t\t\tsign > 0\n\t\t\t\t\t? { left: maxInset * -1, right: 0 }\n\t\t\t\t\t: { right: maxInset, left: 0 }\n\t\t} else {\n\t\t\tdragConstraints = { top: maxInset * -1, bottom: 0 }\n\t\t}\n\t}\n\n\tlet {\n\t\tdrag,\n\t\t_dragX,\n\t\t_dragY,\n\t\tdragMomentum = false,\n\t\tonDragEnd,\n\t\tonPointerDown,\n\t\t...remainingProps\n\t} = containerProps\n\tconst dragMotionValue = axis === \"x\" ? _dragX : _dragY\n\n\tconst dragMomentumAnimation = useRef<ReturnType<typeof animate> | null>(\n\t\tnull\n\t)\n\n\t/**\n\t * TODO: This should probably be accomplished with dragMotionValue.jump()\n\t * in the onPointerDown handler but investigate why this isn't working.\n\t */\n\tconst stopDragMomentumAnimation = () => {\n\t\tif (!dragMomentumAnimation.current) return\n\t\tdragMomentumAnimation.current.stop()\n\t\tdragMomentumAnimation.current = null\n\t}\n\n\tif (!onDragEnd && drag && dragMotionValue) {\n\t\tonPointerDown = () => {\n\t\t\tdragMotionValue.jump(offset.get())\n\t\t\tstopDragMomentumAnimation()\n\t\t}\n\n\t\tonDragEnd = (_e: PointerEvent, { velocity }: PanInfo) => {\n\t\t\tconst current = offset.get()\n\t\t\tstopDragMomentumAnimation()\n\n\t\t\tframe.postRender(() => {\n\t\t\t\tlet target = current + velocity[axis] * (snap ? 0.3 : 0.8)\n\n\t\t\t\tif (snap) {\n\t\t\t\t\tif (velocity[axis] < 0) {\n\t\t\t\t\t\ttarget = -findNextItemInset(\n\t\t\t\t\t\t\t-current,\n\t\t\t\t\t\t\tstate.itemPositions,\n\t\t\t\t\t\t\tgap,\n\t\t\t\t\t\t\t-target\n\t\t\t\t\t\t)\n\t\t\t\t\t} else if (velocity[axis] > 0) {\n\t\t\t\t\t\ttarget = -findPrevItemInset(\n\t\t\t\t\t\t\t-current,\n\t\t\t\t\t\t\tstate.itemPositions,\n\t\t\t\t\t\t\tgap,\n\t\t\t\t\t\t\t-target,\n\t\t\t\t\t\t\tstate.containerLength\n\t\t\t\t\t\t)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst closestNext = -findNextItemInset(\n\t\t\t\t\t\t\t-current,\n\t\t\t\t\t\t\tstate.itemPositions,\n\t\t\t\t\t\t\tgap,\n\t\t\t\t\t\t\t-current\n\t\t\t\t\t\t)\n\t\t\t\t\t\tconst closestPrev = -findPrevItemInset(\n\t\t\t\t\t\t\t-current,\n\t\t\t\t\t\t\tstate.itemPositions,\n\t\t\t\t\t\t\tgap,\n\t\t\t\t\t\t\t-current,\n\t\t\t\t\t\t\tstate.containerLength\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\ttarget =\n\t\t\t\t\t\t\tMath.abs(current - closestNext) <\n\t\t\t\t\t\t\tMath.abs(current - closestPrev)\n\t\t\t\t\t\t\t\t? closestNext\n\t\t\t\t\t\t\t\t: closestPrev\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst constraints = loop\n\t\t\t\t\t? {}\n\t\t\t\t\t: sign > 0\n\t\t\t\t\t? {\n\t\t\t\t\t\t  max: 0,\n\t\t\t\t\t\t  min: dragConstraints[axis === \"x\" ? \"left\" : \"top\"],\n\t\t\t\t\t  }\n\t\t\t\t\t: {\n\t\t\t\t\t\t  min: 0,\n\t\t\t\t\t\t  max: dragConstraints.right,\n\t\t\t\t\t  }\n\n\t\t\t\tdragMomentumAnimation.current = animate(\n\t\t\t\t\tdragMotionValue,\n\t\t\t\t\tclampOffset!(target * sign) * sign,\n\t\t\t\t\tsnap\n\t\t\t\t\t\t? pageTransition\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t  type: \"inertia\",\n\t\t\t\t\t\t\t  velocity: velocity[axis],\n\t\t\t\t\t\t\t  modifyTarget: () => target,\n\t\t\t\t\t\t\t  bounceDamping: 40,\n\t\t\t\t\t\t\t  bounceStiffness: 400,\n\t\t\t\t\t\t\t  ...constraints,\n\t\t\t\t\t\t  }\n\t\t\t\t)\n\t\t\t})\n\t\t}\n\t}\n\n\t/**\n\t * Create mask image to fade edges out\n\t */\n\tconst fadeStartOpacity = useMotionValue(loop ? 0 : 1)\n\tconst fadeEndOpacity = useMotionValue(0)\n\tconst strategy = getLayoutStrategy(axis, state.direction)\n\tconst unit = typeof fade === \"number\" ? \"px\" : \"\"\n\tconst maskImage = useTransform(() => {\n\t\treturn `linear-gradient(to ${\n\t\t\tstrategy.direction\n\t\t}, rgba(0,0,0,${fadeStartOpacity.get()}) 0px, black ${fade}${unit}, black calc(100% - ${fade}${unit}), rgba(0,0,0,${fadeEndOpacity.get()}) 100%)`\n\t})\n\tconst fadeStyles = fade ? { maskImage, WebkitMaskImage: maskImage } : {}\n\tconst isAtLimits = useRef({ start: true, end: false })\n\tuseMotionValueEvent(renderedOffset, \"change\", (value: number) => {\n\t\tif (maxInset === null) return\n\t\tconst maxOffset = maxInset * -1\n\t\tvalue *= sign\n\n\t\t// Start edge\n\t\tif (value < 0) {\n\t\t\t// If it's currently at the limits, and moves, fade mask out\n\t\t\tif (isAtLimits.current.start) {\n\t\t\t\tanimate(fadeStartOpacity, 0, fadeTransition)\n\t\t\t\tisAtLimits.current.start = false\n\t\t\t}\n\t\t} else {\n\t\t\tif (!isAtLimits.current.start) {\n\t\t\t\tanimate(fadeStartOpacity, 1, fadeTransition)\n\t\t\t\tisAtLimits.current.start = true\n\t\t\t}\n\t\t}\n\n\t\t// End edge\n\t\tif (value > maxOffset) {\n\t\t\t// If it's currently at the limits, and moves, fade mask out\n\t\t\tif (isAtLimits.current.end) {\n\t\t\t\tanimate(fadeEndOpacity, 0, fadeTransition)\n\t\t\t\tisAtLimits.current.end = false\n\t\t\t}\n\t\t} else {\n\t\t\tif (!isAtLimits.current.end) {\n\t\t\t\tanimate(fadeEndOpacity, 1, fadeTransition)\n\t\t\t\tisAtLimits.current.end = true\n\t\t\t}\n\t\t}\n\t})\n\n\treturn (\n\t\t<>\n\t\t\t<MotionComponent\n\t\t\t\t{...remainingProps}\n\t\t\t\tref={containerRef}\n\t\t\t\tstyle={{\n\t\t\t\t\toverflowX: !overflow && axis === \"x\" ? \"clip\" : undefined,\n\t\t\t\t\toverflowY: !overflow && axis === \"y\" ? \"clip\" : undefined,\n\t\t\t\t\t...containerStyle,\n\t\t\t\t\t...containerProps.style,\n\t\t\t\t\t...fadeStyles,\n\t\t\t\t}}\n\t\t\t\tonPointerEnter={onPointerEnter}\n\t\t\t\tonPointerLeave={onPointerLeave}\n\t\t\t\tdrag={drag}\n\t\t\t\t_dragX={_dragX}\n\t\t\t\t_dragY={_dragY}\n\t\t\t\tdragConstraints={dragConstraints}\n\t\t\t\tdragMomentum={dragMomentum}\n\t\t\t\tonPointerDown={onPointerDown}\n\t\t\t\tonDragEnd={onDragEnd}\n\t\t\t>\n\t\t\t\t<motion.ul\n\t\t\t\t\tref={listRef}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\t...listStyle,\n\t\t\t\t\t\tflexDirection: axis === \"x\" ? \"row\" : \"column\",\n\t\t\t\t\t\tgap: `${gap}px`,\n\t\t\t\t\t\tx: axis === \"x\" ? renderedOffset : 0,\n\t\t\t\t\t\ty: axis === \"y\" ? renderedOffset : 0,\n\t\t\t\t\t\topacity: isMeasured || isStatic ? 1 : 0,\n\t\t\t\t\t\talignItems,\n\t\t\t\t\t\twillChange:\n\t\t\t\t\t\t\tisMeasured && isInView ? \"transform\" : undefined,\n\t\t\t\t\t\twidth: \"100%\",\n\t\t\t\t\t\theight: \"100%\",\n\t\t\t\t\t\tmaxHeight: \"100%\",\n\t\t\t\t\t\tmaxWidth: \"100%\",\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{items.map((item, index) => (\n\t\t\t\t\t\t<TickerItemWrapper\n\t\t\t\t\t\t\tkey={\"original-\" + index}\n\t\t\t\t\t\t\taxis={axis}\n\t\t\t\t\t\t\toffset={renderedOffset}\n\t\t\t\t\t\t\tlistSize={totalListSize}\n\t\t\t\t\t\t\titemIndex={index}\n\t\t\t\t\t\t\tbounds={state.itemPositions[index] ?? defaultBounds}\n\t\t\t\t\t\t\talignItems={alignItems}\n\t\t\t\t\t\t\tsize={itemSize}\n\t\t\t\t\t\t\treproject={loop}\n\t\t\t\t\t\t\tsafeMargin={safeMargin}\n\t\t\t\t\t\t\tnumItems={items.length}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{item}\n\t\t\t\t\t\t</TickerItemWrapper>\n\t\t\t\t\t))}\n\t\t\t\t\t{clonedItems || null}\n\t\t\t\t</motion.ul>\n\t\t\t</MotionComponent>{\" \"}\n\t\t\t{children}\n\t\t</>\n\t)\n}\n\nfunction invariant(condition: boolean, message: string) {\n\tif (!condition) {\n\t\tthrow new Error(message)\n\t}\n}\n\nconst defaultBounds = { start: 0, end: 0 }\n\nconst containerStyle: React.CSSProperties = {\n\tdisplay: \"flex\",\n\tposition: \"relative\",\n}\n\nconst listStyle: React.CSSProperties = {\n\tdisplay: \"flex\",\n\tposition: \"relative\",\n\twillChange: \"transform\",\n\tlistStyleType: \"none\",\n\tpadding: 0,\n\tmargin: 0,\n\tjustifyContent: \"flex-start\",\n}\n\nconst defaultFadeTransition: Transition = {\n\tduration: 0.2,\n\tease: \"linear\",\n}\n", "import { motion, useAnimationFrame, useMotionValue } from \"framer-motion\"\nimport { type PropsWithChildren, forwardRef, useEffect, useRef } from \"react\"\nimport { useLayoutDirection } from \"../../router/useLocale.ts\"\nimport type { TickerSubComponentProps } from \"./Ticker.tsx\"\nimport { Ticker as MotionPlusTicker } from \"./motionplus/Ticker.tsx\"\n\nexport const DraggableTicker = /* @__PURE__ */ forwardRef(function DraggableTicker(\n\tprops: PropsWithChildren<TickerSubComponentProps>,\n\tref: React.Ref<HTMLDivElement>,\n) {\n\tconst {\n\t\tchildren,\n\t\tas: asProp,\n\t\ttickerEffectVelocity,\n\t\ttickerEffectAlign,\n\t\taxis,\n\t\tdirectionModifier,\n\t\thoverModifier,\n\t\tgap,\n\t\toverflow,\n\t\tplayState,\n\t\t...rest\n\t} = props\n\tconst Component = asProp ?? motion.div\n\n\tconst layoutDirection = useLayoutDirection()\n\t// if the layout direction is rtl and the ticker is horizontal then we reverse the auto scroll direction to match the standard ticker autoscroll behavior\n\tconst layoutDirectionModifier = layoutDirection === \"rtl\" && axis === \"x\" ? -1 : 1\n\tconst baseVelocity = playState === \"paused\" ? 0 : (tickerEffectVelocity ?? 100)\n\tconst targetVelocity = baseVelocity * directionModifier * layoutDirectionModifier\n\n\tconst offsetMotionValue = useMotionValue(0)\n\tconst lastDrag = useRef(0)\n\tconst dragMomentum = useRef(false)\n\tconst isHovering = useRef(false)\n\tconst isDragging = useRef(false)\n\n\t// Prevent click actions being triggered on children during drag\n\t// e.g. ticker item contains link and it shouldn't be triggered on drag end\n\tconst handleClickCapture = (event: React.MouseEvent) => {\n\t\tif (!isDragging.current) return\n\n\t\t// Check if the click target is a link or inside a link\n\t\tif (event.target && event.target !== event.currentTarget) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t}\n\t}\n\n\tuseAnimationFrame((_, delta) => {\n\t\tconst velocity = Math.abs(offsetMotionValue.getVelocity())\n\t\tconst currentTargetVelocity = isHovering.current ? targetVelocity * hoverModifier : targetVelocity\n\t\tif (performance.now() > lastDrag.current && (!dragMomentum.current || velocity < Math.abs(currentTargetVelocity))) {\n\t\t\tconst frameOffset = (delta / 1000) * currentTargetVelocity\n\t\t\tconst updated = offsetMotionValue.get() - frameOffset\n\t\t\tif (dragMomentum.current) {\n\t\t\t\toffsetMotionValue.stop()\n\t\t\t\tdragMomentum.current = false\n\t\t\t}\n\t\t\toffsetMotionValue.set(updated)\n\t\t}\n\t})\n\n\tuseEffect(() => {\n\t\tif (playState === \"paused\") {\n\t\t\toffsetMotionValue.stop()\n\t\t}\n\t}, [playState, offsetMotionValue])\n\n\treturn (\n\t\t<MotionPlusTicker\n\t\t\tref={ref}\n\t\t\tas={Component}\n\t\t\t{...rest}\n\t\t\tgap={gap}\n\t\t\taxis={axis}\n\t\t\talign={tickerEffectAlign ?? \"center\"}\n\t\t\titemSize=\"manual\"\n\t\t\toverflow={overflow}\n\t\t\t_dragX={axis === \"x\" ? offsetMotionValue : undefined}\n\t\t\t_dragY={axis === \"y\" ? offsetMotionValue : undefined}\n\t\t\toffset={offsetMotionValue}\n\t\t\tdrag={axis}\n\t\t\tdragMomentum\n\t\t\tonClickCapture={handleClickCapture}\n\t\t\tonDragStart={() => {\n\t\t\t\tisDragging.current = true\n\t\t\t}}\n\t\t\tonDragEnd={() => {\n\t\t\t\tlastDrag.current = performance.now()\n\t\t\t\tdragMomentum.current = true\n\t\t\t\t// Clear the flag after a short delay to allow normal clicks when not dragging\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tisDragging.current = false\n\t\t\t\t}, 5)\n\t\t\t}}\n\t\t\tonMouseEnter={() => {\n\t\t\t\tisHovering.current = true\n\t\t\t}}\n\t\t\tonMouseLeave={() => {\n\t\t\t\tisHovering.current = false\n\t\t\t}}\n\t\t/>\n\t)\n})\n", "import { type PropsWithChildren, createContext, startTransition, useMemo } from \"react\"\n\nexport type TickerPlayState = \"running\" | \"paused\"\nexport interface TickerContextType {\n\tstart: () => void\n\tstop: () => void\n}\nexport const TickerContext = /* @__PURE__ */ (() => {\n\tconst Context = createContext<TickerContextType | undefined>(undefined)\n\tContext.displayName = \"TickerContext\"\n\treturn Context\n})()\n\nexport const TickerContextProvider = ({\n\tonPlayStateChange,\n\tchildren,\n}: PropsWithChildren<{ onPlayStateChange: (playState: TickerPlayState) => void }>) => {\n\tconst value = useMemo<TickerContextType>(\n\t\t() => ({\n\t\t\tstart: () => startTransition(() => onPlayStateChange(\"running\")),\n\t\t\tstop: () => startTransition(() => onPlayStateChange(\"paused\")),\n\t\t}),\n\t\t[onPlayStateChange],\n\t)\n\n\treturn <TickerContext.Provider value={value}>{children}</TickerContext.Provider>\n}\n", "import type { PropsWithChildren } from \"react\"\nimport { Ticker, type TickerProps } from \"../render/presentation/Ticker.tsx\"\n\nexport const withTickerFX = <T extends PropsWithChildren<TickerProps> & Record<string, unknown>>(\n\tComponent: React.ComponentType<T>,\n) => {\n\treturn (props: T) => {\n\t\tif (props.tickerEffectEnabled) {\n\t\t\treturn <Ticker {...props} as={Component} />\n\t\t}\n\n\t\treturn <Component {...props} />\n\t}\n}\n", "import { LayoutGroup, MotionConfig, type MotionProps, type Transition } from \"framer-motion\"\nimport React, { useMemo } from \"react\"\n\ntype FlowEffectProps = {\n\tflowEffectEnabled?: boolean\n\tflowEffectTransition?: Transition\n\tisNestedFlowEffect?: boolean\n} & Partial<Omit<MotionProps, \"children\">> & { children: React.ReactNode }\n\nexport const withFlowFX = <T extends FlowEffectProps>(\n\tComponent: React.ComponentType<Omit<T, \"flowEffectEnabled\" | \"flowEffectTransition\">>,\n) =>\n\tReact.forwardRef((props: T, forwardedRef: React.RefObject<HTMLElement> | null) => {\n\t\tconst { flowEffectEnabled, flowEffectTransition, isNestedFlowEffect, transition, ...forwardedProps } = props\n\t\tconst mergedTransition = useMemo(\n\t\t\t() =>\n\t\t\t\tflowEffectTransition\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tdefault: transition,\n\t\t\t\t\t\t\tlayout: flowEffectTransition,\n\t\t\t\t\t\t}\n\t\t\t\t\t: transition,\n\t\t\t[transition, flowEffectTransition],\n\t\t)\n\n\t\tif (!flowEffectEnabled) {\n\t\t\treturn <Component {...(forwardedProps as T)} ref={forwardedRef} transition={transition} />\n\t\t}\n\n\t\tlet componentWithFlowEffect = <Component {...(forwardedProps as T)} ref={forwardedRef} />\n\t\t// If there's no transition we allow the ancestor transition to be inherited\n\t\tif (flowEffectTransition) {\n\t\t\tcomponentWithFlowEffect = <MotionConfig transition={mergedTransition}>{componentWithFlowEffect}</MotionConfig>\n\t\t}\n\t\t// If we're already inside a layout group effect then we don't need an extra LayoutGroup, the effect will\n\t\t// just set the layout prop on its children to support layout animations\n\t\tif (!isNestedFlowEffect) {\n\t\t\tcomponentWithFlowEffect = <LayoutGroup>{componentWithFlowEffect}</LayoutGroup>\n\t\t}\n\n\t\treturn componentWithFlowEffect\n\t})\n", "import type React from \"react\"\nimport { asRecord } from \"../utils/asRecord.ts\"\n\n/**\n * All code generated by Framer inlines its annotations as an exported object\n * that can be accessed. The shape of that object is stable, but could change in\n * future. This property access path is hardcoded to make sure that code that is\n * already generated never stops working. If the shape of the annotation\n * changes, this accessing of the value will also need to change at the same\n * time, but this code needs to remain backwards compatible so that old\n * code-generation is not effected.\n */\nfunction extractMappingFromInfo(info: Record<string, any>): Record<string, string> | undefined {\n\tconst json = info.__FramerMetadata__.exports.default.annotations?.framerVariables\n\tif (!json) return undefined\n\ttry {\n\t\treturn JSON.parse(json)\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\n/**\n * Smart Component instances are code-generated with immutable react property\n * keys. This ensures that renaming or reordering variables in Framer, doesn't\n * cause dependents of the Smart Component to provide incorrect values to the\n * new component.\n *\n * However, when a user adds a code override to a smart component, they expect\n * to be able to reference the props by their human readable name. To allow\n * that, this HOC can be wrapped around all of the override HOCs, and when\n * provided an object with ids that map to the human readable property, will\n * remap the props so that those human readable keys are used instead of the\n * immutable ids, and this remapped version of props can be consumed by all user\n * overrides.\n */\nexport function withMappedReactProps<T extends object>(\n\tComponent: React.ComponentType<T>,\n\tinfo: Record<string, unknown>,\n) {\n\treturn (rawProps: T) => {\n\t\tconst props = {} as T\n\t\tconst mapping = extractMappingFromInfo(info)\n\t\tfor (const key in rawProps) {\n\t\t\tasRecord(props)[mapping?.[key] ?? key] = rawProps[key]\n\t\t}\n\n\t\treturn <Component {...props} />\n\t}\n}\n", "export type Vec2 = [number, number]\nexport type Vec4 = [number, number, number, number]\n\nexport const uniformPrefix = \"u_\"\nexport type UniformName = `${typeof uniformPrefix}${string}`\nexport type UniformValue =\n\t| {\n\t\t\ttype: \"float\"\n\t\t\tvalue: number\n\t  }\n\t| {\n\t\t\ttype: \"boolean\"\n\t\t\tvalue: boolean\n\t  }\n\t| {\n\t\t\ttype: \"int\"\n\t\t\tvalue: number\n\t  }\n\t| {\n\t\t\ttype: \"vec2\"\n\t\t\tvalue: Vec2\n\t  }\n\t| {\n\t\t\ttype: \"vec4\"\n\t\t\tvalue: Vec4\n\t  }\n\t| {\n\t\t\ttype: \"sampler2D\"\n\t\t\tvalue: TexImageSource\n\t  }\n\t| {\n\t\t\ttype: \"vec4[]\"\n\t\t\tvalue: Vec4[]\n\t  }\n\ninterface TextureEntry {\n\ttexture: WebGLTexture\n\timage: TexImageSource | null\n}\n\nconst supportedBufferFormats = [\"rgba8\", \"r8\", \"rg16f\", \"rgba16f\", \"rgba32f\"] as const\n\n/**\n * Internal pixel format for a buffer's render target.\n *\n * Choose the narrowest format that fits what the buffer actually stores \u2014 narrower\n * formats save memory bandwidth (meaningful perf on fullscreen passes), wider formats\n * avoid quantization for state that accumulates over time.\n *\n * - `\"rgba8\"` \u2014 4 channels, 8-bit normalized [0,1]. **Default.** Color trails, blur\n *   intermediates, composites, anything storing perceptual color. Cheapest 4-channel.\n * - `\"r8\"` \u2014 1 channel, 8-bit normalized. Masks, alpha-only fields, single-channel\n *   intensity, halftone-style state. **4\u00D7 less bandwidth than `rgba8`** \u2014 pick this\n *   whenever a buffer only needs one channel.\n * - `\"rg16f\"` \u2014 2 channels, 16-bit float. 2D vector fields: mouse displacement,\n *   velocity, flow direction. Stores signed values cleanly with no `(v * 0.5 + 0.5)`\n *   round-trip. Requires `EXT_color_buffer_float`.\n * - `\"rgba16f\"` \u2014 4 channels, 16-bit float. HDR color, precision-sensitive 4-channel\n *   state, light/bloom accumulation. Requires `EXT_color_buffer_float`.\n * - `\"rgba32f\"` \u2014 4 channels, 32-bit float. Long accumulation chains where 16-bit\n *   error compounds (fluid sim, reaction-diffusion). Most precision and most\n *   bandwidth \u2014 use only when 16f genuinely isn't enough. Requires\n *   `EXT_color_buffer_float`.\n */\nexport type ShaderBufferFormat = (typeof supportedBufferFormats)[number]\n\n/** Read-only view of the format catalog. */\nexport const shaderBufferFormats: ReadonlySet<ShaderBufferFormat> = /* @__PURE__ */ new Set(supportedBufferFormats)\n\n/** Built-in uniforms automatically provided to every pass (main and buffers). */\nexport const builtInUniforms = {\n\ttime: { name: \"u_time\", glslType: \"float\" },\n\tresolution: { name: \"u_resolution\", glslType: \"vec2\" },\n\tdeltaTime: { name: \"u_deltaTime\", glslType: \"float\" },\n\tpixelRatio: { name: \"u_pixelRatio\", glslType: \"float\" },\n\tmousePosition: { name: \"u_mousePosition\", glslType: \"vec4\" },\n\tmousePointerDown: { name: \"u_mousePointerDown\", glslType: \"float\" },\n\tmouseHover: { name: \"u_mouseHover\", glslType: \"float\" },\n} as const\n\ntype BuiltInUniformName = (typeof builtInUniforms)[keyof typeof builtInUniforms][\"name\"]\n\ntype MouseInput = { position: Vec4; pointerDown: number; hover: number }\n\nconst webGLContextLostEvent = \"webglcontextlost\"\n\nconst noop = () => {}\n\n/**\n * Resolved buffer descriptor \u2014 what flows through the renderer and runtime types after\n * `defineShader` has run. All fields are required: defaults are applied during prep.\n */\nexport interface BufferDescriptor {\n\t/** GLSL uniform identifier (`u_<name>_buffer`); used for `gl.getUniformLocation` lookups. */\n\tuniformName: UniformName\n\t/** Fragment shader source for this pass, with the auto-generated head prepended. */\n\tfragment: string\n\tresolutionScale: number\n\tformat: ShaderBufferFormat\n}\n\n/**\n * The complete set of GL resources owned by a constructed renderer. Assembled atomically\n * by `buildResources()` \u2014 either fully populated or the partial allocations are cleaned up and\n * the throw propagates. Render methods receive this as a parameter so they never have to\n * check for the absence of individual fields.\n */\ninterface GLResources {\n\tpositionBuffer: WebGLBuffer\n\ttexCoordBuffer: WebGLBuffer\n\tmainPass: PassState\n\tbufferPasses: BufferPass[]\n}\n\n/** Per-pass GL state shared by the main pass and every buffer pass. */\ninterface PassState {\n\tprogram: WebGLProgram\n\tvao: WebGLVertexArrayObject\n\tbuiltInLocations: Record<BuiltInUniformName, WebGLUniformLocation | null>\n\tcustomLocations: Map<string, WebGLUniformLocation | null>\n\tbufferSamplerLocations: Map<string, WebGLUniformLocation | null>\n}\n\n/**\n * GL state for one buffer pass, augmenting `PassState` with the ping-pong textures,\n * FBOs, size, and format.\n */\ninterface BufferPass extends PassState {\n\tuniformName: UniformName\n\tresolutionScale: number\n\t/** Original `ShaderBufferFormat` string. Kept for diagnostic messages (e.g. FBO completeness errors). */\n\tformat: ShaderBufferFormat\n\t/** Internal storage format passed as `texImage2D`'s `internalformat` (e.g. `gl.R8`, `gl.RGBA16F`). */\n\tinternalFormat: GLenum\n\t/** Pixel-data layout passed as `texImage2D`'s `format` (e.g. `gl.RED`, `gl.RG`, `gl.RGBA`). */\n\tuploadFormat: GLenum\n\t/** Pixel-data type passed as `texImage2D`'s `type` (e.g. `gl.UNSIGNED_BYTE`, `gl.HALF_FLOAT`, `gl.FLOAT`). */\n\tpixelType: GLenum\n\twidth: number\n\theight: number\n\ttextures: [WebGLTexture, WebGLTexture]\n\tfbos: [WebGLFramebuffer, WebGLFramebuffer]\n\t/**\n\t * Index (0 or 1) of the texture this pass will write to next.\n\t * The \"current\" / last-written texture is `textures[1 - writeIdx]`.\n\t */\n\twriteIdx: 0 | 1\n\t/** Reserved texture unit. The buffer's \"current\" texture stays bound here for the whole frame. */\n\ttextureUnit: number\n}\n\n/**\n * Encapsulates all WebGL operations for rendering custom fragment shaders, including\n * optional multi-pass buffers (ping-pong FBOs with cross-buffer sampling). Handles\n * context creation, shader compilation, and rendering lifecycle.\n */\nexport class WebGL2ShaderRenderer {\n\tprivate gl: WebGL2RenderingContext\n\tprivate canvas: HTMLCanvasElement | OffscreenCanvas\n\tprivate contextLostHandler: (event: Event) => void\n\tprivate disposed = false\n\tprivate pixelRatio = typeof window !== \"undefined\" ? window.devicePixelRatio : 1\n\tprivate resolutionScale: number\n\tprivate lastBufferWidth = 0\n\tprivate lastBufferHeight = 0\n\tprivate onContextLost: (() => void) | undefined\n\n\tprivate resources: GLResources\n\tprivate textures: Map<string, TextureEntry> = new Map()\n\n\t/** First texture unit available for custom samplers. Buffers occupy `[0, n)`; customs follow. */\n\tprivate get customTextureUnitBase(): number {\n\t\treturn this.resources.bufferPasses.length\n\t}\n\n\tconstructor(\n\t\tcanvas: HTMLCanvasElement | OffscreenCanvas,\n\t\tvertexSource: string,\n\t\tfragmentSource: string,\n\t\tresolutionScale: number,\n\t\tonContextLostHandler: (() => void) | undefined = noop,\n\t\tbufferDescriptors: readonly BufferDescriptor[] = [],\n\t) {\n\t\tthis.resolutionScale = resolutionScale\n\t\tthis.canvas = canvas\n\t\tthis.onContextLost = onContextLostHandler\n\n\t\tconst gl = canvas.getContext(\"webgl2\", {\n\t\t\talpha: true,\n\t\t\tpremultipliedAlpha: false,\n\t\t\tantialias: false,\n\t\t\tpowerPreference: \"default\",\n\t\t\tpreserveDrawingBuffer: canvas instanceof OffscreenCanvas,\n\t\t}) as unknown as WebGL2RenderingContext | null // Complains in dev mode\n\n\t\tif (!gl) {\n\t\t\tthrow new Error(\"WebGL2 not supported\")\n\t\t}\n\n\t\tthis.gl = gl\n\n\t\t// The context can be lost any time after this point.\n\t\t// If `buildResources` throws below, the catch unregisters it so the canvas\n\t\t// doesn't retain the failed renderer via the listener closure.\n\t\tthis.contextLostHandler = (event: Event) => {\n\t\t\tevent.preventDefault()\n\t\t\tthis.dispose()\n\t\t\tthis.onContextLost?.()\n\t\t}\n\t\tcanvas.addEventListener(webGLContextLostEvent, this.contextLostHandler)\n\n\t\t// `buildResources` is atomic: it either returns a fully-assembled `GLResources` or\n\t\t// cleans up its own partial allocations and rethrows.\n\t\ttry {\n\t\t\tthis.resources = this.buildResources(vertexSource, fragmentSource, bufferDescriptors)\n\t\t} catch (error) {\n\t\t\tcanvas.removeEventListener(webGLContextLostEvent, this.contextLostHandler)\n\t\t\tthrow error\n\t\t}\n\n\t\tconst { mainPass, bufferPasses } = this.resources\n\t\t// Set clear color once - it never changes (transparent black)\n\t\tgl.clearColor(0, 0, 0, 0)\n\n\t\t// In the no-buffer hot path we never switch program or VAO, so bind once here and\n\t\t// the per-frame draw avoids redundant `useProgram` / `bindVertexArray` calls.\n\t\tif (bufferPasses.length === 0) {\n\t\t\t// biome-ignore lint/correctness/useHookAtTopLevel: linters incorrectly recognize `useProgram` as a hook\n\t\t\tgl.useProgram(mainPass.program)\n\t\t\tgl.bindVertexArray(mainPass.vao)\n\t\t}\n\t}\n\n\t/**\n\t * Allocates every GL resource the renderer needs and returns them as a `GLResources`.\n\t * If any step throws, the catch deletes whatever was allocated up to that point before\n\t * rethrowing \u2014 so the constructor never has to know about partial state.\n\t */\n\tprivate buildResources(\n\t\tvertexSource: string,\n\t\tfragmentSource: string,\n\t\tbufferDescriptors: readonly BufferDescriptor[],\n\t): GLResources {\n\t\tconst { gl, canvas } = this\n\n\t\tconst offendingFloatBuffer = bufferDescriptors.find(d => shaderBufferFormatRequiresFloatExt(d.format))\n\t\tif (offendingFloatBuffer && !gl.getExtension(\"EXT_color_buffer_float\")) {\n\t\t\tthrow new Error(\n\t\t\t\t`Shader buffer \"${offendingFloatBuffer.uniformName}\" requested format \"${offendingFloatBuffer.format}\" but the EXT_color_buffer_float extension is not available.`,\n\t\t\t)\n\t\t}\n\t\t// `LINEAR` filtering on float textures requires OES_texture_float_linear; without it,\n\t\t// those samplers are incomplete and return black even when the FBO allocates fine.\n\t\t// We don't throw \u2014 float buffers are useful for vector fields where users may not\n\t\t// rely on smoothing \u2014 but float formats fall back to NEAREST when it's missing.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/OES_texture_float_linear\n\t\tconst hasFloatLinear = !offendingFloatBuffer || !!gl.getExtension(\"OES_texture_float_linear\")\n\n\t\tconst vertexShader = this.compileShader(gl.VERTEX_SHADER, vertexSource)\n\t\tlet mainProgram: WebGLProgram | undefined\n\t\tconst bufferProgramPairs: [WebGLProgram, BufferDescriptor][] = []\n\t\tlet positionBuffer: WebGLBuffer | undefined\n\t\tlet texCoordBuffer: WebGLBuffer | undefined\n\t\tlet mainPass: PassState | undefined\n\t\tconst bufferPasses: BufferPass[] = []\n\n\t\ttry {\n\t\t\tmainProgram = this.linkFragmentProgram(vertexShader, fragmentSource)\n\t\t\tfor (const desc of bufferDescriptors) {\n\t\t\t\tbufferProgramPairs.push([this.linkFragmentProgram(vertexShader, desc.fragment), desc])\n\t\t\t}\n\n\t\t\t// Shared fullscreen-quad geometry. One position buffer + one texCoord buffer reused by every VAO.\n\t\t\tpositionBuffer = createStaticArrayBuffer(gl, new Float32Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1]))\n\t\t\ttexCoordBuffer = createStaticArrayBuffer(gl, new Float32Array([0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]))\n\n\t\t\tmainPass = this.buildPassState(mainProgram, bufferDescriptors, positionBuffer, texCoordBuffer)\n\t\t\t// Buffers reserve a contiguous block of texture units starting at 0. Each one's\n\t\t\t// \"current\" texture stays pinned to its unit for the whole frame, which is what\n\t\t\t// `bindStaticSamplerUnits` relies on to wire sampler uniforms once at construction.\n\t\t\t// Custom samplers (image controls, heightmap) start at `customTextureUnitBase`.\n\t\t\tfor (let textureUnit = 0; textureUnit < bufferProgramPairs.length; textureUnit++) {\n\t\t\t\tconst pair = bufferProgramPairs[textureUnit]\n\t\t\t\tif (!pair) continue\n\t\t\t\tconst [program, desc] = pair\n\t\t\t\tbufferPasses.push(\n\t\t\t\t\tthis.buildBufferPass(\n\t\t\t\t\t\tprogram,\n\t\t\t\t\t\tdesc,\n\t\t\t\t\t\tbufferDescriptors,\n\t\t\t\t\t\thasFloatLinear,\n\t\t\t\t\t\ttextureUnit,\n\t\t\t\t\t\tpositionBuffer,\n\t\t\t\t\t\ttexCoordBuffer,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// Allocate buffer textures + FBOs at the canvas's current size. `resize()` will\n\t\t\t// reallocate when the actual size becomes known.\n\t\t\tthis.allocateBufferPassStorages(bufferPasses, canvas.width, canvas.height)\n\n\t\t\t// Sampler-uniform-to-texture-unit bindings never change after compile, so set them once.\n\t\t\t// Each buffer's \"current\" texture stays bound to its reserved unit for the entire frame,\n\t\t\t// so per-frame `gl.uniform1i` calls for these sampler bindings are unnecessary.\n\t\t\tthis.bindStaticSamplerUnits(mainPass, bufferPasses)\n\n\t\t\treturn { positionBuffer, texCoordBuffer, mainPass, bufferPasses }\n\t\t} catch (error) {\n\t\t\t// Roll back in reverse-allocation order. `disposePass` / `disposeBufferPass` own\n\t\t\t// the programs + VAOs they wrap, so any program not yet wrapped is deleted manually.\n\t\t\tfor (const bufferPass of bufferPasses) {\n\t\t\t\tthis.disposeBufferPass(bufferPass)\n\t\t\t}\n\t\t\tfor (let i = bufferPasses.length; i < bufferProgramPairs.length; i++) {\n\t\t\t\tconst pair = bufferProgramPairs[i]\n\t\t\t\tif (pair) {\n\t\t\t\t\tgl.deleteProgram(pair[0])\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (mainPass) {\n\t\t\t\tthis.disposePass(mainPass)\n\t\t\t} else if (mainProgram) {\n\t\t\t\tgl.deleteProgram(mainProgram)\n\t\t\t}\n\t\t\tif (texCoordBuffer) {\n\t\t\t\tgl.deleteBuffer(texCoordBuffer)\n\t\t\t}\n\t\t\tif (positionBuffer) {\n\t\t\t\tgl.deleteBuffer(positionBuffer)\n\t\t\t}\n\t\t\tthrow error\n\t\t} finally {\n\t\t\t// Linked programs retain their own reference to the vertex shader, so it can be\n\t\t\t// released as soon as linking finishes \u2014 on the success path (no longer needed)\n\t\t\t// and on the catch path (any partial programs were already deleted above).\n\t\t\tgl.deleteShader(vertexShader)\n\t\t}\n\t}\n\n\t/**\n\t * Renders a frame with the given timing, optional custom uniforms, and mouse input.\n\t * Branches on whether any buffers are configured: the no-buffer path is a single\n\t * draw with program + VAO already bound from construction; the multi-pass path\n\t * walks each buffer's FBO in declaration order before drawing the main pass.\n\t */\n\trender(\n\t\telapsedTime: number,\n\t\tdeltaTime: number,\n\t\tuniforms: Record<UniformName, UniformValue> | undefined,\n\t\tmouseInput: MouseInput,\n\t): void {\n\t\tif (this.disposed) return\n\t\tif (this.resources.bufferPasses.length === 0) {\n\t\t\tthis.renderSinglePass(elapsedTime, deltaTime, uniforms, mouseInput)\n\t\t\treturn\n\t\t}\n\t\tthis.renderMultiPass(elapsedTime, deltaTime, uniforms, mouseInput)\n\t}\n\n\t/**\n\t * No-buffer hot path: program + VAO are bound once at construction, so each frame\n\t * is just built-ins + custom uniforms + clear + draw.\n\t */\n\tprivate renderSinglePass(\n\t\telapsedTime: number,\n\t\tdeltaTime: number,\n\t\tuniforms: Record<UniformName, UniformValue> | undefined,\n\t\tmouseInput: MouseInput,\n\t): void {\n\t\tconst {\n\t\t\tgl,\n\t\t\tcanvas,\n\t\t\tresources: { mainPass },\n\t\t} = this\n\t\tthis.updatePassBuiltIns(mainPass, elapsedTime, deltaTime, mouseInput, canvas.width, canvas.height)\n\t\tthis.applyCustomUniforms(mainPass, uniforms, this.customTextureUnitBase)\n\t\tgl.clear(gl.COLOR_BUFFER_BIT)\n\t\tgl.drawArrays(gl.TRIANGLES, 0, 6)\n\t}\n\n\t/**\n\t * Multi-pass render: each buffer in declaration order draws into its own FBO, with\n\t * its just-written texture re-pinned to its reserved unit so later buffers (and the\n\t * main pass) see the latest output. The main pass draws to the default framebuffer\n\t * with every buffer texture still bound.\n\t */\n\tprivate renderMultiPass(\n\t\telapsedTime: number,\n\t\tdeltaTime: number,\n\t\tuniforms: Record<UniformName, UniformValue> | undefined,\n\t\tmouseInput: MouseInput,\n\t): void {\n\t\tconst {\n\t\t\tgl,\n\t\t\tcanvas,\n\t\t\tresources: { mainPass, bufferPasses },\n\t\t\tcustomTextureUnitBase,\n\t\t} = this\n\n\t\t// Re-pin each buffer's \"current\" texture to its reserved unit. After each buffer\n\t\t// renders, this is repeated below to swap in the just-written texture, so by the\n\t\t// time the main pass runs every reserved unit holds the latest output.\n\t\tfor (const bufferPass of bufferPasses) {\n\t\t\tgl.activeTexture(gl.TEXTURE0 + bufferPass.textureUnit)\n\t\t\tgl.bindTexture(gl.TEXTURE_2D, bufferPass.textures[bufferPass.writeIdx === 0 ? 1 : 0])\n\t\t}\n\n\t\tfor (const bufferPass of bufferPasses) {\n\t\t\t// biome-ignore lint/correctness/useHookAtTopLevel: linters incorrectly recognize `useProgram` as a hook\n\t\t\tgl.useProgram(bufferPass.program)\n\t\t\tgl.bindVertexArray(bufferPass.vao)\n\t\t\tthis.updatePassBuiltIns(bufferPass, elapsedTime, deltaTime, mouseInput, bufferPass.width, bufferPass.height)\n\t\t\tthis.applyCustomUniforms(bufferPass, uniforms, customTextureUnitBase)\n\n\t\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, bufferPass.fbos[bufferPass.writeIdx])\n\t\t\tgl.viewport(0, 0, bufferPass.width, bufferPass.height)\n\t\t\tgl.clear(gl.COLOR_BUFFER_BIT)\n\t\t\tgl.drawArrays(gl.TRIANGLES, 0, 6)\n\n\t\t\t// Flip ping-pong: the just-written texture becomes the new \"current\". Re-pin so\n\t\t\t// downstream passes (later buffers and main) sample the latest output.\n\t\t\tgl.activeTexture(gl.TEXTURE0 + bufferPass.textureUnit)\n\t\t\tgl.bindTexture(gl.TEXTURE_2D, bufferPass.textures[bufferPass.writeIdx])\n\t\t\tbufferPass.writeIdx = bufferPass.writeIdx === 0 ? 1 : 0\n\t\t}\n\n\t\t// biome-ignore lint/correctness/useHookAtTopLevel: linters incorrectly recognize `useProgram` as a hook\n\t\tgl.useProgram(mainPass.program)\n\t\tgl.bindVertexArray(mainPass.vao)\n\t\tthis.updatePassBuiltIns(mainPass, elapsedTime, deltaTime, mouseInput, canvas.width, canvas.height)\n\t\tthis.applyCustomUniforms(mainPass, uniforms, customTextureUnitBase)\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null)\n\t\tgl.viewport(0, 0, canvas.width, canvas.height)\n\t\tgl.clear(gl.COLOR_BUFFER_BIT)\n\t\tgl.drawArrays(gl.TRIANGLES, 0, 6)\n\t}\n\n\t/**\n\t * Syncs the canvas buffer and viewport to match display size, accounting for device pixel ratio.\n\t * Each buffer's render target resizes alongside (its size = canvas size \u00D7 buffer.resolutionScale).\n\t */\n\tresize(): void {\n\t\tif (this.disposed) return\n\n\t\tconst { canvas } = this\n\t\tif (canvas instanceof OffscreenCanvas) {\n\t\t\tthrow new Error(\"resize() is not supported for OffscreenCanvas.\")\n\t\t}\n\n\t\t// offsetWidth/offsetHeight reflect layout size, unaffected by CSS\n\t\t// transforms. On the canvas editor, zoom is applied via CSS scale()\n\t\t// which changes getBoundingClientRect() but not offset dimensions.\n\t\t// Always rendering at the designed size ensures consistent output for\n\t\t// resolution-dependent shaders while capping the buffer when zoomed in.\n\t\tconst cssWidth = canvas.offsetWidth\n\t\tconst cssHeight = canvas.offsetHeight\n\n\t\tconst dpr = window.devicePixelRatio\n\t\t// Clamp to 1.0 so we never render below CSS pixel resolution on DPR 1 screens.\n\t\t// Performance gains come from high-DPI screens where there are excess pixels to spare.\n\t\tconst effectiveDpr = Math.max(dpr * this.resolutionScale, 1)\n\t\tthis.pixelRatio = effectiveDpr\n\n\t\tconst width = cssWidth * effectiveDpr\n\t\tconst height = cssHeight * effectiveDpr\n\n\t\tif (width === this.lastBufferWidth && height === this.lastBufferHeight) return\n\n\t\tthis.lastBufferWidth = width\n\t\tthis.lastBufferHeight = height\n\t\tcanvas.width = width\n\t\tcanvas.height = height\n\n\t\tthis.gl.viewport(0, 0, width, height)\n\n\t\t// `allocateBufferPassStorage` can throw mid-resize (e.g. an FBO comes back incomplete at\n\t\t// the new size), leaving some buffers resized and others not \u2014 an inconsistent state\n\t\t// that later resize/render calls would keep hitting. Self-dispose so the renderer\n\t\t// settles into a known-dead state and callers can react via `disposed` or the rethrown\n\t\t// error without seeing the half-resized in-between.\n\t\ttry {\n\t\t\tthis.allocateBufferPassStorages(this.resources.bufferPasses, width, height)\n\t\t} catch (error) {\n\t\t\tthis.dispose()\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t/**\n\t * @param pixelDensity - The ratio between the canvas's physical pixel\n\t * dimensions and the logical (CSS) dimensions the shader should assume.\n\t * Surfaces as `u_pixelRatio` so shaders can derive CSS-space values via\n\t * `u_resolution / u_pixelRatio`. On-screen canvases get this from\n\t * `window.devicePixelRatio`; offscreen renders must supply it explicitly\n\t * when the canvas is supersampled (e.g. 2x for fallback image sharpness).\n\t */\n\tresizeOffscreenCanvas(width: number, height: number, pixelDensity?: number): void {\n\t\tif (this.disposed) return\n\t\tif (pixelDensity !== undefined) this.pixelRatio = pixelDensity\n\t\tthis.gl.viewport(0, 0, width, height)\n\t\t// See `resize()` for why we self-dispose on allocation failure here.\n\t\ttry {\n\t\t\tthis.allocateBufferPassStorages(this.resources.bufferPasses, width, height)\n\t\t} catch (error) {\n\t\t\tthis.dispose()\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t/**\n\t * Force all commands to complete execution; used for canvas fallback image generation\n\t */\n\tfinish(): void {\n\t\tif (this.disposed) return\n\t\tthis.gl.finish()\n\t}\n\n\t/**\n\t * Releases every WebGL resource owned by this renderer: shared geometry buffers,\n\t * user-supplied sampler textures, and each pass's program / VAO / (for buffers) FBOs\n\t * and ping-pong textures.\n\t *\n\t * Idempotent. Safe after the WebGL context has been lost \u2014 the GPU driver already\n\t * invalidated the resources, so we skip the gl.delete* calls. `disposed` gates all\n\t * public methods so reads after disposal short-circuit before touching `this.resources`.\n\t */\n\tdispose(): void {\n\t\tif (this.disposed) return\n\t\tthis.disposed = true\n\n\t\tthis.canvas.removeEventListener(webGLContextLostEvent, this.contextLostHandler)\n\n\t\t// Skip WebGL cleanup if context is lost - resources are already invalid\n\t\tif (this.gl.isContextLost()) return\n\n\t\tconst { gl, resources } = this\n\n\t\tfor (const bufferPass of resources.bufferPasses) this.disposeBufferPass(bufferPass)\n\t\tthis.disposePass(resources.mainPass)\n\t\tgl.deleteBuffer(resources.positionBuffer)\n\t\tgl.deleteBuffer(resources.texCoordBuffer)\n\n\t\tfor (const [, entry] of this.textures) gl.deleteTexture(entry.texture)\n\t\tthis.textures.clear()\n\t}\n\n\t/** Releases the program + VAO owned by any pass. Shared by main-pass and buffer-pass disposal. */\n\tprivate disposePass(pass: PassState): void {\n\t\tconst { gl } = this\n\t\tgl.deleteVertexArray(pass.vao)\n\t\tgl.deleteProgram(pass.program)\n\t}\n\n\t/** Releases everything a buffer pass owns: program + VAO (via `disposePass`), plus its ping-pong textures and FBOs. */\n\tprivate disposeBufferPass(bufferPass: BufferPass): void {\n\t\tconst { gl } = this\n\t\tthis.disposePass(bufferPass)\n\t\tfor (const tex of bufferPass.textures) gl.deleteTexture(tex)\n\t\tfor (const fbo of bufferPass.fbos) gl.deleteFramebuffer(fbo)\n\t}\n\n\t/**\n\t * Builds the GL state shared by main and buffer passes: a fresh VAO bound to the shared\n\t * fullscreen-quad geometry with this program's attribute locations, plus uniform-location\n\t * caches for built-ins, custom uniforms (lazy-filled on first set), and one entry per\n\t * buffer's `u_<name>_buffer` sampler. Geometry buffers are passed in so this works during\n\t * construction before the corresponding `this.*` fields are set.\n\t */\n\tprivate buildPassState(\n\t\tprogram: WebGLProgram,\n\t\tbufferDescriptors: readonly BufferDescriptor[],\n\t\tpositionBuffer: WebGLBuffer,\n\t\ttexCoordBuffer: WebGLBuffer,\n\t): PassState {\n\t\tconst { gl } = this\n\t\tconst vao = gl.createVertexArray()\n\t\tif (!vao) throw new Error(\"Failed to create vertex array object\")\n\n\t\tgl.bindVertexArray(vao)\n\t\tbindFullScreenQuadAttribs(gl, program, positionBuffer, texCoordBuffer)\n\t\tgl.bindVertexArray(null)\n\n\t\tconst builtInLocations = lookupBuiltInLocations(gl, program)\n\t\tconst bufferSamplerLocations = new Map<string, WebGLUniformLocation | null>()\n\t\tfor (const desc of bufferDescriptors) {\n\t\t\tbufferSamplerLocations.set(desc.uniformName, gl.getUniformLocation(program, desc.uniformName))\n\t\t}\n\n\t\treturn {\n\t\t\tprogram,\n\t\t\tvao,\n\t\t\tbuiltInLocations,\n\t\t\tcustomLocations: new Map(),\n\t\t\tbufferSamplerLocations,\n\t\t}\n\t}\n\n\t/**\n\t * Extends `buildPassState` with the per-buffer ping-pong storage: two textures + two\n\t * framebuffers, plus a reserved texture unit that every pass (including this buffer's\n\t * own pass, for self-feedback) samples from. Texture storage stays uninitialized\n\t * here \u2014 `allocateBufferPassStorage` sizes them once the canvas dimensions are known.\n\t */\n\tprivate buildBufferPass(\n\t\tprogram: WebGLProgram,\n\t\tdescriptor: BufferDescriptor,\n\t\tbufferDescriptors: readonly BufferDescriptor[],\n\t\thasFloatLinear: boolean,\n\t\ttextureUnit: number,\n\t\tpositionBuffer: WebGLBuffer,\n\t\ttexCoordBuffer: WebGLBuffer,\n\t): BufferPass {\n\t\tconst base = this.buildPassState(program, bufferDescriptors, positionBuffer, texCoordBuffer)\n\t\tconst { gl } = this\n\t\tconst formatGL = resolveBufferFormatGL(gl, descriptor.format)\n\t\t// Float formats only support LINEAR when OES_texture_float_linear is present.\n\t\tconst filter = shaderBufferFormatRequiresFloatExt(descriptor.format) && !hasFloatLinear ? gl.NEAREST : gl.LINEAR\n\n\t\tconst texA = createBufferTexture(gl, filter)\n\t\tconst texB = createBufferTexture(gl, filter)\n\t\tconst fboA = createBufferFramebuffer(gl, texA)\n\t\tconst fboB = createBufferFramebuffer(gl, texB)\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null)\n\t\tgl.bindTexture(gl.TEXTURE_2D, null)\n\n\t\treturn {\n\t\t\t...base,\n\t\t\tuniformName: descriptor.uniformName,\n\t\t\tresolutionScale: descriptor.resolutionScale,\n\t\t\tformat: descriptor.format,\n\t\t\tinternalFormat: formatGL.internalFormat,\n\t\t\tuploadFormat: formatGL.uploadFormat,\n\t\t\tpixelType: formatGL.pixelType,\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t\ttextures: [texA, texB],\n\t\t\tfbos: [fboA, fboB],\n\t\t\twriteIdx: 0,\n\t\t\ttextureUnit,\n\t\t}\n\t}\n\n\t/**\n\t * Wires every `u_<bufferName>_buffer` sampler-to-unit binding once at construction.\n\t * Each buffer's \"current\" texture stays bound to its reserved unit for the entire frame,\n\t * and the unit number is fixed for the lifetime of the program \u2014 so we never need to call\n\t * `gl.uniform1i` for these samplers per-frame. A buffer reading its own name during its\n\t * own pass uses the same binding (the unit holds the prior-frame texture before draw\n\t * and the just-written texture after).\n\t */\n\tprivate bindStaticSamplerUnits(mainPass: PassState, bufferPasses: readonly BufferPass[]): void {\n\t\tconst { gl } = this\n\n\t\tconst allPasses: PassState[] = [mainPass, ...bufferPasses]\n\t\tfor (const pass of allPasses) {\n\t\t\t// biome-ignore lint/correctness/useHookAtTopLevel: linters incorrectly recognize `useProgram` as a hook\n\t\t\tgl.useProgram(pass.program)\n\t\t\tfor (const bufferPass of bufferPasses) {\n\t\t\t\tconst loc = pass.bufferSamplerLocations.get(bufferPass.uniformName)\n\t\t\t\tif (loc) gl.uniform1i(loc, bufferPass.textureUnit)\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Resizes every buffer pass to the given canvas dimensions. */\n\tprivate allocateBufferPassStorages(\n\t\tbufferPasses: readonly BufferPass[],\n\t\tcanvasWidth: number,\n\t\tcanvasHeight: number,\n\t): void {\n\t\tfor (const bufferPass of bufferPasses) {\n\t\t\tthis.allocateBufferPassStorage(bufferPass, canvasWidth, canvasHeight)\n\t\t}\n\t}\n\n\t/**\n\t * Sizes the buffer's two ping-pong textures to `canvas \u00D7 resolutionScale` (clamped to\n\t * at least 1\u00D71) and clears both attached FBOs so a stale prior frame doesn't leak in\n\t * after a resize. Idempotent \u2014 early-returns when the requested size matches the\n\t * current size.\n\t */\n\tprivate allocateBufferPassStorage(bufferPass: BufferPass, canvasWidth: number, canvasHeight: number): void {\n\t\tconst { gl } = this\n\t\tconst w = Math.max(1, Math.floor(canvasWidth * bufferPass.resolutionScale))\n\t\tconst h = Math.max(1, Math.floor(canvasHeight * bufferPass.resolutionScale))\n\n\t\tif (w === bufferPass.width && h === bufferPass.height) return\n\t\tbufferPass.width = w\n\t\tbufferPass.height = h\n\n\t\tfor (const tex of bufferPass.textures) {\n\t\t\tgl.bindTexture(gl.TEXTURE_2D, tex)\n\t\t\tgl.texImage2D(\n\t\t\t\tgl.TEXTURE_2D,\n\t\t\t\t0,\n\t\t\t\tbufferPass.internalFormat,\n\t\t\t\tw,\n\t\t\t\th,\n\t\t\t\t0,\n\t\t\t\tbufferPass.uploadFormat,\n\t\t\t\tbufferPass.pixelType,\n\t\t\t\tnull,\n\t\t\t)\n\t\t}\n\t\tgl.bindTexture(gl.TEXTURE_2D, null)\n\n\t\t// Save/restore the viewport so this helper doesn't leak buffer-sized viewport state.\n\t\t// `getParameter(VIEWPORT)` returns Int32Array(4) of [x, y, width, height] \u2014 narrow to a\n\t\t// concrete tuple so destructured elements aren't `number | undefined`.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getParameter\n\t\t// oxlint-disable-next-line typescript/no-unsafe-type-assertion\n\t\tconst [prevX, prevY, prevW, prevH] = gl.getParameter(gl.VIEWPORT) as [number, number, number, number]\n\n\t\t// Validate completeness once textures are sized (status is FRAMEBUFFER_INCOMPLETE_ATTACHMENT\n\t\t// before storage exists). Drivers can refuse some format/size combos \u2014 surfacing it as a\n\t\t// clear throw beats silently rendering nothing into a broken FBO.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/checkFramebufferStatus\n\t\tfor (const fbo of bufferPass.fbos) {\n\t\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, fbo)\n\t\t\tthrowIfFramebufferIncomplete(gl, bufferPass.uniformName, bufferPass.format)\n\t\t\tgl.viewport(0, 0, w, h)\n\t\t\tgl.clear(gl.COLOR_BUFFER_BIT)\n\t\t}\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null)\n\t\tgl.viewport(prevX, prevY, prevW, prevH)\n\t}\n\n\t/**\n\t * Compiles GLSL source code into a shader object the GPU can execute.\n\t * @throws Error with shader info log if compilation fails\n\t */\n\tprivate compileShader(type: number, source: string): WebGLShader {\n\t\tconst { gl } = this\n\t\tconst shader = gl.createShader(type)\n\t\tif (!shader) {\n\t\t\tthrow new Error(\"Failed to create shader\")\n\t\t}\n\n\t\tgl.shaderSource(shader, source)\n\t\tgl.compileShader(shader)\n\n\t\tif (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n\t\t\tconst info = gl.getShaderInfoLog(shader)\n\t\t\tgl.deleteShader(shader)\n\t\t\tconst shaderType = type === gl.VERTEX_SHADER ? \"Vertex\" : \"Fragment\"\n\t\t\tthrow new Error(`${shaderType} shader compilation failed: ${info}`)\n\t\t}\n\n\t\treturn shader\n\t}\n\n\t/**\n\t * Compiles a fragment source, attaches it to the given vertex shader, and links them\n\t * into a program. The compiled fragment shader is released in a `finally` block so\n\t * we never leak it whether linking succeeds, fails, or compilation throws.\n\t *\n\t * @throws Error with the program info log if linking fails.\n\t */\n\tprivate linkFragmentProgram(vertexShader: WebGLShader, fragmentSource: string): WebGLProgram {\n\t\tconst { gl } = this\n\t\tconst fragmentShader = this.compileShader(gl.FRAGMENT_SHADER, fragmentSource)\n\t\ttry {\n\t\t\tconst program = gl.createProgram()\n\t\t\tif (!program) throw new Error(\"Failed to create program\")\n\n\t\t\tgl.attachShader(program, vertexShader)\n\t\t\tgl.attachShader(program, fragmentShader)\n\t\t\tgl.linkProgram(program)\n\n\t\t\tif (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n\t\t\t\tconst info = gl.getProgramInfoLog(program)\n\t\t\t\tgl.deleteProgram(program)\n\t\t\t\tthrow new Error(`Program linking failed: ${info}`)\n\t\t\t}\n\n\t\t\treturn program\n\t\t} finally {\n\t\t\t// The program retains a reference to the fragment shader after linking, so we can\n\t\t\t// release the shader object now whether we're returning the program or unwinding.\n\t\t\tgl.deleteShader(fragmentShader)\n\t\t}\n\t}\n\n\t/**\n\t * Sets a non-texture uniform value in the shader program.\n\t */\n\tprivate setUniform(\n\t\tlocation: WebGLUniformLocation | null,\n\t\tuniform: Exclude<UniformValue, { type: \"sampler2D\" }>,\n\t): void {\n\t\tif (location === null) return\n\n\t\tswitch (uniform.type) {\n\t\t\tcase \"boolean\":\n\t\t\t\tthis.gl.uniform1f(location, uniform.value ? 1.0 : 0.0)\n\t\t\t\tbreak\n\t\t\tcase \"float\":\n\t\t\t\tthis.gl.uniform1f(location, uniform.value)\n\t\t\t\tbreak\n\t\t\tcase \"int\":\n\t\t\t\tthis.gl.uniform1i(location, uniform.value)\n\t\t\t\tbreak\n\t\t\tcase \"vec2\":\n\t\t\t\tthis.gl.uniform2fv(location, uniform.value)\n\t\t\t\tbreak\n\t\t\tcase \"vec4\":\n\t\t\t\tthis.gl.uniform4fv(location, uniform.value)\n\t\t\t\tbreak\n\t\t\tcase \"vec4[]\":\n\t\t\t\tthis.gl.uniform4fv(location, uniform.value.flat())\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\t/**\n\t * Creates or updates a texture from an HTMLImageElement or ImageBitmap.\n\t * Binds the texture to the specified texture unit.\n\t */\n\tprivate bindTexture(uniformName: string, image: TexImageSource, textureUnit: number): void {\n\t\tconst { gl, textures } = this\n\t\tlet entry = textures.get(uniformName)\n\n\t\tconst isNewTexture = !entry\n\t\tif (isNewTexture) {\n\t\t\tconst texture = gl.createTexture()\n\t\t\tif (!texture) return\n\t\t\tentry = { texture, image: null }\n\t\t\ttextures.set(uniformName, entry)\n\t\t}\n\n\t\tif (!entry) return\n\n\t\tgl.activeTexture(gl.TEXTURE0 + textureUnit)\n\t\tgl.bindTexture(gl.TEXTURE_2D, entry.texture)\n\n\t\t// Upload on first bind or if the image changed\n\t\tif (isNewTexture || entry.image !== image) {\n\t\t\tif (entry.image instanceof ImageBitmap) {\n\t\t\t\tentry.image.close()\n\t\t\t}\n\t\t\tentry.image = image\n\t\t\tgl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image)\n\n\t\t\t// Prevent texture coordinates from wrapping at edges\n\t\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)\n\t\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)\n\n\t\t\t// Mipmaps + trilinear filtering keeps textures crisp when users resize shader frames.\n\t\t\t// Pre-computes downscaled versions (1/2, 1/4, 1/8, etc.) for smooth minification.\n\t\t\tgl.generateMipmap(gl.TEXTURE_2D)\n\t\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR)\n\t\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR)\n\t\t}\n\t}\n\n\t/**\n\t * Pushes user-supplied uniform values into the active program, lazy-caching their\n\t * locations on first encounter. Sampler2D values are uploaded to texture units\n\t * starting at `textureUnitBase` \u2014 which is `0` for the no-buffer hot path and\n\t * `this.resources.bufferPasses.length` when buffers are present (so reserved buffer units come first).\n\t */\n\tprivate applyCustomUniforms(\n\t\tpass: PassState,\n\t\tuniforms: Record<UniformName, UniformValue> | undefined,\n\t\ttextureUnitBase: number,\n\t): void {\n\t\tif (!uniforms) return\n\n\t\tconst { gl } = this\n\t\tlet textureUnit = textureUnitBase\n\n\t\tfor (const uniformName in uniforms) {\n\t\t\tconst uniformValue = uniforms[uniformName as UniformName]\n\t\t\tif (!uniformValue) continue\n\n\t\t\tlet location = pass.customLocations.get(uniformName)\n\t\t\tif (location === undefined) {\n\t\t\t\tlocation = gl.getUniformLocation(pass.program, uniformName)\n\t\t\t\tpass.customLocations.set(uniformName, location)\n\t\t\t}\n\n\t\t\tif (uniformValue.type === \"sampler2D\") {\n\t\t\t\tthis.bindTexture(uniformName, uniformValue.value, textureUnit)\n\t\t\t\tif (location !== null) gl.uniform1i(location, textureUnit)\n\t\t\t\ttextureUnit++\n\t\t\t} else {\n\t\t\t\tthis.setUniform(location, uniformValue)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Sets every built-in uniform (`u_time`, `u_resolution`, mouse, etc.) for the active\n\t * program. `passWidth` / `passHeight` reflect the dimensions of THIS pass's render\n\t * target \u2014 for buffer passes that's `buffer.width \u00D7 buffer.height`, for the main pass\n\t * it's the canvas size \u2014 so `u_resolution` always matches the framebuffer being drawn.\n\t */\n\tprivate updatePassBuiltIns(\n\t\tpass: PassState,\n\t\telapsedTime: number,\n\t\tdeltaTime: number,\n\t\tmouseInput: MouseInput,\n\t\tpassWidth: number,\n\t\tpassHeight: number,\n\t): void {\n\t\tconst { gl, pixelRatio } = this\n\t\tconst locations = pass.builtInLocations\n\n\t\tif (locations[builtInUniforms.time.name] !== null) {\n\t\t\tgl.uniform1f(locations[builtInUniforms.time.name], elapsedTime)\n\t\t}\n\t\tif (locations[builtInUniforms.resolution.name] !== null) {\n\t\t\tgl.uniform2f(locations[builtInUniforms.resolution.name], passWidth, passHeight)\n\t\t}\n\t\tif (locations[builtInUniforms.deltaTime.name] !== null) {\n\t\t\tgl.uniform1f(locations[builtInUniforms.deltaTime.name], deltaTime)\n\t\t}\n\t\tif (locations[builtInUniforms.pixelRatio.name] !== null) {\n\t\t\tgl.uniform1f(locations[builtInUniforms.pixelRatio.name], pixelRatio)\n\t\t}\n\t\tif (locations[builtInUniforms.mousePosition.name] !== null) {\n\t\t\tgl.uniform4fv(locations[builtInUniforms.mousePosition.name], mouseInput.position)\n\t\t}\n\t\tif (locations[builtInUniforms.mousePointerDown.name] !== null) {\n\t\t\tgl.uniform1f(locations[builtInUniforms.mousePointerDown.name], mouseInput.pointerDown)\n\t\t}\n\t\tif (locations[builtInUniforms.mouseHover.name] !== null) {\n\t\t\tgl.uniform1f(locations[builtInUniforms.mouseHover.name], mouseInput.hover)\n\t\t}\n\t}\n}\n\nfunction createStaticArrayBuffer(gl: WebGL2RenderingContext, data: Float32Array): WebGLBuffer {\n\tconst buffer = gl.createBuffer()\n\tif (!buffer) throw new Error(\"Failed to create buffer\")\n\tgl.bindBuffer(gl.ARRAY_BUFFER, buffer)\n\tgl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW)\n\treturn buffer\n}\n\nfunction bindFullScreenQuadAttribs(\n\tgl: WebGL2RenderingContext,\n\tprogram: WebGLProgram,\n\tpositionBuffer: WebGLBuffer,\n\ttexCoordBuffer: WebGLBuffer,\n): void {\n\tconst positionLocation = gl.getAttribLocation(program, \"a_position\")\n\tif (positionLocation >= 0) {\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer)\n\t\tgl.enableVertexAttribArray(positionLocation)\n\t\tgl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0)\n\t}\n\n\tconst texCoordLocation = gl.getAttribLocation(program, \"a_texCoord\")\n\tif (texCoordLocation >= 0) {\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer)\n\t\tgl.enableVertexAttribArray(texCoordLocation)\n\t\tgl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0)\n\t}\n}\n\nfunction lookupBuiltInLocations(\n\tgl: WebGL2RenderingContext,\n\tprogram: WebGLProgram,\n): Record<BuiltInUniformName, WebGLUniformLocation | null> {\n\treturn {\n\t\t[builtInUniforms.time.name]: gl.getUniformLocation(program, builtInUniforms.time.name),\n\t\t[builtInUniforms.resolution.name]: gl.getUniformLocation(program, builtInUniforms.resolution.name),\n\t\t[builtInUniforms.deltaTime.name]: gl.getUniformLocation(program, builtInUniforms.deltaTime.name),\n\t\t[builtInUniforms.pixelRatio.name]: gl.getUniformLocation(program, builtInUniforms.pixelRatio.name),\n\t\t[builtInUniforms.mousePosition.name]: gl.getUniformLocation(program, builtInUniforms.mousePosition.name),\n\t\t[builtInUniforms.mousePointerDown.name]: gl.getUniformLocation(program, builtInUniforms.mousePointerDown.name),\n\t\t[builtInUniforms.mouseHover.name]: gl.getUniformLocation(program, builtInUniforms.mouseHover.name),\n\t}\n}\n\n/**\n * Creates a buffer-pass texture pre-configured for ping-pong rendering: caller-supplied\n * `filter` (LINEAR for clean upsampling on most formats, NEAREST when the float-linear\n * extension is missing \u2014 decided at the call site), CLAMP_TO_EDGE so sampling outside\n * [0,1] returns the edge pixel instead of repeating. Storage is sized later by\n * `allocateBufferPassStorage` once the canvas dimensions are known.\n */\nfunction createBufferTexture(gl: WebGL2RenderingContext, filter: GLenum): WebGLTexture {\n\tconst texture = gl.createTexture()\n\tif (!texture) throw new Error(\"Failed to create buffer texture\")\n\tgl.bindTexture(gl.TEXTURE_2D, texture)\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter)\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter)\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)\n\treturn texture\n}\n\n/** Creates a framebuffer with `texture` attached as COLOR_ATTACHMENT0 and returns it. */\nfunction createBufferFramebuffer(gl: WebGL2RenderingContext, texture: WebGLTexture): WebGLFramebuffer {\n\tconst fbo = gl.createFramebuffer()\n\tif (!fbo) throw new Error(\"Failed to create buffer framebuffer\")\n\tgl.bindFramebuffer(gl.FRAMEBUFFER, fbo)\n\tgl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0)\n\treturn fbo\n}\n\n/**\n * Throws if the currently-bound framebuffer is not complete. Caller must have called\n * `gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)` immediately prior. The buffer's uniform name +\n * format are included so authors can trace failures back to their config.\n */\nfunction throwIfFramebufferIncomplete(\n\tgl: WebGL2RenderingContext,\n\tuniformName: UniformName,\n\tformat: ShaderBufferFormat,\n): void {\n\tconst status = gl.checkFramebufferStatus(gl.FRAMEBUFFER)\n\tif (status !== gl.FRAMEBUFFER_COMPLETE) {\n\t\tthrow new Error(\n\t\t\t`Shader buffer \"${uniformName}\" framebuffer is incomplete (format: \"${format}\", status: 0x${status.toString(16)}).`,\n\t\t)\n\t}\n}\n\ninterface BufferFormatGL {\n\tinternalFormat: GLenum\n\tuploadFormat: GLenum\n\tpixelType: GLenum\n}\n\n/**\n * Translates a `ShaderBufferFormat` string into the three GL constants `texImage2D`\n * needs (internal storage format, upload format, pixel type). Single source for the\n * mapping \u2014 adding a new format means adding one case here, and TypeScript's\n * exhaustiveness check will flag it at every call site if missed.\n */\nfunction resolveBufferFormatGL(gl: WebGL2RenderingContext, format: ShaderBufferFormat): BufferFormatGL {\n\tswitch (format) {\n\t\tcase \"rgba8\":\n\t\t\treturn { internalFormat: gl.RGBA8, uploadFormat: gl.RGBA, pixelType: gl.UNSIGNED_BYTE }\n\t\tcase \"r8\":\n\t\t\treturn { internalFormat: gl.R8, uploadFormat: gl.RED, pixelType: gl.UNSIGNED_BYTE }\n\t\tcase \"rg16f\":\n\t\t\treturn { internalFormat: gl.RG16F, uploadFormat: gl.RG, pixelType: gl.HALF_FLOAT }\n\t\tcase \"rgba16f\":\n\t\t\treturn { internalFormat: gl.RGBA16F, uploadFormat: gl.RGBA, pixelType: gl.HALF_FLOAT }\n\t\tcase \"rgba32f\":\n\t\t\treturn { internalFormat: gl.RGBA32F, uploadFormat: gl.RGBA, pixelType: gl.FLOAT }\n\t}\n}\n\n/**\n * Returns true for formats that need `EXT_color_buffer_float` to be color-renderable\n * (i.e. usable as an FBO color attachment). The 8-bit normalized formats are renderable\n * in the WebGL2 baseline; everything float is gated on the extension.\n */\nfunction shaderBufferFormatRequiresFloatExt(format: ShaderBufferFormat): boolean {\n\treturn format === \"rg16f\" || format === \"rgba16f\" || format === \"rgba32f\"\n}\n", "/**\n * Naming utilities for shader uniforms. The shader pipeline derives every uniform name\n * from a user-facing key (a propertyControl key, a buffer name, etc.) by applying a\n * stable string transform \u2014 keeping those transforms in one module avoids drift between\n * the head generator (`defineShader`) and the renderer's uniform-location lookups.\n */\nimport { type UniformName, uniformPrefix } from \"./WebGL2ShaderRenderer.ts\"\n\nconst heightmapSuffix = \"_heightmap\"\nconst arrayLengthSuffix = \"_length\"\nconst bufferSuffix = \"_buffer\"\n\n/** Matches any non-word character (anything outside `[A-Za-z0-9_]`). */\nconst nonWordCharPattern = /\\W/gu\n\n/** Type guard for strings that already match the `UniformName` template. */\nexport function isUniformName(s: string): s is UniformName {\n\treturn s.startsWith(uniformPrefix) && s.length > uniformPrefix.length\n}\n\n/** Returns true for the `u_<name>_heightmap` shape produced by `toHeightmapUniformName`. */\nexport function isHeightmapUniformName(s: string): boolean {\n\treturn isUniformName(s) && s.endsWith(heightmapSuffix)\n}\n\n/** Returns true for the `u_<name>_length` shape produced by `toArrayLengthName`. */\nexport function isArrayLengthUniformName(s: string): boolean {\n\treturn isUniformName(s) && s.endsWith(arrayLengthSuffix)\n}\n\n/** Returns true for the `u_<name>_buffer` shape produced by `toBufferUniformName`. */\nexport function isBufferUniformName(s: string): boolean {\n\treturn isUniformName(s) && s.endsWith(bufferSuffix)\n}\n\n/**\n * Replaces non-word chars in `key` with `_` so the result is safe to embed in a uniform name.\n * e.g. `foo-bar` \u2192 `foo_bar`, `foo bar` \u2192 `foo_bar`. Word chars (letters, digits, underscores)\n * pass through unchanged.\n */\nexport function sanitizeUniformKey(key: string): string {\n\treturn key.replace(nonWordCharPattern, \"_\")\n}\n\n/** Converts a control prop key to a valid uniform name. e.g. `fooBar` \u2192 `u_fooBar` */\nexport function toUniformName(key: string): UniformName {\n\treturn `${uniformPrefix}${sanitizeUniformKey(key)}`\n}\n\n/** Appends `_length` to a uniform name. e.g. `u_fooBar` \u2192 `u_fooBar_length` */\nexport function toArrayLengthName(uniformName: string): string {\n\treturn `${uniformName}${arrayLengthSuffix}`\n}\n\n/** Converts a control prop key to a heightmap uniform name. e.g. `logo` \u2192 `u_logo_heightmap` */\nexport function toHeightmapUniformName(key: string): UniformName {\n\treturn `${uniformPrefix}${sanitizeUniformKey(key)}${heightmapSuffix}`\n}\n\n/** Converts a buffer name to its sampler uniform. e.g. `trail` \u2192 `u_trail_buffer` */\nexport function toBufferUniformName(key: string): UniformName {\n\treturn `${uniformPrefix}${sanitizeUniformKey(key)}${bufferSuffix}`\n}\n\n/** Converts a control prop key to a valid array max length name. e.g. `fooBar` \u2192 `NUM_FOO_BAR` */\nexport function toArrayMaxLengthName(key: string): string {\n\tconst keyAsConstantCase = sanitizeUniformKey(key)\n\t\t.replace(/[a-z0-9](?=[A-Z])/g, \"$&_\")\n\t\t.toUpperCase()\n\treturn `NUM_${keyAsConstantCase}`\n}\n", "import {\n\ttype BufferDescriptor,\n\ttype ShaderBufferFormat,\n\ttype UniformValue,\n\tbuiltInUniforms,\n\tshaderBufferFormats,\n\tuniformPrefix,\n} from \"../render/presentation/Shader/WebGL2ShaderRenderer.ts\"\nimport {\n\tisArrayLengthUniformName,\n\tisBufferUniformName,\n\tisHeightmapUniformName,\n\tisUniformName,\n\ttoArrayLengthName,\n\ttoArrayMaxLengthName,\n\ttoBufferUniformName,\n\ttoHeightmapUniformName,\n\ttoUniformName,\n} from \"../render/presentation/Shader/uniformName.ts\"\nimport type {\n\tArrayControlDescription,\n\tBooleanControlDescription,\n\tColorControlDescription,\n\tControlDescription,\n\tEnumControlDescription,\n\tNumberControlDescription,\n\tResponsiveImageControlDescription,\n} from \"../render/types/PropertyControls.ts\"\nimport { ControlType } from \"../render/types/PropertyControls.ts\"\nimport { assertNever } from \"../utils/assert.ts\"\nimport { isNumber, isObject } from \"../utils/utils.ts\"\n\n/**\n * Maps scalar property control types to their corresponding GLSL uniform type declarations.\n */\nfunction controlTypeToGLSLType(controlType: ShaderScalarControlDescription[\"type\"]): UniformValue[\"type\"] {\n\tswitch (controlType) {\n\t\tcase ControlType.Number:\n\t\tcase ControlType.Enum:\n\t\t\treturn \"float\"\n\t\tcase ControlType.Boolean:\n\t\t\t// Booleans are passed as floats (0.0 or 1.0)\n\t\t\treturn \"float\"\n\t\tcase ControlType.Color:\n\t\t\treturn \"vec4\"\n\t\tcase ControlType.ResponsiveImage:\n\t\t\treturn \"sampler2D\"\n\t\tdefault:\n\t\t\tassertNever(controlType)\n\t}\n}\n\n/**\n * GLSL ES 3.0 version directive required by WebGL2.\n * Must be the first line in the shader source.\n */\nexport const glslVersionDirective = \"#version 300 es\"\n\n/**\n * Sets the default precision for float operations to highp (high precision).\n * Required in fragment shaders since GLSL ES has no default float precision.\n */\nexport const glslPrecisionDirective = \"precision highp float;\"\n\n/**\n * UV coordinates input from the vertex shader.\n * Provided as a varying from the default fullscreen quad vertex shader,\n * ranging from (0,0) at bottom-left to (1,1) at top-right.\n */\nexport const glslUVInput = \"in vec2 v_uv;\"\n\n/**\n * Fragment color output variable.\n * The final RGBA color written to the framebuffer for this fragment.\n */\nexport const glslFragColorOutput = \"out vec4 fragColor;\"\n\ninterface ShaderHeadOptions {\n\tpropertyControls?: ShaderControls\n\theightmapSource?: string\n\t/** Names of all buffers in this shader; declared as `sampler2D u_<name>_buffer` so any pass can sample them. */\n\tbufferNames?: readonly string[]\n}\n\n/**\n * Generates the complete shader head that gets prepended to user-provided fragment code.\n * The same head is generated for every pass (main and buffers) \u2014 same `propertyControls`,\n * same built-ins, same cross-buffer samplers (`u_<bufferName>_buffer`). For self-feedback\n * inside a buffer's own pass, sample its own name (`u_<thisBufferName>_buffer`) \u2014 the\n * renderer pins the prior-frame texture to that buffer's reserved unit during its own draw.\n */\nfunction generateShaderHead(options: ShaderHeadOptions = {}): string {\n\tconst { propertyControls, heightmapSource, bufferNames } = options\n\tconst lines: string[] = [glslVersionDirective, glslPrecisionDirective, \"\", glslUVInput, glslFragColorOutput]\n\n\t// Generate custom uniform declarations from property controls\n\tconst values = propertyControls ? Object.values(propertyControls) : []\n\tif (values.length > 0) {\n\t\t// If any controls are arrays, add a #define directive for the array max size\n\t\tconst hasArrays = values.some(control => control?.type === ControlType.Array)\n\t\tif (hasArrays) {\n\t\t\tlines.push(\"\")\n\t\t\tfor (const key in propertyControls) {\n\t\t\t\tconst control = propertyControls[key]\n\t\t\t\tif (!control || control.type !== ControlType.Array) continue\n\t\t\t\tif (control.control?.type !== ControlType.Color) {\n\t\t\t\t\tthrow new Error(`Shader array control \"${key}\" is not supported. Only color arrays may be defined.`)\n\t\t\t\t}\n\t\t\t\tif (!isNumber(control.maxCount)) {\n\t\t\t\t\tthrow new Error(`Shader array control \"${key}\" must have a maxCount.`)\n\t\t\t\t}\n\t\t\t\t// Note: no semicolon\n\t\t\t\tlines.push(`#define ${toArrayMaxLengthName(key)} ${control.maxCount}`)\n\t\t\t}\n\t\t}\n\n\t\t// Uniform declarations\n\t\tlines.push(\"\")\n\t\tfor (const key in propertyControls) {\n\t\t\tconst control = propertyControls[key]\n\t\t\tif (!control) continue\n\n\t\t\t// Define the array uniform **and** its length as `u_<key>_length`\n\t\t\tif (control.type === ControlType.Array) {\n\t\t\t\tconst name = toUniformName(key)\n\t\t\t\tlines.push(`uniform vec4 ${name}[${toArrayMaxLengthName(key)}];`)\n\t\t\t\tlines.push(`uniform int ${toArrayLengthName(name)};`)\n\t\t\t} else {\n\t\t\t\tconst glslType = controlTypeToGLSLType(control.type)\n\t\t\t\tlines.push(`uniform ${glslType} ${toUniformName(key)};`)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Auto-generated heightmap uniform for the designated source image\n\tif (heightmapSource) {\n\t\tlines.push(`uniform sampler2D ${toHeightmapUniformName(heightmapSource)};`)\n\t}\n\n\t// Cross-buffer samplers \u2014 every pass can read every buffer as `u_<bufferName>_buffer`.\n\t// The `_buffer` suffix keeps these from colliding with propertyControls uniforms.\n\tif (bufferNames && bufferNames.length > 0) {\n\t\tlines.push(\"\")\n\t\tfor (const name of bufferNames) {\n\t\t\tlines.push(`uniform sampler2D ${toBufferUniformName(name)};`)\n\t\t}\n\t}\n\n\t// NOTE: Built-in uniforms are always included regardless of whether they're used.\n\t// The GLSL compiler optimizes out unused uniforms, so there's no performance\n\t// impact from declaring them unconditionally.\n\tlines.push(\"\")\n\tfor (const uniform of Object.values(builtInUniforms)) {\n\t\tlines.push(`uniform ${uniform.glslType} ${uniform.name};`)\n\t}\n\tlines.push(\"\")\n\n\treturn lines.join(\"\\n\")\n}\n\n/**\n * Prepares a complete fragment shader by prepending the auto-generated head and the\n * optional shared `common` GLSL section to the user-provided fragment code. The order\n * is `head + common + fragment`, so authors can call into helpers declared in `common`\n * from `void main()` and still see all uniforms in scope inside `common`.\n */\nfunction prepareFragmentShader(fragment: string, common: string | undefined, options: ShaderHeadOptions = {}): string {\n\tconst head = generateShaderHead(options)\n\tif (!common) return head + fragment\n\treturn `${head}${common}\\n${fragment}`\n}\n\nconst defaultBufferResolutionScale = 0.5\nconst defaultBufferFormat: ShaderBufferFormat = \"rgba8\"\n\n/**\n * Resolves user `ShaderBufferConfig` inputs into the post-prep `BufferDescriptor` shape:\n * derives `uniformName`, prepends the auto-generated head to each fragment, and applies\n * defaults for `resolutionScale`/`format`.\n */\nfunction resolveBufferDescriptors(\n\tbuffers: readonly ShaderBufferConfig[] | undefined,\n\tcommon: string | undefined,\n\theadOptions: ShaderHeadOptions,\n): readonly BufferDescriptor[] | undefined {\n\tif (!buffers) return undefined\n\treturn buffers.map(buffer => ({\n\t\tuniformName: toBufferUniformName(buffer.name),\n\t\tfragment: prepareFragmentShader(buffer.fragment, common, headOptions),\n\t\tresolutionScale: buffer.resolutionScale ?? defaultBufferResolutionScale,\n\t\tformat: buffer.format ?? defaultBufferFormat,\n\t}))\n}\n\n/**\n * String constant used to brand objects created by defineShader.\n * We use a string instead of Symbol.for() to avoid side effects that\n * would prevent tree-shaking in published site bundles.\n */\nconst shaderConfigBrand = \"__framer_shaderConfig__\"\n\n/**\n * Checks if an object is a valid (post-prep) shader configuration.\n * @param obj - The object to check\n * @returns True if the object is a valid shader configuration, false otherwise\n * @internal\n */\nexport function isShaderConfig(obj: unknown): obj is ResolvedShaderConfig {\n\treturn isObject(obj) && shaderConfigBrand in obj\n}\n\n/**\n * Scalar control types supported in shader modules.\n * @internal\n */\nexport type ShaderScalarControlDescription =\n\t| NumberControlDescription\n\t| BooleanControlDescription\n\t| ColorControlDescription\n\t| ResponsiveImageControlDescription\n\t| EnumControlDescription\n\n/**\n * Color array control type for shader modules. Note that maxCount is required.\n * @internal\n */\nexport interface ShaderArrayControlDescription extends ArrayControlDescription {\n\tcontrol: ColorControlDescription\n\tmaxCount: number\n}\n\n/**\n * All control types supported in shader modules.\n * @internal\n */\nexport type ShaderControlDescription = ShaderScalarControlDescription | ShaderArrayControlDescription\n\nexport const shaderControlTypes: Record<string, true> = {\n\t[ControlType.Number]: true,\n\t[ControlType.Boolean]: true,\n\t[ControlType.Color]: true,\n\t[ControlType.ResponsiveImage]: true,\n\t[ControlType.Enum]: true,\n\t[ControlType.Array]: true,\n}\n\nexport function isShaderUniformControl<T extends ControlDescription>(\n\tcontrol: T,\n): control is Extract<T, { type: ShaderControlDescription[\"type\"] }> {\n\treturn control.type in shaderControlTypes\n}\n/**\n * Record of shader controls keyed by uniform name.\n * @internal\n */\nexport type ShaderControls = Record<string, ShaderControlDescription>\n\n/**\n * User-facing buffer config. Inherits `fragment` from `BufferDescriptor`, adds the\n * user-supplied `name` (which prep maps to `uniformName`), and relaxes `resolutionScale`\n * / `format` to optional (defaults applied by prep).\n * @internal\n */\nexport interface ShaderBufferConfig extends Omit<BufferDescriptor, \"uniformName\" | \"resolutionScale\" | \"format\"> {\n\tname: string\n\tresolutionScale?: number\n\tformat?: ShaderBufferFormat\n}\n\n/**\n * Shader definition object returned from the defineShader factory function.\n * @internal\n */\nexport interface ShaderConfig<C extends ShaderControls = ShaderControls> {\n\t/**\n\t * Fragment shader GLSL source code (required).\n\t * Only needs to contain void main() and any custom helper functions.\n\t * Version, precision, input/output declarations, and uniforms are auto-generated.\n\t */\n\tfragment: string\n\t/** Vertex shader GLSL source code (optional, uses default if not provided) */\n\tvertex?: string\n\t/** Property controls for shader uniforms */\n\tpropertyControls?: C\n\t/** Display name shown in properties panel and layers panel */\n\ttitle?: string\n\t/**\n\t * Controls the rendering resolution relative to device DPI.\n\t * - `\"performance\"` \u2014 reduced DPI (0.75x), fewer pixels on high-DPI screens\n\t * - `\"consistent\"` \u2014 forces DPR 1 on all screens for identical results across devices\n\t * - `number` \u2014 explicit scale factor applied to device DPI\n\t *\n\t * Defaults to full device DPI when omitted.\n\t * Effective DPI is clamped so the canvas never renders below CSS pixel resolution.\n\t */\n\tresolutionScale?: ShaderResolutionScale\n\t/**\n\t * Key of a ResponsiveImage property control to generate a heightmap for.\n\t * The heightmap is a three-channel texture passed as `u_<key>_heightmap`:\n\t * - Red:   normalized Poisson field (0 at boundary, 1 at deepest center)\n\t * - Green: inverted alpha (1 for transparent/outside, 0 for opaque/inside)\n\t * - Blue:  hard binary shape mask (1 = inside, 0 = outside, no anti-aliasing)\n\t */\n\theightmapSource?: string\n\t/**\n\t * Set explicitly to `false` to avoid continuous `requestAnimationFrame` render loop\n\t * for this shader. `true` (default) or `undefined` will result in continuous rendering.\n\t */\n\tanimated?: boolean\n\t/**\n\t * Enables mouse interactivity for this shader. When set, three uniforms are provided:\n\t *\n\t * - `u_mousePosition` (vec4): `(x, y, velocityX, velocityY)`.\n\t *   Position is element-relative (0\u20131 within bounds, y flipped for GLSL UV), extending\n\t *   outside 0\u20131 when the pointer is off the element. Velocity is in element-relative\n\t *   units per second, useful for directional effects like smudge.\n\t * - `u_mousePointerDown` (float): sprung 0\u21921 value, 1.0 when pointer is pressed.\n\t * - `u_mouseHover` (float): sprung 0\u21921 value, 1.0 when pointer is over the element.\n\t *\n\t * Mouse position follows the pointer instantly by default. Users can add a spring\n\t * transition per-instance via the properties panel to smooth position and state values.\n\t *\n\t * - `\"enabledByDefault\"` \u2014 mouse tracking active when the shader loads\n\t * - `\"disabledByDefault\"` \u2014 mouse tracking supported but off until the user enables it\n\t */\n\tmouse?: ShaderMouseDefault\n\t/**\n\t * Multi-pass buffers. Each buffer is a fullscreen pre-pass rendered to its own ping-pong\n\t * (https://ostefani.dev/tech-notes/ping-pong-technique) texture before the main pass;\n\t * `u_<bufferName>_buffer` samples it from the main pass and from later buffers.\n\t * Inside a buffer's own fragment, sampling its own name (`u_<thisBufferName>_buffer`)\n\t * returns the prior-frame output.\n\t *\n\t * Buffers run in array order each frame.\n\t */\n\tbuffers?: readonly ShaderBufferConfig[]\n\t/**\n\t * Shared GLSL injected into every pass (main and each buffer) between the auto-generated\n\t * head and the user's `void main()`. Useful for helper functions, `#define`s, and struct\n\t * types referenced from multiple passes. All built-in uniforms and propertyControl\n\t * uniforms are in scope, so helpers can read them directly.\n\t */\n\tcommon?: string\n\t/** Brand property for runtime type checking */\n\t__framer_shaderConfig__?: true\n}\n\n/**\n * Post-prep variant of `ShaderConfig` returned by `defineShader`. The user-facing `buffers`\n * list is replaced by resolved `BufferDescriptor`s (defaults applied, `uniformName` set).\n * @internal\n */\nexport interface ResolvedShaderConfig<C extends ShaderControls = ShaderControls> extends Omit<\n\tShaderConfig<C>,\n\t\"buffers\"\n> {\n\tbuffers?: readonly BufferDescriptor[]\n}\n\n/**\n * Resolution scale for shader modules.\n * - `\"performance\"` \u2014 reduced DPI (0.75x)\n * - `\"consistent\"` \u2014 forces DPR 1 on all screens\n * - `number` \u2014 explicit scale factor\n */\nexport type ShaderResolutionScale = \"performance\" | \"consistent\" | number\n\nexport type ShaderMouseDefault = \"enabledByDefault\" | \"disabledByDefault\"\n\n/**\n * Defines a shader module with fragment/vertex shaders, controls, and other shader configuration options.\n *\n * The fragment shader only needs to contain the main() function and any custom\n * helper functions. The following boilerplate is automatically prepended:\n * - Version declaration (#version 300 es)\n * - Precision qualifier (precision highp float)\n * - Input/output declarations (in vec2 v_uv, out vec4 fragColor)\n * - Uniform declarations derived from propertyControls\n * - Built-in uniforms\n *\n * @param shaderConfig - Shader configuration\n * @returns The shader definition with the prepared fragment shader\n *\n * @example\n * ```typescript\n * import { defineShader, ControlType } from \"framer\"\n *\n * export default defineShader({\n *     fragment: `\n *         void main() {\n *             vec2 uv = v_uv * u_speed;\n *             fragColor = vec4(uv, sin(u_time), 1.0);\n *         }\n *     `,\n *     propertyControls: {\n *         speed: { type: ControlType.Number, defaultValue: 0.5, min: 0, max: 5 },\n *     },\n * })\n * ```\n * @internal\n */\nexport function defineShader<C extends ShaderControls>(shaderConfig: ShaderConfig<C>): ResolvedShaderConfig<C> {\n\tvalidateShaderInputs(shaderConfig)\n\n\tconst bufferNames = shaderConfig.buffers ? shaderConfig.buffers.map(b => b.name) : undefined\n\n\tconst preparedMainFragment = prepareFragmentShader(shaderConfig.fragment, shaderConfig.common, {\n\t\tpropertyControls: shaderConfig.propertyControls,\n\t\theightmapSource: shaderConfig.heightmapSource,\n\t\tbufferNames,\n\t})\n\n\tconst resolvedBuffers = resolveBufferDescriptors(shaderConfig.buffers, shaderConfig.common, {\n\t\tpropertyControls: shaderConfig.propertyControls,\n\t\theightmapSource: shaderConfig.heightmapSource,\n\t\tbufferNames,\n\t})\n\n\treturn {\n\t\t...shaderConfig,\n\t\tfragment: preparedMainFragment,\n\t\tbuffers: resolvedBuffers,\n\t\t[shaderConfigBrand]: true as const,\n\t}\n}\n\n/**\n * Validates user inputs to `defineShader` before any prep runs. Catches author mistakes\n * (invalid identifiers, names that would double-wrap or collide with framework-derived\n * uniforms, heightmap source pointing to a non-image control) with clear errors instead\n * of opaque GLSL compile failures.\n */\nfunction validateShaderInputs(shaderConfig: ShaderConfig): void {\n\t// Track every derived uniform identifier we emit \u2014 from propertyControl keys AND buffer\n\t// names \u2014 so two inputs that sanitize to the same identifier (e.g. `foo-bar` vs `foo_bar`,\n\t// both \u2192 `u_foo_bar`) are caught with a clear error rather than silently collapsed into\n\t// one GLSL declaration. Property-control derived names (`u_<key>`) and buffer derived\n\t// names (`u_<name>_buffer`) live in disjoint sub-spaces \u2014 keys ending in `_buffer` are\n\t// already rejected below \u2014 so a single map covers both without false positives.\n\tconst seenDerivedNames = new Map<string, string>()\n\n\tif (shaderConfig.propertyControls) {\n\t\tfor (const key in shaderConfig.propertyControls) {\n\t\t\tif (isUniformName(key) || key === uniformPrefix) {\n\t\t\t\tthrow new Error(`Property control key \"${key}\" must not start with \"${uniformPrefix}\".`)\n\t\t\t}\n\t\t\t// `toUniformName(key)` is the propertyControl's eventual GLSL name; reject keys whose\n\t\t\t// derived name overlaps generated shapes, since same-name uniforms with different\n\t\t\t// types fail to compile.\n\t\t\tconst derivedName = toUniformName(key)\n\t\t\tif (isHeightmapUniformName(derivedName)) {\n\t\t\t\tthrow new Error(`Property control key \"${key}\" must not end with \"_heightmap\".`)\n\t\t\t}\n\t\t\tif (isArrayLengthUniformName(derivedName)) {\n\t\t\t\tthrow new Error(`Property control key \"${key}\" must not end with \"_length\".`)\n\t\t\t}\n\t\t\tif (isBufferUniformName(derivedName)) {\n\t\t\t\tthrow new Error(`Property control key \"${key}\" must not end with \"_buffer\".`)\n\t\t\t}\n\t\t\tconst collidingKey = seenDerivedNames.get(derivedName)\n\t\t\tif (collidingKey !== undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Property control keys \"${collidingKey}\" and \"${key}\" both resolve to the same uniform \"${derivedName}\".`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tseenDerivedNames.set(derivedName, key)\n\t\t}\n\t}\n\tif (shaderConfig.heightmapSource) {\n\t\tconst control = shaderConfig.propertyControls?.[shaderConfig.heightmapSource]\n\t\tif (!control || control.type !== ControlType.ResponsiveImage) {\n\t\t\tthrow new Error(\n\t\t\t\t`heightmapSource \"${shaderConfig.heightmapSource}\" must reference a ResponsiveImage property control.`,\n\t\t\t)\n\t\t}\n\t}\n\tif (shaderConfig.buffers) {\n\t\tfor (const buffer of shaderConfig.buffers) {\n\t\t\tif (isUniformName(buffer.name)) {\n\t\t\t\tthrow new Error(`Shader buffer name \"${buffer.name}\" must not start with \"${uniformPrefix}\".`)\n\t\t\t}\n\t\t\tconst derivedName = toBufferUniformName(buffer.name)\n\t\t\tconst collidingName = seenDerivedNames.get(derivedName)\n\t\t\tif (collidingName !== undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\tcollidingName === buffer.name\n\t\t\t\t\t\t? `Duplicate shader buffer name \"${buffer.name}\".`\n\t\t\t\t\t\t: `Shader buffer names \"${collidingName}\" and \"${buffer.name}\" both resolve to the same uniform \"${derivedName}\".`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tseenDerivedNames.set(derivedName, buffer.name)\n\n\t\t\tif (buffer.resolutionScale !== undefined) {\n\t\t\t\tif (!isNumber(buffer.resolutionScale) || buffer.resolutionScale <= 0 || buffer.resolutionScale > 1) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Shader buffer \"${buffer.name}\" has invalid resolutionScale ${buffer.resolutionScale}. Must be in the range (0, 1].`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (buffer.format !== undefined && !shaderBufferFormats.has(buffer.format)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Shader buffer \"${buffer.name}\" has invalid format \"${buffer.format}\". Must be one of: ${[...shaderBufferFormats].join(\", \")}.`,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport { forwardRef, startTransition, useCallback, useEffect, useId, useLayoutEffect, useState } from \"react\"\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\"\nimport { useObserverRef } from \"../../../components/utils/refHelper.ts\"\nimport { useRenderTargetEnvironment } from \"../../../modules/RenderTargetEnvironmentContext.tsx\"\nimport { useIsOnFramerCanvas } from \"../../../modules/useIsOnFramerCanvas.ts\"\nimport { useSharedIntersectionObserver } from \"../../../modules/useSharedIntersectionObserver.ts\"\nimport { RenderTarget } from \"../../types/RenderEnvironment.ts\"\nimport { FrameWithMotion } from \"../Frame/FrameWithMotion.tsx\"\nimport { ShaderFallbackImage } from \"./ShaderFallbackImage.tsx\"\nimport { ShaderSandboxFallbackImage } from \"./ShaderSandboxFallbackImage.tsx\"\nimport { ShaderWithFallbackOverlay } from \"./ShaderWithFallbackOverlay.tsx\"\nimport { useShaderRenderState } from \"./hooks.ts\"\nimport type { ShaderProps } from \"./types.ts\"\nimport { useShaderMouse } from \"./useShaderMouse.ts\"\nimport { useShaderPoolSlot } from \"./useShaderPool.ts\"\n\n/**\n * Main shader component. Renders fallback, canvas, progressively or instantly based on `mode`.\n *\n * When rendered inside a ShaderPoolProvider (canvas), pool-based context management\n * controls which shaders get WebGL contexts. When no pool exists (published sites),\n * the component renders normally based on `mode`.\n */\nexport const Shader = /* @__PURE__ */ forwardRef<HTMLDivElement, ShaderProps>(function Shader(\n\t{\n\t\tmode = \"instant\",\n\t\tfallbackImage,\n\t\tskipInitialFallback,\n\t\tplaceholder,\n\t\tstyle,\n\t\twidth,\n\t\theight,\n\t\tvertexShader,\n\t\tfragmentShader,\n\t\tanimated,\n\t\tuniforms,\n\t\tonError,\n\t\tonReady,\n\t\tresolutionScale,\n\t\tpoolId,\n\t\tisSelected = false,\n\t\tisMultiSelected = false,\n\t\tisPreviewActive = false,\n\t\theightmapSource,\n\t\tmouse,\n\t\tbuffers,\n\t\t...rest\n\t},\n\tref,\n) {\n\tconst observerRef = useObserverRef<HTMLDivElement>(ref)\n\tconst renderTargetEnvironment = useRenderTargetEnvironment()\n\tconst renderTarget = RenderTarget.current()\n\tconst shouldSkipPreviewFallback = renderTarget === RenderTarget.preview && renderTargetEnvironment === \"preview\"\n\tconst shouldSkipInitialFallback = Boolean(fallbackImage && (skipInitialFallback || shouldSkipPreviewFallback))\n\n\tconst isOnCanvas = useIsOnFramerCanvas()\n\n\tconst mouseDataRef = useShaderMouse(observerRef, isOnCanvas ? undefined : mouse)\n\n\t// Assume visible initially when skipping fallback so above-the-fold shaders\n\t// mount immediately. The observer corrects this for below-the-fold elements.\n\tconst [isIntersecting, setIsIntersecting] = useState(shouldSkipInitialFallback)\n\n\tconst intersectionCallback = useCallback((entry: IntersectionObserverEntry) => {\n\t\tstartTransition(() => setIsIntersecting(entry.isIntersecting))\n\t}, [])\n\n\tuseSharedIntersectionObserver(observerRef, intersectionCallback, { threshold: 0, enabled: true })\n\n\tconst autoId = useId()\n\tconst id = poolId ?? autoId\n\tconst poolSlot = useShaderPoolSlot(id, isSelected, isIntersecting)\n\n\t// Beacon: tell the browser that a shader is going to be rendered.\n\t// This allows headless browsers (screenshotter) to know to wait for the `shader_rendered` mark.\n\tuseEffect(() => {\n\t\tperformance.mark?.(\"shader_register\")\n\t}, [])\n\n\tconst {\n\t\tisFallbackOnly,\n\t\teffectiveAnimated,\n\t\teffectiveSingleFrame,\n\t\teffectiveMode,\n\t\tshouldSkipFallbackOverlay,\n\t\tonContextLost,\n\t\tonUniformResolutionSucceeded,\n\t\tonUniformResolutionFailed,\n\t} = useShaderRenderState(\n\t\tpoolSlot,\n\t\tisSelected,\n\t\tisMultiSelected,\n\t\tisIntersecting,\n\t\tmode,\n\t\tanimated,\n\t\tshouldSkipInitialFallback,\n\t\tisPreviewActive,\n\t)\n\n\tconst [isShaderReady, setIsShaderReady] = useState(false)\n\n\tuseLayoutEffect(() => {\n\t\tif (isFallbackOnly) startTransition(() => setIsShaderReady(false))\n\t}, [isFallbackOnly])\n\n\tconst handleShaderReady = useCallback(() => {\n\t\tstartTransition(() => setIsShaderReady(true))\n\t\tonReady?.()\n\t}, [onReady])\n\n\tconst shaderProps = {\n\t\tvertexShader,\n\t\tfragmentShader,\n\t\tuniforms,\n\t\tresolutionScale,\n\t\tonError,\n\t\tonContextLost,\n\t\tonUniformResolutionSucceeded,\n\t\tonUniformResolutionFailed,\n\t\theightmapSource,\n\t\tbuffers,\n\t}\n\n\tconst containerFrameProps = { style, width, height, ...rest }\n\n\t// When on the canvas, the fallback image is optimised for being swapped out with another one.\n\tif (isOnCanvas) {\n\t\t// Hiding the fallback image with CSS opacity instead of unmounting avoids flickers when switching elements.\n\t\tconst hideFallback = !isFallbackOnly && (shouldSkipInitialFallback || isShaderReady)\n\n\t\treturn (\n\t\t\t<ShaderContainerFrame ref={observerRef} {...containerFrameProps}>\n\t\t\t\t{!isFallbackOnly && (\n\t\t\t\t\t<ShaderWithFallbackOverlay\n\t\t\t\t\t\tmode={effectiveMode}\n\t\t\t\t\t\tskipInitialFallback={shouldSkipFallbackOverlay}\n\t\t\t\t\t\tonReady={handleShaderReady}\n\t\t\t\t\t\t{...shaderProps}\n\t\t\t\t\t\tanimated={effectiveAnimated}\n\t\t\t\t\t\tsingleFrame={effectiveSingleFrame}\n\t\t\t\t\t\tmouseDataRef={mouseDataRef}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<ShaderSandboxFallbackImage src={fallbackImage} hidden={hideFallback} />\n\t\t\t\t{isFallbackOnly && !fallbackImage && placeholder}\n\t\t\t</ShaderContainerFrame>\n\t\t)\n\t}\n\n\t// Suppress fallback while off-screen to prevent a flash when scrolling into view.\n\t// Still show it when visible (context loss, reduced motion).\n\tif (isFallbackOnly) {\n\t\treturn (\n\t\t\t<ShaderContainerFrame ref={observerRef} {...containerFrameProps}>\n\t\t\t\t{shouldSkipFallbackOverlay && !isIntersecting ? null : <ShaderFallbackImage src={fallbackImage} />}\n\t\t\t</ShaderContainerFrame>\n\t\t)\n\t}\n\n\treturn (\n\t\t<ShaderContainerFrame ref={observerRef} {...containerFrameProps}>\n\t\t\t<ShaderWithFallbackOverlay\n\t\t\t\tmode={effectiveMode}\n\t\t\t\tfallbackImage={fallbackImage}\n\t\t\t\tskipInitialFallback={shouldSkipFallbackOverlay}\n\t\t\t\tonReady={onReady}\n\t\t\t\t{...shaderProps}\n\t\t\t\tanimated={effectiveAnimated}\n\t\t\t\tsingleFrame={effectiveSingleFrame}\n\t\t\t\tmouseDataRef={mouseDataRef}\n\t\t\t/>\n\t\t</ShaderContainerFrame>\n\t)\n})\n\nconst ShaderContainerFrame = /* @__PURE__ */ forwardRef<\n\tHTMLDivElement,\n\tComponentPropsWithoutRef<typeof FrameWithMotion> & { children: ReactNode }\n>(function ShaderContainerFrame({ children, style, ...rest }, ref) {\n\tconst styles: MotionStyle = { borderRadius: \"inherit\", cornerShape: \"inherit\", ...style, overflow: \"hidden\" }\n\treturn (\n\t\t<FrameWithMotion ref={ref} __fromCanvasComponent style={styles} {...rest} componentType=\"Shader\">\n\t\t\t{children}\n\t\t</FrameWithMotion>\n\t)\n})\n", "import { memo } from \"react\"\nimport { BackgroundImageComponent } from \"../../style/BackgroundImageComponent.tsx\"\n\nexport const ShaderFallbackImage = /* @__PURE__ */ memo(function ShaderFallbackImage({\n\tsrc,\n}: {\n\tsrc: string | undefined\n}) {\n\tif (!src) return null\n\treturn <BackgroundImageComponent image={{ src, fit: \"fill\", loading: \"lazy\" }} draggable={false} alt=\"\" />\n})\n", "import { memo, startTransition, useEffect, useLayoutEffect, useRef, useState } from \"react\"\nimport { overlayStyle } from \"./helpers.ts\"\n\ntype ShaderSandboxFallbackImageProps = {\n\tsrc: string | undefined\n\thidden?: boolean\n\t/** Called when the displayed fallback image changes (after decode). Skips the initial mount. */\n\tonDisplaySrcChange?: () => void\n}\n\nconst sandboxFallbackImageStyle: React.CSSProperties = {\n\tdisplay: \"block\",\n\twidth: \"100%\",\n\theight: \"100%\",\n\tobjectFit: \"cover\",\n\tposition: \"absolute\",\n\tinset: 0,\n}\n\nconst sandboxFallbackContainerStyle: React.CSSProperties = { position: \"absolute\", inset: 0 }\n\nexport const ShaderSandboxFallbackImage = /* @__PURE__ */ memo(function ShaderSandboxFallbackImage({\n\tsrc,\n\thidden = false,\n\tonDisplaySrcChange,\n}: ShaderSandboxFallbackImageProps) {\n\tconst [displaySrc, setDisplaySrc] = useState<string | undefined>(src)\n\tconst [previousSrc, setPreviousSrc] = useState<string | undefined>(undefined)\n\tconst fadeRef = useRef<HTMLDivElement>(null)\n\n\tconst onDisplaySrcChangeRef = useRef(onDisplaySrcChange)\n\tuseLayoutEffect(() => {\n\t\tonDisplaySrcChangeRef.current = onDisplaySrcChange\n\t}, [onDisplaySrcChange])\n\n\tconst isInitialMountRef = useRef(true)\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: Intentional\n\tuseLayoutEffect(() => {\n\t\tif (isInitialMountRef.current) {\n\t\t\tisInitialMountRef.current = false\n\t\t\treturn\n\t\t}\n\t\t// If there's a previous image, a crossfade will animate \u2014 defer callback\n\t\t// to animation finish so the old image is fully gone first.\n\t\t// prevDisplayRef runs after this effect so it still holds the old value.\n\t\tif (!prevDisplayRef.current) {\n\t\t\tonDisplaySrcChangeRef.current?.()\n\t\t}\n\t}, [displaySrc])\n\n\t// Preload and decode the new image before showing it to avoid flicker\n\tuseEffect(() => {\n\t\tif (src === displaySrc) return\n\n\t\tlet isActive = true\n\n\t\tif (src) {\n\t\t\tconst img = new Image()\n\t\t\timg.src = src\n\n\t\t\tconst setSrc = () => (isActive ? startTransition(() => setDisplaySrc(src)) : void 0)\n\n\t\t\tif (typeof img.decode === \"function\") {\n\t\t\t\timg.decode().then(setSrc).catch(setSrc)\n\t\t\t} else {\n\t\t\t\timg.onload = setSrc\n\t\t\t}\n\t\t} else {\n\t\t\tstartTransition(() => setDisplaySrc(undefined))\n\t\t}\n\n\t\treturn () => {\n\t\t\tisActive = false\n\t\t}\n\t}, [src, displaySrc])\n\n\t// When displaySrc changes, save the old src so it stays visible behind the new one\n\tconst prevDisplayRef = useRef(displaySrc)\n\tuseLayoutEffect(() => {\n\t\tif (displaySrc !== prevDisplayRef.current && prevDisplayRef.current) {\n\t\t\tsetPreviousSrc(prevDisplayRef.current)\n\t\t}\n\t\tprevDisplayRef.current = displaySrc\n\t}, [displaySrc])\n\n\t// Fade in the new image on top of the old one, then remove the old one\n\tuseEffect(() => {\n\t\tconst el = fadeRef.current\n\t\tif (!el || !previousSrc) return\n\n\t\tlet cancelled = false\n\n\t\t// Web Animation API because Framer Motion won't work properly on the canvas\n\t\tconst animation = el.animate([{ opacity: 0 }, { opacity: 1 }], {\n\t\t\tduration: 300,\n\t\t\teasing: \"ease-in-out\",\n\t\t\tfill: \"forwards\",\n\t\t})\n\t\tanimation.onfinish = () => {\n\t\t\tif (!cancelled) {\n\t\t\t\tstartTransition(() => setPreviousSrc(undefined))\n\t\t\t\tonDisplaySrcChangeRef.current?.()\n\t\t\t}\n\t\t}\n\n\t\treturn () => {\n\t\t\tcancelled = true\n\t\t\tanimation.cancel()\n\t\t}\n\t}, [previousSrc])\n\n\tif (!displaySrc) return null\n\n\tconst containerStyle: React.CSSProperties = {\n\t\t...overlayStyle,\n\t\topacity: hidden ? 0 : 1,\n\t\tpointerEvents: hidden ? \"none\" : undefined,\n\t}\n\n\treturn (\n\t\t<div style={containerStyle}>\n\t\t\t{previousSrc && (\n\t\t\t\t<img\n\t\t\t\t\tkey={`prev-${previousSrc}`}\n\t\t\t\t\tsrc={previousSrc}\n\t\t\t\t\tdecoding=\"async\"\n\t\t\t\t\tstyle={sandboxFallbackImageStyle}\n\t\t\t\t\tdraggable={false}\n\t\t\t\t\talt=\"\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t<div key={displaySrc} ref={previousSrc ? fadeRef : undefined} style={sandboxFallbackContainerStyle}>\n\t\t\t\t<img src={displaySrc} style={sandboxFallbackImageStyle} decoding=\"async\" draggable={false} alt=\"\" />\n\t\t\t</div>\n\t\t</div>\n\t)\n})\n", "export interface CSSVarRange {\n\tstart: number\n\tend: number\n\tcommaIndex?: number\n}\n\n/**\n * Since the token metadata can contain `(` and `)` if the shared color name or\n * package contain them, we can't use a regex to just find the contents within\n * the parentheses. This function counts up and down as opening and closing\n * parentheses are encountered, returning the result when the first encountered\n * parenthesis is finally closed, excluding the leading and trailing\n * parentheses. Splitting by the first encountered comma, to return the custom\n * property reference, and the fallback value if provided.\n */\nexport function parseCSSVarRange(input: string, from = 0): CSSVarRange | null {\n\tconst varIndex = input.indexOf(\"var(\", from)\n\tif (varIndex === -1) return null\n\n\tconst start = varIndex + 4 // Starting right after \"var(\".\n\tlet parens = 1 // Already counting the one from \"var(\".\n\tlet commaIndex: number | undefined\n\n\tfor (let index = start; index < input.length; index++) {\n\t\tif (input[index] === \"(\") {\n\t\t\tparens++\n\t\t} else if (input[index] === \")\") {\n\t\t\tparens--\n\n\t\t\tif (parens === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tstart: varIndex,\n\t\t\t\t\tend: index + 1,\n\t\t\t\t\tcommaIndex,\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (commaIndex === undefined && input[index] === \",\") {\n\t\t\t// Track the first comma. If encountered, this marks the divider\n\t\t\t// between the custom property, and the fallback.\n\t\t\tcommaIndex = index\n\t\t}\n\t}\n\t// The opening parenthesis was never closed.\n\treturn null\n}\n\nfunction tokenFromVarRange(\n\tstring: string,\n\trange: CSSVarRange | null,\n): {\n\tcustomProperty?: string\n\tfallback?: string\n\tmetadata?: string\n} {\n\tif (!range) return {}\n\n\tconst { start, end, commaIndex } = range\n\tconst metadata = string.substring(end).trim()\n\n\tif (!commaIndex) {\n\t\treturn { customProperty: string.substring(start + 4, end - 1), metadata }\n\t}\n\n\treturn {\n\t\tcustomProperty: string.substring(start + 4, commaIndex),\n\t\tfallback: string.substring(commaIndex + 1, end - 1).trim(),\n\t\tmetadata,\n\t}\n}\n\nexport function parseCSSVariable(token: string): { customProperty?: string; fallback?: string; metadata?: string } {\n\tconst range = parseCSSVarRange(token)\n\treturn tokenFromVarRange(token, range)\n}\n", "type TextureSource = HTMLImageElement | HTMLCanvasElement\n\n/** Maximum URL-keyed entries in `load`'s store before FIFO eviction. */\nexport const maxLoadedTextures = 30\n\n/** Maximum derived-texture entries in `generate`'s store before FIFO eviction. */\nexport const maxGeneratedTextures = 20\n\n/**\n * Shared cache for textures resolved through the shader uniform pipeline.\n *\n * Two stores, separated by source semantics and memory profile:\n *\n * - `load(key, factory)`: async sources (URL-loaded images). Caches the in-flight\n *   promise so concurrent first loads dedupe to a single network/decode pass.\n *   Rejections are evicted so a retry can succeed. FIFO-evicted past\n *   `maxLoadedTextures` \u2014 entries are cheap (raster `HTMLImageElement`s share\n *   their decoded bytes with the browser image cache), but rasterized SVG\n *   canvases can reach 4096px on the longest side, so the cap matters.\n *\n * - `generate(key, factory)`: synchronously derived textures (heightmaps and\n *   future synthetics). FIFO-evicted past when limit is exceeded; each entry is\n *   a source-image-sized canvas and is usually the heaviest thing in the cache.\n *\n * Identity is the whole point: returning the same `HTMLImageElement` /\n * `HTMLCanvasElement` across renders lets `WebGL2ShaderRenderer.bindTexture`'s\n * reference-equality guard skip the GPU upload on drag-induced rerenders.\n *\n * @internal\n */\nexport class ShaderTextureCache {\n\tprivate loaders = new Map<string, Promise<TextureSource>>()\n\tprivate generated = new Map<string, TextureSource>()\n\n\tload(key: string, factory: () => Promise<TextureSource>): Promise<TextureSource> {\n\t\tconst cached = this.loaders.get(key)\n\t\tif (cached) return cached\n\n\t\tconst promise = factory()\n\t\tpromise.catch(() => {\n\t\t\tif (this.loaders.get(key) === promise) this.loaders.delete(key)\n\t\t})\n\t\tevictOldestIfFull(this.loaders, maxLoadedTextures)\n\t\tthis.loaders.set(key, promise)\n\t\treturn promise\n\t}\n\n\tgenerate(key: string, factory: () => TextureSource | undefined): TextureSource | undefined {\n\t\tconst cached = this.generated.get(key)\n\t\tif (cached) return cached\n\n\t\tconst created = factory()\n\t\tif (!created) return undefined\n\n\t\tevictOldestIfFull(this.generated, maxGeneratedTextures)\n\t\tthis.generated.set(key, created)\n\t\treturn created\n\t}\n\n\tclear(): void {\n\t\tthis.loaders.clear()\n\t\tthis.generated.clear()\n\t}\n\n\t/** @internal Exposed for testing. */\n\tget loadedSize(): number {\n\t\treturn this.loaders.size\n\t}\n\n\t/** @internal Exposed for testing. */\n\tget generatedSize(): number {\n\t\treturn this.generated.size\n\t}\n}\n\nfunction evictOldestIfFull(map: Map<string, unknown>, max: number): void {\n\tif (map.size < max) return\n\tconst oldest = map.keys().next().value\n\tif (oldest !== undefined) map.delete(oldest)\n}\n\nexport const shaderTextureCache = /* @__PURE__ */ new ShaderTextureCache()\n", "/**\n * Heightmap generation for shader modules.\n *\n * Generates a three-channel texture from a transparent image:\n * - Red:   normalized Poisson field (0 at boundary, 255 at deepest center)\n * - Green: inverted alpha from the original image (255 = outside/transparent, 0 = inside/opaque)\n * - Blue:  hard binary shape mask (255 = inside, 0 = outside) \u2014 no anti-aliasing\n *\n * The blue channel exists because bilinear texture filtering at the shape boundary\n * blends inside texels (r=depth, g=0) with outside texels (r=0, g=255), producing\n * pixels where both R and G are non-zero simultaneously. Shaders can threshold B\n * (e.g. `step(0.5, hm.b)`) to get a clean inside/outside decision for masking.\n *\n * Pipeline: scale to 1024 working res (short edge) \u2192 binary mask \u2192\n * 8-connected boundary detection \u2192 Poisson solve \u2192 write R+G+B at working res \u2192 upscale.\n * Working resolution scales by the short edge (1024px min) so wide/tall images get\n * more detail. SVGs arrive pre-rasterized at 4096px from loadTexture.\n * The Poisson solver produces smooth harmonic gradients naturally tolerant to noise.\n * Results are cached via `shaderTextureCache` when the caller provides a cache key.\n */\n\nimport { shaderTextureCache } from \"./shaderTextureCache.ts\"\n\nconst scaledDownWorkingResolution = 1024\n\n/**\n * Subset of TexImageSource that heightmap generation supports.\n * We accept TexImageSource at the public API boundary because that's the\n * type WebGL programs use for texture inputs, keeping the interface\n * consistent and easy to extend. Type guards narrow to this union\n * internally so new sources can be added here without changing callers.\n */\ntype HeightMapSupportedTexImageSource = HTMLImageElement | HTMLCanvasElement\n\n/**\n * Generates a heightmap texture from a source image with transparency.\n * Returns a canvas usable directly as a WebGL texture source.\n *\n * The caller provides cache identity via `getCacheKey` (e.g. URL, data\n * attribute) \u2014 passing `undefined` skips caching entirely.\n */\nexport function generateHeightmap(\n\timage: TexImageSource,\n\tgetCacheKey?: () => string | undefined,\n): HTMLCanvasElement | undefined {\n\tif (!isHeightMapSupportedTexImageSource(image)) return\n\n\tconst cacheKey = getCacheKey?.()\n\tif (!cacheKey) return buildHeightmap(image)\n\n\tconst cached = shaderTextureCache.generate(cacheKey, () => buildHeightmap(image))\n\tif (!(cached instanceof HTMLCanvasElement)) return undefined\n\treturn cached\n}\n\nfunction buildHeightmap(image: HeightMapSupportedTexImageSource): HTMLCanvasElement | undefined {\n\tconst info = getImageInfo(image)\n\tif (!info) return undefined\n\n\t// Scale so the short edge = scaledDownWorkingResolution, then cap total pixel count\n\t// to avoid OOM on extreme aspect ratios (e.g. 12000\u00D7200 would otherwise\n\t// produce a 61440\u00D71024 working canvas).\n\tlet scale = scaledDownWorkingResolution / Math.min(info.width, info.height)\n\tconst maxPixelCount = scaledDownWorkingResolution * scaledDownWorkingResolution\n\tconst uncappedPixels = info.width * scale * (info.height * scale)\n\tif (uncappedPixels > maxPixelCount) {\n\t\tscale *= Math.sqrt(maxPixelCount / uncappedPixels)\n\t}\n\tconst width = Math.max(1, Math.round(info.width * scale))\n\tconst height = Math.max(1, Math.round(info.height * scale))\n\n\t// Draw source image onto a canvas to extract pixel data\n\tconst srcCanvas = document.createElement(\"canvas\")\n\tsrcCanvas.width = width\n\tsrcCanvas.height = height\n\tconst srcCtx = srcCanvas.getContext(\"2d\")\n\tif (!srcCtx) return undefined\n\tsrcCtx.drawImage(info.source, 0, 0, width, height)\n\tconst pixels = srcCtx.getImageData(0, 0, width, height).data\n\n\t// Step 1: Binary shape mask from alpha \u2014 any visible pixel is shape.\n\t// The Poisson solver is naturally noise-tolerant, so no morphological\n\t// filtering is needed.\n\tconst size = width * height\n\tconst mask = new Uint8Array(size)\n\tfor (let i = 0; i < size; i++) {\n\t\tmask[i] = (pixels[i * 4 + 3] ?? 0) > 0 ? 1 : 0\n\t}\n\n\t// Step 2: Classify shape pixels as boundary vs interior (8-connected).\n\t// A shape pixel is \"boundary\" if it has at least one non-shape neighbor\n\t// or sits on the canvas edge. Boundary pixels are pinned at 0,\n\t// interior pixels get their value computed by the Poisson solver.\n\tconst interior = new Uint8Array(size)\n\tfor (let i = 0; i < size; i++) {\n\t\tif (mask[i] === 0) continue\n\t\tconst x = i % width\n\t\tconst y = Math.floor(i / width)\n\t\tif (x === 0 || x === width - 1 || y === 0 || y === height - 1) continue\n\n\t\tlet isBoundary = false\n\t\tfor (let dy = -1; dy <= 1 && !isBoundary; dy++) {\n\t\t\tfor (let dx = -1; dx <= 1 && !isBoundary; dx++) {\n\t\t\t\tif (dx === 0 && dy === 0) continue\n\t\t\t\tif (mask[(y + dy) * width + (x + dx)] === 0) isBoundary = true\n\t\t\t}\n\t\t}\n\t\tif (!isBoundary) interior[i] = 1\n\t}\n\n\t// Step 3: Poisson solve over interior pixels using Red-Black SOR.\n\t// Produces a smooth harmonic field that peaks at the deepest interior\n\t// and falls to 0 at boundaries \u2014 naturally noise-tolerant.\n\tconst field = solvePoissonField(interior, width, height)\n\n\t// Normalize to 0-1 range\n\tlet maxVal = 0\n\tfor (let i = 0; i < size; i++) {\n\t\tconst v = field[i] ?? 0\n\t\tif (v > maxVal) maxVal = v\n\t}\n\n\t// Step 4: Write R (Poisson field), G (inverted alpha), and B (hard mask)\n\t// at working resolution. All channels are upscaled together in step 5.\n\tconst lowResCanvas = document.createElement(\"canvas\")\n\tlowResCanvas.width = width\n\tlowResCanvas.height = height\n\tconst lowResCtx = lowResCanvas.getContext(\"2d\")\n\tif (!lowResCtx) return undefined\n\tconst outData = lowResCtx.createImageData(width, height)\n\tfor (let i = 0; i < size; i++) {\n\t\tconst normalized = maxVal > 0 ? (field[i] ?? 0) / maxVal : 0\n\t\toutData.data[i * 4] = Math.round(normalized * 255) // R = Poisson field\n\t\toutData.data[i * 4 + 1] = 255 - (pixels[i * 4 + 3] ?? 0) // G = inverted alpha\n\t\toutData.data[i * 4 + 2] = mask[i] ? 255 : 0 // B = hard shape mask (no AA)\n\t\toutData.data[i * 4 + 3] = 255 // A = full opacity\n\t}\n\n\tlowResCtx.putImageData(outData, 0, 0)\n\n\t// Step 5: Upscale all channels to output dimensions.\n\t// Bilinear interpolation smooths R and G; B gets interpolated too\n\t// but shaders threshold it at 0.5 for a hard edge.\n\tconst outCanvas = document.createElement(\"canvas\")\n\toutCanvas.width = info.width\n\toutCanvas.height = info.height\n\tconst outCtx = outCanvas.getContext(\"2d\")\n\tif (!outCtx) return undefined\n\toutCtx.imageSmoothingEnabled = true\n\toutCtx.drawImage(lowResCanvas, 0, 0, info.width, info.height)\n\n\treturn outCanvas\n}\n\ninterface ImageInfo {\n\treadonly source: CanvasImageSource\n\treadonly width: number\n\treadonly height: number\n}\n\n/**\n * Solves a Poisson equation over interior shape pixels using Red-Black\n * Successive Over-Relaxation (SOR). Produces a smooth harmonic field\n * that peaks at the deepest interior and falls to 0 at boundaries.\n *\n * Uses a sparse representation \u2014 only interior pixels are iterated,\n * with precomputed neighbor indices. For typical logos covering ~30%\n * of the image, this is ~3x faster than iterating the full grid.\n *\n * Parameters:\n * - omega 1.95: near-optimal SOR relaxation for large grids (theoretical\n *   optimum ~1.99 for 1024px). Conservative enough to avoid oscillation.\n * - iterations 50: tuned for 1024px working resolution. SOR convergence\n *   scales with grid dimension; 50 gives full propagation at 1024px.\n * - sourceTerm 0.01: constant driving term. Scale is arbitrary since the\n *   output is normalized to 0-1.\n *\n * @internal Exported for testing.\n */\nexport function solvePoissonField(\n\tinterior: Readonly<Uint8Array>,\n\twidth: number,\n\theight: number,\n): Readonly<Float32Array> {\n\tconst size = width * height\n\tconst field = new Float32Array(size)\n\n\tconst omega = 1.95\n\tconst sourceTerm = 0.01\n\tconst iterations = 50\n\n\t// Build sparse pixel lists split by red-black checkerboard parity.\n\t// Each list is a flat Int32Array with stride 5: [idx, top, bottom, left, right].\n\t// Neighbor index is -1 for out-of-bounds (reads as 0).\n\tconst redEntries: number[] = []\n\tconst blackEntries: number[] = []\n\tfor (let i = 0; i < size; i++) {\n\t\tif (interior[i] === 0) continue\n\t\tconst x = i % width\n\t\tconst y = Math.floor(i / width)\n\t\tconst entries = (x + y) % 2 === 0 ? redEntries : blackEntries\n\t\tentries.push(\n\t\t\ti,\n\t\t\ty > 0 ? i - width : -1,\n\t\t\ty < height - 1 ? i + width : -1,\n\t\t\tx > 0 ? i - 1 : -1,\n\t\t\tx < width - 1 ? i + 1 : -1,\n\t\t)\n\t}\n\tconst red = new Int32Array(redEntries)\n\tconst black = new Int32Array(blackEntries)\n\n\tconst oneMinusOmega = 1 - omega\n\tconst omegaOver4 = omega / 4\n\n\tfor (let iter = 0; iter < iterations; iter++) {\n\t\t// Standard Red-Black SOR: update all red pixels then all black pixels\n\t\t// within each iteration, so each color benefits from the other's updates.\n\t\tupdatePixels(red, field, oneMinusOmega, omegaOver4, sourceTerm)\n\t\tupdatePixels(black, field, oneMinusOmega, omegaOver4, sourceTerm)\n\t}\n\n\treturn field\n}\n\n/** Processes a sparse pixel list (stride 5) for one SOR half-step. */\nfunction updatePixels(\n\tpixels: Readonly<Int32Array>,\n\tfield: Float32Array,\n\toneMinusOmega: number,\n\tomegaOver4: number,\n\tsourceTerm: number,\n): void {\n\tfor (let j = 0; j < pixels.length; j += 5) {\n\t\tconst idx = pixels[j] ?? 0\n\t\tconst topIdx = pixels[j + 1] ?? -1\n\t\tconst bottomIdx = pixels[j + 2] ?? -1\n\t\tconst leftIdx = pixels[j + 3] ?? -1\n\t\tconst rightIdx = pixels[j + 4] ?? -1\n\n\t\tconst top = topIdx >= 0 ? (field[topIdx] ?? 0) : 0\n\t\tconst bottom = bottomIdx >= 0 ? (field[bottomIdx] ?? 0) : 0\n\t\tconst left = leftIdx >= 0 ? (field[leftIdx] ?? 0) : 0\n\t\tconst right = rightIdx >= 0 ? (field[rightIdx] ?? 0) : 0\n\n\t\tfield[idx] = oneMinusOmega * (field[idx] ?? 0) + omegaOver4 * (sourceTerm + top + bottom + left + right)\n\t}\n}\n\n// NOTE: Extend this with other instance checks in case sources other than\n// image and canvas elements need height map generation support.\nfunction getImageInfo(image: TexImageSource): ImageInfo | undefined {\n\tif (image instanceof HTMLImageElement) {\n\t\tconst w = image.naturalWidth\n\t\tconst h = image.naturalHeight\n\t\treturn w > 0 && h > 0 ? { source: image, width: w, height: h } : undefined\n\t}\n\tif (image instanceof HTMLCanvasElement) {\n\t\treturn image.width > 0 && image.height > 0 ? { source: image, width: image.width, height: image.height } : undefined\n\t}\n\n\treturn undefined\n}\n\nfunction isHeightMapSupportedTexImageSource(image: TexImageSource): image is HeightMapSupportedTexImageSource {\n\treturn image instanceof HTMLImageElement || image instanceof HTMLCanvasElement\n}\n", "import type { ShaderResolutionScale } from \"../../../modules/defineShader.ts\"\nimport { assertNever } from \"../../../utils/assert.ts\"\nimport { isObject, isString } from \"../../../utils/utils.ts\"\nimport { Color, P3Color } from \"../../types/Color/Color.ts\"\nimport { ControlType } from \"../../types/PropertyControls.ts\"\nimport { parseCSSVariable } from \"../../utils/parseCSSVariable.ts\"\nimport type { UniformName, UniformValue, Vec4 } from \"./WebGL2ShaderRenderer.ts\"\nimport { generateHeightmap } from \"./heightmap.ts\"\nimport { shaderTextureCache } from \"./shaderTextureCache.ts\"\nimport type { ShaderMouseData, ShaderUniformInput } from \"./types.ts\"\nimport { toArrayLengthName, toHeightmapUniformName, toUniformName } from \"./uniformName.ts\"\n\nexport const overlayStyle: React.CSSProperties = {\n\tposition: \"absolute\",\n\tinset: 0,\n\twidth: \"100%\",\n\theight: \"100%\",\n}\n\n/**\n * Multiplier to convert milliseconds to seconds.\n * Since we use requestAnimationFrame and performance.now(), the base time we receive in callbacks is in milliseconds.\n */\nexport const timeMultiplier = 0.001\n\n/**\n * Sentinel UV coordinate used when the pointer is absent or outside the element.\n */\nexport const offScreen = -999\n\n/**\n * Default mouse state representing \"no pointer interaction.\"\n * Non-interactive render paths (offscreen fallback worker, shaders without mouse\n * config) pass this explicitly to `WebGL2ShaderRenderer.render` \u2014 avoids the\n * WebGL zero-init trap where `u_mousePosition` would otherwise read as `vec4(0)`\n * (UV origin / bottom-left).\n */\nexport const defaultMouseData: ShaderMouseData = {\n\tposition: [offScreen, offScreen, 0, 0],\n\tpointerDown: 0,\n\thover: 0,\n}\n\n/**\n * Resolves a CSS variable string to its computed color value using the DOM.\n * Falls back to the inline fallback value if the custom property is not defined\n * or no element is available. P3 values are converted to sRGB because shaders\n * only work with sRGB color space.\n */\nexport function resolveCSSVariableColor(color: string, element?: Element | null): string {\n\tconst parsed = parseCSSVariable(color)\n\tif (!parsed.customProperty) return color\n\n\tif (element) {\n\t\tconst resolved = getComputedStyle(element).getPropertyValue(parsed.customProperty).trim()\n\t\tif (resolved) return P3Color.srgbFromValue(resolved)\n\t}\n\n\treturn P3Color.srgbFromValue(parsed.fallback ?? color)\n}\n\n/**\n * Converts a CSS color string to a normalized vec4 array for shader uniforms.\n * RGB values are normalized from 0-255 to 0-1 range.\n *\n * When the color is a CSS variable (e.g. a design token), the element is used\n * to resolve the variable via getComputedStyle before conversion.\n */\nexport function colorToVec4(color: string, element?: Element | null): Vec4 {\n\tconst resolved = resolveCSSVariableColor(color, element)\n\tconst rgba = Color.toRgb(Color(resolved))\n\treturn [rgba.r / 255, rgba.g / 255, rgba.b / 255, rgba.a]\n}\n\n/**\n * Loads an image from a URL for use as a WebGL texture.\n *\n * SVGs arrive rasterized at 4096px on the longest side (texture filtering handles\n * downscaling). Uses HTMLImageElement instead of createImageBitmap to preserve the\n * browser's native decoding, color-management, and premultiplied-alpha behavior\n * for `texImage2D`.\n */\nexport function loadTexture(url: string): Promise<HTMLImageElement | HTMLCanvasElement> {\n\treturn shaderTextureCache.load(url, () => loadTextureFromNetwork(url))\n}\n\nfunction loadTextureFromNetwork(url: string): Promise<HTMLImageElement | HTMLCanvasElement> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst img = new Image()\n\t\timg.crossOrigin = \"anonymous\"\n\t\timg.onload = () => resolve(rasterizeSVGAtFixedRes(img) ?? img)\n\t\timg.onerror = event => {\n\t\t\tconst message =\n\t\t\t\tevent instanceof ErrorEvent && event.message\n\t\t\t\t\t? `Failed to load texture from \"${url}\": ${event.message}`\n\t\t\t\t\t: `Failed to load texture from \"${url}\"`\n\t\t\treject(new Error(message))\n\t\t}\n\t\timg.src = url\n\t})\n}\n\n/**\n * Returns a stable cache key for a texture source.\n * HTMLImageElement uses its src URL. HTMLCanvasElement uses data-src\n * (set during SVG rasterization to preserve the original image URL).\n * @internal Exported for testing.\n */\nexport function getTextureCacheKey(image: TexImageSource): string | undefined {\n\tif (image instanceof HTMLImageElement) return image.src || undefined\n\tif (image instanceof HTMLCanvasElement) return image.dataset.src || undefined\n\treturn undefined\n}\n\nconst svgExtension = \".svg\"\n\n/** Fixed high resolution for SVG rasterization. Matches Paper's approach. */\nconst svgRasterSize = 4096\n\n/**\n * Re-rasterizes an SVG at a fixed high resolution (4096px on longest side).\n * The browser re-renders the vector source at the target canvas dimensions,\n * producing crisp edges regardless of element size. The GPU handles\n * downscaling via texture filtering (LINEAR_MIPMAP_LINEAR).\n *\n * Returns undefined for non-SVG images.\n */\nfunction rasterizeSVGAtFixedRes(image: HTMLImageElement): HTMLCanvasElement | undefined {\n\tif (!isSVGSource(image.src)) return undefined\n\n\tconst w = image.naturalWidth\n\tconst h = image.naturalHeight\n\tif (w <= 0 || h <= 0) return undefined\n\n\tconst scale = svgRasterSize / Math.max(w, h)\n\tconst targetW = Math.max(1, Math.round(w * scale))\n\tconst targetH = Math.max(1, Math.round(h * scale))\n\n\tconst canvas = document.createElement(\"canvas\")\n\tcanvas.width = targetW\n\tcanvas.height = targetH\n\tconst ctx = canvas.getContext(\"2d\")\n\tif (!ctx) return undefined\n\n\tctx.drawImage(image, 0, 0, targetW, targetH)\n\n\t// Preserve the source URL so downstream consumers (e.g. heightmap cache)\n\t// can identify this canvas as originating from a specific image.\n\tcanvas.dataset.src = image.src\n\n\treturn canvas\n}\n\nfunction isSVGSource(url: string): boolean {\n\ttry {\n\t\tconst pathname = new URL(url, \"https://placeholder\").pathname.toLowerCase()\n\t\treturn pathname.endsWith(svgExtension)\n\t} catch {\n\t\treturn url.toLowerCase().includes(svgExtension)\n\t}\n}\n\n/**\n * Resolves a single uniform input to its WebGL-compatible value.\n * Immediate values resolve instantly, textures are loaded from their URL.\n * Color uniforms that contain CSS variables are resolved via the element's computed style.\n */\nexport async function resolveUniform(\n\tuniform: ShaderUniformInput,\n\telement?: Element | null,\n): Promise<UniformValue | undefined> {\n\tswitch (uniform.type) {\n\t\tcase ControlType.Number:\n\t\tcase ControlType.Enum:\n\t\t\treturn { type: \"float\", value: uniform.value }\n\t\tcase ControlType.Boolean:\n\t\t\treturn { type: \"boolean\", value: uniform.value }\n\t\tcase ControlType.Color:\n\t\t\treturn { type: \"vec4\", value: colorToVec4(uniform.value, element) }\n\t\tcase ControlType.ResponsiveImage: {\n\t\t\tlet url: string | undefined\n\n\t\t\tif (isString(uniform.value)) {\n\t\t\t\turl = uniform.value\n\t\t\t} else if (isObject(uniform.value) && \"src\" in uniform.value) {\n\t\t\t\turl = uniform.value.src\n\t\t\t}\n\n\t\t\tif (!url) return\n\n\t\t\tconst image = await loadTexture(url)\n\t\t\treturn { type: \"sampler2D\", value: image }\n\t\t}\n\t\tcase ControlType.Array:\n\t\t\treturn { type: \"vec4[]\", value: uniform.value.map(color => colorToVec4(color, element)) }\n\t\tdefault:\n\t\t\tassertNever(uniform)\n\t}\n}\n\n/**\n * Resolves all uniform inputs to WebGL-compatible values. Adds `u_<key>_length` for arrays.\n * Color uniforms that contain CSS variables are resolved via the element's computed style.\n *\n * When `heightmapSource` is set, also generates a heightmap texture from the referenced\n * image uniform and adds it as `u_<key>_heightmap`.\n */\nexport async function resolveUniforms(\n\tuniforms: Record<UniformName, ShaderUniformInput>,\n\telement?: Element | null,\n\theightmapSource?: string,\n): Promise<Record<UniformName, UniformValue>> {\n\tconst result: Record<string, UniformValue> = {}\n\tconst heightmapSourceUniform = heightmapSource ? toUniformName(heightmapSource) : undefined\n\n\tfor (const [name, uniform] of Object.entries(uniforms)) {\n\t\tconst resolved = await resolveUniform(uniform, element)\n\t\tif (!resolved) continue\n\n\t\tresult[name] = resolved\n\n\t\tif (uniform.type === ControlType.Array) {\n\t\t\tresult[toArrayLengthName(name)] = { type: \"int\", value: uniform.value.length }\n\t\t}\n\n\t\t// Generate heightmap for the designated source image\n\t\tif (heightmapSource && heightmapSourceUniform && name === heightmapSourceUniform && resolved.type === \"sampler2D\") {\n\t\t\tconst heightmap = generateHeightmap(resolved.value, () => getTextureCacheKey(resolved.value))\n\t\t\tif (heightmap) {\n\t\t\t\tresult[toHeightmapUniformName(heightmapSource)] = { type: \"sampler2D\", value: heightmap }\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result\n}\n\nexport function closeImageBitmaps(uniforms: Record<string, UniformValue>): void {\n\tfor (const uniform of Object.values(uniforms)) {\n\t\tif (uniform.type === \"sampler2D\" && uniform.value instanceof ImageBitmap) {\n\t\t\tuniform.value.close()\n\t\t}\n\t}\n}\n\nexport function resolveResolutionScale(scale: ShaderResolutionScale | undefined): number {\n\tif (typeof scale === \"number\") return scale\n\tif (scale === \"performance\") return 0.75\n\tif (scale === \"consistent\") return 0\n\treturn 1\n}\n\n/**\n * Calculates shader timing values from a raw millisecond timestamp.\n */\nexport function getShaderTiming(timeMs: number, startTime: number, lastTime: number) {\n\tconst currentTime = timeMs * timeMultiplier\n\tconst elapsedTime = currentTime - startTime\n\t// Use a sensible default for the first frame when lastTime equals startTime\n\tconst deltaTime = lastTime === startTime ? 1 / 60 : currentTime - lastTime\n\treturn { currentTime, elapsedTime, deltaTime }\n}\n", "import { memo, startTransition, useCallback, useEffect, useLayoutEffect, useRef, useState } from \"react\"\nimport { ShaderCanvas } from \"./ShaderCanvas.tsx\"\nimport { ShaderFallbackImage } from \"./ShaderFallbackImage.tsx\"\nimport { overlayStyle } from \"./helpers.ts\"\nimport { usePatchDelayShaderRender } from \"./hooks.ts\"\nimport type { ShaderMouseData, ShaderProps } from \"./types.ts\"\n\ntype ShaderWithFallbackOverlayProps = Pick<\n\tShaderProps,\n\t| \"fallbackImage\"\n\t| \"skipInitialFallback\"\n\t| \"vertexShader\"\n\t| \"fragmentShader\"\n\t| \"animated\"\n\t| \"resolutionScale\"\n\t| \"uniforms\"\n\t| \"onError\"\n\t| \"onReady\"\n\t| \"mode\"\n\t| \"onContextLost\"\n\t| \"onUniformResolutionSucceeded\"\n\t| \"onUniformResolutionFailed\"\n\t| \"heightmapSource\"\n\t| \"buffers\"\n> & {\n\t/** Pass through to ShaderCanvas for pool-based single-frame rendering. */\n\tsingleFrame?: boolean\n\t/** Ref to mouse interaction data. */\n\tmouseDataRef?: React.RefObject<ShaderMouseData>\n}\n\nconst SHADER_PLAY_DELAY = 250\n\nexport const ShaderWithFallbackOverlay = /* @__PURE__ */ memo(function ShaderWithFallbackOverlay({\n\tmode,\n\tfallbackImage,\n\tskipInitialFallback,\n\tvertexShader,\n\tfragmentShader,\n\tanimated,\n\tresolutionScale,\n\tuniforms,\n\tonError,\n\tonReady,\n\tsingleFrame,\n\tonContextLost,\n\tonUniformResolutionSucceeded,\n\tonUniformResolutionFailed,\n\theightmapSource,\n\tmouseDataRef,\n\tbuffers,\n}: ShaderWithFallbackOverlayProps) {\n\tconst [isShaderReady, setIsShaderReady] = useState(false)\n\tconst [shouldPlay, setShouldPlay] = useState(false)\n\n\t// When mode is progressive, the fallback image is shown initially\n\t// and then the real shader is rendered. (production / published site)\n\tconst isProgressive = mode === \"progressive\"\n\tconst hasFallbackImage = Boolean(fallbackImage)\n\tconst shouldSkipInitialFallback = Boolean(skipInitialFallback && hasFallbackImage)\n\tconst isFallbackShown = isProgressive && hasFallbackImage && !shouldSkipInitialFallback\n\tconst isRevealDelayComplete = usePatchDelayShaderRender(isFallbackShown)\n\n\t// Keep `handleReady` stable, but still call the latest `onReady`\n\tconst onReadyRef = useRef(onReady)\n\n\tuseLayoutEffect(() => {\n\t\tonReadyRef.current = onReady\n\t}, [onReady])\n\n\tconst handleReady = useCallback(() => {\n\t\tstartTransition(() => setIsShaderReady(true))\n\t\tonReadyRef.current?.()\n\t}, [])\n\n\t// Progressive mode: once the first frame has painted, start playing after a delay\n\t// to make the swap between the fallback and the shader less noticeable.\n\tuseEffect(() => {\n\t\t// If not progressive mode, shader plays right away\n\t\tif (!isProgressive) return\n\n\t\t// The shader calls `handleReady` when the first frame has painted.\n\t\t// `isRevealDelayComplete` is true after our delay has completed.\n\t\tif (!isShaderReady || !isRevealDelayComplete) return\n\n\t\t// Finally, we start playing the shader after a further delay to\n\t\t// make the swap less noticeable.\n\t\tconst timeout = window.setTimeout(() => {\n\t\t\tstartTransition(() => setShouldPlay(true))\n\t\t}, SHADER_PLAY_DELAY)\n\n\t\treturn () => {\n\t\t\tclearTimeout(timeout)\n\t\t}\n\t}, [isProgressive, isRevealDelayComplete, isShaderReady])\n\n\tconst shouldHideCanvas = isFallbackShown && !isRevealDelayComplete\n\n\t// In progressive mode, use singleFrame rendering until the reveal sequence completes.\n\t// This renders a single frame at t=0 (matching the fallback) until playback starts.\n\t// When skipInitialFallback is set, bypass the progressive reveal entirely and play immediately.\n\tconst isWaitingForPlayback = isProgressive && !shouldSkipInitialFallback && !shouldPlay\n\tconst effectiveSingleFrame = singleFrame || shouldHideCanvas || isWaitingForPlayback\n\tconst shouldShowFallback =\n\t\thasFallbackImage && !shouldSkipInitialFallback && (!isRevealDelayComplete || !isShaderReady)\n\n\treturn (\n\t\t<>\n\t\t\t<div style={{ ...overlayStyle, opacity: shouldHideCanvas ? 0 : 1 }}>\n\t\t\t\t<ShaderCanvas\n\t\t\t\t\tvertexShader={vertexShader}\n\t\t\t\t\tfragmentShader={fragmentShader}\n\t\t\t\t\tanimated={animated}\n\t\t\t\t\tresolutionScale={resolutionScale}\n\t\t\t\t\tsingleFrame={effectiveSingleFrame}\n\t\t\t\t\tuniforms={uniforms}\n\t\t\t\t\tonError={onError}\n\t\t\t\t\tonReady={handleReady}\n\t\t\t\t\tonContextLost={onContextLost}\n\t\t\t\t\tonUniformResolutionSucceeded={onUniformResolutionSucceeded}\n\t\t\t\t\tonUniformResolutionFailed={onUniformResolutionFailed}\n\t\t\t\t\theightmapSource={heightmapSource}\n\t\t\t\t\tmouseDataRef={mouseDataRef}\n\t\t\t\t\tbuffers={buffers}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{fallbackImage && !shouldSkipInitialFallback && (\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\t...overlayStyle,\n\t\t\t\t\t\topacity: shouldShowFallback ? 1 : 0,\n\t\t\t\t\t\ttransition: \"opacity 200ms ease-in-out\",\n\t\t\t\t\t\tpointerEvents: \"none\",\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<ShaderFallbackImage src={fallbackImage} />\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</>\n\t)\n})\n", "import { useCallback, useEffect, useLayoutEffect, useRef } from \"react\"\nimport { WebGL2ShaderRenderer } from \"./WebGL2ShaderRenderer.ts\"\nimport { DEFAULT_FRAGMENT_SHADER, DEFAULT_VERTEX_SHADER } from \"./defaultShaders.ts\"\nimport { defaultMouseData, getShaderTiming, resolveResolutionScale, timeMultiplier } from \"./helpers.ts\"\nimport { useCanvasResize, useResolvedUniforms } from \"./hooks.ts\"\nimport type { ShaderMouseData, ShaderProps } from \"./types.ts\"\n\ntype ShaderCanvasProps = Pick<\n\tShaderProps,\n\t| \"vertexShader\"\n\t| \"fragmentShader\"\n\t| \"animated\"\n\t| \"resolutionScale\"\n\t| \"uniforms\"\n\t| \"onError\"\n\t| \"onContextLost\"\n\t| \"onUniformResolutionSucceeded\"\n\t| \"onUniformResolutionFailed\"\n\t| \"heightmapSource\"\n\t| \"buffers\"\n> & {\n\tonReady?: () => void\n\t/**\n\t * When true, no continuous rAF loop runs. Instead, a single frame is rendered\n\t * at t=0 on mount and whenever resolvedUniforms change or the canvas resizes.\n\t * Used by the pool system for non-selected shaders that hold a WebGL context,\n\t * and by progressive mode while waiting for reveal.\n\t */\n\tsingleFrame?: boolean\n\t/** Ref to mouse interaction data. Updated externally each frame. */\n\tmouseDataRef?: React.RefObject<ShaderMouseData>\n}\n\nconst canvasStyle: React.CSSProperties = {\n\tdisplay: \"block\",\n\twidth: \"100%\",\n\theight: \"100%\",\n}\n\n/**\n * WebGL2 canvas for rendering custom fragment shaders.\n *\n * Uniforms can include texture URLs (type: \"texture\") which are automatically\n * loaded and converted to sampler2D uniforms for the shader.\n */\nexport function ShaderCanvas({\n\tvertexShader = DEFAULT_VERTEX_SHADER,\n\tfragmentShader = DEFAULT_FRAGMENT_SHADER,\n\tanimated = true,\n\tresolutionScale,\n\tuniforms,\n\tonError,\n\tonReady,\n\tonContextLost,\n\tonUniformResolutionSucceeded,\n\tonUniformResolutionFailed,\n\tsingleFrame = false,\n\theightmapSource,\n\tmouseDataRef,\n\tbuffers,\n}: ShaderCanvasProps) {\n\tconst canvasRef = useRef<HTMLCanvasElement>(null)\n\tconst rendererRef = useRef<WebGL2ShaderRenderer | null>(null)\n\tconst animationFrameRef = useRef<number>(0)\n\tconst startTimeRef = useRef<number>(0)\n\tconst lastTimeRef = useRef<number>(0)\n\tconst shaderRenderedFrameRef = useRef<number | null>(null)\n\n\t// Store callbacks in refs so the WebGL setup effect doesn't re-run when they change.\n\tconst onReadyRef = useRef(onReady)\n\tuseLayoutEffect(() => {\n\t\tonReadyRef.current = onReady\n\t}, [onReady])\n\n\tconst onContextLostRef = useRef(onContextLost)\n\tuseLayoutEffect(() => {\n\t\tonContextLostRef.current = onContextLost\n\t}, [onContextLost])\n\n\tconst { resolvedUniforms, haveUniformsResolved } = useResolvedUniforms(\n\t\tuniforms,\n\t\tcanvasRef,\n\t\theightmapSource,\n\t\tonUniformResolutionSucceeded,\n\t\tonUniformResolutionFailed,\n\t)\n\n\t// Store resolved uniforms in a ref so animate callback doesn't need to depend on them.\n\t// This breaks the dependency chain that would otherwise cause WebGL context recreation on uniform changes.\n\tconst resolvedUniformsRef = useRef(resolvedUniforms)\n\n\t// Store animated in a ref so the animate loop doesn't depend on props directly,\n\t// avoiding WebGL context recreation when animation state changes.\n\tconst animatedRef = useRef(animated)\n\tuseLayoutEffect(() => {\n\t\tanimatedRef.current = animated\n\t}, [animated])\n\n\tconst singleFrameRef = useRef(singleFrame)\n\tuseLayoutEffect(() => {\n\t\tsingleFrameRef.current = singleFrame\n\t}, [singleFrame])\n\n\t// Tracks whether onReady has been signalled for the current renderer instance.\n\t// Reset in the setup effect when the renderer is recreated.\n\tconst readySignalledRef = useRef(false)\n\n\t/** Signal ready after the first frame where uniforms have been resolved. */\n\tconst signalReadyIfNeeded = useCallback(() => {\n\t\tif (readySignalledRef.current || !haveUniformsResolved) return\n\t\treadySignalledRef.current = true\n\t\tonReadyRef.current?.()\n\t\t// Mark on the next rAF so the draw has had a chance to reach the browser's paint pipeline.\n\t\tshaderRenderedFrameRef.current = requestAnimationFrame(() => {\n\t\t\tshaderRenderedFrameRef.current = null\n\n\t\t\t// Beacon: tell headless browsers (screenshotter) that the shader has finished\n\t\t\t// rendering the first frame and that it's safe to screenshot now\n\t\t\tperformance.mark?.(\"shader_rendered\")\n\t\t})\n\t}, [haveUniformsResolved])\n\n\t// Cached CSS size + DPR, populated from ResizeObserver and useOnDprChange callbacks.\n\t// `maybeResize` compares cached vs last-applied so the per-frame call is a no-op when\n\t// nothing has changed \u2014 `renderer.resize()` only runs on real change events.\n\tconst currentSizeRef = useRef({ width: 0, height: 0, dpr: 0 })\n\tconst lastAppliedSizeRef = useRef({ width: 0, height: 0, dpr: 0 })\n\n\tconst updateCurrentSize = useCallback(() => {\n\t\tconst canvas = canvasRef.current\n\t\tif (!canvas) return\n\t\tcurrentSizeRef.current = {\n\t\t\twidth: canvas.offsetWidth,\n\t\t\theight: canvas.offsetHeight,\n\t\t\tdpr: window.devicePixelRatio,\n\t\t}\n\t}, [])\n\n\tconst maybeResize = useCallback(() => {\n\t\tconst renderer = rendererRef.current\n\t\tif (!renderer) return\n\t\tconst current = currentSizeRef.current\n\t\tconst last = lastAppliedSizeRef.current\n\t\tif (current.width === last.width && current.height === last.height && current.dpr === last.dpr) return\n\t\trenderer.resize()\n\t\tlastAppliedSizeRef.current = { ...current }\n\t}, [])\n\n\tconst animate = useCallback(\n\t\t(time: number) => {\n\t\t\tconst renderer = rendererRef.current\n\t\t\tif (!renderer) return\n\n\t\t\t// If we've transitioned to single-frame mode, render one final frame at t=0\n\t\t\t// and stop the loop. This prevents a flash of the last animated time.\n\t\t\tif (singleFrameRef.current) {\n\t\t\t\tif (!haveUniformsResolved) return\n\t\t\t\tmaybeResize()\n\t\t\t\trenderer.render(0, 0, resolvedUniformsRef.current, mouseDataRef?.current ?? defaultMouseData)\n\t\t\t\tsignalReadyIfNeeded()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Skip the draw until async uniform resolution has settled \u2014 otherwise the\n\t\t\t// first frame composes from zero-init custom uniforms and flashes black.\n\t\t\t// Keep the loop alive so we pick up the resolved ref on the next tick.\n\t\t\tif (!haveUniformsResolved) {\n\t\t\t\tanimationFrameRef.current = requestAnimationFrame(animate)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// On the first frame after uniforms become ready, anchor t=0 to now so\n\t\t\t// shaders with intro animations don't skip past their start.\n\t\t\tif (!readySignalledRef.current) {\n\t\t\t\tstartTimeRef.current = time * timeMultiplier\n\t\t\t\tlastTimeRef.current = startTimeRef.current\n\t\t\t}\n\n\t\t\tmaybeResize()\n\n\t\t\tconst { currentTime, elapsedTime, deltaTime } = getShaderTiming(time, startTimeRef.current, lastTimeRef.current)\n\t\t\tlastTimeRef.current = currentTime\n\t\t\trenderer.render(elapsedTime, deltaTime, resolvedUniformsRef.current, mouseDataRef?.current ?? defaultMouseData)\n\n\t\t\tsignalReadyIfNeeded()\n\n\t\t\tif (!singleFrameRef.current && animatedRef.current) {\n\t\t\t\tanimationFrameRef.current = requestAnimationFrame(animate)\n\t\t\t}\n\t\t},\n\t\t[haveUniformsResolved, signalReadyIfNeeded, mouseDataRef, maybeResize],\n\t)\n\n\t/** Render a single frame at t=0 with current uniforms. */\n\tconst renderSingleFrame = useCallback(() => {\n\t\tconst renderer = rendererRef.current\n\t\tif (!renderer || !haveUniformsResolved) return\n\t\tmaybeResize()\n\t\trenderer.render(0, 0, resolvedUniformsRef.current, mouseDataRef?.current ?? defaultMouseData)\n\t\tsignalReadyIfNeeded()\n\t}, [haveUniformsResolved, mouseDataRef, signalReadyIfNeeded, maybeResize])\n\n\t// Sync resolved uniforms ref and re-render in single-frame mode when they change.\n\tuseLayoutEffect(() => {\n\t\tresolvedUniformsRef.current = resolvedUniforms\n\t\tif (singleFrameRef.current && rendererRef.current) {\n\t\t\trenderSingleFrame()\n\t\t}\n\t}, [resolvedUniforms, renderSingleFrame])\n\n\tuseEffect(() => {\n\t\tconst canvas = canvasRef.current\n\t\t// Defer renderer creation until uniforms resolve. Drawing earlier would\n\t\t// render with zero-init custom uniforms, and creating a context that gets\n\t\t// disposed when resolution fails wastes a WebGL slot.\n\t\tif (!canvas || !haveUniformsResolved) return\n\n\t\treadySignalledRef.current = false\n\n\t\ttry {\n\t\t\tconst renderer = new WebGL2ShaderRenderer(\n\t\t\t\tcanvas,\n\t\t\t\tvertexShader,\n\t\t\t\tfragmentShader,\n\t\t\t\tresolveResolutionScale(resolutionScale),\n\t\t\t\tonContextLostRef.current,\n\t\t\t\tbuffers,\n\t\t\t)\n\t\t\trendererRef.current = renderer\n\t\t\t// Reset the last-applied tracker so the new renderer always gets its first resize()\n\t\t\t// call \u2014 otherwise a `resolutionScale` change (which recreates the renderer but\n\t\t\t// leaves CSS size + DPR unchanged) would skip the call and leave canvas dims and\n\t\t\t// `u_pixelRatio` at the constructor defaults.\n\t\t\tlastAppliedSizeRef.current = { width: 0, height: 0, dpr: 0 }\n\t\t\tupdateCurrentSize()\n\t\t\tmaybeResize()\n\t\t\tstartTimeRef.current = performance.now() * timeMultiplier\n\t\t\tlastTimeRef.current = startTimeRef.current\n\n\t\t\tif (singleFrameRef.current) {\n\t\t\t\trenderSingleFrame()\n\t\t\t} else {\n\t\t\t\tanimationFrameRef.current = requestAnimationFrame(animate)\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t// Shader compilation or context creation failed - notify rendering context via callback if provided\n\t\t\tif (onError && error instanceof Error) {\n\t\t\t\tonError(error)\n\t\t\t}\n\t\t}\n\n\t\treturn () => {\n\t\t\tcancelAnimationFrame(animationFrameRef.current)\n\t\t\tif (shaderRenderedFrameRef.current !== null) cancelAnimationFrame(shaderRenderedFrameRef.current)\n\t\t\trendererRef.current?.dispose()\n\t\t\trendererRef.current = null\n\t\t}\n\t}, [\n\t\tvertexShader,\n\t\tfragmentShader,\n\t\tresolutionScale,\n\t\tanimate,\n\t\trenderSingleFrame,\n\t\tonError,\n\t\tbuffers,\n\t\thaveUniformsResolved,\n\t\tupdateCurrentSize,\n\t\tmaybeResize,\n\t])\n\n\t// When leaving single-frame or non-animated state, reset timing so animation\n\t// starts from t=0 (matching the frozen frame the user was seeing) and\n\t// restart the rAF loop.\n\tconst wasAnimatedRef = useRef(animated)\n\tconst wasReactiveRef = useRef(singleFrame)\n\tuseEffect(() => {\n\t\tconst becameAnimated = animated && !wasAnimatedRef.current\n\t\tconst leftReactive = !singleFrame && wasReactiveRef.current\n\n\t\tif ((becameAnimated || leftReactive) && rendererRef.current) {\n\t\t\tstartTimeRef.current = performance.now() * timeMultiplier\n\t\t\tlastTimeRef.current = startTimeRef.current\n\t\t\tanimationFrameRef.current = requestAnimationFrame(animate)\n\t\t}\n\n\t\twasAnimatedRef.current = animated\n\t\twasReactiveRef.current = singleFrame\n\t}, [animated, singleFrame, animate])\n\n\tconst handleResize = useCallback(() => {\n\t\tconst renderer = rendererRef.current\n\t\tif (!renderer || !haveUniformsResolved) return\n\n\t\tupdateCurrentSize()\n\n\t\tif (singleFrameRef.current) {\n\t\t\trenderSingleFrame()\n\t\t\treturn\n\t\t}\n\n\t\tmaybeResize()\n\n\t\t// Render immediately after resize to prevent flashing.\n\t\tconst { currentTime, elapsedTime, deltaTime } = getShaderTiming(\n\t\t\tperformance.now(),\n\t\t\tstartTimeRef.current,\n\t\t\tlastTimeRef.current,\n\t\t)\n\t\tlastTimeRef.current = currentTime\n\t\trenderer.render(elapsedTime, deltaTime, resolvedUniformsRef.current, mouseDataRef?.current ?? defaultMouseData)\n\t}, [haveUniformsResolved, mouseDataRef, renderSingleFrame, updateCurrentSize, maybeResize])\n\n\tuseCanvasResize(canvasRef, handleResize)\n\n\treturn <canvas ref={canvasRef} style={canvasStyle} draggable={false} />\n}\n", "/**\n * Default vertex shader - fullscreen quad with UV coordinates passed to fragment shader.\n * This is the standard vertex shader for most 2D shader effects.\n */\nexport const DEFAULT_VERTEX_SHADER = `#version 300 es\nprecision highp float;\n\nin vec2 a_position;\nin vec2 a_texCoord;\n\nout vec2 v_uv;\n\nvoid main() {\n    v_uv = a_texCoord;\n    gl_Position = vec4(a_position, 0.0, 1.0);\n}\n`\n\n/**\n * Default fragment shader - transparent output.\n */\nexport const DEFAULT_FRAGMENT_SHADER = `#version 300 es\nprecision highp float;\n\nin vec2 v_uv;\nout vec4 fragColor;\n\nvoid main() {\n    fragColor = vec4(0.0);\n}\n`\n", "import { useReducedMotionConfig } from \"framer-motion\"\nimport { startTransition, useCallback, useEffect, useLayoutEffect, useRef, useState } from \"react\"\nimport { useIsomorphicLayoutEffect } from \"../../../useIsomorphicLayoutEffect.ts\"\nimport { RenderTarget } from \"../../types/RenderEnvironment.ts\"\nimport type { SlotStatus } from \"./ShaderPoolContext.ts\"\nimport { slotStatus } from \"./ShaderPoolContext.ts\"\nimport type { UniformName, UniformValue } from \"./WebGL2ShaderRenderer.ts\"\nimport { closeImageBitmaps, resolveUniforms } from \"./helpers.ts\"\nimport type { ShaderRenderMode, ShaderUniformInput } from \"./types.ts\"\n\n/**\n * Resolves uniform inputs to WebGL-compatible values.\n * All uniform types go through the same resolution path.\n * Color uniforms that contain CSS variables are resolved via the element's computed style.\n */\nexport function useResolvedUniforms(\n\tuniforms: Record<UniformName, ShaderUniformInput> | undefined,\n\tcanvasRef: React.RefObject<HTMLCanvasElement | null>,\n\theightmapSource?: string,\n\tonUniformResolutionSucceeded?: () => void,\n\tonUniformResolutionFailed?: () => void,\n): { resolvedUniforms: Record<UniformName, UniformValue>; haveUniformsResolved: boolean } {\n\tconst [resolvedUniforms, setResolvedUniforms] = useState<Record<UniformName, UniformValue>>({})\n\t// Sticky-true once the first resolution attempt commits, even if the result\n\t// is `{}` (e.g. all uniforms are unset images that resolve to undefined).\n\t// Used to gate renderer creation so we don't draw with zero-init custom\n\t// uniforms or allocate a WebGL context that gets disposed on failure.\n\tconst [haveUniformsResolved, setHaveUniformsResolved] = useState(uniforms === undefined)\n\n\tuseEffect(() => {\n\t\tif (!uniforms) {\n\t\t\tstartTransition(() => setHaveUniformsResolved(true))\n\t\t\treturn\n\t\t}\n\n\t\tlet isCancelled = false\n\n\t\tresolveUniforms(uniforms, canvasRef.current, heightmapSource)\n\t\t\t.then(resolved => {\n\t\t\t\tif (isCancelled) {\n\t\t\t\t\tcloseImageBitmaps(resolved)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tstartTransition(() => {\n\t\t\t\t\tsetResolvedUniforms(resolved)\n\t\t\t\t\tsetHaveUniformsResolved(true)\n\t\t\t\t})\n\t\t\t\tonUniformResolutionSucceeded?.()\n\t\t\t})\n\t\t\t.catch(() => {\n\t\t\t\tif (!isCancelled) onUniformResolutionFailed?.()\n\t\t\t})\n\n\t\treturn () => {\n\t\t\tisCancelled = true\n\t\t}\n\t}, [uniforms, canvasRef, heightmapSource, onUniformResolutionSucceeded, onUniformResolutionFailed])\n\n\treturn { resolvedUniforms, haveUniformsResolved }\n}\n\n/**\n * Observes canvas size and device pixel ratio changes.\n *\n * NOTE: ResizeObserver batches calls to the resize handler to once per frame.\n * Performance issues during resize should be done by improving shader performance in favor of enabling instant rendering on resize.\n */\nexport function useCanvasResize(canvasRef: React.RefObject<HTMLCanvasElement | null>, resizeHandler: () => void): void {\n\tuseEffect(() => {\n\t\tconst canvas = canvasRef.current\n\t\tif (!canvas) return\n\n\t\tconst resizeObserver = new ResizeObserver(resizeHandler)\n\t\tresizeObserver.observe(canvas)\n\n\t\treturn () => {\n\t\t\tresizeObserver.disconnect()\n\t\t}\n\t}, [canvasRef, resizeHandler])\n\n\tuseOnDprChange(resizeHandler)\n}\n\n/**\n * Fires callback when device pixel ratio changes (e.g., window moved between monitors).\n */\nexport function useOnDprChange(callback: () => void): void {\n\tuseEffect(() => {\n\t\tlet dprQuery = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`)\n\n\t\tconst handleChange = () => {\n\t\t\tcallback()\n\t\t\tdprQuery.removeEventListener(\"change\", handleChange)\n\t\t\tdprQuery = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`)\n\t\t\tdprQuery.addEventListener(\"change\", handleChange)\n\t\t}\n\n\t\tdprQuery.addEventListener(\"change\", handleChange)\n\n\t\treturn () => {\n\t\t\tdprQuery.removeEventListener(\"change\", handleChange)\n\t\t}\n\t}, [callback])\n}\n\ninterface ShaderRenderState {\n\tisFallbackOnly: boolean\n\teffectiveAnimated: boolean\n\teffectiveSingleFrame: boolean\n\teffectiveMode: ShaderRenderMode\n\tshouldSkipFallbackOverlay: boolean\n\t/** Invoke when the WebGL context is lost; sets the fallback latch. */\n\tonContextLost: () => void\n\t/** Invoke when uniform resolution succeeded; clears any prior failure latch. */\n\tonUniformResolutionSucceeded: () => void\n\t/** Invoke when uniform resolution failed; sets the fallback latch. */\n\tonUniformResolutionFailed: () => void\n}\n\n/**\n * Derives the rendering state for a shader based on pool slot, visibility,\n * reduced motion, and context loss. Handles recovery when a shader is\n * re-selected after context loss.\n */\nexport function useShaderRenderState(\n\tpoolSlot: SlotStatus | null,\n\tisSelected: boolean,\n\tisMultiSelected: boolean,\n\tisIntersecting: boolean,\n\tmode: ShaderRenderMode,\n\tanimated: boolean | undefined,\n\tskipInitialFallback: boolean,\n\tisPreviewActive: boolean,\n): ShaderRenderState {\n\tconst shouldReduceMotion = useReducedMotionConfig()\n\tconst shouldPauseOnFirstFrame = shouldReduceMotion === true || RenderTarget.current() === RenderTarget.export\n\tconst shouldSkipFallbackOverlay = skipInitialFallback || shouldPauseOnFirstFrame\n\n\tlet isFallbackOnly: boolean\n\tlet effectiveAnimated: boolean\n\tlet effectiveSingleFrame: boolean\n\tlet effectiveMode: ShaderRenderMode\n\n\tif (poolSlot !== null) {\n\t\tconst hasSlot = poolSlot !== slotStatus.noSlot\n\t\tisFallbackOnly = !hasSlot\n\t\t// Only animate when this is the sole selected node. Multi-selected shaders\n\t\t// render single frames to avoid competing animation loops.\n\t\t// The animated prop (from config) can disable animation entirely.\n\t\t// Skip when the preview is active \u2014 the canvas-side shader is occluded\n\t\t// and would otherwise run for nothing.\n\t\teffectiveAnimated =\n\t\t\t(animated ?? true) && isSelected && !isMultiSelected && !shouldPauseOnFirstFrame && !isPreviewActive\n\t\teffectiveSingleFrame = hasSlot && !effectiveAnimated\n\t\teffectiveMode = \"instant\"\n\t} else {\n\t\tisFallbackOnly = mode === \"fallback\" || !isIntersecting\n\t\teffectiveAnimated = (animated ?? true) && !shouldPauseOnFirstFrame && !isPreviewActive\n\t\teffectiveSingleFrame = !effectiveAnimated\n\t\teffectiveMode = mode\n\t}\n\n\tconst [contextLost, setContextLost] = useState(false)\n\tconst onContextLost = useCallback(() => {\n\t\tstartTransition(() => setContextLost(true))\n\t}, [])\n\n\t// Clear context-lost when the shader is selected so ShaderCanvas mounts\n\t// fresh and creates a new WebGL context.\n\tuseLayoutEffect(() => {\n\t\tif (contextLost && isSelected) {\n\t\t\tstartTransition(() => setContextLost(false))\n\t\t}\n\t}, [contextLost, isSelected])\n\n\tif (contextLost) {\n\t\tisFallbackOnly = true\n\t}\n\n\tconst [uniformResolutionFailed, setUniformResolutionFailed] = useState(false)\n\tconst onUniformResolutionFailed = useCallback(() => {\n\t\tstartTransition(() => setUniformResolutionFailed(true))\n\t}, [])\n\tconst onUniformResolutionSucceeded = useCallback(() => {\n\t\tstartTransition(() => setUniformResolutionFailed(false))\n\t}, [])\n\n\t// Recovery on canvas \u2014 fire only on the false \u2192 true edge of `isSelected`\n\t// so a deterministic failure (e.g. faulty texture URL) doesn't loop.\n\tconst wasSelectedRef = useRef(isSelected)\n\tuseLayoutEffect(() => {\n\t\tconst becameSelected = !wasSelectedRef.current && isSelected\n\t\twasSelectedRef.current = isSelected\n\t\tif (becameSelected && uniformResolutionFailed) {\n\t\t\t// Clearing the failure state lifts the fallback-only guard so ShaderCanvas\n\t\t\t// remounts and re-attempts uniform resolution.\n\t\t\tonUniformResolutionSucceeded()\n\t\t}\n\t}, [uniformResolutionFailed, isSelected, onUniformResolutionSucceeded])\n\n\tif (uniformResolutionFailed) {\n\t\tisFallbackOnly = true\n\t}\n\n\t// Skip fallback when visible, unless context is lost or the pool denied a\n\t// slot \u2014 without the pool check, component-embedded instances all bypass\n\t// the slot limit and race for browser-level WebGL contexts, and the losers\n\t// render blank with the fallback hidden.\n\t// Off-screen fallback suppression is handled in Shader.tsx's render path.\n\tif (\n\t\tmode !== \"fallback\" &&\n\t\tskipInitialFallback &&\n\t\t!contextLost &&\n\t\t!uniformResolutionFailed &&\n\t\tisIntersecting &&\n\t\tpoolSlot !== slotStatus.noSlot\n\t) {\n\t\tisFallbackOnly = false\n\t}\n\n\treturn {\n\t\tisFallbackOnly,\n\t\teffectiveAnimated,\n\t\teffectiveSingleFrame,\n\t\teffectiveMode,\n\t\tshouldSkipFallbackOverlay,\n\t\tonContextLost,\n\t\tonUniformResolutionSucceeded,\n\t\tonUniformResolutionFailed,\n\t}\n}\n\n/**\n * PATCH: Delays shader reveal with a fixed timeout.\n * This avoids, but doesn't fix, a flash of white in Chrome when the shader loads.\n * Other things tried: idle timeout, n frame delay, waiting for window load, PerformanceObserver.\n * It's basically a hack and we should find a better solution.\n */\nconst SHADER_REVEAL_DELAY_MS = 300\nexport function usePatchDelayShaderRender(enabled = true): boolean {\n\tconst [mayRender, setMayRender] = useState(!enabled)\n\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (!enabled) {\n\t\t\tstartTransition(() => setMayRender(true))\n\t\t\treturn\n\t\t}\n\n\t\tstartTransition(() => setMayRender(false))\n\n\t\tconst timeoutId = window.setTimeout(() => {\n\t\t\tstartTransition(() => setMayRender(true))\n\t\t}, SHADER_REVEAL_DELAY_MS)\n\n\t\treturn () => {\n\t\t\tclearTimeout(timeoutId)\n\t\t}\n\t}, [enabled])\n\n\treturn mayRender\n}\n", "import { createContext, useContext } from \"react\"\n\nexport const slotStatus = {\n\t/** No WebGL context slot allocated \u2014 show fallback image. */\n\tnoSlot: 0,\n\t/** Slot allocated, render a single frame at t=0 and re-render on change. */\n\tsingleFrame: 1,\n\t/** Slot allocated, run continuous rAF animation. */\n\tanimate: 2,\n} as const\n\nexport type SlotStatus = (typeof slotStatus)[keyof typeof slotStatus]\n\n/**\n * Abstract interface for the shader pool, consumed by <Shader> via context.\n * The implementation lives in vekter (ShaderPool.ts).\n */\nexport interface ShaderPoolHandle {\n\tregister(id: string, priority: number): void\n\tderegister(id: string): void\n\tsubscribe(id: string, listener: () => void): () => void\n\tgetSlotStatus(id: string): SlotStatus\n}\n\n/**\n * Context for the shader pool system. When present (canvas), shaders register\n * with the pool and rendering is managed by slot allocation. When null\n * (published sites), shaders render normally without pool management.\n */\nexport const ShaderPoolContext = /* @__PURE__ */ createContext<ShaderPoolHandle | null>(null)\n\nexport function useShaderPoolContext(): ShaderPoolHandle | null {\n\treturn useContext(ShaderPoolContext)\n}\n", "import type { SpringOptions } from \"framer-motion\"\nimport { frame, hover, press, resize, useMotionValue, useSpring, useTransform, useVelocity } from \"framer-motion\"\nimport { useCallback, useEffect, useRef } from \"react\"\nimport { usePointerPosition } from \"../motionplus/usePointerPosition.ts\"\nimport { defaultMouseData, offScreen } from \"./helpers.ts\"\nimport type { ResolvedShaderMouseConfig, ShaderMouseData } from \"./types.ts\"\n\n/** Instant follow \u2014 no spring smoothing. Used when no spring is configured. */\nconst fallbackShaderMouseSpringOptions: SpringOptions = { duration: 0 }\n\n/** Converts SpringOptions duration from seconds to milliseconds for useSpring. */\nexport function toSpringOptions(spring: SpringOptions | undefined): SpringOptions {\n\tconst resolved = spring ?? fallbackShaderMouseSpringOptions\n\treturn resolved.duration !== undefined ? { ...resolved, duration: resolved.duration * 1000 } : resolved\n}\n\nfunction toElementRelative(rect: DOMRect | null, clientX: number, clientY: number): [number, number] {\n\tif (!rect || rect.width <= 0 || rect.height <= 0) return [offScreen, offScreen]\n\tconst x = (clientX - rect.left) / rect.width\n\t// Flip Y for GLSL UV convention (0 at bottom, 1 at top)\n\tconst y = 1 - (clientY - rect.top) / rect.height\n\treturn [x, y]\n}\n\n/**\n * Returns a ref containing mouse position, state, and velocity for shader uniforms.\n * Position is tracked globally so shaders react before hover. pointerDown/hover are element-scoped.\n */\nexport function useShaderMouse(\n\tcontainerRef: React.RefObject<HTMLElement | null>,\n\tmouseConfig: ResolvedShaderMouseConfig | undefined,\n): React.RefObject<ShaderMouseData> {\n\tconst dataRef = useRef<ShaderMouseData>(defaultMouseData)\n\tconst enabled = mouseConfig?.enabled ?? false\n\n\tconst springOptions = toSpringOptions(mouseConfig?.springOptions)\n\n\t// Cache the element rect to avoid forcing layout on every pointermove.\n\tconst rectRef = useRef<DOMRect | null>(null)\n\n\tconst updateRect = useCallback(() => {\n\t\tconst el = containerRef.current\n\t\tif (el) rectRef.current = el.getBoundingClientRect()\n\t}, [containerRef])\n\n\tconst { x: trackedX, y: trackedY } = usePointerPosition(enabled)\n\t// Fallback to local stubs when tracking hasn't initialized (e.g. on the editor canvas\n\t// where every shader passes enabled=false). useTransform needs stable MotionValue\n\t// references every render and crashes on undefined.\n\tconst stubX = useMotionValue(0)\n\tconst stubY = useMotionValue(0)\n\tconst pointerX = trackedX ?? stubX\n\tconst pointerY = trackedY ?? stubY\n\n\tconst rawX = useTransform(pointerX, x => toElementRelative(rectRef.current, x, pointerY.get())[0])\n\tconst rawY = useTransform(pointerY, y => toElementRelative(rectRef.current, pointerX.get(), y)[1])\n\tconst rawPointerDown = useMotionValue(0)\n\tconst rawHover = useMotionValue(0)\n\n\tconst smoothX = useSpring(rawX, springOptions)\n\tconst smoothY = useSpring(rawY, springOptions)\n\tconst smoothPointerDown = useSpring(rawPointerDown, springOptions)\n\tconst smoothHover = useSpring(rawHover, springOptions)\n\n\tconst velocityX = useVelocity(smoothX)\n\tconst velocityY = useVelocity(smoothY)\n\n\tuseEffect(() => {\n\t\tif (!enabled) return\n\n\t\tconst el = containerRef.current\n\t\tif (!el) return\n\n\t\tupdateRect()\n\n\t\tlet hasEnteredOnce = false\n\n\t\twindow.addEventListener(\"scroll\", updateRect, { passive: true, capture: true })\n\n\t\t// Observes the element itself (via ResizeObserver) \u2014 catches size changes from\n\t\t// any source (viewport resize, parent layout, CSS changes), not just window resize.\n\t\tconst cleanupResize = resize(el, updateRect)\n\n\t\tconst cleanupHover = hover(el, () => {\n\t\t\tif (!hasEnteredOnce) {\n\t\t\t\t// Jump the spring to the current position to avoid animating from the\n\t\t\t\t// initial (0, 0) that pointerX/pointerY start at before the first move.\n\t\t\t\thasEnteredOnce = true\n\t\t\t\tsmoothX.jump(rawX.get())\n\t\t\t\tsmoothY.jump(rawY.get())\n\t\t\t}\n\t\t\tframe.update(() => rawHover.set(1))\n\t\t\treturn () => frame.update(() => rawHover.set(0))\n\t\t})\n\n\t\tconst cleanupPress = press(el, () => {\n\t\t\tframe.update(() => rawPointerDown.set(1))\n\t\t\treturn () => frame.update(() => rawPointerDown.set(0))\n\t\t})\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"scroll\", updateRect, { capture: true })\n\t\t\tcleanupResize()\n\t\t\tcleanupHover()\n\t\t\tcleanupPress()\n\t\t\tdataRef.current = defaultMouseData\n\t\t}\n\t}, [enabled, containerRef, rawX, rawY, rawPointerDown, rawHover, smoothX, smoothY, updateRect])\n\n\tconst syncToRef = useCallback(() => {\n\t\tdataRef.current = {\n\t\t\tposition: [smoothX.get(), smoothY.get(), velocityX.get(), velocityY.get()],\n\t\t\tpointerDown: smoothPointerDown.get(),\n\t\t\thover: smoothHover.get(),\n\t\t}\n\t}, [smoothX, smoothY, smoothPointerDown, smoothHover, velocityX, velocityY])\n\n\tuseConditionalAnimationFrame(enabled, syncToRef)\n\n\treturn dataRef\n}\n\n/**\n * Runs the rAF loop only while `enabled` is true \u2014 disabled shaders pay zero cost.\n * `callback` should be wrapped in `useCallback` so the loop isn't torn down every render.\n */\nfunction useConditionalAnimationFrame(enabled: boolean, callback: (time: number, delta: number) => void): void {\n\tuseEffect(() => {\n\t\tif (!enabled) return\n\n\t\tlet rafId = 0\n\t\tlet lastTime = performance.now()\n\t\tfunction tick(time: number) {\n\t\t\tcallback(time, time - lastTime)\n\t\t\tlastTime = time\n\t\t\trafId = requestAnimationFrame(tick)\n\t\t}\n\n\t\trafId = requestAnimationFrame(tick)\n\t\treturn () => cancelAnimationFrame(rafId)\n\t}, [enabled, callback])\n}\n", "/**\n * This file is generated from motion-plus/react.\n * Before committing any changes, please make sure that the overrides we noted below persist.\n */\nimport { frame, type MotionValue, motionValue } from \"framer-motion\"\n\n// NOTE: This type has been extended with `undefined` to fit FramerStudio's use case better\nlet x: MotionValue<number> | undefined\nlet y: MotionValue<number> | undefined\n\nfunction initPointerTracking() {\n\tx = motionValue(0)\n\ty = motionValue(0)\n\n\t// Cached pointer\n\tlet pointerX = 0\n\tlet pointerY = 0\n\n\tfunction updatePointer() {\n\t\t// NOTE: This early return has been added due to the typing additions needed for FramerStudio's use case\n\t\tif (!x || !y) return\n\t\tx.set(pointerX)\n\t\ty.set(pointerY)\n\t}\n\n\tif (typeof window !== \"undefined\") {\n\t\twindow.addEventListener(\n\t\t\t\"pointermove\",\n\t\t\tonlyMouse((event: PointerEvent) => {\n\t\t\t\tpointerX = event.clientX\n\t\t\t\tpointerY = event.clientY\n\n\t\t\t\t/**\n\t\t\t\t * Don't update pointer until the next render frame to\n\t\t\t\t * avoid\n\t\t\t\t *\n\t\t\t\t * TODO: Update motion values to cache rendered value\n\t\t\t\t * and use that in projection measurements\n\t\t\t\t * instead of using this approach\n\t\t\t\t */\n\t\t\t\tframe.update(updatePointer)\n\t\t\t}),\n\t\t)\n\n\t\t// Track pointer during native HTML drag operations,\n\t\t// when pointermove stops firing.\n\t\twindow.addEventListener(\"dragover\", (event: DragEvent) => {\n\t\t\tpointerX = event.clientX\n\t\t\tpointerY = event.clientY\n\t\t\tframe.update(updatePointer)\n\t\t})\n\t}\n}\n\n/**\n * NOTE: this slightly differs from the motion-plus `usePointerPosition()` API, which has no\n * parameters and always attaches global window listeners on first call. The `enabled`\n * flag is a FramerStudio-specific addition so consumers can opt out of initializing the\n * singleton when they don't need pointer tracking. Once any caller opts in, tracking\n * is live for the page lifetime.\n */\nexport function usePointerPosition(enabled = true) {\n\tif (enabled && !x) initPointerTracking()\n\n\treturn { x, y }\n}\n\nfunction onlyMouse(callback: (event: PointerEvent) => void) {\n\treturn (event: PointerEvent) => {\n\t\tif (event.pointerType === \"mouse\") {\n\t\t\tcallback(event)\n\t\t}\n\t}\n}\n", "import { startTransition, useEffect, useState } from \"react\"\nimport type { SlotStatus } from \"./ShaderPoolContext.ts\"\nimport { slotStatus, useShaderPoolContext } from \"./ShaderPoolContext.ts\"\n\n/** Priority values for pool slot allocation. Higher = more likely to get a slot. */\nexport const shaderPriority = {\n\tlow: 0,\n\tmedium: 1,\n\thigh: 2,\n} as const\n\n/**\n * Hook that registers a shader with the pool and returns its current slot status.\n *\n * Returns null when no pool context exists (published sites).\n */\nexport function useShaderPoolSlot(id: string | undefined, isSelected: boolean, isVisible: boolean): SlotStatus | null {\n\tconst pool = useShaderPoolContext()\n\n\tconst priority = isSelected\n\t\t? shaderPriority.high // Animate continuously\n\t\t: isVisible\n\t\t\t? shaderPriority.medium // Render single frames on change\n\t\t\t: shaderPriority.low // May be evicted to show fallback\n\n\tconst [status, setStatus] = useState<SlotStatus>(slotStatus.noSlot)\n\n\t// Register with the pool and subscribe to slot status changes.\n\t// Re-runs on priority changes to update the pool in-place (without deregistering),\n\t// which preserves the shader's registrationOrder tiebreak position.\n\tuseEffect(() => {\n\t\tif (!pool || !id) return\n\t\tpool.register(id, priority)\n\t\tstartTransition(() => setStatus(pool.getSlotStatus(id)))\n\t\tconst unsub = pool.subscribe(id, () => {\n\t\t\tstartTransition(() => setStatus(pool.getSlotStatus(id)))\n\t\t})\n\t\treturn () => {\n\t\t\tunsub()\n\t\t}\n\t}, [pool, id, priority])\n\n\t// Deregister only when the shader leaves the pool (id/pool change or unmount).\n\t// Kept separate from the above effect so that priority changes don't trigger\n\t// a deregister\u2192register cycle, which would reset registrationOrder.\n\tuseEffect(() => {\n\t\tif (!pool || !id) return\n\t\treturn () => {\n\t\t\tpool.deregister(id)\n\t\t}\n\t}, [pool, id])\n\n\tif (!pool) return null\n\treturn status\n}\n", "import type { TargetAndTransition, VariantLabels } from \"framer-motion\"\nimport { scroll, transform } from \"framer-motion\"\nimport React from \"react\"\nimport { useObserverRef } from \"../components/utils/refHelper.ts\"\nimport { RenderTarget } from \"../render/types/RenderEnvironment.ts\"\nimport { useCurrentRouteKey, useOnRouteChange } from \"../router/useCurrentRoute.tsx\"\nimport { isNumber } from \"../utils/utils.ts\"\nimport type { EffectScrollTarget } from \"./createTransformInputRange.ts\"\nimport { createTransformInputRange } from \"./createTransformInputRange.ts\"\nimport type { Prefixed } from \"./hocOptions.ts\"\nimport { extractPrefixedProps } from \"./hocOptions.ts\"\nimport { useAppearEffect } from \"./useAppearEffect.ts\"\nimport { useScrollDirectionChange } from \"./useScrollDirectionChange.ts\"\n\ninterface VariantAppearEffectOptions {\n\tvisibleVariantId: string | undefined\n\tobscuredVariantId: string | undefined\n\tthreshold: number | undefined\n\tanimateOnce: boolean\n\tvariantAppearEffectEnabled: true | undefined\n\ttargets?: EffectVariantScrollTarget[]\n\texitTarget?: boolean\n\tscrollDirection?: EffectVariantScrollTarget\n}\n\nexport type EffectVariantScrollTarget = EffectScrollTarget<string>\n\nexport type PrefixedVariantAppearEffectOptions = Prefixed<VariantAppearEffectOptions>\n\nconst keys = new Set<keyof VariantAppearEffectOptions>([\n\t\"visibleVariantId\",\n\t\"obscuredVariantId\",\n\t\"threshold\",\n\t\"animateOnce\",\n\t\"variantAppearEffectEnabled\",\n\t\"targets\",\n\t\"exitTarget\",\n\t\"scrollDirection\",\n])\n\ninterface InputOutputRanges {\n\tinputRange: number[]\n\toutputRange: number[]\n}\n\nconst defaultRanges: InputOutputRanges = { inputRange: [], outputRange: [] }\n\n/**\n * Creates an input range in px offset from the top of the screen, and the index\n * of the transform target that should be active during those ranges. We use\n * index, rather than the target variant, because we want to be able to record\n * that we have animated to each transformTarget, to prevent running transitions\n * more than once when the user desires. If we recorded the variant string, and\n * the user used the same variant for multiple targets, we may not know if we\n * should or should not animate \"back\" to a variant we had already animated to\n * once before.\n *\n * -1 means the initial variant should be animated back to.\n *\n * e.g. [0, 199, 200, 400, 600, 800] | [-1, -1, 1, 1, 2, 2]\n */\nfunction createInputOutputRanges(\n\ttransformTargets: EffectVariantScrollTarget[],\n\tthreshold: number,\n\texitTarget?: boolean,\n): InputOutputRanges {\n\tconst outputRange: number[] = []\n\tconst inputRange = createTransformInputRange(transformTargets, threshold, index => outputRange.unshift(index, index))\n\n\tif (exitTarget) {\n\t\tconst lastInputRange = inputRange[inputRange.length - 1]\n\t\t// If the last item isn't a number, the ranges are invalid.\n\t\tif (!isNumber(lastInputRange)) return defaultRanges\n\t\tinputRange.push(lastInputRange + 1)\n\t\toutputRange.push(-1)\n\t}\n\n\tconst firstItem = inputRange[0]\n\t// If the first item isn't a number, the ranges are invalid.\n\tif (!isNumber(firstItem)) return defaultRanges\n\n\t// If the first variant scroll target starts so close to 0 that the\n\t// animation must start immediately, don't create ranges that support\n\t// animating away from the first scroll target to the current variant. It\n\t// will just confuse the transformer.\n\tif (firstItem <= 1) return { inputRange, outputRange }\n\n\t// If the input range supports animating back to the initial variant, the\n\t// input range must be at least [0, 1, 2, *, ...].\n\treturn { inputRange: [0, Math.max(firstItem - 1, 0), ...inputRange], outputRange: [-1, -1, ...outputRange] }\n}\n\n/**\n * @public\n */\nexport const withVariantAppearEffect = <\n\tT extends {\n\t\tvariant?: string | undefined\n\t} & object,\n>(\n\tComponent: React.ComponentType<T>,\n) =>\n\tReact.forwardRef(\n\t\t(props: Prefixed<VariantAppearEffectOptions> & T, forwardedRef: React.RefObject<HTMLElement> | null) => {\n\t\t\t// Disable the component when we are on the canvas. This doesn't\n\t\t\t// violate the rule of hooks because it will always be stable.\n\t\t\t//\n\t\t\t// This doesn't violate the rule of hooks because it will always be\n\t\t\t// stable. Rule lint/correctness/useHookAtTopLevel disabled in biome.jsonc for file.\n\t\t\tif (RenderTarget.current() === RenderTarget.canvas) return <Component {...props} ref={forwardedRef} />\n\n\t\t\tconst [options, rest] = extractPrefixedProps<VariantAppearEffectOptions, T>(props, keys)\n\t\t\tconst {\n\t\t\t\tvisibleVariantId,\n\t\t\t\tobscuredVariantId,\n\t\t\t\tanimateOnce,\n\t\t\t\tthreshold,\n\t\t\t\tvariantAppearEffectEnabled,\n\t\t\t\ttargets,\n\t\t\t\texitTarget,\n\t\t\t\tscrollDirection,\n\t\t\t} = options\n\t\t\tconst [activeVariant, setVariant] = React.useState<VariantLabels | undefined>(obscuredVariantId)\n\t\t\tconst animateState = React.useRef<VariantLabels | boolean | undefined>(false)\n\n\t\t\tconst observerRef = useObserverRef(forwardedRef)\n\n\t\t\t// If targets is not provided, we will run the effect based on the intersection of this element and the viewport.\n\t\t\tuseAppearEffect(\n\t\t\t\tobserverRef,\n\t\t\t\t(appears: boolean) => {\n\t\t\t\t\tif (options.targets) return\n\t\t\t\t\tif (options.scrollDirection) return\n\t\t\t\t\tif (animateOnce && animateState.current === true) return\n\t\t\t\t\tif (animateState.current === appears) return\n\n\t\t\t\t\tanimateState.current = appears\n\n\t\t\t\t\tReact.startTransition(() => {\n\t\t\t\t\t\tsetVariant(appears ? visibleVariantId : obscuredVariantId)\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tenabled: variantAppearEffectEnabled,\n\t\t\t\t\tanimateOnce,\n\t\t\t\t\tthreshold: {\n\t\t\t\t\t\ty: threshold,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t)\n\n\t\t\t// Track the current route so the scroll effect re-runs on navigation.\n\t\t\t// Without this, the scroll handler's closure state (playedState,\n\t\t\t// currentVariant) persists across route changes, preventing the\n\t\t\t// variant from resetting. This matches useStyleAppearEffect.\n\t\t\tconst currentRouteKey = useCurrentRouteKey()\n\t\t\tconst prevRouteKey = React.useRef(currentRouteKey)\n\n\t\t\t// When `targets` are provided, we run the effect based on the\n\t\t\t// scroll offsets of the target elements. We create a scroll handler\n\t\t\t// for each target. As soon as the progress is greater than 0 the\n\t\t\t// target has hit the threshold that should trigger the animation.\n\t\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: We want to re-run it when `props.variant` changes\n\t\t\tReact.useEffect(() => {\n\t\t\t\tif (scrollDirection) return\n\t\t\t\tif (!targets) return\n\n\t\t\t\t// Reset variant state when the route changes (not on initial\n\t\t\t\t// mount or other dependency changes). The scroll handler below\n\t\t\t\t// cannot do this because at index -1 (above the first target)\n\t\t\t\t// the computed variant is `undefined` which matches the fresh\n\t\t\t\t// `currentVariant`, so setVariant is never called.\n\t\t\t\tif (prevRouteKey.current !== currentRouteKey) {\n\t\t\t\t\tprevRouteKey.current = currentRouteKey\n\t\t\t\t\tReact.startTransition(() => setVariant(obscuredVariantId))\n\t\t\t\t}\n\n\t\t\t\t// Track if we have animated to a variant. This allows us to avoid\n\t\t\t\t// running that animation more than once if the \"animateOnce\" is true.\n\t\t\t\t// We use an index instead of the variant because the variant could be\n\t\t\t\t// reused multiple times by different targets.\n\t\t\t\tconst playedState: Record<number, boolean> = {}\n\t\t\t\tlet currentVariant: TargetAndTransition | VariantLabels | undefined = undefined\n\t\t\t\treturn scroll((_, { y: scrollY }) => {\n\t\t\t\t\t/**\n\t\t\t\t\t * It can be that this function fires after scroll target refs have been\n\t\t\t\t\t * dehydrated. Check the first target to see if it is still hydrated and\n\t\t\t\t\t * bail if not.\n\t\t\t\t\t */\n\t\t\t\t\tif (!targets[0] || (targets[0].ref && !targets[0].ref.current)) return\n\n\t\t\t\t\tconst { inputRange, outputRange } = createInputOutputRanges(\n\t\t\t\t\t\ttargets,\n\t\t\t\t\t\t(threshold ?? 0) * scrollY.containerLength,\n\t\t\t\t\t\texitTarget,\n\t\t\t\t\t)\n\n\t\t\t\t\t// The input range can be empty if a ref is missing or\n\t\t\t\t\t// unset. Transform ranges must have the same number of\n\t\t\t\t\t// entries. If target refs are missing these ranges may not\n\t\t\t\t\t// match.\n\t\t\t\t\tif (inputRange.length === 0 || inputRange.length !== outputRange.length) return\n\n\t\t\t\t\tconst index = Math.floor(transform(scrollY.current, inputRange, outputRange))\n\t\t\t\t\tif (animateOnce && playedState[index]) return\n\t\t\t\t\tplayedState[index] = true\n\n\t\t\t\t\tconst variant = targets[index]?.target ?? undefined\n\t\t\t\t\tif (variant === currentVariant) return\n\t\t\t\t\tcurrentVariant = variant\n\n\t\t\t\t\tReact.startTransition(() => {\n\t\t\t\t\t\tsetVariant(variant)\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t}, [currentRouteKey, animateOnce, threshold, targets, props.variant, scrollDirection, exitTarget])\n\n\t\t\tuseScrollDirectionChange(scrollDirection, variant => React.startTransition(() => setVariant(variant)), {\n\t\t\t\tenabled: variantAppearEffectEnabled,\n\t\t\t\trepeat: !animateOnce,\n\t\t\t})\n\n\t\t\tuseOnRouteChange(() => {\n\t\t\t\tif (!variantAppearEffectEnabled) return\n\t\t\t\tconst useObscuredVariant = !options.targets && !options.scrollDirection\n\t\t\t\tconst target = useObscuredVariant ? options.obscuredVariantId : undefined\n\n\t\t\t\tReact.startTransition(() => setVariant(target))\n\t\t\t})\n\n\t\t\t// variantAppearEffectEnabled is a new property. Since code is\n\t\t\t// generated without this boolean, and `undefined` should be treated\n\t\t\t// as `false`, we must check if the key exists in the props, and if\n\t\t\t// it doesn't, consider the effect enabled.\n\t\t\tif (!(\"variantAppearEffectEnabled\" in options) || variantAppearEffectEnabled === true) {\n\t\t\t\treturn <Component {...rest} variant={activeVariant ?? props.variant} ref={observerRef} />\n\t\t\t} else {\n\t\t\t\treturn <Component {...rest} />\n\t\t\t}\n\t\t},\n\t)\n", "import type { MotionProps } from \"framer-motion\"\nimport React from \"react\"\nimport { useObserverRef } from \"../components/utils/refHelper.ts\"\nimport type { PresenceEffectOptions } from \"./usePresenceAnimation.ts\"\nimport { usePresenceAnimation } from \"./usePresenceAnimation.ts\"\n\ntype Props<T> = Omit<T, \"animate\" | \"initial\" | \"exit\"> & Pick<PresenceEffectOptions, \"animate\" | \"exit\" | \"initial\">\n\n/**\n * Allow motion elements inside of a Smart Component, which uses `animate`\n * inheritance to update visual variants, to perform presence animations without\n * breaking inheritance of the active variant for descendants.\n *\n * @deprecated - This component was used before we generally supported effects\n * in smart components, when we supported appear effects for relative overlays.\n * It is now no longer code-generated, and replaced with withFX. This does not\n * mean we can remove this code. Code generated by Framer may still import it.\n */\nexport const withVariantFX = <T extends MotionProps>(Component: React.ComponentType<T>) =>\n\tReact.forwardRef(\n\t\t({ initial, animate, exit, ...props }: Props<T>, forwardedRef: React.MutableRefObject<HTMLElement | null>) => {\n\t\t\tconst observerRef = useObserverRef(forwardedRef)\n\n\t\t\tconst effect = usePresenceAnimation(\n\t\t\t\t{\n\t\t\t\t\tinitial,\n\t\t\t\t\tanimate,\n\t\t\t\t\texit,\n\t\t\t\t},\n\t\t\t\tobserverRef,\n\t\t\t\ttrue,\n\t\t\t)\n\n\t\t\treturn <Component {...(props as T)} style={{ ...props?.style, ...effect.values }} ref={observerRef} />\n\t\t},\n\t)\n", "import React from \"react\"\n\n/** @public */\nexport const WindowContext = /* @__PURE__ */ React.createContext<(Window & typeof globalThis) | undefined | null>(\n\tundefined,\n)\n\n/** @public */\nexport const useProvidedWindow = () => React.useContext(WindowContext)\n", "// These types don\u2019t do anything except make the code more readable\ntype Family = string\ntype Style = string\ntype Selector = string\ntype Weight = number | undefined\ninterface Font {\n\tselector: Selector\n\tweight: Weight\n}\n\ntype FontFamilyMembers = Record<Style, Font>\ntype FontFamilies = Record<Family, FontFamilyMembers>\n// Parentheses for (slightly) improved readability only\ntype FontFamilyDescriptors = [Family, [Style, Selector, Weight][]][]\n\nconst safeFonts: FontFamilies = {\n\tArial: {\n\t\tRegular: { selector: \"Arial\", weight: undefined },\n\t\tBlack: { selector: \"Arial-Black\", weight: undefined },\n\t\tNarrow: { selector: \"Arial Narrow\", weight: undefined },\n\t\t\"Rounded Bold\": { selector: \"Arial Rounded MT Bold\", weight: undefined },\n\t},\n\tAvenir: {\n\t\tBook: { selector: \"Avenir\", weight: undefined },\n\t\tLight: { selector: \"Avenir-Light\", weight: undefined },\n\t\tMedium: { selector: \"Avenir-Medium\", weight: undefined },\n\t\tHeavy: { selector: \"Avenir-Heavy\", weight: undefined },\n\t\tBlack: { selector: \"Avenir-Black\", weight: undefined },\n\t},\n\t\"Avenir Next\": {\n\t\tRegular: { selector: \"Avenir Next\", weight: undefined },\n\t\t\"Ultra Light\": { selector: \"AvenirNext-UltraLight\", weight: undefined },\n\t\tMedium: { selector: \"AvenirNext-Medium\", weight: undefined },\n\t\t\"Demi Bold\": { selector: \"AvenirNext-DemiBold\", weight: undefined },\n\t\tHeavy: { selector: \"AvenirNext-Heavy\", weight: undefined },\n\t},\n\t\"Avenir Next Condensed\": {\n\t\tRegular: { selector: \"Avenir Next Condensed\", weight: undefined },\n\t\t\"Ultra Light\": { selector: \"AvenirNextCondensed-UltraLight\", weight: undefined },\n\t\tMedium: { selector: \"AvenirNextCondensed-Medium\", weight: undefined },\n\t\t\"Demi Bold\": { selector: \"AvenirNextCondensed-DemiBold\", weight: undefined },\n\t\tHeavy: { selector: \"AvenirNextCondensed-Heavy\", weight: undefined },\n\t},\n\tBaskerville: {\n\t\tRegular: { selector: \"Baskerville\", weight: undefined },\n\t\t\"Semi Bold\": { selector: \"Baskerville-SemiBold\", weight: undefined },\n\t},\n\t\"Bodoni 72\": {\n\t\tBook: { selector: \"Bodoni 72\", weight: undefined },\n\t\tOldstyle: { selector: \"Bodoni 72 Oldstyle\", weight: undefined },\n\t\tSmallcaps: { selector: \"Bodoni 72 Smallcaps\", weight: undefined },\n\t},\n\tCourier: { Regular: { selector: \"Courier\", weight: undefined } },\n\t\"Courier New\": { Regular: { selector: \"Courier New\", weight: undefined } },\n\tFutura: {\n\t\tMedium: { selector: \"Futura\", weight: undefined },\n\t\tCondensed: { selector: \"Futura-CondensedMedium\", weight: undefined },\n\t\t\"Condensed ExtraBold\": { selector: \"Futura-CondensedExtraBold\", weight: undefined },\n\t},\n\tGeorgia: { Regular: { selector: \"Georgia\", weight: undefined } },\n\t\"Gill Sans\": {\n\t\tRegular: { selector: \"Gill Sans\", weight: undefined },\n\t\tLight: { selector: \"GillSans-Light\", weight: undefined },\n\t\tSemiBold: { selector: \"GillSans-SemiBold\", weight: undefined },\n\t\tUltraBold: { selector: \"GillSans-UltraBold\", weight: undefined },\n\t},\n\tHelvetica: {\n\t\tRegular: { selector: \"Helvetica\", weight: undefined },\n\t\tLight: { selector: \"Helvetica-Light\", weight: undefined },\n\t\tBold: { selector: \"Helvetica-Bold\", weight: undefined },\n\t\tOblique: { selector: \"Helvetica-Oblique\", weight: undefined },\n\t\t\"Light Oblique\": { selector: \"Helvetica-LightOblique\", weight: undefined },\n\t\t\"Bold Oblique\": { selector: \"Helvetica-BoldOblique\", weight: undefined },\n\t},\n\t\"Helvetica Neue\": {\n\t\tRegular: { selector: \"Helvetica Neue\", weight: undefined },\n\t\tUltraLight: { selector: \"HelveticaNeue-UltraLight\", weight: undefined },\n\t\tThin: { selector: \"HelveticaNeue-Thin\", weight: undefined },\n\t\tLight: { selector: \"HelveticaNeue-Light\", weight: undefined },\n\t\tMedium: { selector: \"HelveticaNeue-Medium\", weight: undefined },\n\t\tBold: { selector: \"HelveticaNeue-Bold\", weight: undefined },\n\t\tItalic: { selector: \"HelveticaNeue-Italic\", weight: undefined },\n\t\t\"UltraLight Italic\": { selector: \"HelveticaNeue-UltraLightItalic\", weight: undefined },\n\t\t\"Thin Italic\": { selector: \"HelveticaNeue-ThinItalic\", weight: undefined },\n\t\t\"Light Italic\": { selector: \"HelveticaNeue-LightItalic\", weight: undefined },\n\t\t\"Medium Italic\": { selector: \"HelveticaNeue-MediumItalic\", weight: undefined },\n\t\t\"Bold Italic\": { selector: \"HelveticaNeue-BoldItalic\", weight: undefined },\n\t\t\"Condensed Bold\": { selector: \"HelveticaNeue-CondensedBold\", weight: undefined },\n\t\t\"Condensed Black\": { selector: \"HelveticaNeue-CondensedBlack\", weight: undefined },\n\t},\n\t\"Hoefler Text\": { Regular: { selector: \"Hoefler Text\", weight: undefined } },\n\tImpact: { Regular: { selector: \"Impact\", weight: undefined } },\n\t\"Lucida Grande\": { Regular: { selector: \"Lucida Grande\", weight: undefined } },\n\tMenlo: { Regular: { selector: \"Menlo\", weight: undefined } },\n\tMonaco: { Regular: { selector: \"Monaco\", weight: undefined } },\n\tOptima: {\n\t\tRegular: { selector: \"Optima\", weight: undefined },\n\t\tExtraBlack: { selector: \"Optima-ExtraBlack\", weight: undefined },\n\t},\n\tPalatino: { Regular: { selector: \"Palatino\", weight: undefined } },\n\t\"SF Pro Display\": {\n\t\tRegular: { selector: \"__SF-UI-Display-Regular__\", weight: 400 },\n\t\tUltralight: { selector: \"__SF-UI-Display-Ultralight__\", weight: 100 },\n\t\tThin: { selector: \"__SF-UI-Display-Thin__\", weight: 200 },\n\t\tLight: { selector: \"__SF-UI-Display-Light__\", weight: 300 },\n\t\tMedium: { selector: \"__SF-UI-Display-Medium__\", weight: 500 },\n\t\tSemibold: { selector: \"__SF-UI-Display-Semibold__\", weight: 600 },\n\t\tBold: { selector: \"__SF-UI-Display-Bold__\", weight: 700 },\n\t\tHeavy: { selector: \"__SF-UI-Display-Heavy__\", weight: 800 },\n\t\tBlack: { selector: \"__SF-UI-Display-Black__\", weight: 900 },\n\t\tItalic: { selector: \"__SF-UI-Display-Italic__\", weight: 400 },\n\t\t\"Ultralight Italic\": { selector: \"__SF-UI-Display-Ultralight-Italic__\", weight: 100 },\n\t\t\"Thin Italic\": { selector: \"__SF-UI-Display-Thin-Italic__\", weight: 200 },\n\t\t\"Light Italic\": { selector: \"__SF-UI-Display-Light-Italic__\", weight: 300 },\n\t\t\"Medium Italic\": { selector: \"__SF-UI-Display-Medium-Italic__\", weight: 500 },\n\t\t\"Semibold Italic\": { selector: \"__SF-UI-Display-Semibold-Italic__\", weight: 600 },\n\t\t\"Bold Italic\": { selector: \"__SF-UI-Display-Bold-Italic__\", weight: 700 },\n\t\t\"Heavy Italic\": { selector: \"__SF-UI-Display-Heavy-Italic__\", weight: 800 },\n\t\t\"Black Italic\": { selector: \"__SF-UI-Display-Black-Italic__\", weight: 900 },\n\t},\n\t\"SF Pro Display Condensed\": {\n\t\tRegular: { selector: \"__SF-UI-Display-Condensed-Regular__\", weight: 400 },\n\t\tUltralight: { selector: \"__SF-UI-Display-Condensed-Ultralight__\", weight: 100 },\n\t\tThin: { selector: \"__SF-UI-Display-Condensed-Thin__\", weight: 200 },\n\t\tLight: { selector: \"__SF-UI-Display-Condensed-Light__\", weight: 300 },\n\t\tMedium: { selector: \"__SF-UI-Display-Condensed-Medium__\", weight: 500 },\n\t\tSemibold: { selector: \"__SF-UI-Display-Condensed-Semibold__\", weight: 600 },\n\t\tBold: { selector: \"__SF-UI-Display-Condensed-Bold__\", weight: 700 },\n\t\tHeavy: { selector: \"__SF-UI-Display-Condensed-Heavy__\", weight: 800 },\n\t\tBlack: { selector: \"__SF-UI-Display-Condensed-Black__\", weight: 900 },\n\t},\n\t\"SF Pro Text\": {\n\t\tRegular: { selector: \"__SF-UI-Text-Regular__\", weight: 400 },\n\t\tLight: { selector: \"__SF-UI-Text-Light__\", weight: 200 },\n\t\tMedium: { selector: \"__SF-UI-Text-Medium__\", weight: 500 },\n\t\tSemibold: { selector: \"__SF-UI-Text-Semibold__\", weight: 600 },\n\t\tBold: { selector: \"__SF-UI-Text-Bold__\", weight: 700 },\n\t\tHeavy: { selector: \"__SF-UI-Text-Heavy__\", weight: 800 },\n\t\tItalic: { selector: \"__SF-UI-Text-Italic__\", weight: 400 },\n\t\t\"Light Italic\": { selector: \"__SF-UI-Text-Light-Italic__\", weight: 200 },\n\t\t\"Medium Italic\": { selector: \"__SF-UI-Text-Medium-Italic__\", weight: 500 },\n\t\t\"Semibold Italic\": { selector: \"__SF-UI-Text-Semibold-Italic__\", weight: 600 },\n\t\t\"Bold Italic\": { selector: \"__SF-UI-Text-Bold-Italic__\", weight: 700 },\n\t\t\"Heavy Italic\": { selector: \"__SF-UI-Text-Heavy-Italic__\", weight: 800 },\n\t},\n\t\"SF Pro Text Condensed\": {\n\t\tRegular: { selector: \"__SF-UI-Text-Condensed-Regular__\", weight: 400 },\n\t\tLight: { selector: \"__SF-UI-Text-Condensed-Light__\", weight: 200 },\n\t\tMedium: { selector: \"__SF-UI-Text-Condensed-Medium__\", weight: 500 },\n\t\tSemibold: { selector: \"__SF-UI-Text-Condensed-Semibold__\", weight: 600 },\n\t\tBold: { selector: \"__SF-UI-Text-Condensed-Bold__\", weight: 700 },\n\t\tHeavy: { selector: \"__SF-UI-Text-Condensed-Heavy__\", weight: 800 },\n\t},\n\tTahoma: { Regular: { selector: \"Tahoma\", weight: undefined } },\n\tTimes: { Regular: { selector: \"Times\", weight: undefined } },\n\t\"Times New Roman\": { Regular: { selector: \"Times New Roman\", weight: undefined } },\n\tTrebuchet: { Regular: { selector: \"Trebuchet MS\", weight: undefined } },\n\tVerdana: { Regular: { selector: \"Verdana\", weight: undefined } },\n}\n\n// NOTE: While the SF Compact fonts have been removed from the default font\n// list, because there are no longer selectors that work on both macOS (in all\n// cases) and iOS, the aliases are still here so old documents keep working.\n// See https://github.com/framer/company/issues/17747\n\nexport const fontAliases: { [key: string]: string } = {\n\t\"__SF-Compact-Display-Regular__\": \"SFCompactDisplay-Regular|.SFCompactDisplay-Regular\",\n\t\"__SF-Compact-Display-Ultralight__\": \"SFCompactDisplay-Ultralight|.SFCompactDisplay-Ultralight\",\n\t\"__SF-Compact-Display-Thin__\": \"SFCompactDisplay-Thin|.SFCompactDisplay-Thin\",\n\t\"__SF-Compact-Display-Light__\": \"SFCompactDisplay-Light|.SFCompactDisplay-Light\",\n\t\"__SF-Compact-Display-Medium__\": \"SFCompactDisplay-Medium|.SFCompactDisplay-Medium\",\n\t\"__SF-Compact-Display-Semibold__\": \"SFCompactDisplay-Semibold|.SFCompactDisplay-Semibold\",\n\t\"__SF-Compact-Display-Heavy__\": \"SFCompactDisplay-Heavy|.SFCompactDisplay-Heavy\",\n\t\"__SF-Compact-Display-Black__\": \"SFCompactDisplay-Black|.SFCompactDisplay-Black\",\n\t\"__SF-Compact-Display-Bold__\": \"SFCompactDisplay-Bold|.SFCompactDisplay-Bold\",\n\n\t\"__SF-UI-Text-Regular__\": \".SFNSText|SFProText-Regular|SFUIText-Regular|.SFUIText\",\n\t\"__SF-UI-Text-Light__\": \".SFNSText-Light|SFProText-Light|SFUIText-Light|.SFUIText-Light\",\n\t\"__SF-UI-Text-Medium__\": \".SFNSText-Medium|SFProText-Medium|SFUIText-Medium|.SFUIText-Medium\",\n\t\"__SF-UI-Text-Semibold__\": \".SFNSText-Semibold|SFProText-Semibold|SFUIText-Semibold|.SFUIText-Semibold\",\n\t\"__SF-UI-Text-Bold__\": \".SFNSText-Bold|SFProText-Bold|SFUIText-Bold|.SFUIText-Bold\",\n\t\"__SF-UI-Text-Heavy__\": \".SFNSText-Heavy|SFProText-Heavy|.SFUIText-Heavy\",\n\t\"__SF-UI-Text-Italic__\": \".SFNSText-Italic|SFProText-Italic|SFUIText-Italic|.SFUIText-Italic\",\n\t\"__SF-UI-Text-Light-Italic__\":\n\t\t\".SFNSText-LightItalic|SFProText-LightItalic|SFUIText-LightItalic|.SFUIText-LightItalic\",\n\t\"__SF-UI-Text-Medium-Italic__\":\n\t\t\".SFNSText-MediumItalic|SFProText-MediumItalic|SFUIText-MediumItalic|.SFUIText-MediumItalic\",\n\t\"__SF-UI-Text-Semibold-Italic__\":\n\t\t\".SFNSText-SemiboldItalic|SFProText-SemiboldItalic|SFUIText-SemiboldItalic|.SFUIText-SemiboldItalic\",\n\t\"__SF-UI-Text-Bold-Italic__\": \".SFNSText-BoldItalic|SFProText-BoldItalic|SFUIText-BoldItalic|.SFUIText-BoldItalic\",\n\t\"__SF-UI-Text-Heavy-Italic__\": \".SFNSText-HeavyItalic|SFProText-HeavyItalic|.SFUIText-HeavyItalic\",\n\n\t\"__SF-Compact-Text-Regular__\": \"SFCompactText-Regular|.SFCompactText-Regular\",\n\t\"__SF-Compact-Text-Light__\": \"SFCompactText-Light|.SFCompactText-Light\",\n\t\"__SF-Compact-Text-Medium__\": \"SFCompactText-Medium|.SFCompactText-Medium\",\n\t\"__SF-Compact-Text-Semibold__\": \"SFCompactText-Semibold|.SFCompactText-Semibold\",\n\t\"__SF-Compact-Text-Bold__\": \"SFCompactText-Bold|.SFCompactText-Bold\",\n\t\"__SF-Compact-Text-Heavy__\": \"SFCompactText-Heavy|.SFCompactText-Heavy\",\n\t\"__SF-Compact-Text-Italic__\": \"SFCompactText-Italic|.SFCompactText-Italic\",\n\t\"__SF-Compact-Text-Light-Italic__\": \"SFCompactText-LightItalic|.SFCompactText-LightItalic\",\n\t\"__SF-Compact-Text-Medium-Italic__\": \"SFCompactText-MediumItalic|.SFCompactText-MediumItalic\",\n\t\"__SF-Compact-Text-Semibold-Italic__\": \"SFCompactText-SemiboldItalic|.SFCompactText-SemiboldItalic\",\n\t\"__SF-Compact-Text-Bold-Italic__\": \"SFCompactText-BoldItalic|.SFCompactText-BoldItalic\",\n\t\"__SF-Compact-Text-Heavy-Italic__\": \"SFCompactText-HeavyItalic|.SFCompactText-HeavyItalic\",\n\n\t\"__SF-UI-Display-Condensed-Regular__\":\n\t\t\".SFNSDisplayCondensed-Regular|SFUIDisplayCondensed-Regular|.SFUIDisplayCondensed-Regular\",\n\t\"__SF-UI-Display-Condensed-Ultralight__\":\n\t\t\".SFNSDisplayCondensed-Ultralight|SFUIDisplayCondensed-Ultralight|.SFUIDisplayCondensed-Ultralight\",\n\t\"__SF-UI-Display-Condensed-Thin__\": \".SFNSDisplayCondensed-Thin|SFUIDisplayCondensed-Thin|.SFUIDisplayCondensed-Thin\",\n\t\"__SF-UI-Display-Condensed-Light__\":\n\t\t\".SFNSDisplayCondensed-Light|SFUIDisplayCondensed-Light|.SFUIDisplayCondensed-Light\",\n\t\"__SF-UI-Display-Condensed-Medium__\":\n\t\t\".SFNSDisplayCondensed-Medium|SFUIDisplayCondensed-Medium|.SFUIDisplayCondensed-Medium\",\n\t\"__SF-UI-Display-Condensed-Semibold__\":\n\t\t\".SFNSDisplayCondensed-Semibold|SFUIDisplayCondensed-Semibold|.SFUIDisplayCondensed-Semibold\",\n\t\"__SF-UI-Display-Condensed-Bold__\": \".SFNSDisplayCondensed-Bold|SFUIDisplayCondensed-Bold|.SFUIDisplayCondensed-Bold\",\n\t\"__SF-UI-Display-Condensed-Heavy__\":\n\t\t\".SFNSDisplayCondensed-Heavy|SFUIDisplayCondensed-Heavy|.SFUIDisplayCondensed-Heavy\",\n\t\"__SF-UI-Display-Condensed-Black__\": \".SFNSDisplayCondensed-Black|.SFUIDisplayCondensed-Black\",\n\n\t\"__SF-UI-Display-Regular__\": \".SFNSDisplay|SFProDisplay-Regular|SFUIDisplay-Regular|.SFUIDisplay\",\n\t\"__SF-UI-Display-Ultralight__\":\n\t\t\".SFNSDisplay-Ultralight|SFProDisplay-Ultralight|SFUIDisplay-Ultralight|.SFUIDisplay-Ultralight\",\n\t\"__SF-UI-Display-Thin__\": \".SFNSDisplay-Thin|SFProDisplay-Thin|SFUIDisplay-Thin|.SFUIDisplay-Thin\",\n\t\"__SF-UI-Display-Light__\": \".SFNSDisplay-Light|SFProDisplay-Light|SFUIDisplay-Light|.SFUIDisplay-Light\",\n\t\"__SF-UI-Display-Medium__\": \".SFNSDisplay-Medium|SFProDisplay-Medium|SFUIDisplay-Medium|.SFUIDisplay-Medium\",\n\t\"__SF-UI-Display-Semibold__\":\n\t\t\".SFNSDisplay-Semibold|SFProDisplay-Semibold|SFUIDisplay-Semibold|.SFUIDisplay-Semibold\",\n\t\"__SF-UI-Display-Bold__\": \".SFNSDisplay-Bold|SFProDisplay-Bold|SFUIDisplay-Bold|.SFUIDisplay-Bold\",\n\t\"__SF-UI-Display-Heavy__\": \".SFNSDisplay-Heavy|SFProDisplay-Heavy|SFUIDisplay-Heavy|.SFUIDisplay-Heavy\",\n\t\"__SF-UI-Display-Black__\": \".SFNSDisplay-Black|SFProDisplay-Black|.SFUIDisplay-Black\",\n\t\"__SF-UI-Display-Italic__\": \".SFNSDisplay-Italic|SFProDisplay-Italic|SFUIDisplay-Italic\",\n\t\"__SF-UI-Display-Ultralight-Italic__\":\n\t\t\".SFNSDisplay-UltralightItalic|SFProDisplay-UltralightItalic|SFUIDisplay-UltralightItalic|.SFUIDisplay-UltralightItalic\",\n\t\"__SF-UI-Display-Thin-Italic__\":\n\t\t\".SFNSDisplay-ThinItalic|SFProDisplay-ThinItalic|SFUIDisplay-ThinItalic|.SFUIDisplay-ThinItalic\",\n\t\"__SF-UI-Display-Light-Italic__\":\n\t\t\".SFNSDisplay-LightItalic|SFProDisplay-LightItalic|SFUIDisplay-LightItalic|.SFUIDisplay-LightItalic\",\n\t\"__SF-UI-Display-Medium-Italic__\":\n\t\t\".SFNSDisplay-MediumItalic|SFProDisplay-MediumItalic|SFUIDisplay-MediumItalic|.SFUIDisplay-MediumItalic\",\n\t\"__SF-UI-Display-Semibold-Italic__\":\n\t\t\".SFNSDisplay-SemiboldItalic|SFProDisplay-SemiboldItalic|SFUIDisplay-SemiboldItalic|.SFUIDisplay-SemiboldItalic\",\n\t\"__SF-UI-Display-Bold-Italic__\":\n\t\t\".SFNSDisplay-BoldItalic|SFProDisplay-BoldItalic|SFUIDisplay-BoldItalic|.SFUIDisplay-BoldItalic\",\n\t\"__SF-UI-Display-Heavy-Italic__\":\n\t\t\".SFNSDisplay-HeavyItalic|SFProDisplay-HeavyItalic|SFUIDisplay-HeavyItalic|.SFUIDisplay-HeavyItalic\",\n\t\"__SF-UI-Display-Black-Italic__\": \".SFNSDisplay-BlackItalic|SFProDisplay-BlackItalic|.SFUIDisplay-BlackItalic\",\n\n\t\"__SF-UI-Text-Condensed-Regular__\": \".SFNSTextCondensed-Regular|SFUITextCondensed-Regular|.SFUITextCondensed-Regular\",\n\t\"__SF-UI-Text-Condensed-Light__\": \".SFNSTextCondensed-Light|SFUITextCondensed-Light|.SFUITextCondensed-Light\",\n\t\"__SF-UI-Text-Condensed-Medium__\": \".SFNSTextCondensed-Medium|SFUITextCondensed-Medium|.SFUITextCondensed-Medium\",\n\t\"__SF-UI-Text-Condensed-Semibold__\":\n\t\t\".SFNSTextCondensed-Semibold|SFUITextCondensed-Semibold|.SFUITextCondensed-Semibold\",\n\t\"__SF-UI-Text-Condensed-Bold__\": \".SFNSTextCondensed-Bold|SFUITextCondensed-Bold|.SFUITextCondensed-Bold\",\n\t\"__SF-UI-Text-Condensed-Heavy__\": \".SFNSTextCondensed-Heavy|.SFUITextCondensed-Heavy\",\n\n\t\"__SF-Compact-Rounded-Regular__\": \"SFCompactRounded-Regular|.SFCompactRounded-Regular\",\n\t\"__SF-Compact-Rounded-Ultralight__\": \"SFCompactRounded-Ultralight|.SFCompactRounded-Ultralight\",\n\t\"__SF-Compact-Rounded-Thin__\": \"SFCompactRounded-Thin|.SFCompactRounded-Thin\",\n\t\"__SF-Compact-Rounded-Light__\": \"SFCompactRounded-Light|.SFCompactRounded-Light\",\n\t\"__SF-Compact-Rounded-Medium__\": \"SFCompactRounded-Medium|.SFCompactRounded-Medium\",\n\t\"__SF-Compact-Rounded-Semibold__\": \"SFCompactRounded-Semibold|.SFCompactRounded-Semibold\",\n\t\"__SF-Compact-Rounded-Bold__\": \"SFCompactRounded-Bold|.SFCompactRounded-Bold\",\n\t\"__SF-Compact-Rounded-Heavy__\": \"SFCompactRounded-Heavy|.SFCompactRounded-Heavy\",\n\t\"__SF-Compact-Rounded-Black__\": \"SFCompactRounded-Black|.SFCompactRounded-Black\",\n}\n\nexport const fontFamilies: FontFamilies = safeFonts\n", "import type {\n\tAsset as _Asset,\n\tAssetFontProperties as _AssetFontProperties,\n\tAssetWithOwnerTypes as _AssetWithOwnerTypes,\n} from \"@framerjs/assets\"\n\nexport type Asset = _Asset\nexport type AssetFontProperties = _AssetFontProperties\nexport type AssetWithOwnerTypes = _AssetWithOwnerTypes\n\n/** @public */\nexport type FontSourceName = \"local\" | \"google\" | \"framer\" | \"fontshare\" | \"custom\" | \"builtIn\"\n\nexport type FontSelector = string\n\nexport enum FontSourceNames {\n\tGoogle = \"google\",\n\tFontshare = \"fontshare\",\n\tFramer = \"framer\",\n\tLocal = \"local\",\n\tCustom = \"custom\",\n\tBuiltIn = \"builtIn\",\n}\n\nexport interface FontSource {\n\treadonly name: FontSourceName\n\tgetFontFamilyByName: (family: string) => ReadonlyFontFamily | null\n}\n\nexport interface FontFamily {\n\tsource: FontSourceName\n\tname: string\n\tfonts: Font[]\n\tfoundryName?: string\n\t/**\n\t * Used by built-in fonts to differentiate different versions of the same font family \u2013\n\t * when we need to update a font but can\u2019t do it in a non-breaking way (think Inter v3 vs v4).\n\t * The field looks like `v0` or `v1`.\n\t */\n\tversion?: string\n}\n\nexport type FontCategory = \"serif\" | \"sans-serif\" | \"slab\" | \"monospace\" | \"display\" | \"handwriting\"\n\nexport interface OpenTypeFeature {\n\ttag: string\n\tcoverage?: string[] // i.e affected characters, ligatures, etc.\n}\n\nexport interface VariationAxis {\n\ttag: string\n\tminValue: number\n\tmaxValue: number\n\tdefaultValue: number\n\tname?: string\n}\n\nexport interface Font {\n\tfamily: FontFamily\n\tvariant: string\n\tselectorBold?: string\n\tselectorBoldItalic?: string\n\tselectorItalic?: string\n\tselectorVariable?: string\n\tselectorVariableItalic?: string\n\t/**\n\t * The font-style of the font.\n\t *\n\t * Can be parsed from the `variant` when using Google Fonts.\n\t */\n\tstyle?: \"normal\" | \"italic\"\n\t/**\n\t * The font-weight of the font, between 100-900.\n\t *\n\t * Can be parsed from the `variant` when using google fonts\n\t */\n\tweight?: number\n\t/** The category of a font, as defined by Google Fonts or Fontshare */\n\tcategory?: FontCategory\n\tselector: FontSelector\n\tfile?: string\n\tsubsets?: { unicodeRange: string; file: string }[]\n\thasOpenTypeFeatures?: boolean\n\tvariationAxes?: VariationAxis[]\n\t/** Owner defines the type of the owner of a custom font. Unset for other sources. */\n\towner?: \"team\" | \"project\"\n\t/** Unique identifier of the source asset file. Used to reference the original font asset. Unset for other sources. */\n\tassetKey?: string\n\t/**\n\t * Alternative selectors for this font with per-selector overrides.\n\t * When a font is looked up by an alternative selector, these overrides are applied transparently.\n\t * Example: { \"CUSTOM;Roboto Bold\": { cssFamilyName: \"Roboto Bold\" } }\n\t */\n\talternativeSelectors?: Record<string, Partial<Omit<Font, \"selector\" | \"alternativeSelectors\">>>\n\t/**\n\t * Defines a font's `font-family` property. The value of this field:\n\t * - must go into `@font-face` when loading the font\n\t * - will be used by DOM nodes inside the component (e.g. `style={fontFamily: \"XXX\"}`)\n\t *\n\t * Unlike `family.name`, this property is defined per font and not per font family. Some fonts\n\t * (Sep 2025: only custom ones) will share the font family but will have distinct `cssFamilyName`s\n\t * to prevent conflicts (see \"Context\" in https://github.com/framer/FramerStudio/pull/24693).\n\t */\n\tcssFamilyName: string\n}\n\n/**\n * The data required to locate a font family\n *\n * @internal\n */\nexport interface FontFamilyLocator {\n\tsource: FontSourceName\n\tname: string\n}\n\n/**\n * The data required to locate a font\n *\n * @internal\n */\nexport interface WebFontFamilyLocator extends FontFamilyLocator {\n\tvariant: string\n\tfile?: string\n\tisVariable: boolean\n}\n\n/**\n * Specific set of properties required by draft to render a font\n * @internal\n */\nexport interface DraftFontProperties {\n\tstyle: string | undefined\n\tweight: number | undefined\n\tvariant: string | undefined\n\tcssFamilyName: string\n\tsource: FontSourceName\n\tcategory: FontCategory | undefined\n}\n\n/** Parsed weight and style of a font variant */\nexport interface FontVariant {\n\tstyle?: \"normal\" | \"italic\"\n\t/** 100 / 200 / 300 / 400 / 500 / 600 / 700 / 800 / 900 */\n\tweight?: number\n}\n\nexport type SuccessfullyParsedFontVariant = Required<FontVariant>\nexport function isSuccessfullyParsedFontVariant<T extends FontVariant>(\n\tvariant: T,\n): variant is T & SuccessfullyParsedFontVariant {\n\treturn variant.weight !== undefined && variant.style !== undefined\n}\n\n/**\n * Recursive readonly.\n *\n * https://github.com/microsoft/TypeScript/issues/13923#issuecomment-2191862501\n */\ntype DeepReadonly<T> = T extends Map<infer K, infer V> ? DeepReadonlyMap<K, V> : DeepReadonlyNotMap<T>\ntype DeepReadonlyMap<K, V> = ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>>\ntype DeepReadonlyNotMap<T> = T extends Set<infer V> ? DeepReadonlySet<V> : DeepReadonlyNotMapOrSet<T>\ntype DeepReadonlySet<V> = ReadonlySet<DeepReadonly<V>>\ntype DeepReadonlyNotMapOrSet<T> = T extends object ? DeepReadonlyObject<T> : T\ntype DeepReadonlyObject<T> = { readonly [K in keyof T]: DeepReadonly<T[K]> }\n\nexport type ReadonlyFont = DeepReadonly<Font>\nexport type ReadonlyFontFamily = DeepReadonly<FontFamily>\nexport type ReadonlyFontOpenTypeFeatureTags = DeepReadonly<OpenTypeFeature>\nexport type ReadonlyFontVariationAxes = DeepReadonly<VariationAxis[]>\n", "import { fontAliases, fontFamilies as systemFontFamilies } from \"./fonts.ts\"\nimport type { Font, FontFamily, FontSource, FontSourceName, ReadonlyFontFamily } from \"./types.ts\"\nimport { FontSourceNames } from \"./types.ts\"\n\n/** @internal */\nexport const systemFontFamilyName = \"System Default\"\n\n/** @internal */\nexport class LocalFontSource implements FontSource {\n\treadonly name: FontSourceName = FontSourceNames.Local\n\n\tprivate fontFamilies: FontFamily[] = []\n\tprivate byFamilyName = new Map<string, FontFamily>()\n\tprivate fontAliasBySelector = new Map<string, string>()\n\tprivate fontAliases = new Map<string, string>()\n\n\tgetFontFamilyByName(family: string): ReadonlyFontFamily | null {\n\t\treturn this.byFamilyName.get(family) ?? null\n\t}\n\t// TODO: these are duplicated across implementations of FontSource\n\t// When adding a third source, we should abstract them\n\tcreateFontFamily(family: string): FontFamily {\n\t\tconst fontFamily = { name: family, fonts: [], source: this.name }\n\t\tthis.addFontFamily(fontFamily)\n\t\treturn fontFamily\n\t}\n\n\tprivate addFontFamily(fontFamily: FontFamily) {\n\t\tthis.fontFamilies.push(fontFamily)\n\t\tthis.byFamilyName.set(fontFamily.name, fontFamily)\n\t}\n\t// end of duplication\n\n\timportFonts(): Font[] {\n\t\tconst fonts: Font[] = []\n\t\tfor (const family of Object.keys(systemFontFamilies)) {\n\t\t\tconst members = systemFontFamilies[family]\n\t\t\tif (!members) continue\n\t\t\tconst fontFamily: FontFamily = this.createFontFamily(family)\n\t\t\tfor (const variant of Object.keys(members)) {\n\t\t\t\tconst member = members[variant]\n\t\t\t\tif (!member) continue\n\t\t\t\tconst { selector, weight } = member\n\t\t\t\t// font.style is never defined in local fonts, we always use a specific font family that already includes the style\n\t\t\t\tconst font: Font = {\n\t\t\t\t\tvariant,\n\t\t\t\t\tselector,\n\t\t\t\t\tweight,\n\t\t\t\t\tfamily: fontFamily,\n\t\t\t\t\tcssFamilyName: fontFamily.name,\n\t\t\t\t}\n\t\t\t\tfontFamily.fonts.push(font)\n\t\t\t}\n\t\t\tfonts.push(...fontFamily.fonts)\n\t\t}\n\n\t\tfor (const [key, value] of Object.entries(fontAliases)) {\n\t\t\tthis.addFontAlias(key, value)\n\t\t}\n\t\tconst { fontFamily: systemFontFamily, aliases } = this.getSystemFontFamily()\n\t\tthis.addFontFamily(systemFontFamily)\n\t\tfor (const [key, value] of aliases) {\n\t\t\tthis.addFontAlias(key, value)\n\t\t}\n\t\tfonts.push(...systemFontFamily.fonts)\n\n\t\treturn fonts\n\t}\n\n\tprivate addFontAlias(key: string, value: string) {\n\t\tthis.fontAliases.set(key, value)\n\t\tthis.fontAliasBySelector.set(value, key)\n\t}\n\n\tprivate getSystemFontFamily(): { fontFamily: FontFamily; aliases: Map<string, string> } {\n\t\tconst fontFamilies =\n\t\t\t// System fonts - Taken from https://furbo.org/stuff/systemfonts-new.html - \"All Platforms\" section\n\t\t\t\"system-ui|-apple-system|BlinkMacSystemFont|Segoe UI|Roboto|Oxygen|Ubuntu|Cantarell|Fira Sans|Droid Sans|Helvetica Neue|sans-serif\"\n\n\t\tconst fontFamily: FontFamily = { name: systemFontFamilyName, fonts: [], source: this.name }\n\t\tconst aliases = new Map<string, string>()\n\n\t\tconst weights: Weight[] = [400, 100, 200, 300, 500, 600, 700, 800, 900]\n\t\tconst styles: (\"normal\" | \"italic\")[] = [\"normal\", \"italic\"]\n\t\tfor (const style of styles) {\n\t\t\tfor (const weight of weights) {\n\t\t\t\tconst variant = createVariantName(weight, style)\n\t\t\t\tconst alias = `__SystemDefault-${weight}-${style}__`\n\t\t\t\tconst font: Font = {\n\t\t\t\t\tvariant,\n\t\t\t\t\tselector: alias,\n\t\t\t\t\tstyle,\n\t\t\t\t\tweight,\n\t\t\t\t\tfamily: fontFamily,\n\t\t\t\t\tcssFamilyName: fontFamily.name,\n\t\t\t\t}\n\t\t\t\tfontFamily.fonts.push(font)\n\t\t\t\taliases.set(alias, fontFamilies)\n\t\t\t}\n\t\t}\n\t\treturn { fontFamily, aliases }\n\t}\n\n\tgetFontAliasBySelector(selector: string): string | null {\n\t\treturn this.fontAliasBySelector.get(selector) || null\n\t}\n\tgetFontSelectorByAlias(alias: string): string | null {\n\t\treturn this.fontAliases.get(alias) || null\n\t}\n\t/** Font family aliases are in the format of `__Alias-Name__` */\n\tisFontFamilyAlias(value: string): boolean {\n\t\tif (value && /^__.*__$/u.exec(value)) return true\n\t\treturn false\n\t}\n}\n\nconst fontWeightNames: Record<Weight, string> = {\n\t\"100\": \"Thin\",\n\t\"200\": \"Extra Light\",\n\t\"300\": \"Light\",\n\t\"400\": \"Normal\",\n\t\"500\": \"Medium\",\n\t\"600\": \"Semi Bold\",\n\t\"700\": \"Bold\",\n\t\"800\": \"Extra Bold\",\n\t\"900\": \"Black\",\n}\n\ntype Weight = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900\n\nfunction createVariantName(weight: Weight, style: \"normal\" | \"italic\") {\n\tconst friendlyStyle = style === \"normal\" ? \"Regular\" : \"Italic\"\n\tif (weight === 400) {\n\t\treturn friendlyStyle\n\t}\n\tif (style !== \"normal\") {\n\t\treturn `${fontWeightNames[weight]} ${friendlyStyle}`\n\t}\n\treturn `${fontWeightNames[weight]}`\n}\n", "/**\n * Like a regular `Map`, but with a `hash` that changes whenever the map changes.\n * Use to cheaply check whether the map has changed.\n */\nexport class MapWithHash<K, V> extends Map<K, V> {\n\tprivate _hash = 0\n\n\tget hash() {\n\t\treturn this._hash\n\t}\n\n\toverride set(key: K, value: V) {\n\t\tthis._hash++\n\t\treturn super.set(key, value)\n\t}\n\n\toverride delete(key: K) {\n\t\tthis._hash++\n\t\treturn super.delete(key)\n\t}\n\n\toverride clear() {\n\t\tthis._hash++\n\t\treturn super.clear()\n\t}\n}\n", "import type { BootstrappedWindow, ServiceMap } from \"@framerjs/bootstrap\"\nexport type { ServiceMap }\n\nlet cachedServiceMap: ServiceMap | undefined\n\nexport function getServiceMap(): ServiceMap {\n\t// In non browser contexts there is no service map so we just return non functional stub which\n\t// is good enough for code to initialize.\n\tif (typeof window === \"undefined\") return {} as ServiceMap\n\n\tif (cachedServiceMap) return cachedServiceMap\n\tcachedServiceMap = extractServiceMap()\n\treturn cachedServiceMap\n}\n\nfunction extractServiceMap(): ServiceMap {\n\tconst location = window.location\n\n\t// First check for the service map embedded on the page.\n\t// TODO: Embed it in a nicer way (a script tag that exposes getServiceMap()).\n\tlet services = (window as BootstrappedWindow)?.bootstrap?.services\n\tif (services) {\n\t\treturn services\n\t}\n\t// If the service map is not available, try accessing the top frame.\n\tlet topOrigin: string | undefined\n\ttry {\n\t\tconst topWindow = window.top as BootstrappedWindow\n\t\t// This fails if we are sandboxed from the top frame.\n\t\ttopOrigin = topWindow.location.origin\n\t\tservices = (window.top as BootstrappedWindow)?.bootstrap?.services\n\t\tif (services) {\n\t\t\treturn services\n\t\t}\n\t} catch (e) {\n\t\t// Ignore\n\t}\n\tif (process.env.NODE_ENV !== \"development\" && topOrigin && topOrigin !== location.origin) {\n\t\tthrow Error(`Unexpectedly embedded by ${topOrigin} (expected ${location.origin})`)\n\t}\n\t// Don't trust any values if we get here on what seems to be a framer.com domain.\n\tif (location.origin.endsWith(\"framer.com\") || location.origin.endsWith(\"framer.dev\")) {\n\t\tthrow Error(\"ServiceMap data was not provided in document\")\n\t}\n\t// If we get here we're sandboxed from the top frame.\n\t// TODO: Provide this data via a trusted endpoint instead of query string.\n\ttry {\n\t\tconst servicesJSON =\n\t\t\tnew URLSearchParams(location.search).get(\"services\") ||\n\t\t\tnew URLSearchParams(location.hash.substring(1)).get(\"services\")\n\t\tif (servicesJSON) {\n\t\t\tservices = JSON.parse(servicesJSON)\n\t\t}\n\t} catch (e) {\n\t\t// Ignore\n\t}\n\tif (services && typeof services === \"object\" && services.api) {\n\t\treturn services\n\t}\n\tthrow Error(\"ServiceMap requested but not available\")\n}\n", "import { getServiceMap } from \"@framerjs/shared/src/ServiceMap.ts\"\nimport type { AssetWithOwnerTypes } from \"./AssetMap.ts\"\nimport type { Asset, AssetIntrinsicSize } from \"./types/Asset.ts\"\n\nexport function isString(value: unknown): value is string {\n\treturn typeof value === \"string\"\n}\n\nexport function isNumber(value: unknown): value is number {\n\treturn Number.isFinite(value)\n}\n\nexport function getAssetFilename(asset: Pick<Asset, \"key\" | \"extension\">): string {\n\treturn asset.key + asset.extension\n}\n\n/**\n * Creates an absolute URL to the image.\n */\nexport function createAbsoluteImageAssetURL(\n\tfilename: string,\n\tscaleDownTo?: number,\n\tisLossless?: boolean,\n\tintrinsicSize?: AssetIntrinsicSize,\n) {\n\tconst serviceMap = getServiceMap()\n\tconst baseURL = new URL(`${serviceMap.userContent}/images/${filename}`)\n\n\tif (isNumber(scaleDownTo)) baseURL.searchParams.set(\"scale-down-to\", `${scaleDownTo}`)\n\n\tif (isLossless) baseURL.searchParams.set(\"lossless\", \"1\")\n\n\tif (intrinsicSize) {\n\t\tbaseURL.searchParams.set(\"width\", intrinsicSize.width.toString())\n\t\tbaseURL.searchParams.set(\"height\", intrinsicSize.height.toString())\n\t}\n\treturn baseURL.toString()\n}\n\n/**\n * Creates an absolute URL to the image.\n */\nexport function createAbsoluteImageAssetURLFromAsset(\n\tasset: Omit<AssetWithOwnerTypes, \"ownerTypes\">,\n\tscaleDownTo?: number,\n\tisLossless?: boolean,\n) {\n\treturn createAbsoluteImageAssetURL(\n\t\tgetAssetFilename(asset),\n\t\tscaleDownTo,\n\t\tisLossless,\n\t\tasset.properties?.image\n\t\t\t? { width: asset.properties.image.width, height: asset.properties.image.height }\n\t\t\t: undefined,\n\t)\n}\n\n/**\n * Creates an absolute URL to the asset (non-images).\n */\nexport function createAbsoluteAssetURL(filename: string) {\n\tconst serviceMap = getServiceMap()\n\treturn `${serviceMap.userContent}/assets/${filename}`\n}\n\n/**\n * Creates an absolute URL to the asset (non-images).\n */\nexport function createAbsoluteAssetURLFromAsset(asset: Pick<Asset, \"key\" | \"extension\">) {\n\treturn createAbsoluteAssetURL(getAssetFilename(asset))\n}\n\nexport function extractAssetMetaFromAbsoluteURL(\n\trawUrl: string,\n): { filename: string; searchParams: URLSearchParams } | undefined {\n\tconst serviceMap = getServiceMap()\n\n\tconst url = new URL(rawUrl)\n\tif (url.origin !== serviceMap.userContent) return\n\n\tconst [, assetType, filename, ...rest] = url.pathname.split(\"/\")\n\tif (assetType !== \"images\" && assetType !== \"assets\") return\n\tif (filename === undefined || filename === \"\" || rest.length > 0) return\n\n\treturn { filename, searchParams: url.searchParams }\n}\n", "import { FontSourceNames, type WebFontFamilyLocator } from \"./types.ts\"\n\nexport const FRAMER_VARIABLE_FONT_SUFFIX = \"Variable\"\n\n/**\n * Creates CSS family name for a font, adding the variable suffix if it's a variable font.\n */\nexport function createCSSFamilyName(fontFamilyName: string, isVariable: boolean): string {\n\treturn isVariable ? `${fontFamilyName} ${FRAMER_VARIABLE_FONT_SUFFIX}` : fontFamilyName\n}\n\nexport function createCSSFontFamilyFromWebFontLocator(\n\tlocator: WebFontFamilyLocator,\n\tfontSource: FontSourceNames,\n): string {\n\t// This implementation must mirror createCSSFontFamily()\n\tswitch (fontSource) {\n\t\tcase FontSourceNames.Custom:\n\t\t\tthrow new Error(\"Custom fonts are not supported\")\n\t\tdefault:\n\t\t\treturn createCSSFamilyName(locator.name, locator.isVariable)\n\t}\n}\n", "import type { OpenTypeFeature, VariationAxis } from \"./types.ts\"\n\nexport function supportsOpenType(openTypeData: unknown): openTypeData is OpenTypeFeature[] {\n\treturn Boolean(openTypeData && Array.isArray(openTypeData))\n}\n\nexport function validateVariationAxes(variationAxesData: unknown): VariationAxis[] | undefined {\n\tif (!variationAxesData) return\n\tif (!Array.isArray(variationAxesData)) return\n\n\tconst variationAxes: VariationAxis[] = []\n\tfor (const axis of variationAxesData) {\n\t\tif (!isVariationAxis(axis)) continue\n\t\tvariationAxes.push({\n\t\t\ttag: axis.tag,\n\t\t\tname: axis.name,\n\t\t\tminValue: axis.minValue,\n\t\t\tmaxValue: axis.maxValue,\n\t\t\tdefaultValue: axis.defaultValue,\n\t\t})\n\t}\n\treturn variationAxes\n}\n\nexport function isOpenTypeFeature(feature: unknown): feature is OpenTypeFeature {\n\tif (typeof feature !== \"object\" || feature === null) return false\n\tif (!(\"tag\" in feature) || typeof (feature as { tag: unknown }).tag !== \"string\") return false\n\tif (\n\t\t\"coverage\" in feature &&\n\t\ttypeof (feature as { coverage: unknown }).coverage !== \"undefined\" &&\n\t\t!Array.isArray((feature as { coverage: unknown }).coverage)\n\t) {\n\t\treturn false\n\t}\n\treturn true\n}\n\nexport function isVariationAxis(axis: unknown): axis is VariationAxis {\n\tif (typeof axis !== \"object\" || axis === null) return false\n\tif (!(\"tag\" in axis) || typeof (axis as { tag: unknown }).tag !== \"string\") return false\n\tif (\"name\" in axis && typeof (axis as { name: unknown }).name !== \"string\") return false\n\tif (!(\"minValue\" in axis) || typeof (axis as { minValue: unknown }).minValue !== \"number\") return false\n\tif (!(\"maxValue\" in axis) || typeof (axis as { maxValue: unknown }).maxValue !== \"number\") return false\n\tif (!(\"defaultValue\" in axis) || typeof (axis as { defaultValue: unknown }).defaultValue !== \"number\") {\n\t\treturn false\n\t}\n\treturn true\n}\n", "import { createAbsoluteAssetURLFromAsset } from \"@framerjs/assets/src/utils.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport { createCSSFamilyName } from \"./css.ts\"\nimport { isOpenTypeFeature, supportsOpenType, validateVariationAxes } from \"./fontUtils.ts\"\nimport type {\n\tAsset,\n\tAssetFontProperties,\n\tFont,\n\tFontFamily,\n\tFontSource,\n\tFontVariant,\n\tOpenTypeFeature,\n\tReadonlyFont,\n\tReadonlyFontFamily,\n\tWebFontFamilyLocator,\n} from \"./types.ts\"\nimport { FontSourceNames } from \"./types.ts\"\n\nexport const builtInFontSelectorPrefix = \"BI;\"\n\ntype BuiltInFontAsset = Asset & {\n\tproperties: Asset[\"properties\"] & {\n\t\tfont: {\n\t\t\tfontVersion: NonNullable<AssetFontProperties[\"fontVersion\"]>\n\t\t\tfontFamily: NonNullable<AssetFontProperties[\"fontFamily\"]>\n\t\t}\n\t}\n}\n\n/** @internal */\nexport class BuiltInFontSource implements FontSource {\n\treadonly name: FontSourceNames = FontSourceNames.BuiltIn\n\n\tprivate fontFamilies: FontFamily[] = []\n\tprivate byFamilyName = new Map<string, FontFamily>()\n\tprivate assetByKey = new Map<string, BuiltInFontAsset>()\n\n\timportFonts(assets: readonly Asset[]): Font[] {\n\t\tthis.fontFamilies.length = 0\n\t\tthis.byFamilyName.clear()\n\t\tthis.assetByKey.clear()\n\n\t\tconst fonts: Font[] = []\n\n\t\tfor (const asset of assets) {\n\t\t\tif (!this.isValidBuiltInFont(asset)) continue\n\n\t\t\tconst { properties } = asset\n\n\t\t\tconst fontName = properties.font.fontFamily\n\t\t\tconst fontFamily: FontFamily = this.createFontFamily(\n\t\t\t\tfontName,\n\t\t\t\tproperties.font.foundryName,\n\t\t\t\tproperties.font.fontVersion,\n\t\t\t)\n\t\t\tconst openTypeData = properties.font.openTypeData\n\t\t\tconst variationAxesData = properties.font.variationAxes\n\t\t\tconst isVariableFont = Array.isArray(variationAxesData)\n\n\t\t\tconst variant = isVariableFont ? \"variable\" : properties.font.fontSubFamily || \"regular\"\n\t\t\tconst url = createAbsoluteAssetURLFromAsset(asset)\n\n\t\t\tconst font: Font = {\n\t\t\t\tassetKey: asset.key,\n\t\t\t\tfamily: fontFamily,\n\t\t\t\tselector: this.createSelector(fontName, variant, properties.font.fontVersion),\n\t\t\t\tvariant,\n\t\t\t\tfile: url,\n\t\t\t\thasOpenTypeFeatures: supportsOpenType(openTypeData),\n\t\t\t\tvariationAxes: validateVariationAxes(variationAxesData),\n\t\t\t\tcategory: properties.font.fontCategory,\n\t\t\t\tweight: variantNameToWeight(variant),\n\t\t\t\tstyle: getFontStyle(variant),\n\t\t\t\tcssFamilyName: createCSSFamilyName(fontName, isVariableFont),\n\t\t\t}\n\n\t\t\tfontFamily.fonts.push(font)\n\n\t\t\tthis.assetByKey.set(asset.key, asset)\n\t\t\tfonts.push(font)\n\t\t}\n\n\t\tfor (const fontFamily of this.fontFamilies) {\n\t\t\tfontFamily.fonts.sort((a, b) => {\n\t\t\t\tconst weightA = variantNameToWeight(a.variant)\n\t\t\t\tconst weightB = variantNameToWeight(b.variant)\n\t\t\t\tif (!weightA || !weightB) return 1\n\t\t\t\treturn weightA - weightB\n\t\t\t})\n\t\t}\n\n\t\treturn fonts\n\t}\n\n\tstatic parseVariant(variant: string): FontVariant {\n\t\tconst kebabCaseVariant = variantToKebabCase(variant)\n\t\tconst weight = variantsNameToWeight[kebabCaseVariant]\n\t\tconst style = getFontStyle(variant)\n\t\treturn { weight, style }\n\t}\n\n\tgetFontBySelector(selector: string): ReadonlyFont | undefined {\n\t\tconst locator = this.parseSelector(selector)\n\t\tif (!locator) return\n\t\tconst fontFamily = this.getFontFamilyByName(locator.name)\n\t\tif (!fontFamily) return\n\t\treturn fontFamily.fonts.find(f => f.selector === selector)\n\t}\n\n\tgetFontFamilyByName(family: string): ReadonlyFontFamily | null {\n\t\treturn this.byFamilyName.get(family) ?? null\n\t}\n\n\tprivate createFontFamily(family: string, foundryName?: string, version?: string): FontFamily {\n\t\tconst existingFontFamily = this.byFamilyName.get(family)\n\t\tif (existingFontFamily && existingFontFamily.version === version) return existingFontFamily\n\n\t\tconst fontFamily: FontFamily = {\n\t\t\tsource: this.name,\n\t\t\tname: family,\n\t\t\tfonts: [],\n\t\t\tfoundryName,\n\t\t\tversion,\n\t\t}\n\n\t\tthis.addFontFamily(fontFamily)\n\t\treturn fontFamily\n\t}\n\n\tgetOpenTypeFeatures(font: ReadonlyFont): OpenTypeFeature[] {\n\t\tassert(font.assetKey, \"Font must have an asset key\")\n\n\t\tconst asset = this.assetByKey.get(font.assetKey)\n\t\tconst openTypeData = asset?.properties?.font?.openTypeData\n\n\t\tif (!supportsOpenType(openTypeData)) return []\n\n\t\treturn openTypeData?.map((feature: unknown) => {\n\t\t\tif (!isOpenTypeFeature(feature)) return\n\t\t\treturn { tag: feature.tag, coverage: feature.coverage }\n\t\t}) as OpenTypeFeature[]\n\t}\n\n\tprivate isValidBuiltInFont(asset: Asset): asset is BuiltInFontAsset {\n\t\tif (!asset.mimeType.startsWith(\"font/\")) return false\n\t\tif (asset.properties?.kind !== \"font\") return false\n\t\tif (!asset.properties.font) return false\n\t\tif (!asset.properties.font.fontVersion) return false\n\t\tif (!asset.properties.font.fontFamily) return false\n\t\treturn \"fontFamily\" in asset.properties.font\n\t}\n\n\tprivate createSelector(family: string, variant: string, version: string) {\n\t\treturn `${builtInFontSelectorPrefix}${family}/${variant}/${version}`\n\t}\n\n\tpublic parseSelector(selector: string): WebFontFamilyLocator | null {\n\t\tif (!selector.startsWith(builtInFontSelectorPrefix)) return null\n\n\t\tconst [_, selectorWithoutPrefix] = selector.split(builtInFontSelectorPrefix)\n\t\tif (selectorWithoutPrefix === undefined) return null\n\n\t\tconst [name, variant, version] = selectorWithoutPrefix.split(\"/\")\n\t\tif (!name || !variant || !version) return null\n\n\t\treturn {\n\t\t\tname,\n\t\t\tvariant,\n\t\t\tsource: this.name,\n\t\t\tisVariable: variant.toLowerCase().includes(\"variable\"),\n\t\t}\n\t}\n\n\tprivate addFontFamily(fontFamily: FontFamily) {\n\t\tthis.fontFamilies.push(fontFamily)\n\t\tthis.byFamilyName.set(fontFamily.name, fontFamily)\n\t}\n}\n\n// This is a temporary workaround, to determine the weight of the font.\n// This will soon be moved to the backend, and directly returned from the API.\nconst variantsNameToWeight: Record<string, number> = {\n\tultralight: 100,\n\t\"ultralight-italic\": 100,\n\tthin: 200,\n\t\"thin-italic\": 200,\n\tdemi: 200,\n\tlight: 300,\n\t\"light-italic\": 300,\n\tnormal: 350,\n\tbase: 400,\n\tregular: 400,\n\tclassic: 400,\n\t\"regular-slanted\": 400,\n\titalic: 400,\n\toblique: 400,\n\tdense: 400,\n\tbrukt: 300,\n\tbook: 400,\n\t\"book-italic\": 400,\n\ttext: 400,\n\t\"text-italic\": 400,\n\tmedium: 500,\n\tsolid: 500,\n\t\"medium-oblique\": 500,\n\t\"medium-italic\": 500,\n\tmittel: 500,\n\tsemibold: 600,\n\t\"semibold-italic\": 600,\n\tbold: 700,\n\t\"bold-italic\": 700,\n\t\"bold-oblique\": 700,\n\tfett: 700,\n\tultrabold: 800,\n\t\"ultrabold-italic\": 800,\n\textrabold: 800,\n\t\"extrabold-italic\": 800,\n\tblack: 900,\n\textralight: 100,\n\t\"extralight-italic\": 100,\n\t\"black-italic\": 900,\n\t\"extra-italic\": 900,\n\t\"extra-italic-bold\": 900,\n\tsatt: 900,\n\theavy: 900,\n\t\"heavy-italic\": 900,\n\t// The following variants are only used in the FT88 font. These are not really weights, but more font styles (gothique, cursive, etc.).\n\t// We assign them different (fake) weights to ensure that the changes are picked up when switching between variants.\n\tserif: 100,\n\tschool: 200,\n\texpanded: 300,\n\tgothique: 500,\n\t// The following variants are only used in the ARK_ES font.\n\t// We assign them different (fake) weights to ensure that the changes are picked up when switching between variants.\n\t// The order is important because we want to group all the light together and solid together.\n\t\"dense-light\": 200,\n\t\"dense-regular\": 300,\n\t\"dense-medium\": 400,\n\t\"dense-bold\": 500,\n\t\"solid-light\": 600,\n\t\"solid-regular\": 700,\n\t\"solid-medium\": 800,\n\t\"solid-bold\": 900,\n\t// The following variants are only used in the Tecnica font.\n\t// We assign them different (fake) weights to ensure that the changes are picked up when switching between variants.\n\t\"53\": 400,\n\t\"55\": 600,\n\t// The following variants are only used in the Rag font.\n\t// We assign them different (fake) weights to ensure that the changes are picked up when switching between variants.\n\t\"narrow-regular\": 350,\n\t\"narrow-black\": 850,\n\t// we want to put variable fonts last\n\tvariable: 1000,\n\t\"variable-italic\": 1000,\n}\n\nfunction variantNameToWeight(variant: string) {\n\tconst kebabCaseVariant = variantToKebabCase(variant)\n\treturn variantsNameToWeight[kebabCaseVariant]\n}\n\nfunction variantToKebabCase(variant: string) {\n\treturn variant.toLowerCase().replace(/\\s+/gu, \"-\")\n}\n\nfunction getFontStyle(variant: string) {\n\tvariant = variant.toLowerCase()\n\tif (variant.includes(\"italic\") || variant.includes(\"oblique\") || variant.includes(\"slanted\")) return \"italic\"\n\treturn \"normal\"\n}\n\nexport const testing = { variantNameToWeight, getFontStyle }\n", "import type { SuccessfullyParsedFontVariant } from \"./types.ts\"\n\ntype FontVariantWithMetadata = SuccessfullyParsedFontVariant & { isVariable: boolean }\n\n/** @internal */\nexport function getRelatedFontVariants<T extends FontVariantWithMetadata>(\n\tcurrentVariant: T,\n\tavailableVariants: T[],\n): {\n\tvariantBold: T | undefined\n\tvariantBoldItalic: T | undefined\n\tvariantItalic: T | undefined\n\tvariantVariable: T | undefined\n\tvariantVariableItalic: T | undefined\n} {\n\treturn {\n\t\t...pickBoldItalicVariants(currentVariant, availableVariants),\n\t\t...pickVariableVariants(currentVariant, availableVariants),\n\t}\n}\n\nfunction pickBoldItalicVariants<T extends FontVariantWithMetadata>(currentVariant: T, availableVariants: T[]) {\n\tif (availableVariants.length === 0) {\n\t\treturn {\n\t\t\tvariantBold: undefined,\n\t\t\tvariantBoldItalic: undefined,\n\t\t\tvariantItalic: undefined,\n\t\t}\n\t}\n\n\tconst { weight: currentWeight, style: currentStyle } = currentVariant\n\tconst variantByWeightAndStyle = new Map<string, T>()\n\tconst boldVariantByStyle = new Map<string, T>()\n\n\tfor (const variant of availableVariants) {\n\t\t// Only consider variants that have the same type (static or variable).\n\t\t// This ensures that for static fonts, we only pick bold variants,\n\t\t// and for variable fonts, we only pick variable bold variants.\n\t\tif (variant.isVariable !== currentVariant.isVariable) continue\n\n\t\tvariantByWeightAndStyle.set(`${variant.weight}-${variant.style}`, variant)\n\n\t\tif (variant.weight <= currentWeight) continue\n\t\tif (!boldVariantByStyle.has(variant.style)) {\n\t\t\tboldVariantByStyle.set(variant.style, variant)\n\t\t}\n\t}\n\n\t// Follow the relative weights convention when possible. If those weights aren't available, load the \"next\" bolder variant\n\t// More in https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight\n\tlet variantBold: T | undefined = boldVariantByStyle.get(currentStyle)\n\tlet variantBoldItalic: T | undefined = boldVariantByStyle.get(\"italic\")\n\n\tconst currentVariantWeight = currentVariant.weight\n\tif (currentVariantWeight <= 300) {\n\t\tvariantBold = variantByWeightAndStyle.get(`400-${currentStyle}`) ?? variantBold\n\n\t\tvariantBoldItalic = variantByWeightAndStyle.get(\"400-italic\") ?? variantBoldItalic\n\t} else if (currentVariantWeight <= 500) {\n\t\tvariantBold = variantByWeightAndStyle.get(`700-${currentStyle}`) ?? variantBold\n\n\t\tvariantBoldItalic = variantByWeightAndStyle.get(\"700-italic\") ?? variantBoldItalic\n\t} else {\n\t\tvariantBold = variantByWeightAndStyle.get(`900-${currentStyle}`) ?? variantBold\n\n\t\tvariantBoldItalic = variantByWeightAndStyle.get(\"900-italic\") ?? variantBoldItalic\n\t}\n\n\t// Follow the `font-style: italic` defaults logic as stated in\n\t// https://developer.mozilla.org/en-US/docs/Web/CSS/font-style\n\tconst variantItalic = variantByWeightAndStyle.get(`${currentWeight}-italic`)\n\n\treturn { variantBold, variantItalic, variantBoldItalic }\n}\n\nfunction pickVariableVariants<T extends FontVariantWithMetadata>(currentVariant: T, availableVariants: T[]) {\n\tif (availableVariants.length === 0) return { variantVariable: undefined, variantVariableItalic: undefined }\n\t// TODO for custom fonts pick the variable variants based on the variation axes\n\tconst variantByWeightAndStyle = new Map<string, T>()\n\tlet variantVariable: T | undefined\n\tlet variantVariableItalic: T | undefined\n\tlet fallbackVariant: T | undefined\n\tlet fallbackItalicVariant: T | undefined\n\tfor (const variant of availableVariants) {\n\t\tif (!variant.isVariable) continue\n\t\tconst isSameWeight = variant.weight === currentVariant.weight\n\t\tconst isDefaultWeight = variant.weight === 400\n\t\tif (variant.style === \"normal\") {\n\t\t\tif (isSameWeight) {\n\t\t\t\tvariantVariable = variant\n\t\t\t} else if (isDefaultWeight) {\n\t\t\t\tfallbackVariant = variant\n\t\t\t} else if (!fallbackVariant) {\n\t\t\t\tfallbackVariant = variant\n\t\t\t}\n\t\t} else if (variant.style === \"italic\") {\n\t\t\tif (isSameWeight) {\n\t\t\t\tvariantVariableItalic = variant\n\t\t\t} else if (isDefaultWeight) {\n\t\t\t\tfallbackItalicVariant = variant\n\t\t\t} else if (!fallbackItalicVariant) {\n\t\t\t\tfallbackItalicVariant = variant\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tvariantVariable: variantVariable ?? fallbackVariant,\n\t\tvariantVariableItalic: variantVariableItalic ?? fallbackItalicVariant,\n\t}\n}\n", "import type { ComponentFont } from \"../../utils/addFonts.ts\"\nimport type { Font, ReadonlyFont } from \"./types.ts\"\n\n/** @internal */\nexport type VariableFont = Font & { variationAxes: NonNullable<Font[\"variationAxes\"]> }\n\n/** @internal */\ninterface ComponentFontWithVariationAxes extends ComponentFont {\n\tvariationAxes: NonNullable<ComponentFont[\"variationAxes\"]>\n}\n\n/**\n * Checks whether a font is a variable font.\n *\n * @internal\n */\nexport function isVariableFont(font: ComponentFont): font is ComponentFontWithVariationAxes\nexport function isVariableFont(font: Font | ReadonlyFont): font is VariableFont\nexport function isVariableFont(font: Font | ReadonlyFont | ComponentFont): font is VariableFont {\n\treturn Boolean(font.variationAxes)\n}\n", "import { createAbsoluteAssetURLFromAsset } from \"@framerjs/assets/src/utils.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport { getLogger } from \"../../utils/getLogger.ts\"\nimport { FRAMER_VARIABLE_FONT_SUFFIX } from \"./css.ts\"\nimport { isOpenTypeFeature, supportsOpenType, validateVariationAxes } from \"./fontUtils.ts\"\nimport { getRelatedFontVariants } from \"./getRelatedFontVariants.ts\"\nimport type {\n\tAssetFontProperties,\n\tAssetWithOwnerTypes,\n\tFont,\n\tFontFamily,\n\tFontSource,\n\tOpenTypeFeature,\n\tReadonlyFont,\n\tReadonlyFontFamily,\n} from \"./types.ts\"\nimport { FontSourceNames } from \"./types.ts\"\nimport { isVariableFont } from \"./variableFont.ts\"\n\nconst log = getLogger(\"custom-font-source\")\n\n// When we started using grouping custom fonts by family in the UI, we also updated the selector\n// prefix, because we won't destinguish custom fonts by family in the css anymore, so we need\n// different font loading for the old and new selectors.\nexport const customFontSelectorLegacyPrefix = \"CUSTOM;\"\nexport const customFontSelectorPrefixV2 = \"CUSTOMV2;\"\n\nexport function isCustomFontSelector(selector: string): boolean {\n\treturn isCustomFontSelectorV2(selector) || isCustomFontSelectorLegacy(selector)\n}\n\nexport function isCustomFontSelectorV2(selector: string): boolean {\n\treturn selector.startsWith(customFontSelectorPrefixV2)\n}\n\nexport function isCustomFontSelectorLegacy(selector: string): boolean {\n\treturn selector.startsWith(customFontSelectorLegacyPrefix)\n}\n\nfunction findDuplicateFont(\n\texistingFonts: Font[],\n\tnewFont: Font,\n): { existingFont: Font; index: number; projectDuplicate: boolean } | undefined {\n\tfor (let i = 0; i < existingFonts.length; i++) {\n\t\tconst existingFont = existingFonts[i]\n\t\tif (!existingFont) continue\n\n\t\t// Check for a font asset duplicated to both the workspace and the project.\n\t\t// We deduplicate by content hash on the CDN, so `file` will be the same.\n\t\tif (existingFont.owner !== newFont.owner && existingFont.file === newFont.file) {\n\t\t\treturn { existingFont, index: i, projectDuplicate: true }\n\t\t}\n\n\t\tif (\n\t\t\texistingFont &&\n\t\t\t// TODO: When fonts have a duplicate selector, we assume it's the same font, but it can\n\t\t\t// be a different file. Currently there is no way to resolve these conflicts in the UI.\n\t\t\t// This problem exsits already for files with the same metadata.\n\t\t\texistingFont.selector === newFont.selector\n\t\t) {\n\t\t\treturn { existingFont, index: i, projectDuplicate: false }\n\t\t}\n\t}\n\treturn undefined\n}\n\n/**\n * @deprecated Use getCustomFontInfo instead.\n * With properties provided, the preferred family and sub family are chosen over the base font family.\n */\nexport function getLegacyFontFamilyName(properties: Exclude<AssetWithOwnerTypes[\"properties\"], undefined>): string {\n\tconst { font } = properties\n\tconst fontFamily = font.fontFamily\n\tconst isAssetVariableFont = Array.isArray(font.variationAxes)\n\tif (isAssetVariableFont && fontFamily.toLowerCase().includes(\"variable\")) return fontFamily\n\n\tconst variant = isAssetVariableFont ? FRAMER_VARIABLE_FONT_SUFFIX : font.fontSubFamily.trim()\n\tif (variant === \"\") return fontFamily\n\treturn `${fontFamily} ${variant}`\n}\n\n/**\n * Extracts the font variant directly from the asset properties.\n * Returns the variant as specified in the font metadata without inference.\n */\nexport function getCustomFontInfo({ fontFamily, fontSubFamily, variationAxes, faceDescriptors }: AssetFontProperties): {\n\tfamily: string\n\tvariant: string\n\tweight: number\n\tstyle: \"normal\" | \"italic\"\n} {\n\tconst rawVariant = fontSubFamily.trim() || \"Regular\"\n\tconst containsVariant = rawVariant.toLocaleLowerCase().includes(\"variable\")\n\tconst variant = validateVariationAxes(variationAxes) && !containsVariant ? `Variable ${rawVariant}` : rawVariant\n\tlet style: \"normal\" | \"italic\" = \"normal\"\n\tlet weight = 400\n\tif (faceDescriptors) {\n\t\tweight = faceDescriptors.weight\n\t\tstyle = faceDescriptors.italic || faceDescriptors.oblique ? \"italic\" : \"normal\"\n\t}\n\treturn { family: fontFamily, variant, weight, style }\n}\n\n/** @internal */\nexport class CustomFontSource implements FontSource {\n\treadonly name: FontSourceNames = FontSourceNames.Custom\n\n\tprivate fontFamilies: FontFamily[] = []\n\tprivate byFamilyName = new Map<string, FontFamily>()\n\tprivate assetsByKey = new Map<string, AssetWithOwnerTypes>()\n\n\tdeprecatedImportFonts(assets: readonly AssetWithOwnerTypes[]): Font[] {\n\t\tthis.fontFamilies.length = 0\n\t\tthis.byFamilyName.clear()\n\t\tthis.assetsByKey.clear()\n\n\t\tconst fonts: Font[] = []\n\n\t\tfor (const asset of assets) {\n\t\t\tif (!this.isValidCustomFontAsset(asset)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst variationAxesData = asset.properties?.font.variationAxes\n\t\t\tconst assetIsVariableFont = Array.isArray(variationAxesData)\n\n\t\t\tconst fontName = getLegacyFontFamilyName(asset.properties)\n\t\t\tconst fontFamily: FontFamily = this.createFontFamily(fontName)\n\t\t\tconst openTypeData = asset.properties?.font.openTypeData\n\t\t\tconst variant = assetIsVariableFont ? \"variable\" : this.inferVariantName(fontName)\n\t\t\tconst url = createAbsoluteAssetURLFromAsset(asset)\n\t\t\tconst selector = CustomFontSource.createLegacySelector(fontName)\n\n\t\t\t// Create V2 selector for forwards compatibility\n\t\t\tconst { family, variant: v2Variant } = getCustomFontInfo(asset.properties.font)\n\t\t\tconst v2Selector = CustomFontSource.createSelector(family, v2Variant)\n\n\t\t\tconst font: Font = {\n\t\t\t\tassetKey: asset.key,\n\t\t\t\tfamily: fontFamily,\n\t\t\t\tselector,\n\t\t\t\tvariant,\n\t\t\t\tfile: url,\n\t\t\t\thasOpenTypeFeatures: supportsOpenType(openTypeData),\n\t\t\t\tvariationAxes: validateVariationAxes(variationAxesData),\n\t\t\t\towner: getAssetOwnerType(asset),\n\t\t\t\tcssFamilyName: CustomFontSource.cssFontFamilyFromSelector(selector),\n\t\t\t\talternativeSelectors: {\n\t\t\t\t\t[v2Selector]: {\n\t\t\t\t\t\tvariant: v2Variant,\n\t\t\t\t\t\tcssFamilyName: CustomFontSource.cssFontFamilyFromSelector(v2Selector),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tfontFamily.fonts.push(font)\n\n\t\t\tthis.assetsByKey.set(asset.key, asset)\n\t\t\tfonts.push(...fontFamily.fonts)\n\t\t}\n\n\t\treturn fonts\n\t}\n\n\timportFonts(assets: readonly AssetWithOwnerTypes[], enableFontImprovements: boolean): Font[] {\n\t\tif (!enableFontImprovements) {\n\t\t\treturn this.deprecatedImportFonts(assets)\n\t\t}\n\n\t\tthis.fontFamilies.length = 0\n\t\tthis.byFamilyName.clear()\n\t\tthis.assetsByKey.clear()\n\n\t\tconst fonts: Record<string, Font> = {}\n\n\t\tfor (const asset of assets) {\n\t\t\tif (!this.isValidCustomFontAsset(asset)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst { family, variant, weight, style } = getCustomFontInfo(asset.properties.font)\n\n\t\t\tconst variationAxesData = asset.properties.font.variationAxes\n\t\t\tconst assetIsVariableFont = Array.isArray(variationAxesData)\n\t\t\tconst openTypeData = asset.properties.font.openTypeData\n\t\t\tconst url = createAbsoluteAssetURLFromAsset(asset)\n\t\t\tconst ownerType = getAssetOwnerType(asset)\n\t\t\tconst legacyFontFamilyName = getLegacyFontFamilyName(asset.properties)\n\t\t\tconst legacySelector = CustomFontSource.createLegacySelector(legacyFontFamilyName)\n\t\t\tconst fontFamily: FontFamily = this.createFontFamily(family)\n\t\t\tconst selector = CustomFontSource.createSelector(fontFamily.name, variant)\n\n\t\t\tconst font: Font = {\n\t\t\t\tassetKey: asset.key,\n\t\t\t\tfamily: fontFamily,\n\t\t\t\tselector,\n\t\t\t\tvariant,\n\t\t\t\tweight,\n\t\t\t\tstyle,\n\t\t\t\tfile: url,\n\t\t\t\thasOpenTypeFeatures: supportsOpenType(openTypeData),\n\t\t\t\tvariationAxes: validateVariationAxes(variationAxesData),\n\t\t\t\towner: ownerType,\n\t\t\t\talternativeSelectors: {\n\t\t\t\t\t[legacySelector]: {\n\t\t\t\t\t\tvariant: assetIsVariableFont ? \"variable\" : this.inferVariantName(legacyFontFamilyName),\n\t\t\t\t\t\tcssFamilyName: CustomFontSource.cssFontFamilyFromSelector(legacySelector),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tcssFamilyName: CustomFontSource.cssFontFamilyFromSelector(selector),\n\t\t\t}\n\n\t\t\tconst duplicateInfo = findDuplicateFont(fontFamily.fonts, font)\n\n\t\t\tif (duplicateInfo?.projectDuplicate) {\n\t\t\t\t// We expect to see identical duplicated fonts where one is owned by the team and one by the project.\n\t\t\t\t// We should prioritize the project font.\n\t\t\t\tif (font.owner === \"project\") {\n\t\t\t\t\tfontFamily.fonts[duplicateInfo.index] = font\n\t\t\t\t\tfonts[selector] = font\n\t\t\t\t}\n\t\t\t} else if (duplicateInfo) {\n\t\t\t\tlog.debug(\"Duplicate font found for:\", font, \"with existing font:\", duplicateInfo.existingFont)\n\t\t\t\tconst existingFont = duplicateInfo.existingFont\n\t\t\t\tconst newIsWoff2 = font.file?.endsWith(\".woff2\") ?? false\n\t\t\t\tconst existingIsWoff2 = existingFont.file?.endsWith(\".woff2\") ?? false\n\n\t\t\t\tif (newIsWoff2 && !existingIsWoff2) {\n\t\t\t\t\tfontFamily.fonts[duplicateInfo.index] = font\n\t\t\t\t\tfonts[selector] = font\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfontFamily.fonts.push(font)\n\t\t\t\tfonts[selector] = font\n\t\t\t}\n\n\t\t\tthis.assetsByKey.set(asset.key, asset)\n\t\t}\n\n\t\tfor (const fontFamily of this.fontFamilies) {\n\t\t\tif (fontFamily.fonts.length > 0) {\n\t\t\t\tupdateFontRelationships(fontFamily)\n\t\t\t}\n\t\t}\n\t\treturn Object.values(fonts)\n\t}\n\n\tstatic createSelector(family: string, variant: string) {\n\t\treturn `${customFontSelectorPrefixV2}${family}${variant ? ` ${variant}` : \"\"}`\n\t}\n\n\tstatic createLegacySelector(fontName: string) {\n\t\treturn `${customFontSelectorLegacyPrefix}${fontName}`\n\t}\n\n\tstatic cssFontFamilyFromSelector(selector: string) {\n\t\tassert(isCustomFontSelector(selector), \"Selector must be a custom font selector\")\n\t\tif (isCustomFontSelectorLegacy(selector)) {\n\t\t\treturn selector.slice(customFontSelectorLegacyPrefix.length)\n\t\t}\n\t\treturn selector.slice(customFontSelectorPrefixV2.length)\n\t}\n\n\tprivate isValidCustomFontAsset(asset: AssetWithOwnerTypes): asset is AssetWithOwnerTypes & {\n\t\tproperties: AssetFontProperties\n\t} {\n\t\tif (!asset.mimeType.startsWith(\"font/\")) return false\n\t\tif (asset.properties?.kind !== \"font\") return false\n\t\tif (!asset.properties.font) return false\n\t\treturn \"fontFamily\" in asset.properties.font\n\t}\n\n\tgetOpenTypeFeatures(font: ReadonlyFont): OpenTypeFeature[] {\n\t\tassert(font.assetKey, \"Font must have an asset key\")\n\n\t\tconst asset = this.assetsByKey.get(font.assetKey)\n\t\tconst openTypeData = asset?.properties?.font?.openTypeData\n\n\t\tif (!supportsOpenType(openTypeData)) return []\n\n\t\treturn openTypeData?.map((feature: unknown) => {\n\t\t\tif (!isOpenTypeFeature(feature)) return\n\t\t\treturn { tag: feature.tag, coverage: feature.coverage }\n\t\t}) as OpenTypeFeature[]\n\t}\n\n\tinferVariantName(family: string) {\n\t\tconst possibleValues = [\n\t\t\t\"thin\",\n\t\t\t\"ultra light\",\n\t\t\t\"extra light\",\n\t\t\t\"light\",\n\t\t\t\"normal\",\n\t\t\t\"medium\",\n\t\t\t\"semi bold\",\n\t\t\t\"bold\",\n\t\t\t\"extra bold\",\n\t\t\t\"black\",\n\t\t]\n\t\tconst possibleValuesWithItalics = [...possibleValues.map(value => `${value} italic`), ...possibleValues]\n\t\tconst lowerCaseFamily = family.toLowerCase()\n\t\tconst tokens = [...lowerCaseFamily.split(\" \"), ...lowerCaseFamily.split(\"-\"), ...lowerCaseFamily.split(\"_\")]\n\t\tconst foundToken = possibleValuesWithItalics.find(\n\t\t\tvalue => tokens.includes(value) || tokens.includes(value.replace(/\\s+/gu, \"\")),\n\t\t)\n\n\t\t// Return found token with each letter capitalized\n\t\tif (foundToken) return foundToken.replace(/^\\w|\\s\\w/gu, char => char.toUpperCase())\n\n\t\treturn \"Regular\"\n\t}\n\n\tcreateFontFamily(family: string): FontFamily {\n\t\tconst existingFontFamily = this.byFamilyName.get(family)\n\t\tif (existingFontFamily) return existingFontFamily\n\n\t\tconst fontFamily: FontFamily = {\n\t\t\tsource: this.name,\n\t\t\tname: family,\n\t\t\tfonts: [],\n\t\t}\n\n\t\tthis.addFontFamily(fontFamily)\n\t\treturn fontFamily\n\t}\n\n\tprivate addFontFamily(fontFamily: FontFamily) {\n\t\tthis.fontFamilies.push(fontFamily)\n\t\tthis.byFamilyName.set(fontFamily.name, fontFamily)\n\t}\n\n\tgetFontFamilyByName(family: string): ReadonlyFontFamily | null {\n\t\tconst foundFontFamily = this.byFamilyName.get(family)\n\t\tif (!foundFontFamily) return null\n\t\treturn foundFontFamily\n\t}\n}\n\nexport const testing = {\n\tfindDuplicateFont,\n\tcustomFontSelectorLegacyPrefix,\n\tcustomFontSelectorPrefixV2,\n}\n\n/**\n * Converts a Font object to the format expected by getRelatedFontVariants\n * @internal\n */\nfunction fontToVariantWithMetadata(font: Font) {\n\tif (!font.weight || !font.style) return undefined\n\treturn {\n\t\tweight: font.weight,\n\t\tstyle: font.style,\n\t\tisVariable: isVariableFont(font),\n\t\tselector: font.selector,\n\t} as const\n}\n\n/**\n * Updates font relationships (selectorVariable, selectorVariableItalic, etc.) for all fonts in a family\n */\nfunction updateFontRelationships(fontFamily: FontFamily) {\n\tconst availableVariants = fontFamily.fonts\n\t\t.map(font => fontToVariantWithMetadata(font))\n\t\t.filter(font => font !== undefined)\n\t// Update selector properties for each font based on related variants\n\tfor (const font of fontFamily.fonts) {\n\t\tconst variant = fontToVariantWithMetadata(font)\n\t\tif (!variant) continue\n\t\tconst relatedVariants = getRelatedFontVariants(variant, availableVariants)\n\t\tfont.selectorVariable = relatedVariants.variantVariable?.selector\n\t\tfont.selectorVariableItalic = relatedVariants.variantVariableItalic?.selector\n\t\tfont.selectorBold = relatedVariants.variantBold?.selector\n\t\tfont.selectorBoldItalic = relatedVariants.variantBoldItalic?.selector\n\t\tfont.selectorItalic = relatedVariants.variantItalic?.selector\n\t}\n}\n\nfunction getAssetOwnerType(asset: AssetWithOwnerTypes): \"team\" | \"project\" {\n\t// If the same asset is in the team and the project, we treat it as a team font.\n\treturn asset.ownerTypes.includes(\"team\") ? \"team\" : \"project\"\n}\n", "import type { FontSourceNames, OpenTypeFeature } from \"./types.ts\"\n\nexport async function loadFontsWithOpenType(\n\tsource: Exclude<FontSourceNames, FontSourceNames.Local | FontSourceNames.Custom | FontSourceNames.Framer>,\n): Promise<Record<string, true>> {\n\tswitch (source) {\n\t\tcase \"google\": {\n\t\t\tconst supportedFonts = await import(\"./static/open-type/supported/google.json\", { with: { type: \"json\" } })\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- Is is an optimizationt to make sure TS doesn't evaluate the type of the expression\n\t\t\treturn supportedFonts.default\n\t\t}\n\n\t\tcase \"fontshare\": {\n\t\t\tconst supportedFonts = await import(\"./static/open-type/supported/fontshare.json\", {\n\t\t\t\twith: { type: \"json\" },\n\t\t\t})\n\t\t\treturn supportedFonts.default\n\t\t}\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown font source: ${source}`)\n\t}\n}\n\nexport async function loadFontToOpenTypeFeatures(\n\tsource: Exclude<FontSourceNames, FontSourceNames.Local | FontSourceNames.Custom>,\n): Promise<Record<string, OpenTypeFeature[]>> {\n\tswitch (source) {\n\t\tcase \"google\": {\n\t\t\tconst features = await import(\"./static/open-type/features/google.json\", { with: { type: \"json\" } })\n\t\t\treturn features.default\n\t\t}\n\t\tcase \"fontshare\": {\n\t\t\tconst features = await import(\"./static/open-type/features/fontshare.json\", { with: { type: \"json\" } })\n\t\t\treturn features.default\n\t\t}\n\t\tcase \"framer\": {\n\t\t\tconst features = await import(\"./static/open-type/features/framer-font.json\", { with: { type: \"json\" } })\n\t\t\treturn features.default\n\t\t}\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown font source: ${source}`)\n\t}\n}\n", "const knownFontshareCategories = [\"display\", \"sans\", \"serif\", \"slab\", \"handwritten\", \"script\"] as const\n\nexport type FontshareCategory = (typeof knownFontshareCategories)[number]\n\n// It appears that Fontshare\u2019s `category` field is a simple string field that can contain freeform data.\n// As of Jan 2024, it may look like:\n// - \"display\" \u2192 single category\n// - \"serif, display\" \u2192 multiple categories\n// - \"serif,  blackletter, display\" \u2192 multiple categories, with double spaces [sic] and some categories being non-canonical\n// We try our best at normalizing this into a list of canonical categories.\nexport function parseFontshareCategories(categoriesField: string): FontshareCategory[] {\n\treturn categoriesField\n\t\t.split(\",\")\n\t\t.map(category => category.trim().toLowerCase())\n\t\t.filter(isKnownFontshareCategory)\n}\n\nfunction isKnownFontshareCategory(category: string): category is FontshareCategory {\n\treturn knownFontshareCategories.includes(category as any)\n}\n", "import { createCSSFamilyName } from \"./css.ts\"\nimport { getRelatedFontVariants } from \"./getRelatedFontVariants.ts\"\nimport { loadFontToOpenTypeFeatures, loadFontsWithOpenType } from \"./loadOpenType.ts\"\nimport type { FontshareCategory } from \"./parseFontshareCategories.ts\"\nimport { parseFontshareCategories } from \"./parseFontshareCategories.ts\"\nimport type {\n\tFont,\n\tFontCategory,\n\tFontFamily,\n\tFontSource,\n\tFontSourceName,\n\tOpenTypeFeature,\n\tReadonlyFont,\n\tReadonlyFontFamily,\n\tSuccessfullyParsedFontVariant,\n\tVariationAxis,\n\tWebFontFamilyLocator,\n} from \"./types.ts\"\nimport { FontSourceNames } from \"./types.ts\"\n\nexport const fontsharePrefix = \"FS;\"\n\n/** @internal */\nexport interface FontshareAxes {\n\tid: string\n\tname: string\n\tproperty: string\n\trange_default: number\n\trange_left: number\n\trange_right: number\n}\n\n/** @internal */\nexport interface FontshareStyle {\n\tid: string\n\tname: string\n\tfile: string\n\tis_variable: boolean\n}\n\n/** @internal */\nexport interface FontshareFont {\n\tid: string\n\tname: string\n\tis_variable?: boolean\n\tfont_styles: FontshareStyle[]\n\tfont_axes: FontshareAxes[]\n\t/** May be \"display\" or \"sans, display\" or even \"serif,  blackletter, display\" [with double space!] */\n\tcategory: string\n}\n\n/** @internal */\nexport interface FontshareFonts {\n\tfonts: FontshareFont[]\n}\n\n/** @internal */\nconst weightNameToNumber: Record<string, number> = {\n\tthin: 100,\n\thairline: 100, // Alternative name for \"thin\".\n\textralight: 200,\n\tlight: 300,\n\tregular: 400,\n\tmedium: 500,\n\tsemibold: 600,\n\tbold: 700,\n\textrabold: 800,\n\tultra: 800, // Alternative name for \"extrabold\".\n\tblack: 900,\n\theavy: 900, // Alternative name for \"black\".\n}\n\n/** @internal */\nconst weightNames = /* @__PURE__ */ Object.keys(weightNameToNumber)\n\n/** @internal */\n// Match any of the weight names at the start of the variant string.\nconst allowedVariantsRegex = /* @__PURE__ */ (() =>\n\tnew RegExp(`^(?:${[...weightNames, \"italic\", \"variable\"].join(\"|\")})`, \"u\"))()\n\n/** @internal */\nexport class FontshareSource implements FontSource {\n\treadonly name: FontSourceName = FontSourceNames.Fontshare\n\n\tprivate fontFamilies: FontFamily[] = []\n\tprivate byFamilyName = new Map<string, FontFamily>()\n\n\tgetFontFamilyByName(family: string): ReadonlyFontFamily | null {\n\t\treturn this.byFamilyName.get(family) ?? null\n\t}\n\n\t/**\n\t * Parses variant a string into a weight number and style, defaulting to a\n\t * weight of `400` and/or a style of `\"normal\"` depending on what isn't\n\t * present in the variant string.\n\t *\n\t * E.g:\n\t *   - `\"Bold\"` becomes `{ weight: 700, style: \"normal\" }`\n\t *   - `\"Bold Italic\"` becomes `{ weight: 700, style: \"italic\" }`\n\t *   - `\"Italic\"` becomes `{ weight: 400, style: \"italic\" }`\n\t *   - `\"Variable Italic\"` becomes `{ weight: 400, style: \"italic\" }`\n\t */\n\tstatic parseVariant(variant: string): SuccessfullyParsedFontVariant {\n\t\tconst variantSplit = variant.toLowerCase().split(\" \")\n\n\t\tconst weightName = weightNames.find(weightName => {\n\t\t\treturn variantSplit.includes(weightName)\n\t\t})\n\t\tconst styleName = variant.toLowerCase().includes(\"italic\") ? \"italic\" : \"normal\"\n\n\t\tconst weight = (weightName && weightNameToNumber[weightName]) || 400\n\t\tconst style = styleName === \"italic\" ? styleName : \"normal\"\n\n\t\treturn { weight, style }\n\t}\n\n\tparseSelector(selector: string): WebFontFamilyLocator | null {\n\t\tif (!selector.startsWith(fontsharePrefix)) return null\n\n\t\tconst tokens = selector.split(\"-\")\n\t\tif (tokens.length !== 2) return null\n\n\t\tconst [family, variant] = tokens\n\t\tif (!family || !variant) return null\n\n\t\treturn {\n\t\t\tname: family.replace(fontsharePrefix, \"\"),\n\t\t\tvariant,\n\t\t\tsource: this.name,\n\t\t\tisVariable: variant.toLowerCase().includes(\"variable\"),\n\t\t}\n\t}\n\n\tstatic createSelector(family: string, variant: string) {\n\t\treturn `${fontsharePrefix}${family}-${variant.toLowerCase()}`\n\t}\n\n\t/**\n\t * We are using this selector to get Open Type features and variable fonts variation axes.\n\t * CAUTION: This method has to be exactly the same as the one in font-metadata-extractor tool.\n\t * https://github.com/framer/FramerStudio/blob/master/tools/font-metadata-extractor/src/utils/fontShare.ts\n\t */\n\tstatic createMetadataSelector(family: string) {\n\t\treturn `${fontsharePrefix}${family}`\n\t}\n\n\tprivate addFontFamily(fontFamily: FontFamily) {\n\t\tthis.fontFamilies.push(fontFamily)\n\t\tthis.byFamilyName.set(fontFamily.name, fontFamily)\n\t}\n\n\tasync importFonts(\n\t\tfontshareFonts: FontshareFont[],\n\t\tvariationAxesData?: Record<string, VariationAxis[]> | undefined,\n\t): Promise<Font[]> {\n\t\tthis.fontFamilies.length = 0\n\t\tthis.byFamilyName.clear()\n\n\t\tconst fontsWithOpenType = await loadFontsWithOpenType(FontSourceNames.Fontshare)\n\n\t\tconst fonts: Font[] = []\n\n\t\tfor (const fontshareFont of fontshareFonts) {\n\t\t\tconst fontStyles = fontshareFont.font_styles.filter(fontStyle => {\n\t\t\t\tconst variant = fontStyle.name.toLowerCase()\n\n\t\t\t\t// We exclude variants that don't map directly to a CSS\n\t\t\t\t// `font-weight`. For example, variants such as \"hairline\",\n\t\t\t\t// \"semilight\", \"zero\" or \"variable\" etc. We also don't support\n\t\t\t\t// the ability to select `font-stretch` in the properties\n\t\t\t\t// panel, so we also exclude any variant that has a \"wide\"\n\t\t\t\t// suffix.\n\t\t\t\tconst allowedVariantMatch = allowedVariantsRegex.exec(variant)\n\n\t\t\t\tif (!allowedVariantMatch || variant.split(\" \").includes(\"wide\")) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\n\t\t\t\treturn true\n\t\t\t})\n\n\t\t\tconst fontVariants = fontStyles.map(fontStyle => {\n\t\t\t\tconst variantInfo = FontshareSource.parseVariant(fontStyle.name)\n\t\t\t\treturn {\n\t\t\t\t\t...variantInfo,\n\t\t\t\t\tselector: FontshareSource.createSelector(fontshareFont.name, fontStyle.name),\n\t\t\t\t\tisVariable: fontStyle.is_variable,\n\t\t\t\t\tfontshareVariantName: fontStyle.name,\n\t\t\t\t\tfile: fontStyle.file,\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tconst key = FontshareSource.createMetadataSelector(fontshareFont.name)\n\t\t\tconst variationAxes = variationAxesData?.[key]\n\n\t\t\tconst familyName = fontshareFont.name\n\t\t\tlet fontFamily = this.getFontFamilyByName(familyName) as FontFamily | null\n\t\t\tif (!fontFamily) {\n\t\t\t\tfontFamily = { name: familyName, fonts: [], source: this.name }\n\t\t\t\tthis.addFontFamily(fontFamily)\n\t\t\t}\n\n\t\t\tconst fontMetadataSelector = FontshareSource.createMetadataSelector(fontshareFont.name)\n\t\t\tconst hasOpenTypeFeatures = fontsWithOpenType[fontMetadataSelector]\n\n\t\t\tfor (const fontVariant of fontVariants) {\n\t\t\t\tconst { variantBold, variantBoldItalic, variantItalic, variantVariable, variantVariableItalic } =\n\t\t\t\t\tgetRelatedFontVariants(fontVariant, fontVariants)\n\n\t\t\t\tconst font: Font = {\n\t\t\t\t\tfamily: fontFamily,\n\t\t\t\t\tvariant: fontVariant.fontshareVariantName.toLowerCase(),\n\t\t\t\t\tselector: fontVariant.selector,\n\t\t\t\t\tselectorBold: variantBold?.selector,\n\t\t\t\t\tselectorBoldItalic: variantBoldItalic?.selector,\n\t\t\t\t\tselectorItalic: variantItalic?.selector,\n\t\t\t\t\tselectorVariable: variantVariable?.selector,\n\t\t\t\t\tselectorVariableItalic: variantVariableItalic?.selector,\n\t\t\t\t\tweight: fontVariant.weight,\n\t\t\t\t\tstyle: fontVariant.style,\n\t\t\t\t\tfile: fontVariant.file,\n\t\t\t\t\tcategory: mapToKnownCategory(fontshareFont.category),\n\t\t\t\t\thasOpenTypeFeatures,\n\t\t\t\t\tvariationAxes: fontVariant.isVariable ? variationAxes : undefined,\n\t\t\t\t\tcssFamilyName: createCSSFamilyName(fontFamily.name, fontVariant.isVariable),\n\t\t\t\t}\n\n\t\t\t\tfontFamily.fonts.push(font)\n\t\t\t\tfonts.push(font)\n\t\t\t}\n\t\t}\n\n\t\treturn fonts\n\t}\n\n\tasync getOpenTypeFeatures(font: ReadonlyFont): Promise<OpenTypeFeature[] | undefined> {\n\t\tconst fontToOpenTypeFeatures = await loadFontToOpenTypeFeatures(FontSourceNames.Fontshare)\n\t\tconst metadataSelector = FontshareSource.createMetadataSelector(font.family.name)\n\t\treturn fontToOpenTypeFeatures[metadataSelector]\n\t}\n}\n\nfunction mapToKnownCategory(categoryString: string): FontCategory | undefined {\n\tconst categoryMapping: Record<FontshareCategory, FontCategory> = {\n\t\tserif: \"serif\",\n\t\tsans: \"sans-serif\",\n\t\tslab: \"slab\",\n\t\tdisplay: \"display\",\n\t\t// As of Nov 2023, these two look similar enough \u2013 so we can map them into the same category.\n\t\thandwritten: \"handwriting\",\n\t\tscript: \"handwriting\",\n\t}\n\n\t// Fontshare fonts can have multiple categories, so we pick the first one that we know.\n\t// (The assumption is it\u2019s the prevalent one.)\n\tconst category = parseFontshareCategories(categoryString)[0]\n\treturn category && categoryMapping[category]\n}\n", "import { loadFontToOpenTypeFeatures } from \"./loadOpenType.ts\"\nimport type {\n\tDraftFontProperties,\n\tFont,\n\tFontFamily,\n\tFontSource,\n\tFontSourceName,\n\tOpenTypeFeature,\n\tReadonlyFont,\n\tReadonlyFontFamily,\n\tVariationAxis,\n} from \"./types.ts\"\nimport { FontSourceNames } from \"./types.ts\"\n\nconst framerInterFontPrefix = \"Inter\"\nconst framerFontPrefix = \"FR;\"\n\nexport const framerFontVariants = [\n\t\"Regular\",\n\t\"Thin\",\n\t\"Extra Light\",\n\t\"Light\",\n\t\"Medium\",\n\t\"Semibold\",\n\t\"Bold\",\n\t\"Extra Bold\",\n\t\"Black\",\n\t\"Thin Italic\",\n\t\"Extra Light Italic\",\n\t\"Light Italic\",\n\t\"Italic\",\n\t\"Medium Italic\",\n\t\"Semibold Italic\",\n\t\"Bold Italic\",\n\t\"Extra Bold Italic\",\n\t\"Black Italic\",\n\t\"Regular Italic\",\n\t\"Variable\",\n\t\"Variable Italic\",\n] as const\n\nexport type FramerFontVariant = (typeof framerFontVariants)[number]\n\n/** @internal */\nexport type FramerFontDefinition = Omit<Font, \"family\"> & {\n\tuiFamilyName: string\n\tcssFamilyName: string\n\tvariant: FramerFontVariant\n}\n\nconst weightNameToNumber: Record<string, number> = {\n\tThin: 100,\n\tExtraLight: 200,\n\tLight: 300,\n\t\"\": 400, // Regular weights have a selector like \"Inter\" or \"Inter-Italic\", with no mention of weight.\n\tMedium: 500,\n\tSemiBold: 600,\n\tBold: 700,\n\tExtraBold: 800,\n\tBlack: 900,\n}\n\n/**\n * FramerFontSource manages all fonts that are loaded/provided by Framer (like\n * Inter).\n * @internal\n */\nexport class FramerFontSource implements FontSource {\n\treadonly name: FontSourceName = FontSourceNames.Framer\n\n\tprivate fontFamilies: FontFamily[] = []\n\tprivate byFamilyName = new Map<string, FontFamily>()\n\n\tgetFontFamilyByName(family: string): ReadonlyFontFamily | null {\n\t\treturn this.byFamilyName.get(family) ?? null\n\t}\n\n\tprivate addFontFamily(familyName: string): FontFamily {\n\t\tconst fontFamily = { name: familyName, fonts: [], source: this.name }\n\t\tthis.fontFamilies.push(fontFamily)\n\t\tthis.byFamilyName.set(fontFamily.name, fontFamily)\n\t\treturn fontFamily\n\t}\n\n\tstatic getDraftFontPropertiesBySelector(selector: string): DraftFontProperties | null {\n\t\tif (!selector.startsWith(framerFontPrefix) && !selector.startsWith(framerInterFontPrefix)) return null\n\n\t\t// Inter selectors look like \"Inter-BlackItalic\" or \"Inter-ExtraBold\" or just \"Inter\".\n\t\tconst tokens = selector.split(\"-\")\n\t\tconst [family, weightAndStyleInfo = \"\"] = tokens\n\t\tif (!family) return null\n\n\t\tconst style = weightAndStyleInfo.includes(\"Italic\") ? \"italic\" : \"normal\"\n\n\t\tconst weightName = weightAndStyleInfo.replace(\"Italic\", \"\")\n\t\tconst weight = (weightName && weightNameToNumber[weightName]) || 400\n\n\t\t// FIXME: this code isn\u2019t 100% correct. Specifically, the returned family here should have\n\t\t// the `${family} Variable` suffix when the font is variable. Not having it might end up in\n\t\t// Inter Variable not loading correctly.\n\t\t//\n\t\t// The probability of hitting this bug is very low (it\u2019s likely this code path will be\n\t\t// executed ~never, because by the time `getDraftPropertiesBySelector()` is executed, Framer\n\t\t// fonts will likely be already loaded, and `getDraftPropertiesBySelector()` will exit\n\t\t// early [1]). So I\u2019m not fixing this at the moment. A short-term but ugly fix would be to\n\t\t// concatenate the suffix as needed; a longer-term one would be to get rid of\n\t\t// `getDraftPropertiesBySelector()` completely, since it was created ~5 years ago for\n\t\t// completely different requirements, and its been a pain to understand and maintain. Either\n\t\t// way, if in doubt, ping @ivan.\n\t\t//\n\t\t// [1] https://github.com/framer/FramerStudio/blob/9c6400fea5d1b20e4a7b5f90dc5d8908768752da/src/library/src/render/fonts/fontStore.ts#L219-L228\n\t\treturn {\n\t\t\tcssFamilyName: family,\n\t\t\tstyle,\n\t\t\tweight,\n\t\t\tsource: FontSourceNames.Framer,\n\t\t\tvariant: undefined,\n\t\t\tcategory: \"sans-serif\",\n\t\t}\n\t}\n\n\tstatic createMetadataSelector(family: string) {\n\t\treturn `${framerFontPrefix}${family}`\n\t}\n\n\timportFonts(\n\t\tframerFonts: FramerFontDefinition[],\n\t\tvariationAxesData?: Record<string, VariationAxis[]> | undefined,\n\t): Font[] {\n\t\tthis.fontFamilies.length = 0\n\t\tthis.byFamilyName.clear()\n\n\t\tconst fonts: Font[] = []\n\t\tframerFonts.forEach(framerFont => {\n\t\t\tconst { uiFamilyName: familyName, ...rest } = framerFont\n\t\t\tconst key = FramerFontSource.createMetadataSelector(framerFont.uiFamilyName)\n\t\t\tconst variationAxes = variationAxesData?.[key]\n\n\t\t\tlet fontFamily = this.getFontFamilyByName(familyName) as FontFamily | null\n\t\t\tif (!fontFamily) {\n\t\t\t\tfontFamily = this.addFontFamily(familyName)\n\t\t\t}\n\t\t\tconst isVariable =\n\t\t\t\tframerFont.selector === framerFont.selectorVariable || framerFont.selector === framerFont.selectorVariableItalic\n\t\t\tconst font: Font = {\n\t\t\t\t...rest,\n\t\t\t\tfamily: fontFamily,\n\t\t\t\tvariationAxes: isVariable ? variationAxes : undefined,\n\t\t\t}\n\n\t\t\tfontFamily.fonts.push(font)\n\t\t\tfonts.push(font)\n\t\t})\n\n\t\treturn fonts\n\t}\n\n\tasync getOpenTypeFeatures(font: ReadonlyFont): Promise<OpenTypeFeature[] | undefined> {\n\t\tconst fontToOpenTypeFeatures = await loadFontToOpenTypeFeatures(FontSourceNames.Framer)\n\t\tconst metadataSelector = FramerFontSource.createMetadataSelector(font.family.name)\n\t\treturn fontToOpenTypeFeatures[metadataSelector]\n\t}\n}\n", "import { createCSSFamilyName } from \"./css.ts\"\nimport { getRelatedFontVariants } from \"./getRelatedFontVariants.ts\"\nimport { loadFontToOpenTypeFeatures, loadFontsWithOpenType } from \"./loadOpenType.ts\"\nimport type {\n\tFont,\n\tFontCategory,\n\tFontFamily,\n\tFontSource,\n\tFontSourceName,\n\tFontVariant,\n\tOpenTypeFeature,\n\tReadonlyFont,\n\tReadonlyFontFamily,\n\tVariationAxis,\n\tWebFontFamilyLocator,\n} from \"./types.ts\"\nimport { FontSourceNames, isSuccessfullyParsedFontVariant } from \"./types.ts\"\n\nexport const googleFontSelectorPrefix = \"GF;\"\n\ntype GoogleFontCategory = \"sans-serif\" | \"serif\" | \"monospace\" | \"display\" | \"handwriting\"\n\n/**\n * The return type of the [Google Fonts Developer API](https://developers.google.com/fonts/docs/developer_api) without capabilities=VF\n * @internal\n */\nexport type GoogleWebFontFamily = google.fonts.WebfontFamily\n/**\n * The return type of the [Google Fonts Developer API](https://developers.google.com/fonts/docs/developer_api) with capabilities=VF\n * @internal\n */\nexport type GoogleWebFontFamilyWithAxes = google.fonts.WebfontFamily & {\n\taxes?: { tag: string; start: number; end: number }[]\n}\n\n/** @internal */\nexport class GoogleFontSource implements FontSource {\n\treadonly name: FontSourceName = FontSourceNames.Google\n\n\tprivate fontFamilies: FontFamily[] = []\n\tprivate byFamilyName = new Map<string, FontFamily>()\n\n\tgetFontFamilyByName(family: string): ReadonlyFontFamily | null {\n\t\treturn this.byFamilyName.get(family) ?? null\n\t}\n\n\tstatic parseVariant(variant: string): FontVariant {\n\t\tif (variant === \"regular\") return { style: \"normal\", weight: 400 }\n\n\t\t// Parse Google Font variant IDs that are formatted like \"100\", \"200italic\",\n\t\t// or just \"italic\". See https://regex101.com/r/tum8kH/2 for all variants.\n\t\tconst match = /(\\d*)(normal|italic)?/u.exec(variant)\n\t\tif (!match) return {}\n\n\t\tconst weight = parseInt(match[1] || \"400\")\n\t\tconst style = match[2] === \"italic\" ? \"italic\" : \"normal\"\n\n\t\treturn { weight, style }\n\t}\n\n\tparseSelector(selector: string): WebFontFamilyLocator | null {\n\t\tif (!selector.startsWith(googleFontSelectorPrefix)) return null\n\t\tconst isVariable = selector.includes(\"-variable-\")\n\t\tconst tokens = isVariable ? selector.split(\"-variable-\") : selector.split(\"-\")\n\t\tif (tokens.length !== 2) return null\n\t\tconst [family, variant] = tokens\n\t\tif (!family || !variant) return null\n\t\treturn { name: family.replace(googleFontSelectorPrefix, \"\"), variant, source: this.name, isVariable }\n\t}\n\n\tstatic createSelector(family: string, variant: string, isVariableFont: boolean) {\n\t\treturn `${googleFontSelectorPrefix}${family}-${isVariableFont ? \"variable-\" : \"\"}${variant}`\n\t}\n\n\t/**\n\t * We are using this selector to get Open Type features and variable fonts variation axes.\n\t * CAUTION: This method has to be exactly the same as the one in font-metadata-extractor tool.\n\t * https://github.com/framer/FramerStudio/blob/master/tools/font-metadata-extractor/src/utils/googleFonts.ts\n\t */\n\tstatic createMetadataSelector(family: string) {\n\t\treturn `${googleFontSelectorPrefix}${family}`\n\t}\n\n\tprivate addFontFamily(family: string): FontFamily {\n\t\tconst fontFamily = { name: family, fonts: [], source: this.name }\n\t\tthis.fontFamilies.push(fontFamily)\n\t\tthis.byFamilyName.set(fontFamily.name, fontFamily)\n\t\treturn fontFamily\n\t}\n\n\tasync importFonts(\n\t\twebFonts: GoogleWebFontFamily[],\n\t\twebFontsWithAxes: GoogleWebFontFamilyWithAxes[],\n\t\tfontsToVariationAxes?: Record<string, VariationAxis[]> | undefined,\n\t): Promise<Font[]> {\n\t\tthis.fontFamilies.length = 0\n\t\tthis.byFamilyName.clear()\n\n\t\tconst fontsWithOpenType = await loadFontsWithOpenType(FontSourceNames.Google)\n\n\t\tconst fonts: Font[] = []\n\n\t\tconst webFontsMap = mapBy(webFonts, webFont => webFont.family)\n\t\tconst webFontsWithAxesMap = mapBy(webFontsWithAxes, webFont => webFont.family)\n\n\t\tfor (const webFontName in webFontsMap) {\n\t\t\tconst webFont = webFontsMap[webFontName]\n\t\t\tif (!webFont) continue\n\t\t\t// Find the parent FontFamily for the font (or create it)\n\t\t\tlet fontFamily = this.getFontFamilyByName(webFont.family) as FontFamily | null\n\t\t\tif (!fontFamily) {\n\t\t\t\tfontFamily = this.addFontFamily(webFont.family)\n\t\t\t}\n\n\t\t\tconst rawStaticVariants = webFont.variants\n\t\t\tconst staticVariants = rawStaticVariants.map(variantName => {\n\t\t\t\tconst parsedVariant = GoogleFontSource.parseVariant(variantName)\n\n\t\t\t\treturn {\n\t\t\t\t\t...parsedVariant,\n\t\t\t\t\tgoogleFontsVariantName: variantName,\n\t\t\t\t\tselector: GoogleFontSource.createSelector(webFontName, variantName, false),\n\t\t\t\t\tisVariable: false,\n\t\t\t\t\tfile: webFont.files[variantName],\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tconst variableFont = webFontsWithAxesMap[webFontName]\n\t\t\tconst variableVariants = variableFont?.axes\n\t\t\t\t? variableFont.variants.map(variantName => {\n\t\t\t\t\t\tconst parsedVariant = GoogleFontSource.parseVariant(variantName)\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...parsedVariant,\n\t\t\t\t\t\t\tgoogleFontsVariantName: variantName,\n\t\t\t\t\t\t\tselector: GoogleFontSource.createSelector(webFontName, variantName, true),\n\t\t\t\t\t\t\tisVariable: true,\n\t\t\t\t\t\t\tfile: variableFont.files[variantName],\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t: []\n\n\t\t\tconst key = GoogleFontSource.createMetadataSelector(webFont.family)\n\t\t\tconst variationAxes = fontsToVariationAxes?.[key]\n\n\t\t\tconst allVariants = [...staticVariants, ...variableVariants]\n\t\t\tconst allSuccessfullyParsedVariants = allVariants.filter(isSuccessfullyParsedFontVariant)\n\n\t\t\tconst fontMetadataSelector = GoogleFontSource.createMetadataSelector(webFontName)\n\t\t\tconst hasOpenTypeFeatures = fontsWithOpenType[fontMetadataSelector]\n\n\t\t\tfor (const variant of allVariants) {\n\t\t\t\tconst { weight, style, selector, googleFontsVariantName } = variant\n\n\t\t\t\tconst linkedVariants = isSuccessfullyParsedFontVariant(variant)\n\t\t\t\t\t? getRelatedFontVariants(variant, allSuccessfullyParsedVariants)\n\t\t\t\t\t: undefined\n\t\t\t\tconst { variantBold, variantItalic, variantBoldItalic, variantVariable, variantVariableItalic } =\n\t\t\t\t\tlinkedVariants ?? {}\n\n\t\t\t\tconst font: Font = {\n\t\t\t\t\tfamily: fontFamily,\n\t\t\t\t\tvariant: googleFontsVariantName,\n\t\t\t\t\tselector,\n\t\t\t\t\tselectorBold: variantBold?.selector,\n\t\t\t\t\tselectorBoldItalic: variantBoldItalic?.selector,\n\t\t\t\t\tselectorItalic: variantItalic?.selector,\n\t\t\t\t\tselectorVariable: variantVariable?.selector,\n\t\t\t\t\tselectorVariableItalic: variantVariableItalic?.selector,\n\t\t\t\t\tweight,\n\t\t\t\t\tstyle,\n\t\t\t\t\tcategory: mapToKnownCategory(webFont.category),\n\t\t\t\t\tfile: variant.file?.replace(\"http://\", \"https://\"),\n\t\t\t\t\tvariationAxes: variant.isVariable ? variationAxes : undefined,\n\t\t\t\t\thasOpenTypeFeatures,\n\t\t\t\t\tcssFamilyName: createCSSFamilyName(fontFamily.name, variant.isVariable),\n\t\t\t\t}\n\n\t\t\t\tfontFamily.fonts.push(font)\n\t\t\t\tfonts.push(font)\n\t\t\t}\n\t\t}\n\n\t\treturn fonts\n\t}\n\n\tasync getOpenTypeFeatures(font: ReadonlyFont): Promise<OpenTypeFeature[] | undefined> {\n\t\tconst fontToOpenTypeFeatures = await loadFontToOpenTypeFeatures(FontSourceNames.Google)\n\t\tconst metadataSelector = GoogleFontSource.createMetadataSelector(font.family.name)\n\t\treturn fontToOpenTypeFeatures[metadataSelector]\n\t}\n}\n\nfunction mapToKnownCategory(category: string | undefined): FontCategory | undefined {\n\tconst categoryMapping: Record<string, FontCategory> = {\n\t\tserif: \"serif\",\n\t\t\"sans-serif\": \"sans-serif\",\n\t\tdisplay: \"display\",\n\t\thandwriting: \"handwriting\",\n\t\tmonospace: \"monospace\",\n\t} satisfies Record<GoogleFontCategory, FontCategory>\n\n\tif (!category) return undefined\n\treturn categoryMapping[category]\n}\n\nfunction mapBy<T, K extends string>(array: T[], keyFn: (item: T) => K): Record<K, T> {\n\treturn array.reduce(\n\t\t(acc, item) => {\n\t\t\tacc[keyFn(item)] = item\n\t\t\treturn acc\n\t\t},\n\t\t{} as Record<K, T>,\n\t)\n}\n", "import FontFaceObserver from \"fontfaceobserver\"\nimport { isString } from \"../../utils/utils.ts\"\nimport type { ReadonlyFontVariationAxes } from \"./types.ts\"\n\nconst FONT_LOADING_TIMEOUT = 5000 // Amount of ms to wait when detecting if a font is ready\nconst MAX_RETRIES = 3 // Max number of times to retry font loading in case network error occurs\n\nexport class FontLoadingError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message)\n\t\tthis.name = \"FontLoadingError\"\n\t}\n}\n\nconst fontRequests = new Map<string, Promise<void>>()\nconst fontReadyPromises = new Map<string, Promise<void>>()\n\nexport interface FontFaceData {\n\tfamily: string\n\turl: string\n\t// If possible, use a `number` here. The string one is only there to\n\t// support loading of ComponentFonts\n\tweight?: number | string\n\tstyle?: string\n\tstretch?: string\n\tunicodeRange?: string\n\tvariationAxes?: ReadonlyFontVariationAxes\n}\n\n/** @internal  */\nexport const loadFont = (data: FontFaceData, doc: Document): Promise<void> => loadFontWithRetries(data, doc)\n\nasync function loadFontWithRetries(data: FontFaceData, doc: Document, attempt = 0): Promise<void> {\n\tconst { family, url, stretch, unicodeRange } = data\n\tconst weight = data.weight\n\tconst style = data.style || \"normal\"\n\n\t// For variable fonts we want to create a unique request id to avoid loading\n\t// the same font multiple times since family, style, and weight will be same.\n\tconst requestId = `${family}-${style}-${weight}-${url}`\n\n\tif (!fontRequests.has(requestId) || attempt > 0) {\n\t\tconst fontFace = new FontFace(family, `url(${url})`, {\n\t\t\tweight: isString(weight) ? weight : weight?.toString(),\n\t\t\tstyle,\n\t\t\tstretch,\n\t\t\tunicodeRange,\n\t\t})\n\t\tconst readyPromise = fontFace\n\t\t\t// Load the font\n\t\t\t.load()\n\t\t\t.then(() => {\n\t\t\t\t// Add the font to the document\n\t\t\t\tdoc.fonts.add(fontFace)\n\t\t\t\t// Wait until it's fully ready\n\t\t\t\treturn isFontReady(family, style, weight)\n\t\t\t})\n\t\t\t.catch(e => {\n\t\t\t\tif (e.name !== \"NetworkError\") {\n\t\t\t\t\tthrow e\n\t\t\t\t}\n\t\t\t\t// In case of a network error; retry\n\t\t\t\tif (attempt < MAX_RETRIES) {\n\t\t\t\t\treturn loadFontWithRetries(data, doc, attempt + 1)\n\t\t\t\t}\n\t\t\t\t// Throw error when retry limit has been reached\n\t\t\t\tthrow new FontLoadingError(\n\t\t\t\t\t`Font loading failed after ${attempt} retries due to network error: ${JSON.stringify({\n\t\t\t\t\t\tfamily,\n\t\t\t\t\t\tstyle,\n\t\t\t\t\t\tweight,\n\t\t\t\t\t\turl,\n\t\t\t\t\t\tstretch,\n\t\t\t\t\t\tunicodeRange,\n\t\t\t\t\t})}`,\n\t\t\t\t)\n\t\t\t})\n\t\tfontRequests.set(requestId, readyPromise)\n\t}\n\tawait fontRequests.get(requestId)\n}\n\n/** @internal  */\nexport async function isFontReady(\n\tfamily: string,\n\tstyle: string | undefined,\n\tweight: number | string | undefined,\n): Promise<void> {\n\tconst readyPromiseId = `${family}-${style}-${weight}`\n\tif (!fontReadyPromises.has(readyPromiseId)) {\n\t\tconst observer = new FontFaceObserver(family, {\n\t\t\tstyle,\n\t\t\tweight,\n\t\t})\n\t\tconst readyPromise = observer.load(null, FONT_LOADING_TIMEOUT)\n\t\tfontReadyPromises.set(readyPromiseId, readyPromise)\n\t}\n\ttry {\n\t\tawait fontReadyPromises.get(readyPromiseId)\n\t} catch (e) {\n\t\tthrow new FontLoadingError(\n\t\t\t`Failed to check if font is ready (${FONT_LOADING_TIMEOUT}ms timeout exceeded): ${JSON.stringify({\n\t\t\t\tfamily,\n\t\t\t\tstyle,\n\t\t\t\tweight,\n\t\t\t})}`,\n\t\t)\n\t}\n}\n\n/**\n * @internal\n * Util function for use in tests to clear state between test cases\n * */\nexport function _clearCache() {\n\tfontRequests.clear()\n\tfontReadyPromises.clear()\n}\n", "{\"FR;Inter\":[{\"tag\":\"opsz\",\"minValue\":14,\"maxValue\":32,\"defaultValue\":14,\"name\":\"Optical size\"},{\"tag\":\"wght\",\"minValue\":100,\"maxValue\":900,\"defaultValue\":400,\"name\":\"Weight\"}]}\n", "import { assertNever } from \"../../utils/assert.ts\"\nimport { isObject, isString } from \"../../utils/utils.ts\"\nimport framerVariationAxes from \"./static/variable-fonts/framer.json\" with { type: \"json\" }\nimport type { VariationAxis } from \"./types.ts\"\nimport { FontSourceNames } from \"./types.ts\"\n\n/** @internal  */\nexport function loadVariationAxes(source: FontSourceNames.Framer): Record<string, VariationAxis[]> | undefined\nexport function loadVariationAxes(\n\tsource: Exclude<\n\t\tFontSourceNames,\n\t\tFontSourceNames.BuiltIn | FontSourceNames.Local | FontSourceNames.Custom | FontSourceNames.Framer\n\t>,\n): Promise<Record<string, VariationAxis[]> | undefined>\nexport function loadVariationAxes(\n\tsource: Exclude<FontSourceNames, FontSourceNames.BuiltIn | FontSourceNames.Local | FontSourceNames.Custom>,\n): Record<string, VariationAxis[]> | undefined | Promise<Record<string, VariationAxis[]> | undefined> {\n\ttry {\n\t\tif (source === FontSourceNames.Framer) {\n\t\t\t// Synchronous version for Framer\n\t\t\tif (!isValidVariationAxesData(framerVariationAxes)) return undefined\n\t\t\treturn framerVariationAxes\n\t\t} else {\n\t\t\t// Asynchronous version for other sources\n\t\t\tconst axes = (async () => {\n\t\t\t\tswitch (source) {\n\t\t\t\t\tcase FontSourceNames.Google: {\n\t\t\t\t\t\treturn (await import(\"./static/variable-fonts/google.json\", { with: { type: \"json\" } })).default\n\t\t\t\t\t}\n\t\t\t\t\tcase FontSourceNames.Fontshare: {\n\t\t\t\t\t\treturn (await import(\"./static/variable-fonts/fontshare.json\", { with: { type: \"json\" } })).default\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(source)\n\t\t\t\t}\n\t\t\t})()\n\t\t\tif (!isValidVariationAxesData(axes)) return undefined\n\t\t\treturn axes\n\t\t}\n\t} catch (error) {\n\t\t// biome-ignore lint/suspicious/noConsole: intentional\n\t\tconsole.error(error)\n\t\treturn undefined\n\t}\n}\n\nfunction isValidVariationAxesData(data: unknown): data is Record<string, VariationAxis[]> {\n\treturn isObject(data) && Object.values(data).every(isValidVariationAxes)\n}\n\nfunction isVariationAxis(data: unknown): data is VariationAxis {\n\treturn isObject(data) && isString(data.tag)\n}\n\nfunction isValidVariationAxes(data: unknown): data is VariationAxis[] {\n\treturn Array.isArray(data) && data.every(isVariationAxis)\n}\n", "import type { AssetWithOwnerTypes } from \"@framerjs/assets\"\nimport { isTest } from \"@framerjs/shared/src/environment.ts\"\nimport { MapWithHash } from \"../../utils/MapWithHash.ts\"\nimport { assert, assertNever } from \"../../utils/assert.ts\"\nimport { runtime } from \"../../utils/runtimeInjection.ts\"\nimport { warnOnce } from \"../../utils/warnOnce.ts\"\nimport { BuiltInFontSource, builtInFontSelectorPrefix } from \"./BuiltInFontSource.ts\"\nimport { CustomFontSource, isCustomFontSelector } from \"./CustomFontSource.ts\"\nimport type { FontshareFont } from \"./FontshareSource.ts\"\nimport { FontshareSource, fontsharePrefix } from \"./FontshareSource.ts\"\nimport type { FramerFontDefinition } from \"./FramerFontSource.ts\"\nimport { FramerFontSource } from \"./FramerFontSource.ts\"\nimport type { GoogleWebFontFamily, GoogleWebFontFamilyWithAxes } from \"./GoogleFontSource.ts\"\nimport { GoogleFontSource, googleFontSelectorPrefix } from \"./GoogleFontSource.ts\"\nimport { LocalFontSource } from \"./LocalFontSource.ts\"\nimport { createCSSFontFamilyFromWebFontLocator } from \"./css.ts\"\nimport { isFontReady, loadFont } from \"./loadFont.ts\"\nimport { loadVariationAxes } from \"./loadVariationAxes.ts\"\nimport type { Asset, DraftFontProperties, Font, FontFamilyLocator, ReadonlyFont, ReadonlyFontFamily } from \"./types.ts\"\nimport { FontSourceNames, isSuccessfullyParsedFontVariant } from \"./types.ts\"\nimport { isVariableFont } from \"./variableFont.ts\"\n/**\n * Used to differentiate between requests that are immediately fulfilled,\n * because the font was already loaded, and those that resulted in a newly\n * loaded font\n *\n * @internal\n */\nexport enum LoadFontResult {\n\tAlreadyLoaded,\n\tLoaded,\n\tNotFound,\n}\n\n/**\n * Stores all available fonts, whether they are currently loaded or not\n * Provides APIs to import, add and resolve fonts and font selectors\n * Model:\n * `FontStore` (single instance available via `fontStore`)\n *   `FontSource` (local/google)\n *     `FontFamily` (all fonts in a font family)\n *       `Font` (font family with a specific variant)\n * Every `Font` has a `selector` (string), which is a unique identifier of a font\n * Google web fonts provide consistent naming for fonts,\n * so it's also possible to `parseFontSelector()` and get some info about a web font from only its selector\n *\n * @internal\n */\nexport class FontStore {\n\t/**\n\t * Enabling the `FontStore` will make Text components automatically load\n\t * their fonts on render. Otherwise font loading is the responsibility of\n\t * the environment.\n\t */\n\tenabled = false\n\n\tprivate bySelector = new MapWithHash<string, ReadonlyFont>()\n\tprivate loadedSelectors = new Set<string>()\n\n\tprivate getGoogleFontsListPromise:\n\t\t| Promise<{\n\t\t\t\tstaticFonts: GoogleWebFontFamily[]\n\t\t\t\tvariableFonts: GoogleWebFontFamilyWithAxes[]\n\t\t  }>\n\t\t| undefined\n\tprivate getFontshareFontsListPromise: Promise<FontshareFont[]> | undefined\n\tprivate getBuiltInFontsListPromise: Promise<Asset[]> | undefined\n\n\tdeclare private resolveCustomFontsImportPromise: () => void\n\tprivate customFontsImportPromise = new Promise<void>(resolve => {\n\t\tthis.resolveCustomFontsImportPromise = resolve\n\t})\n\n\tconstructor() {\n\t\tthis.local = new LocalFontSource()\n\t\tthis.google = new GoogleFontSource()\n\t\tthis.fontshare = new FontshareSource()\n\t\tthis.framer = new FramerFontSource()\n\t\tthis.custom = new CustomFontSource()\n\t\tthis.builtIn = new BuiltInFontSource()\n\n\t\tthis.importLocalFonts()\n\t}\n\n\tlocal: LocalFontSource\n\tgoogle: GoogleFontSource\n\tfontshare: FontshareSource\n\tbuiltIn: BuiltInFontSource\n\tframer: FramerFontSource\n\tcustom: CustomFontSource\n\n\tget hash() {\n\t\treturn this.bySelector.hash\n\t}\n\n\tprivate addFont(font: Font) {\n\t\tthis.bySelector.set(font.selector, font)\n\t\tif (font.alternativeSelectors) {\n\t\t\tfor (const altSelector of Object.keys(font.alternativeSelectors)) {\n\t\t\t\tthis.bySelector.set(altSelector, font)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate bySelectorValuesCache:\n\t\t| {\n\t\t\t\tresult: ReadonlyFont[]\n\t\t\t\thash: number\n\t\t  }\n\t\t| undefined\n\n\tgetAvailableFonts(): ReadonlyFont[] {\n\t\tif (!this.bySelectorValuesCache || this.bySelectorValuesCache.hash !== this.bySelector.hash) {\n\t\t\t// De-duplicate fonts that were added under both primary and legacy selectors\n\t\t\tconst uniqueFonts = new Map<ReadonlyFont, true>()\n\t\t\tfor (const font of this.bySelector.values()) {\n\t\t\t\tuniqueFonts.set(font, true)\n\t\t\t}\n\t\t\tthis.bySelectorValuesCache = {\n\t\t\t\tresult: Array.from(uniqueFonts.keys()),\n\t\t\t\thash: this.bySelector.hash,\n\t\t\t}\n\t\t}\n\t\treturn this.bySelectorValuesCache.result\n\t}\n\n\tprivate importLocalFonts() {\n\t\tfor (const font of this.local.importFonts()) {\n\t\t\tthis.addFont(font)\n\t\t\t// Immediately \u201Cload\u201D fonts (as they require no real loading). The path for loading a\n\t\t\t// local font is sync, so we do not need to await it\n\t\t\tvoid this.loadFont(font.selector)\n\t\t}\n\t}\n\n\tasync importGoogleFonts(): Promise<{\n\t\tstaticFonts: GoogleWebFontFamily[]\n\t\tvariableFonts: GoogleWebFontFamilyWithAxes[]\n\t}> {\n\t\t// eslint-disable-next-line @typescript-eslint/no-misused-promises -- not misused here\n\t\tif (!this.getGoogleFontsListPromise) {\n\t\t\t// We await this promise in the engine to update the `webFontsLoaded`\n\t\t\t// flag in the loading store, which should happen after `addFont`\n\t\t\t// is called and the fonts have been imported. Otherwise text will\n\t\t\t// render before we can load the required font files.\n\t\t\tthis.getGoogleFontsListPromise = Promise.resolve().then(async () => {\n\t\t\t\tconst { staticFonts, variableFonts } = await runtime.fetchGoogleFontsList()\n\t\t\t\tconst axesData = await loadVariationAxes(FontSourceNames.Google)\n\n\t\t\t\tfor (const font of await this.google.importFonts(staticFonts, variableFonts, axesData)) {\n\t\t\t\t\tthis.addFont(font)\n\t\t\t\t}\n\n\t\t\t\treturn { staticFonts, variableFonts }\n\t\t\t})\n\t\t}\n\t\treturn this.getGoogleFontsListPromise\n\t}\n\n\tasync importFontshareFonts(): Promise<FontshareFont[]> {\n\t\t// eslint-disable-next-line @typescript-eslint/no-misused-promises -- not misused here\n\t\tif (!this.getFontshareFontsListPromise) {\n\t\t\tthis.getFontshareFontsListPromise = runtime.fetchFontshareFontsList()\n\t\t\tconst fontshareFonts = await this.getFontshareFontsListPromise\n\t\t\tconst axesData = await loadVariationAxes(FontSourceNames.Fontshare)\n\n\t\t\tfor (const font of await this.fontshare.importFonts(fontshareFonts, axesData)) {\n\t\t\t\tthis.addFont(font)\n\t\t\t}\n\t\t}\n\n\t\treturn this.getFontshareFontsListPromise\n\t}\n\n\t/** Ensure Google, Fontshare, and BuiltIn font sources are all populated. Idempotent. */\n\tasync importAllWebFonts(): Promise<void> {\n\t\tawait Promise.all([this.importGoogleFonts(), this.importFontshareFonts(), this.importBuiltInFonts()])\n\t}\n\n\tasync importBuiltInFonts(): Promise<Asset[]> {\n\t\t// eslint-disable-next-line @typescript-eslint/no-misused-promises -- not misused here\n\t\tif (!this.getBuiltInFontsListPromise) {\n\t\t\tthis.getBuiltInFontsListPromise = runtime.fetchBuiltInFontsList()\n\t\t\tconst builtInFonts = await this.getBuiltInFontsListPromise\n\n\t\t\tfor (const font of await this.builtIn.importFonts(builtInFonts)) {\n\t\t\t\tthis.addFont(font)\n\t\t\t}\n\t\t}\n\n\t\treturn this.getBuiltInFontsListPromise\n\t}\n\n\timportFramerFonts(fonts: FramerFontDefinition[]) {\n\t\tconst axesData = loadVariationAxes(FontSourceNames.Framer)\n\t\tthis.framer.importFonts(fonts, axesData).forEach(font => {\n\t\t\tthis.addFont(font)\n\t\t})\n\t}\n\n\timportCustomFonts(assets: readonly AssetWithOwnerTypes[], enableFontImprovements: boolean) {\n\t\t// Clear custom fonts from the list as they might have been deleted from assets\n\t\tthis.bySelector.forEach((_, key) => {\n\t\t\tif (isCustomFontSelector(key)) {\n\t\t\t\tthis.bySelector.delete(key)\n\t\t\t}\n\t\t})\n\n\t\tconst importedFonts = this.custom.importFonts(assets, enableFontImprovements)\n\n\t\tfor (const font of importedFonts) {\n\t\t\tthis.addFont(font)\n\t\t}\n\n\t\tthis.resolveCustomFontsImportPromise()\n\t}\n\n\t/**\n\t * Returns a promise that resolves when custom fonts have been imported\n\t * @internal\n\t */\n\tgetCustomFontsImportPromise(): Promise<void> {\n\t\treturn this.customFontsImportPromise\n\t}\n\n\tgetFontFamily(info: FontFamilyLocator): ReadonlyFontFamily | null {\n\t\tconst fontFamily = this[info.source].getFontFamilyByName(info.name)\n\t\treturn fontFamily\n\t}\n\n\tgetFontBySelector(selector: string | undefined): ReadonlyFont | undefined {\n\t\tif (!selector) return undefined\n\t\tlet font: ReadonlyFont | undefined\n\t\tfont = this.bySelector.get(selector)\n\t\tif (!font) return undefined\n\n\t\t// If this is an alternative selector, apply the overrides\n\t\tif (font.alternativeSelectors && selector in font.alternativeSelectors) {\n\t\t\treturn { ...font, ...font.alternativeSelectors[selector] }\n\t\t}\n\n\t\treturn font\n\t}\n\n\t// Function called by draft to get font properties for a selector, before the (google) font is available in the store\n\t// It replaces a previous function that created Font instances and added them to the store\n\t// on the fly while rendering drafts, which caused issues (overriding real google font info with fake instances with partial data).\n\t// Ideally this should not happen, but that's a fix for another day\n\tgetDraftPropertiesBySelector(selector: string): DraftFontProperties | null {\n\t\tconst font = this.getFontBySelector(selector)\n\t\tif (font) {\n\t\t\treturn {\n\t\t\t\tstyle: font.style,\n\t\t\t\tweight: font.weight,\n\t\t\t\tvariant: font.variant,\n\t\t\t\tcssFamilyName: font.cssFamilyName,\n\t\t\t\tsource: font.family.source,\n\t\t\t\tcategory: font.category,\n\t\t\t}\n\t\t}\n\t\t// If this is an unknown selector, attempt to parse it as a google font selector\n\t\tconst googleLocator = this.google.parseSelector(selector)\n\t\tif (googleLocator) {\n\t\t\tconst fontVariant = GoogleFontSource.parseVariant(googleLocator.variant)\n\t\t\tif (isSuccessfullyParsedFontVariant(fontVariant)) {\n\t\t\t\treturn {\n\t\t\t\t\tstyle: fontVariant.style,\n\t\t\t\t\tweight: fontVariant.weight,\n\t\t\t\t\tvariant: googleLocator.variant,\n\t\t\t\t\tcssFamilyName: createCSSFontFamilyFromWebFontLocator(googleLocator, FontSourceNames.Google),\n\t\t\t\t\tsource: FontSourceNames.Google,\n\t\t\t\t\tcategory: undefined,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst fontshareLocator = this.fontshare.parseSelector(selector)\n\t\tif (fontshareLocator) {\n\t\t\tconst fontVariant = FontshareSource.parseVariant(fontshareLocator.variant)\n\t\t\tif (isSuccessfullyParsedFontVariant(fontVariant)) {\n\t\t\t\treturn {\n\t\t\t\t\tstyle: fontVariant.style,\n\t\t\t\t\tweight: fontVariant.weight,\n\t\t\t\t\tvariant: fontshareLocator.variant,\n\t\t\t\t\tcssFamilyName: createCSSFontFamilyFromWebFontLocator(fontshareLocator, FontSourceNames.Fontshare),\n\t\t\t\t\tsource: FontSourceNames.Fontshare,\n\t\t\t\t\tcategory: undefined,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst builtInFontLocator = this.builtIn.parseSelector(selector)\n\t\tif (builtInFontLocator) {\n\t\t\tconst fontVariant = BuiltInFontSource.parseVariant(builtInFontLocator.variant)\n\t\t\tif (isSuccessfullyParsedFontVariant(fontVariant)) {\n\t\t\t\treturn {\n\t\t\t\t\tstyle: fontVariant.style,\n\t\t\t\t\tweight: fontVariant.weight,\n\t\t\t\t\tvariant: builtInFontLocator.variant,\n\t\t\t\t\tcssFamilyName: createCSSFontFamilyFromWebFontLocator(builtInFontLocator, FontSourceNames.BuiltIn),\n\t\t\t\t\tsource: FontSourceNames.BuiltIn,\n\t\t\t\t\tcategory: undefined,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst framerFontDraftProperties = FramerFontSource.getDraftFontPropertiesBySelector(selector)\n\t\tif (framerFontDraftProperties) {\n\t\t\treturn framerFontDraftProperties\n\t\t}\n\n\t\treturn null\n\t}\n\n\tisSelectorLoaded(selector: string): boolean {\n\t\treturn this.loadedSelectors.has(selector)\n\t}\n\n\t/**\n\t * Load a single font\n\t * */\n\tprivate async loadFont(selector: string): Promise<LoadFontResult> {\n\t\t// We need to get the font by selector here, because it might be an alternative selector, in\n\t\t// which case we need to load the font again.\n\t\tconst font = this.getFontBySelector(selector)\n\t\tif (!font) {\n\t\t\treturn LoadFontResult.NotFound\n\t\t}\n\t\tif (this.loadedSelectors.has(selector)) {\n\t\t\treturn LoadFontResult.AlreadyLoaded\n\t\t}\n\n\t\tconst family = font.cssFamilyName\n\n\t\t// assertNever() doesn\u2019t work without the cast to an enum\n\t\tconst source = font.family.source as FontSourceNames\n\t\tconst fontIsVariable = isVariableFont(font)\n\n\t\tswitch (source) {\n\t\t\tcase FontSourceNames.Local:\n\t\t\t\t// In case of a local font, we can safely assume it's loaded\n\t\t\t\tthis.loadedSelectors.add(selector)\n\t\t\t\treturn LoadFontResult.Loaded\n\n\t\t\tcase FontSourceNames.Framer:\n\t\t\t\t// Framer fonts (eg Inter) are loaded via an external CSS file. Loading will be\n\t\t\t\t// initiated automatically by the browser, we only need to wait until it's ready.\n\t\t\t\t// NOTE: Skip for tests and assume Inter is loaded.\n\t\t\t\tif (!isTest()) {\n\t\t\t\t\tawait isFontReady(font.family.name, font.style, font.weight)\n\t\t\t\t}\n\n\t\t\t\t// TODO:  Framer variable fonts also should be loaded via an external\n\t\t\t\t// CSS file. However, loading both variable and non-variable fontfaces\n\t\t\t\t// is only supported from Chrome 129 onwards. Once there are at\n\t\t\t\t// least two major versions of Chrome with this support, we can stop\n\t\t\t\t// manual loading of variable fonts. See Slack thread:\n\t\t\t\t// https://framer-team.slack.com/archives/CR3CYA1D4/p1730131919189849\n\t\t\t\tif (fontIsVariable) {\n\t\t\t\t\tif (!font.file) {\n\t\t\t\t\t\treturn Promise.reject(`Unable to load font: ${selector}`)\n\t\t\t\t\t}\n\t\t\t\t\tawait loadFont(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfamily,\n\t\t\t\t\t\t\turl: font.file,\n\t\t\t\t\t\t\tweight: font.weight,\n\t\t\t\t\t\t\tstyle: font.style,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdocument,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tthis.loadedSelectors.add(selector)\n\t\t\t\treturn LoadFontResult.Loaded\n\n\t\t\tcase FontSourceNames.Google:\n\t\t\tcase FontSourceNames.Fontshare:\n\t\t\tcase FontSourceNames.BuiltIn:\n\t\t\tcase FontSourceNames.Custom:\n\t\t\t\tif (!font.file) {\n\t\t\t\t\treturn Promise.reject(`Unable to load font: ${selector}`)\n\t\t\t\t}\n\t\t\t\tawait loadFont(\n\t\t\t\t\t{\n\t\t\t\t\t\tfamily,\n\t\t\t\t\t\turl: font.file,\n\t\t\t\t\t\tweight: font.weight,\n\t\t\t\t\t\tstyle: font.style,\n\t\t\t\t\t},\n\t\t\t\t\tdocument,\n\t\t\t\t)\n\t\t\t\tthis.loadedSelectors.add(selector)\n\t\t\t\treturn LoadFontResult.Loaded\n\n\t\t\tdefault:\n\t\t\t\tassertNever(source)\n\t\t}\n\t}\n\n\tprivate async loadFontsFromSelectors(selectors: readonly string[]): Promise<PromiseSettledResult<LoadFontResult>[]> {\n\t\tif (!this.enabled) return []\n\n\t\tconst importPromises: Promise<unknown>[] = []\n\n\t\tconst shouldImportFontshareFonts = selectors.some(selector => selector.startsWith(fontsharePrefix))\n\t\tif (shouldImportFontshareFonts) {\n\t\t\timportPromises.push(\n\t\t\t\tthis.importFontshareFonts().catch(error => {\n\t\t\t\t\twarnOnce(\"Failed to load Fontshare fonts:\", error)\n\t\t\t\t}),\n\t\t\t)\n\t\t}\n\n\t\tconst shouldImportGoogleFonts = selectors.some(selector => selector.startsWith(googleFontSelectorPrefix))\n\t\tif (shouldImportGoogleFonts) {\n\t\t\timportPromises.push(\n\t\t\t\tthis.importGoogleFonts().catch(error => {\n\t\t\t\t\twarnOnce(\"Failed to load Google fonts:\", error)\n\t\t\t\t}),\n\t\t\t)\n\t\t}\n\n\t\tconst shouldImportBuiltInFonts = selectors.some(selector => selector.startsWith(builtInFontSelectorPrefix))\n\t\tif (shouldImportBuiltInFonts) {\n\t\t\timportPromises.push(\n\t\t\t\tthis.importBuiltInFonts().catch(error => {\n\t\t\t\t\twarnOnce(\"Failed to load built-in fonts:\", error)\n\t\t\t\t}),\n\t\t\t)\n\t\t}\n\n\t\tconst shouldImportCustomFonts = selectors.some(isCustomFontSelector)\n\t\tif (shouldImportCustomFonts) {\n\t\t\timportPromises.push(\n\t\t\t\tthis.customFontsImportPromise.catch(error => {\n\t\t\t\t\twarnOnce(\"Failed to load custom fonts:\", error)\n\t\t\t\t}),\n\t\t\t)\n\t\t}\n\n\t\tif (importPromises.length > 0) {\n\t\t\tawait Promise.all(importPromises)\n\t\t}\n\n\t\tconst loadingPromises: Promise<LoadFontResult>[] = []\n\n\t\tfor (const selector of selectors) {\n\t\t\tloadingPromises.push(this.loadFont(selector))\n\t\t}\n\t\t// Trigger the loading of all fonts. We\u2019re using `allSettled` here\n\t\t// (polyfilled below) to make sure as many as possible are loaded. Fonts\n\t\t// that have failed before will immediately reject.\n\t\treturn Promise.allSettled(loadingPromises)\n\t}\n\n\tpublic async loadFonts(fontSelectors: readonly string[]): Promise<{ newlyLoadedFontCount: number }> {\n\t\tconst results = await this.loadFontsFromSelectors(fontSelectors)\n\n\t\tconst newlyLoadedFontCount = results.filter(\n\t\t\tresult => result.status === \"fulfilled\" && result.value === LoadFontResult.Loaded,\n\t\t).length\n\t\t// Returning an object to allow extending it with e.g. `fullResults` if\n\t\t// any API consumer needs to access the full results in the future\n\t\treturn { newlyLoadedFontCount }\n\t}\n\n\t// Deprecated methods that are kept for backwards compatibility with any compiled code that might still be using them\n\t/**\n\t * @deprecated This method\u2019s API is confusing as 1) it works for all fonts,\n\t * not just missing ones, 2) it supports both async/await and a callback,\n\t * but the callback is called only if *all* fonts have been loaded. Use\n\t * `loadFonts` instead.\n\t */\n\tpublic async loadMissingFonts(fontSelectors: readonly string[], fontsLoadedCallback?: () => void) {\n\t\tconst selectors = fontSelectors.filter(selector => {\n\t\t\treturn !fontStore.loadedSelectors.has(selector)\n\t\t})\n\n\t\tif (selectors.length === 0) return\n\n\t\tawait fontStore.loadWebFontsFromSelectors(selectors)\n\n\t\tconst isEachFontLoaded = selectors.every(selector => {\n\t\t\treturn fontStore.loadedSelectors.has(selector)\n\t\t})\n\n\t\tif (isEachFontLoaded && fontsLoadedCallback) fontsLoadedCallback()\n\t}\n\n\t/**\n\t * @deprecated This method is misleading as it works with all fonts, not\n\t * just web fonts. Use `loadFonts` instead. (In Framer, \u201Cweb fonts\u201D has a\n\t * specific meaning: it refers to Google/Fontshare fonts and exludes custom\n\t * and local fonts. See e.g. `WebFontStore` and the \u201CWeb\u201D/\u201CCustom\u201D toggle in\n\t * the font picker in the UI. More context: https://github.com/framer/FramerStudio/pull/15778#discussion_r1395120760)\n\t */\n\tpublic async loadWebFontsFromSelectors(selectors: string[]): Promise<PromiseSettledResult<LoadFontResult>[]> {\n\t\treturn this.loadFontsFromSelectors(selectors)\n\t}\n\n\t// defaultFont doesn\u2019t seem to be used anywhere in our code (except tests),\n\t// but keeping it for backwards compatibility with any compiled code.\n\t/** @deprecated This will be removed in the future. Don\u2019t use it. */\n\tpublic get defaultFont(): ReadonlyFont {\n\t\tconst defaultFont = this.getFontBySelector(\"Inter\")\n\t\tassert(defaultFont, \"Can\u2019t find Inter font\")\n\t\treturn defaultFont\n\t}\n\n\ttesting = {\n\t\taddFont: this.addFont.bind(this),\n\t}\n}\n\n/** @internal */\nexport const fontStore = /* @__PURE__ */ new FontStore()\n", "import type React from \"react\"\n\n/**\n * Takes a CSS properties map of custom property to value and inserts them into the DOM.\n * @internal\n *\n */\nexport function CustomProperties({\n\tchildren,\n\tcustomProperties,\n}: {\n\tchildren?: React.ReactNode\n\tcustomProperties: { [property: string]: string }\n}) {\n\treturn <div style={customProperties}>{children}</div>\n}\n", "import type { MotionProps } from \"framer-motion\"\nimport { motion } from \"framer-motion\"\nimport type { Ref } from \"react\"\nimport type React from \"react\"\nimport { forwardRef, startTransition, useCallback } from \"react\"\nimport { cx } from \"../../../modules/cx.ts\"\nimport { withCSS } from \"../../../modules/withCSS.tsx\"\nimport { encodeSVGForCSS } from \"../../../utils/utils.ts\"\nimport type { LayerProps } from \"../Layer.tsx\"\nimport {\n\tFormInputStyleVariableNames as Var,\n\tcss,\n\temptyValueClassName,\n\tforcedFocusClassName,\n\ticonImageCSS,\n\ticonSize,\n\ticonSpacing,\n\tinputBorderAllSides,\n\tinputBorderCSS,\n\tinputClassName,\n\tinputIconCSSDeclaration,\n\tinputWrapperCSS,\n\tinputWrapperClassName,\n\trightIconSpacing,\n\tsharedInputCSS,\n\tuseCustomValidity,\n} from \"./shared.ts\"\nimport type { MotionInputProps } from \"./types.ts\"\nimport { useOptimisticValue } from \"./useOptimisticValue.ts\"\nimport { useReplayPreHydrationInput } from \"./useReplayPreHydrationInput.ts\"\n\nexport interface FormPlainTextInputProps extends MotionInputProps, Omit<LayerProps, \"children\">, MotionProps {\n\tisDisabled?: boolean\n\tinputName?: string\n\tvisible?: boolean\n\tdefaultValue?: string\n\tvalue?: string\n\tautofillEnabled?: boolean\n\tonChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void\n\tonValid?: () => void\n\tonClear?: () => void\n}\n\n// When the autofill property is disabled, these data props will be applied to the input.\n// This is to prevent the browser based & external password managers from\n// autofilling the input.\n// The list below is by no means exhaustive, but should cover most of the\n// major password managers such as LastPass, Dashlane, and 1Password.\nconst passwordManagerIgnoreDataProps = {\n\t// 1Password\n\t\"data-1p-ignore\": true,\n\t// LastPass\n\t\"data-lpignore\": true,\n\t// Dashlane\n\t// https://support.dashlane.com/hc/en-us/articles/4420122792594-Optimize-your-web-forms-for-Dashlane-Autofill\n\t\"data-form-type\": \"other\",\n\t// autocomplete=\"off\" is a generic property that disables autofilling. It\n\t// is not always respected by some browsers or password managers.\n\tautocomplete: \"off\",\n}\n\n/** @internal */\nexport enum TextAreaStyleVariableNames {\n\tResize = \"--framer-textarea-resize\",\n}\n\n/** @internal */\nconst PlainTextInput = /* @__PURE__ */ forwardRef(function FormPlainTextInput(\n\tprops: FormPlainTextInputProps,\n\tref: Ref<HTMLDivElement>,\n) {\n\tconst {\n\t\tautoFocus,\n\t\tclassName,\n\t\tinputName,\n\t\tmax,\n\t\tmin,\n\t\tplaceholder,\n\t\trequired,\n\t\tstep,\n\t\tstyle,\n\t\ttype,\n\t\tmaxLength,\n\t\tvalue,\n\t\t// We allow a defaultValue instead of a value so that the input remains\n\t\t// uncontrolled by React. This is important because we want the user\n\t\t// to be able to provide an initial value in the property panel, and for\n\t\t// the value to be editable by the user in the preview.\n\t\tdefaultValue,\n\t\tautofillEnabled,\n\t\tonChange,\n\t\tonBlur,\n\t\tonInvalid,\n\t\tonFocus,\n\t\tonValid,\n\t\tonClear,\n\t\t...rest\n\t} = props\n\n\tconst externalValue = value ?? defaultValue\n\tconst normalizedExternalValue = normalizeValueForInputType(externalValue, type)\n\tconst [optimisticValue, setOptimisticValue, handleChange] = useOptimisticValue(\n\t\tnormalizedExternalValue ?? \"\",\n\t\ttrue,\n\t\tonChange,\n\t)\n\n\tconst setInputRef = useReplayPreHydrationInput<HTMLInputElement | HTMLTextAreaElement, string>(\n\t\tnormalizedExternalValue,\n\t)\n\n\tconst handleClear = useCallback(() => {\n\t\t// Intentionally a non-transition setState\n\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition\n\t\tsetOptimisticValue(\"\")\n\n\t\tif (onClear) {\n\t\t\tstartTransition(() => onClear())\n\t\t}\n\t}, [onClear, setOptimisticValue])\n\n\tconst eventHandlers = useCustomValidity(onValid, onInvalid, handleChange, onBlur, onFocus)\n\n\t// visual area of the input is bigger than the real input area due to paddings,\n\t// so clicking on the wrapper padding should focus the input.\n\t// We don't use a label here as this component often wrapped in one already.\n\tconst handleWrapperClick = useCallback(\n\t\t(e: React.MouseEvent<HTMLDivElement>) => {\n\t\t\tif (e.target === e.currentTarget) {\n\t\t\t\tsetInputRef.current?.focus()\n\t\t\t}\n\t\t},\n\t\t[setInputRef],\n\t)\n\n\tif (type === \"hidden\") {\n\t\treturn <motion.input type=\"hidden\" name={inputName} defaultValue={defaultValue} />\n\t}\n\n\tconst dataProps = autofillEnabled === false ? passwordManagerIgnoreDataProps : undefined\n\tconst hasValue = !!optimisticValue\n\tconst showClear = !!onClear && hasValue\n\n\tconst wrapperClassName = cx(\n\t\ttextInputWrapperClassName,\n\t\tinputWrapperClassName,\n\t\tclassName,\n\t\ttype === \"text\" && textInputTypeWrapperClassName,\n\t\ttype === \"textarea\" && textareaInputTypeWrapperClassName,\n\t)\n\n\treturn (\n\t\t<motion.div ref={ref} onClick={handleWrapperClick} style={style} className={wrapperClassName} {...rest}>\n\t\t\t{type === \"textarea\" ? (\n\t\t\t\t<motion.textarea\n\t\t\t\t\tref={setInputRef as Ref<HTMLTextAreaElement>}\n\t\t\t\t\t{...dataProps}\n\t\t\t\t\t{...eventHandlers}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tautoFocus={autoFocus}\n\t\t\t\t\tname={inputName}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\tclassName={inputClassName}\n\t\t\t\t\tvalue={optimisticValue}\n\t\t\t\t\tmaxLength={maxLength}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<motion.input\n\t\t\t\t\tref={setInputRef as Ref<HTMLInputElement>}\n\t\t\t\t\t{...dataProps}\n\t\t\t\t\t{...eventHandlers}\n\t\t\t\t\ttype={type}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tautoFocus={autoFocus}\n\t\t\t\t\tname={inputName}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\tclassName={cx(inputClassName, !hasValue && emptyValueClassName)}\n\t\t\t\t\tvalue={optimisticValue}\n\t\t\t\t\tmin={min}\n\t\t\t\t\tmax={max}\n\t\t\t\t\tstep={step}\n\t\t\t\t\tmaxLength={maxLength}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{showClear && (\n\t\t\t\t<button type=\"button\" className={clearButtonClassName} onClick={handleClear} aria-label=\"Clear\">\n\t\t\t\t\t<ClearIcon />\n\t\t\t\t</button>\n\t\t\t)}\n\t\t</motion.div>\n\t)\n})\n\nfunction normalizeValueForInputType(value: string | undefined, type: string | undefined): string | undefined {\n\tif (!value || type !== \"date\") return value\n\tif (value.includes(\"T\")) return value.split(\"T\")[0]\n\treturn value\n}\n\nfunction ClearIcon() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" aria-hidden=\"true\">\n\t\t\t<path d=\"m1.5 6.5 5-5M6.5 6.5l-5-5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n\t\t</svg>\n\t)\n}\n\nconst textInputWrapperClassName = \"framer-form-text-input\"\nconst textInputTypeWrapperClassName = \"framer-form-text-input-type\"\nconst textareaInputTypeWrapperClassName = \"framer-form-textarea-input-type\"\nconst clearButtonClassName = \"framer-form-text-input-clear\"\n\nconst defaultTextareaResizerIcon = `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\"><path d=\"m1.5 8 7-7M9 5.5l-3 3\" stroke=\"%23999\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path></svg>`\n// `transform` css property doesn't seem to work in `::-webkit-resizer`, so flipping the SVG asset manually\nconst defaultTextareaResizerIconFlipped = `<svg xmlns=\"http://www.w3.org/2000/svg\" transform=\"scale(-1, 1)\" width=\"14\" height=\"14\"><path d=\"m1.5 8 7-7M9 5.5l-3 3\" stroke=\"%23999\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path></svg>`\n\nconst defaultDateIconMaskImage =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\"><path fill=\"rgb(153, 153, 153)\" d=\"M3 5a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2H3Z\" opacity=\".3\"/><path fill=\"transparent\" stroke=\"rgb(153, 153, 153)\" stroke-width=\"1.5\" d=\"M3.25 5.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-2ZM3 6.75h9.5\"/></svg>'\nconst defaultTimeIconMaskImage =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\"><path fill=\"transparent\" stroke=\"rgb(153, 153, 153)\" stroke-width=\"1.5\" d=\"M2.5 8a5.5 5.5 0 1 1 11 0 5.5 5.5 0 1 1-11 0Z\"/><path fill=\"transparent\" stroke=\"rgb(153, 153, 153)\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" d=\"M7.75 8.25v-3m0 3h2\"/></svg>'\n\nconst styles = /* @__PURE__ */ (() => [\n\t...sharedInputCSS,\n\t...inputBorderCSS,\n\t...inputWrapperCSS,\n\tcss(`.${inputWrapperClassName}`, {\n\t\tboxShadow: css.variable(Var.BoxShadow),\n\t\tborderTopLeftRadius: css.variable(Var.BorderRadiusTopLeft),\n\t\tborderTopRightRadius: css.variable(Var.BorderRadiusTopRight),\n\t\tborderBottomRightRadius: css.variable(Var.BorderRadiusBottomRight),\n\t\tborderBottomLeftRadius: css.variable(Var.BorderRadiusBottomLeft),\n\t\tcornerShape: css.variable(Var.CornerShape),\n\t\tbackground: css.variable(Var.Background),\n\t\ttransition: css.variable(Var.FocusedTransition),\n\t\ttransitionProperty: \"background, box-shadow\",\n\t}),\n\tcss(`.${textInputWrapperClassName} .${inputClassName}::placeholder`, {\n\t\tcolor: css.variable(Var.PlaceholderColor),\n\t}),\n\tcss(`.${textInputWrapperClassName}`, {\n\t\tdisplay: \"flex\",\n\t\talignItems: \"center\",\n\t\tpadding: css.variable(Var.Padding),\n\t}),\n\tcss(`.${textInputWrapperClassName} .${inputClassName}`, {\n\t\tflex: 1,\n\t\tminWidth: 0,\n\t\twidth: \"auto\",\n\t\tpadding: 0,\n\t}),\n\n\t// Textarea can't have an icon - so paddings don't need to be on wrapper.\n\t// Plus we have to deal with native resizer handle in webkit\n\tcss(`.${textInputWrapperClassName}.${textareaInputTypeWrapperClassName}`, {\n\t\tpadding: 0,\n\t}),\n\tcss(`.${textInputWrapperClassName}.${textareaInputTypeWrapperClassName} textarea.${inputClassName}`, {\n\t\twidth: \"100%\",\n\t\tpadding: css.variable(Var.Padding),\n\t}),\n\n\tcss(\n\t\t`.${textInputWrapperClassName} .${inputClassName}[type=\"date\"], .${textInputWrapperClassName} .${inputClassName}[type=\"time\"]`,\n\t\t{\n\t\t\t\"-webkit-appearance\": \"none\",\n\t\t\tappearance: \"none\",\n\t\t},\n\t),\n\t// iOS only fix for centered date & time inputs: https://github.com/tailwindlabs/tailwindcss-forms/pull/144\n\tcss(`.${textInputWrapperClassName} .${inputClassName}::-webkit-date-and-time-value`, {\n\t\ttextAlign: \"start\",\n\t}),\n\tcss(`.${textInputWrapperClassName} textarea`, {\n\t\tdisplay: \"flex\",\n\t\tresize: css.variable(TextAreaStyleVariableNames.Resize),\n\t\toverflowY: \"auto\",\n\t\tminHeight: \"inherit\",\n\t\tmaxHeight: \"inherit\",\n\t\twhiteSpace: \"break-spaces\",\n\t}),\n\t// This targets the resize handle in WebKit browsers. Unfortunately, it is not\n\t// possible in CSS to target the resize handle in Firefox, so FF will always\n\t// show the native resize handle.\n\tcss(`.${textInputWrapperClassName} textarea::-webkit-resizer`, {\n\t\tbackground: `no-repeat ${encodeSVGForCSS(defaultTextareaResizerIcon)}`,\n\t}),\n\tcss(`.${textInputWrapperClassName}:dir(rtl) textarea::-webkit-resizer`, {\n\t\tbackground: `no-repeat ${encodeSVGForCSS(defaultTextareaResizerIconFlipped)}`,\n\t}),\n\tcss(`.${textInputWrapperClassName} textarea::-webkit-scrollbar`, {\n\t\tcursor: \"pointer\",\n\t\tbackground: \"transparent\",\n\t}),\n\tcss(`.${textInputWrapperClassName} textarea::-webkit-scrollbar-thumb:window-inactive`, {\n\t\topacity: 0,\n\t}),\n\tcss(`.${textInputWrapperClassName} textarea::-webkit-scrollbar-corner`, {\n\t\tbackground: \"none\",\n\t\tbackgroundColor: \"transparent\",\n\t\toutline: \"none\",\n\t}),\n\tcss(`.${textInputWrapperClassName} .${inputClassName}::-webkit-datetime-edit`, {\n\t\t// Prevent browsers from improvising the date/time placeholder height.\n\t\theight: css.variable(Var.FontLineHeight),\n\t}),\n\tcss(`.${textInputWrapperClassName} .${inputClassName}.${emptyValueClassName}::-webkit-datetime-edit`, {\n\t\tcolor: css.variable(Var.PlaceholderColor),\n\t\t// This tells safari to use the color for the shadow dom elements.\n\t\t\"-webkit-text-fill-color\": css.variable(Var.PlaceholderColor),\n\t\toverflow: \"visible\",\n\t}),\n\n\tcss(`.${textInputWrapperClassName}.${textInputTypeWrapperClassName}::before`, {\n\t\tcontent: css.variable(Var.IconContent, \"none\"),\n\t\tdisplay: \"block\",\n\t\tflexShrink: 0,\n\t\twidth: `${iconSize}px`,\n\t\theight: `${iconSize}px`,\n\t\tmarginRight: `${iconSpacing}px`,\n\t\t...iconImageCSS,\n\t\tbackgroundPosition: \"center\",\n\t\tmaskPosition: \"center\",\n\t\tmaskImage: css.variable(Var.IconMaskImage),\n\t\tbackgroundImage: css.variable(Var.IconBackgroundImage),\n\t}),\n\n\t// Date/time input right-positioned input icon\n\tcss(\n\t\t`.${textInputWrapperClassName} .${inputClassName}[type=\"date\"]::before, .${textInputWrapperClassName} .${inputClassName}[type=\"time\"]::before`,\n\t\t{\n\t\t\t...inputIconCSSDeclaration,\n\t\t\tpaddingLeft: `${rightIconSpacing}px`,\n\t\t\tmaskPosition: `${rightIconSpacing}px center`,\n\t\t\tbackgroundPosition: `${rightIconSpacing}px center`,\n\t\t},\n\t),\n\tcss(`.${textInputWrapperClassName} .${inputClassName}[type=\"date\"]::before`, {\n\t\tmaskImage: css.variable(Var.IconMaskImage, encodeSVGForCSS(defaultDateIconMaskImage)),\n\t\tbackgroundImage: css.variable(Var.IconBackgroundImage),\n\t}),\n\tcss(`.${textInputWrapperClassName} .${inputClassName}[type=\"time\"]::before`, {\n\t\tmaskImage: css.variable(Var.IconMaskImage, encodeSVGForCSS(defaultTimeIconMaskImage)),\n\t\tbackgroundImage: css.variable(Var.IconBackgroundImage),\n\t}),\n\t// Hide the native date picker icon, but still align it with the custom icon, allowing user to click it to show the\n\t// date/time picker.\n\tcss(`.${textInputWrapperClassName} .${inputClassName}::-webkit-calendar-picker-indicator`, {\n\t\topacity: 0,\n\t\tposition: \"absolute\",\n\t\tright: 0,\n\t\ttop: 0,\n\t\tbottom: 0,\n\t\tpadding: css.variable(Var.Padding),\n\t\tpaddingTop: 0,\n\t\tpaddingBottom: 0,\n\t\twidth: `${iconSize}px`,\n\t\t// Makes sure the icon hit target covers the entire height of the input.\n\t\theight: \"100%\",\n\t}),\n\tcss(`.${textInputWrapperClassName}:focus-within, .${textInputWrapperClassName}.${forcedFocusClassName}`, {\n\t\tboxShadow: css.variable(Var.FocusedBoxShadow, Var.BoxShadow),\n\t\tbackground: css.variable(Var.FocusedBackground, Var.Background),\n\t}),\n\tcss(\n\t\t`.${textInputWrapperClassName}:focus-within::after, .${textInputWrapperClassName}.${forcedFocusClassName}::after`,\n\t\t{\n\t\t\tborderColor: css.variable(Var.FocusedBorderColor, Var.BorderColor),\n\t\t\tborderStyle: css.variable(Var.FocusedBorderStyle, Var.BorderStyle),\n\t\t\tborderWidth: css.variable(Var.FocusedBorderWidth, inputBorderAllSides),\n\t\t},\n\t),\n\tcss(`.${clearButtonClassName}`, {\n\t\tdisplay: \"flex\",\n\t\torder: 2,\n\t\talignItems: \"center\",\n\t\tjustifyContent: \"center\",\n\t\tflexShrink: 0,\n\t\twidth: `${iconSize}px`,\n\t\theight: `${iconSize}px`,\n\t\tmarginLeft: `${iconSpacing}px`,\n\t\tpadding: 0,\n\t\tborder: \"none\",\n\t\tbackground: \"transparent\",\n\t\tcursor: \"pointer\",\n\t\tcolor: css.variable(Var.PlaceholderColor),\n\t\ttransition: \"color 0.15s ease\",\n\t\toutline: \"none\",\n\t}),\n\tcss(`.${clearButtonClassName}:hover, .${clearButtonClassName}:focus-visible`, {\n\t\tcolor: css.variable(Var.FontColor),\n\t}),\n])()\n\nexport const FormPlainTextInput = /* @__PURE__ */ withCSS(PlainTextInput, styles, \"framer-lib-form-plain-text-input\")\n", "import React from \"react\"\nimport { shouldIgnoreReplayEvent } from \"./useReplayPreHydrationInput.ts\"\n\ntype FormChangeEvent = React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>\n\ntype UseOptimisticValueResult<T, E extends FormChangeEvent> = readonly [\n\tvalue: T,\n\tsetter: React.Dispatch<React.SetStateAction<T>>,\n\thandleChange: (event: E) => void,\n]\n\nconst defaultGetValueFromEvent = <T, E extends FormChangeEvent>(event: E): T => {\n\treturn (event.target as HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement).value as T\n}\n\nexport function useOptimisticValue<T, E extends FormChangeEvent = FormChangeEvent>(\n\texternalValue: T,\n\tshouldSyncExternalValue: boolean,\n\tonChange?: (event: E) => void,\n\tgetValueFromEvent: (event: E) => T = defaultGetValueFromEvent,\n): UseOptimisticValueResult<T, E> {\n\tconst [optimisticValue, setOptimisticValue] = React.useState(externalValue)\n\tconst [previousExternalValue, setPreviousExternalValue] = React.useState(externalValue)\n\n\tif (shouldSyncExternalValue && externalValue !== previousExternalValue) {\n\t\tsetPreviousExternalValue(externalValue)\n\t\tsetOptimisticValue(externalValue)\n\t}\n\n\tconst handleChange = React.useCallback(\n\t\t(event: E) => {\n\t\t\tif (shouldIgnoreReplayEvent(event)) return\n\n\t\t\tif (shouldSyncExternalValue) {\n\t\t\t\t// Intentionally a non-transition setState for immediate input UI response.\n\t\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition\n\t\t\t\tsetOptimisticValue(getValueFromEvent(event))\n\t\t\t}\n\n\t\t\tif (onChange) {\n\t\t\t\tReact.startTransition(() => {\n\t\t\t\t\tonChange(event)\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[getValueFromEvent, onChange, shouldSyncExternalValue],\n\t)\n\n\treturn [optimisticValue, setOptimisticValue, handleChange] as const\n}\n", "import type { MotionProps } from \"framer-motion\"\nimport { motion } from \"framer-motion\"\nimport React from \"react\"\nimport { setRef } from \"../../../components/utils/refHelper.ts\"\nimport { useBooleanLatch } from \"../../../hooks/useBooleanLatch.ts\"\nimport { cx } from \"../../../modules/cx.ts\"\nimport { useIsOnFramerCanvas } from \"../../../modules/useIsOnFramerCanvas.ts\"\nimport { withCSS } from \"../../../modules/withCSS.tsx\"\nimport type { LayerProps } from \"../Layer.tsx\"\nimport {\n\tcss,\n\tforcedCheckedClassName,\n\tforcedFocusClassName,\n\tFormInputStyleVariableNames as Var,\n\tinputBorderAllSides,\n\tinputIconCSSDeclaration,\n\tuseCustomValidity,\n} from \"./shared.ts\"\nimport type { MotionInputProps } from \"./types.ts\"\nimport { useOptimisticValue } from \"./useOptimisticValue.ts\"\nimport { useReplayPreHydrationInput } from \"./useReplayPreHydrationInput.ts\"\n\nexport interface FormBooleanInputProps extends MotionInputProps, Omit<LayerProps, \"children\">, MotionProps {\n\tinputName?: string\n\ttype?: \"checkbox\" | \"radio\"\n\tchecked?: boolean\n\tonValid?: () => void\n}\n\nconst className = \"framer-form-boolean-input\"\n\nconst getCheckedFromEvent = (event: React.ChangeEvent<HTMLInputElement>) => event.target.checked\n\n/** @internal */\nconst BooleanInput = /* @__PURE__ */ React.forwardRef(function FormBooleanInput(\n\tprops: FormBooleanInputProps,\n\tref: React.Ref<HTMLInputElement>,\n) {\n\tconst {\n\t\tinputName,\n\t\ttype = \"checkbox\",\n\t\tdefaultChecked,\n\t\tchecked,\n\t\tonValid,\n\t\tonChange,\n\t\tonBlur,\n\t\tonFocus,\n\t\tonInvalid,\n\t\t...rest\n\t} = props\n\n\tconst isCanvas = useIsOnFramerCanvas()\n\tconst isControlled = useBooleanLatch(!isCanvas && checked !== undefined)\n\tconst externalChecked = checked ?? false\n\n\tconst [optimisticChecked, , handleChange] = useOptimisticValue(\n\t\texternalChecked,\n\t\tisControlled,\n\t\tonChange,\n\t\tgetCheckedFromEvent,\n\t)\n\tconst setReplayInputRef = useReplayPreHydrationInput<HTMLInputElement, boolean | undefined>(\n\t\tisControlled ? externalChecked : defaultChecked,\n\t)\n\n\tconst eventHandlers = useCustomValidity(onValid, onInvalid, handleChange, onBlur, onFocus)\n\tconst attributes = isCanvas\n\t\t? { checked: defaultChecked }\n\t\t: isControlled\n\t\t\t? { checked: optimisticChecked }\n\t\t\t: { defaultChecked }\n\n\tconst setInputRef = React.useCallback(\n\t\t(input: HTMLInputElement | null) => {\n\t\t\tsetRef(ref, input)\n\t\t\tsetRef(setReplayInputRef, input)\n\t\t},\n\t\t[ref, setReplayInputRef],\n\t)\n\n\treturn (\n\t\t<motion.input\n\t\t\t{...rest}\n\t\t\t{...attributes}\n\t\t\t{...eventHandlers}\n\t\t\treadOnly={isCanvas}\n\t\t\tref={setInputRef}\n\t\t\ttype={type}\n\t\t\tname={inputName}\n\t\t\tclassName={cx(className, props.className)}\n\t\t/>\n\t)\n})\n\nexport const defaultCheckedIcon =\n\t'data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\"><path d=\"M 4 8 L 6.5 10.5 L 11.5 5.5\" fill=\"transparent\" stroke-width=\"2\" stroke=\"rgb(255, 255, 255)\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path></svg>'\nconst borderRadius = /* @__PURE__ */ `var(${Var.BorderRadiusTopLeft}) var(${Var.BorderRadiusTopRight}) var(${Var.BorderRadiusBottomRight}) var(${Var.BorderRadiusBottomLeft})`\n\nconst styles = /* @__PURE__ */ (() => [\n\tcss(`.${className}`, {\n\t\t\"-webkit-appearance\": \"none\",\n\t\t// background-color: #fff; fixes a bug on iOS where the checkbox shows\n\t\t// through the appearance: none;\n\t\talignItems: \"center\",\n\t\tappearance: \"none\",\n\t\tbackgroundColor: \"#fff\",\n\t\tbackground: Var.Background,\n\t\tborderRadius: borderRadius,\n\t\tcornerShape: css.variable(Var.CornerShape),\n\t\tboxShadow: Var.BoxShadow,\n\t\tdisplay: \"flex\",\n\t\tjustifyContent: \"center\",\n\t\tmargin: 0,\n\t\toverflow: \"hidden\",\n\t\tposition: \"relative\",\n\t\ttransition: Var.BooleanCheckedTransition,\n\t\ttransitionProperty: \"box-shadow, background\",\n\t}),\n\t// The after element styles the border of the checkbox to conform to\n\t// framer's inset border model.\n\tcss(`.${className}::after`, {\n\t\tbackground: \"transparent\",\n\t\tborderColor: css.variable(Var.BorderColor, \"transparent\"),\n\t\tborderRadius: borderRadius,\n\t\tcornerShape: css.variable(Var.CornerShape),\n\t\tborderStyle: Var.BorderStyle,\n\t\tborderWidth: inputBorderAllSides,\n\t\tboxSizing: \"border-box\",\n\t\tcontent: \"\",\n\t\tdisplay: \"block\",\n\t\tinset: 0,\n\t\tposition: \"absolute\",\n\t\ttransition: Var.BooleanCheckedTransition,\n\t\ttransitionProperty: \"border-color, border-width, border-style\",\n\t}),\n\t// The before element is used to display the check mark icon. It is\n\t// faded in when the input is checked.\n\tcss(`.${className}::before`, {\n\t\t...inputIconCSSDeclaration,\n\t\tbackgroundPosition: \"center\",\n\t\tbackgroundSize: \"contain\",\n\t\tmaskPosition: \"center\",\n\t\tmaskSize: \"contain\",\n\t\theight: \"100%\",\n\t\topacity: 0,\n\t\ttransition: Var.BooleanCheckedTransition,\n\t\ttransitionProperty: \"opacity\",\n\t\twidth: \"100%\",\n\t}),\n\t// The BooleanInput component shows an svg check mark icon whenever an\n\t// image url isn't provided. That's not an intuitive system for radios\n\t// however, where we never want to show the default check mark.\n\tcss(`.${className}[type=\"checkbox\"]::before`, {\n\t\tbackgroundImage: css.variable(Var.IconBackgroundImage),\n\t\tmaskImage: css.variable(Var.IconMaskImage, `url('${defaultCheckedIcon}')`),\n\t}),\n\tcss(`.${className}[type=\"radio\"]::before`, {\n\t\tbackgroundImage: css.variable(Var.IconBackgroundImage),\n\t\tmaskImage: css.variable(Var.IconMaskImage),\n\t}),\n\tcss(`.${className}:checked, .${className}.${forcedCheckedClassName}`, {\n\t\t// When not set, the styles when checked shouldn't clear the default\n\t\t// styles.\n\t\tbackgroundColor: css.variable(Var.BooleanCheckedBackground, Var.Background),\n\t\tboxShadow: css.variable(Var.BooleanCheckedBoxShadow, Var.BoxShadow),\n\t}),\n\tcss(`.${className}:checked::before, .${className}.${forcedCheckedClassName}::before`, {\n\t\topacity: 1,\n\t}),\n\tcss(`.${className}:checked::after, .${className}.${forcedCheckedClassName}::after`, {\n\t\t// When not set, the styles when checked shouldn't clear the default\n\t\t// styles.\n\t\tborderColor: css.variable(Var.BooleanCheckedBorderColor, Var.BorderColor, \"transparent\"),\n\t\tborderStyle: css.variable(Var.BooleanCheckedBorderStyle, Var.BorderStyle, \"solid\"),\n\t\tborderWidth: css.variable(Var.BooleanCheckedBorderWidth, inputBorderAllSides),\n\t}),\n\tcss(`.${className}:focus, .${className}.${forcedFocusClassName}`, {\n\t\tbackgroundColor: css.variable(Var.FocusedBackground, Var.Background),\n\t\tboxShadow: css.variable(Var.FocusedBoxShadow, Var.BoxShadow),\n\t}),\n\tcss(`.${className}:focus-visible`, { outline: \"none\" }),\n\tcss(`.${className}:focus::after, .${className}.${forcedFocusClassName}::after`, {\n\t\t// When not set, the styles when focused shouldn't clear the checked\n\t\t// styles.\n\t\tborderColor: css.variable(Var.FocusedBorderColor, Var.BorderColor, \"transparent\"),\n\t\tborderStyle: css.variable(Var.FocusedBorderStyle, Var.BorderStyle, \"solid\"),\n\t\tborderWidth: css.variable(Var.FocusedBorderWidth, inputBorderAllSides),\n\t}),\n\tcss(`.${className}:focus:checked`, {\n\t\tbackgroundColor: css.variable(Var.FocusedBackground, Var.BooleanCheckedBackground, Var.Background),\n\t\tboxShadow: css.variable(Var.FocusedBoxShadow, Var.BooleanCheckedBoxShadow, Var.BoxShadow),\n\t}),\n\tcss(`.${className}:focus:checked::after`, {\n\t\tborderStyle: css.variable(Var.FocusedBorderStyle, Var.BooleanCheckedBorderStyle, Var.BorderStyle, \"solid\"),\n\t\tborderWidth: css.variable(Var.FocusedBorderWidth, Var.BooleanCheckedBorderWidth, inputBorderAllSides),\n\t}),\n])()\n\nexport const FormBooleanInput = /* @__PURE__ */ withCSS(BooleanInput, styles, \"framer-lib-form-boolean-input\")\n", "import { useState } from \"react\"\n\n/**\n * Takes in a boolean value and optionally a latch target.\n * Once the value have become equal to the latch target,\n * it will remain latched to that value for the lifetime of the component\n *\n * @param value - The state that should be used to latch\n * @param latchTo - The value that the latch should stick to\n */\nexport function useBooleanLatch(value: boolean, latchTo: boolean = true) {\n\tconst [latchedValue, setLatchedValue] = useState(value)\n\n\tif (latchedValue !== latchTo && latchedValue !== value) {\n\t\tsetLatchedValue(value)\n\t}\n\n\treturn latchedValue\n}\n", "import type { HTMLMotionProps, MotionProps } from \"framer-motion\"\nimport { motion } from \"framer-motion\"\nimport React from \"react\"\nimport { cx } from \"../../../modules/cx.ts\"\nimport { useIsOnFramerCanvas } from \"../../../modules/useIsOnFramerCanvas.ts\"\nimport { withCSS } from \"../../../modules/withCSS.tsx\"\nimport { assertNever } from \"../../../utils/assert.ts\"\nimport { isNumber } from \"../../../utils/utils.ts\"\nimport type { LayerProps } from \"../Layer.tsx\"\nimport {\n\tFormInputStyleVariableNames as Var,\n\tcss,\n\tforcedFocusClassName,\n\tinputBorderAllSides,\n\tinputBorderCSS,\n\tinputClassName,\n\tinputIconCSSDeclaration,\n\tinputWrapperCSS,\n\tinputWrapperClassName,\n\trightIconSpacing,\n\tsharedInputCSS,\n\tuseCustomValidity,\n} from \"./shared.ts\"\nimport { useOptimisticValue } from \"./useOptimisticValue.ts\"\nimport { useReplayPreHydrationInput } from \"./useReplayPreHydrationInput.ts\"\ninterface FormSelectOptionBase {\n\ttype: \"option\"\n\tvalue: string | undefined\n\ttitle: string | undefined\n\t/* defaults to true */\n\tdisabled?: boolean\n}\n\ninterface FormSelectDivider {\n\ttype: \"divider\"\n\tvalue?: string\n\ttitle?: string\n\tdisabled?: boolean\n}\n\nexport type FormSelectOption = FormSelectOptionBase | FormSelectDivider\n\ntype PickedSelectProps = \"autoFocus\" | \"required\" | \"onInvalid\" | \"onChange\" | \"onBlur\" | \"onFocus\"\ntype WrapperProps = Omit<HTMLMotionProps<\"div\">, PickedSelectProps | \"defaultValue\">\ntype SelectDefaultProps = HTMLMotionProps<\"select\">\ntype SelectProps = Pick<SelectDefaultProps, PickedSelectProps> & {\n\t// We don't support `multiple`.\n\tdefaultValue?: Exclude<SelectDefaultProps[\"defaultValue\"], readonly string[]>\n}\n\nexport interface FormSelectProps extends WrapperProps, SelectProps, Omit<LayerProps, \"children\">, MotionProps {\n\tinputName?: string\n\tvalue?: string\n\tselectOptions?: FormSelectOption[]\n\tonValid?: () => void\n}\n\nconst Select = /* @__PURE__ */ React.forwardRef(function Select(\n\tprops: FormSelectProps,\n\tmeasureRef: React.Ref<HTMLDivElement>,\n) {\n\tconst {\n\t\tautoFocus,\n\t\tclassName,\n\t\tinputName,\n\t\trequired,\n\t\thidden,\n\t\tdefaultValue,\n\t\tvalue,\n\t\tselectOptions,\n\t\tstyle,\n\t\tonValid,\n\t\tonChange,\n\t\tonBlur,\n\t\tonInvalid,\n\t\tonFocus,\n\t\t...rest\n\t} = props\n\n\tconst isCanvas = useIsOnFramerCanvas()\n\tconst isControlled = !isCanvas && value !== undefined\n\tconst externalValue = value ?? \"\"\n\tconst [optimisticValue, , handleChange] = useOptimisticValue(externalValue, isControlled, onChange)\n\tconst setSelectRef = useReplayPreHydrationInput<HTMLSelectElement, string | number>(\n\t\tisControlled ? externalValue : defaultValue,\n\t)\n\n\tconst eventHandlers = useCustomValidity(onValid, onInvalid, handleChange, onBlur, onFocus)\n\n\tif (hidden) {\n\t\treturn <motion.input type=\"hidden\" name={inputName} defaultValue={defaultValue} />\n\t}\n\n\treturn (\n\t\t<motion.div\n\t\t\tref={measureRef}\n\t\t\tstyle={style}\n\t\t\tclassName={cx(inputWrapperClassName, selectWrapperClassName, className)}\n\t\t\t{...rest}\n\t\t>\n\t\t\t<motion.select\n\t\t\t\tref={setSelectRef}\n\t\t\t\t// Trick the select to update when the default value updates on the canvas.\n\t\t\t\tkey={isCanvas ? serializeDefaultValue(defaultValue) : undefined}\n\t\t\t\tname={inputName}\n\t\t\t\tautoFocus={autoFocus}\n\t\t\t\trequired={required}\n\t\t\t\tclassName={inputClassName}\n\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\tvalue={isControlled ? optimisticValue : undefined}\n\t\t\t\t{...eventHandlers}\n\t\t\t>\n\t\t\t\t{selectOptions?.map((option, index) => {\n\t\t\t\t\tswitch (option.type) {\n\t\t\t\t\t\tcase \"divider\":\n\t\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: There might be multiple divider, so we could only use UUIDs here (but that isn't really better)\n\t\t\t\t\t\t\treturn <hr key={index} />\n\t\t\t\t\t\tcase \"option\":\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: Values can be duplicated, so we could only use UUIDs here (but that isn't really better)\n\t\t\t\t\t\t\t\t<option key={index} value={option.value ?? option.title} disabled={option.disabled}>\n\t\t\t\t\t\t\t\t\t{option.title ?? option.value}\n\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn assertNever(option)\n\t\t\t\t\t}\n\t\t\t\t})}\n\t\t\t</motion.select>\n\t\t</motion.div>\n\t)\n})\n\nfunction serializeDefaultValue(defaultValue: string | number | undefined): string {\n\tif (defaultValue === undefined) return \"__undefined__\"\n\tif (isNumber(defaultValue)) return String(defaultValue)\n\tif (defaultValue === \"\") return \"__empty__\"\n\treturn defaultValue\n}\n\nconst selectWrapperClassName = \"framer-form-select-wrapper\"\nconst selectArrowSize = 16\nconst defaultSelectCaretMaskImage = /* @__PURE__ */ (() =>\n\t`data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${selectArrowSize}\" height=\"${selectArrowSize}\"><path d=\"M 3.5 6 L 8 10.5 L 12.5 6\" fill=\"transparent\" stroke-width=\"1.5\" stroke=\"rgb(153, 153, 153)\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path></svg>`)()\n\nconst styles = /* @__PURE__ */ (() => [\n\t...sharedInputCSS,\n\t...inputBorderCSS,\n\t...inputWrapperCSS,\n\tcss(`.${selectWrapperClassName}`, {\n\t\t// First we use the complete padding string, which may be any valid\n\t\t// padding string (10px, 10px 10px, 10px 10px 10px, or 10px 10px\n\t\t// 10px 10px), and use it to set only the right padding. This pushes\n\t\t// the actual select away from the arrow by 1x.\n\t\tpadding: css.variable(Var.Padding),\n\t\tpaddingTop: 0,\n\t\tpaddingBottom: 0,\n\t\tpaddingLeft: 0,\n\t\tbackground: css.variable(Var.Background),\n\t\tborderTopLeftRadius: css.variable(Var.BorderRadiusTopLeft),\n\t\tborderTopRightRadius: css.variable(Var.BorderRadiusTopRight),\n\t\tborderBottomRightRadius: css.variable(Var.BorderRadiusBottomRight),\n\t\tborderBottomLeftRadius: css.variable(Var.BorderRadiusBottomLeft),\n\t\tcornerShape: css.variable(Var.CornerShape),\n\t\tboxShadow: css.variable(Var.BoxShadow),\n\t\ttransition: css.variable(Var.FocusedTransition),\n\t\ttransitionProperty: \"background, box-shadow\",\n\t}),\n\tcss(`.${selectWrapperClassName} select`, {\n\t\tappearance: \"none\",\n\t\t\"-webkit-appearance\": \"none\",\n\t\t// Then we use the complete padding string again as the margin for\n\t\t// the select. This moves the select 2x the padding right away from\n\t\t// the arrow.\n\t\tpadding: css.variable(Var.Padding),\n\t\t// Overwrite the values inherited from .${inputClassName}. On a\n\t\t// select, these values are on the wrapper.\n\t\tbackground: \"transparent\",\n\t}),\n\tcss(`.${selectWrapperClassName}::before`, {\n\t\t...inputIconCSSDeclaration,\n\t\tpaddingLeft: `${rightIconSpacing}px`,\n\t\tbackgroundPosition: `${rightIconSpacing}px center`,\n\t\tmaskPosition: `${rightIconSpacing}px center`,\n\t\tbackgroundImage: css.variable(Var.IconBackgroundImage),\n\t\tmaskImage: css.variable(Var.IconMaskImage, `url('${defaultSelectCaretMaskImage}')`),\n\t}),\n\tcss(`.${selectWrapperClassName} select:required:invalid`, {\n\t\tcolor: css.variable(Var.InvalidTextColor),\n\t}),\n\tcss(`.${selectWrapperClassName}:focus-within, .${selectWrapperClassName}.${forcedFocusClassName}`, {\n\t\tbackground: css.variable(Var.FocusedBackground, Var.Background),\n\t\tboxShadow: css.variable(Var.FocusedBoxShadow, Var.BoxShadow),\n\t}),\n\tcss(`.${selectWrapperClassName}:focus-within::after, .${selectWrapperClassName}.${forcedFocusClassName}::after`, {\n\t\tborderColor: css.variable(Var.FocusedBorderColor, Var.BorderColor),\n\t\tborderStyle: css.variable(Var.FocusedBorderStyle, Var.BorderStyle),\n\t\tborderWidth: css.variable(Var.FocusedBorderWidth, inputBorderAllSides),\n\t}),\n\t// Enforcing a color on the native select options. On windows, browsers select options\n\t// inherit some style properties like color but not others so they might end up in a weird\n\t// state in which we can't read the options until we hover.\n\t// These are ignored on mac\n\tcss(`.${selectWrapperClassName} select option`, {\n\t\tcolor: \"#000\",\n\t}),\n\tcss(`.${selectWrapperClassName} select option:disabled`, {\n\t\tcolor: \"rgba(0, 0, 0, 0.4)\",\n\t}),\n])()\n\nexport const FormSelect = /* @__PURE__ */ withCSS(Select, styles, \"framer-lib-form-select\")\n", "import type { MotionStyle } from \"framer-motion\"\nimport React, { useMemo, useState } from \"react\"\nimport type { ImageAltProps } from \"../style/BackgroundImageComponent.tsx\"\nimport { BackgroundImageComponent } from \"../style/BackgroundImageComponent.tsx\"\nimport type { BackgroundImage, FitImageDimensionType } from \"../types/BackgroundImage.ts\"\nimport { getIntrinsicSizeForBackgroundImage } from \"../utils/getIntrinsicSizeForBackgroundImage.ts\"\nimport { htmlElementAsMotionComponent } from \"../utils/htmlElementAsMotionComponent.ts\"\nimport type { MotionDivProps } from \"./Frame/types.ts\"\nimport { withLightboxEffect } from \"./withLightbox.tsx\"\n\n/** @public */\ninterface BackgroundImageProps extends ImageAltProps {\n\tbackground: BackgroundImage\n\t/** @internal */\n\tfitImageDimension?: FitImageDimensionType\n}\n\n/** @public */\nexport interface ImageProps extends MotionDivProps, BackgroundImageProps {\n\tas?: keyof HTMLElementTagNameMap\n\tonClick?: React.HTMLAttributes<HTMLDivElement>[\"onClick\"]\n}\n\nconst Component = /* @__PURE__ */ React.forwardRef(function Image(\n\tprops: Partial<ImageProps>,\n\tref: React.Ref<HTMLDivElement>,\n) {\n\tconst { background, children, alt, draggable, fitImageDimension, style: styleFromProps, ...rest } = props\n\tconst style: MotionStyle = { ...styleFromProps }\n\tconst intrinsicSize = useMemo(() => getIntrinsicSizeForBackgroundImage(background), [background])\n\tconst [fallbackIntrinsicSize, setFallbackIntrinsicSize] = useState<{ width: number; height: number }>()\n\n\tReact.useLayoutEffect(() => {\n\t\tif (!background?.src) return\n\t\tif (!fitImageDimension) return\n\t\tif (intrinsicSize) return\n\n\t\tconst img = document.createElement(\"img\")\n\t\timg.onload = () => {\n\t\t\tif (img.naturalWidth && img.naturalHeight) {\n\t\t\t\tsetFallbackIntrinsicSize({ width: img.naturalWidth, height: img.naturalHeight })\n\t\t\t}\n\t\t}\n\t\timg.src = background.src\n\t}, [background?.src, fitImageDimension, intrinsicSize])\n\n\tconst size = intrinsicSize ?? fallbackIntrinsicSize\n\tif (fitImageDimension && size) {\n\t\tstyle[fitImageDimension] = \"auto\"\n\t\tstyle.aspectRatio = size.width / size.height\n\t}\n\n\tif (background) {\n\t\t// Remove existing `background` props from style, when we are rendering a background asset.\n\t\t// This ensures that the background prop can be properly reset when removing the background-image.\n\t\t// We prefer `delete` over `style.background = undefined` because `style.background = undefined`\n\t\t// might accidentally override other styles like `background-color` if the key is inserted after the other styles.\n\t\tdelete style.background\n\t}\n\n\tconst MotionComponent = htmlElementAsMotionComponent(props.as)\n\n\treturn (\n\t\t<MotionComponent {...rest} style={style} ref={ref} draggable={draggable}>\n\t\t\t{background && <BackgroundImageComponent image={background} alt={alt} draggable={draggable} />}\n\t\t\t{children as React.ReactNode /* Ignore that these can be MotionValues, that will not happen */}\n\t\t</MotionComponent>\n\t)\n})\n\n/** @public */\nexport const Image = /* @__PURE__ */ withLightboxEffect(Component)\n", "import type { TargetAndTransition, TransformProperties, Transition } from \"framer-motion\"\nimport { AnimatePresence, MotionConfigContext, frame, motion, visualElementStore } from \"framer-motion\"\nimport {\n\tFragment,\n\tforwardRef,\n\tstartTransition,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseId,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { portalIdAttribute } from \"../../modules/CustomCursor.tsx\"\nimport { overlayContainerId, templateOverlayContainerId } from \"../../modules/Floating.tsx\"\nimport { useStableCallback } from \"../../utils/useStableCallback.ts\"\nimport { isNumber } from \"../../utils/utils.ts\"\nimport { BackgroundImageComponent } from \"../style/BackgroundImageComponent.tsx\"\nimport { getSrcSet } from \"../style/getSrcSet.ts\"\nimport type { BackgroundImage } from \"../types/BackgroundImage.ts\"\nimport type { Size } from \"../types/Size.ts\"\nimport type { ImageProps } from \"./Image.tsx\"\nimport { TickerContext } from \"./TickerContext.tsx\"\nimport { useEscToClose } from \"./useEscToClose.ts\"\n\nexport interface LightboxEffectProps {\n\ttransition: Transition\n\tzIndex: number\n\tmaxWidth: number\n\tbackdrop?: string\n\tpadding?: number\n\tpaddingTop?: number\n\tpaddingRight?: number\n\tpaddingBottom?: number\n\tpaddingLeft?: number\n}\n\nfunction calculateImageWidth(\n\taspectRatio: number,\n\tmaxWidth: number,\n\ttotalHorizontalPadding: number,\n\ttotalVerticalPadding: number,\n) {\n\tconst availableHeight = window.innerHeight - totalVerticalPadding\n\tconst availableWidth = Math.min(window.innerWidth - totalHorizontalPadding, maxWidth)\n\n\t// Calculate the maximum width that fits within both constraints:\n\t// 1. Width cannot exceed available width\n\t// 2. Width * aspectRatio cannot exceed available height\n\tconst maxWidthBasedOnHeight = availableHeight / aspectRatio\n\n\treturn Math.min(availableWidth, maxWidthBasedOnHeight)\n}\n\nfunction optimisticallyDecodeImage(\n\timage: BackgroundImageWithSrcSet,\n\t{ width, height }: Size,\n): Promise<void> | undefined {\n\tif (!image.src || !image.srcSet) return\n\n\tconst i = new window.Image()\n\ti.src = image.src\n\ti.srcset = image.srcSet\n\ti.sizes = image.sizes || \"\"\n\ti.width = width\n\ti.height = height\n\n\treturn i.decode()\n}\n\nfunction getPortalContainer() {\n\treturn (\n\t\tdocument.getElementById(templateOverlayContainerId) ?? document.getElementById(overlayContainerId) ?? document.body\n\t)\n}\n\nfunction getSidePadding(value: number | undefined, padding: number | undefined) {\n\tif (isNumber(value)) return value\n\treturn padding ?? 0\n}\n\nfunction getTotalVerticalPadding(lightbox: LightboxEffectProps | undefined) {\n\treturn (\n\t\tgetSidePadding(lightbox?.paddingTop, lightbox?.padding) + getSidePadding(lightbox?.paddingBottom, lightbox?.padding)\n\t)\n}\n\nfunction getTotalHorizontalPadding(lightbox: LightboxEffectProps | undefined) {\n\treturn (\n\t\tgetSidePadding(lightbox?.paddingLeft, lightbox?.padding) + getSidePadding(lightbox?.paddingRight, lightbox?.padding)\n\t)\n}\n\ninterface BackgroundImageWithSrcSet extends BackgroundImage {\n\tsrcSet?: string | undefined\n\tsizes?: string | undefined\n}\n\n/**\n * Create a new srcset for the image. Discard an existing srcset even if it exists, since we avoid\n * generating srcset entries that are smaller than the trigger. The lightbox however may scale down\n * past that since it is tied to the screen size.\n */\nfunction createImageWithSrcSet(\n\tlightbox: LightboxEffectProps | undefined,\n\tbackground: BackgroundImage | undefined,\n): BackgroundImageWithSrcSet | undefined {\n\tif (!lightbox || !background || !background.src) return background\n\n\tconst base = new URL(background.src)\n\n\tbase.searchParams.delete(\"scale-down-to\")\n\tbase.searchParams.delete(\"lossless\")\n\n\treturn {\n\t\t...background,\n\t\tsizes: `min(100vw, ${lightbox.maxWidth - getTotalHorizontalPadding(lightbox)}px)`,\n\t\tsrcSet: getSrcSet(background.nodeFixedSize, background, background.src).srcSet,\n\t}\n}\n\n// Undefined keys are not considered distortion transforms.\n// Motion stores transform values as numbers.\nconst distortionTransforms: Record<keyof TransformProperties, number | undefined> = (() => ({\n\tx: undefined,\n\ty: undefined,\n\tz: 0,\n\ttranslateX: undefined,\n\ttranslateY: undefined,\n\ttranslateZ: 0,\n\trotate: undefined,\n\trotateX: 0,\n\trotateY: 0,\n\trotateZ: undefined,\n\tscale: 1,\n\tscaleX: 1,\n\tscaleY: 1,\n\tscaleZ: 1,\n\tskew: 0,\n\tskewX: 0,\n\tskewY: 0,\n\toriginX: undefined,\n\toriginY: undefined,\n\toriginZ: undefined,\n\tperspective: 0,\n\ttransformPerspective: 0,\n}))()\n\nfunction isDistortionTransform(values: Record<string, number | string> | undefined) {\n\tif (!values) return false\n\n\t// TODO: We could be more permissive by only returning true for perspective if there are other\n\t// distortion transforms present.\n\tfor (const k in values) {\n\t\tif (!(k in distortionTransforms)) continue\n\t\tconst identityValue = distortionTransforms[k as keyof TransformProperties]\n\t\tconst value = values[k]\n\t\tif (!isNumber(identityValue) || !isNumber(value)) continue\n\t\tif (identityValue === value) continue\n\t\treturn true\n\t}\n\treturn false\n}\n\n/**\n * Check if an element is distorted by transforms, either by its own style, or by an ancestor.\n */\nfunction isDistorted(ref: React.RefObject<HTMLDivElement>) {\n\tconst element = visualElementStore.get(ref.current)\n\tif (!element) return false\n\n\tif (isDistortionTransform(element.projection?.latestValues)) return true\n\n\tconst path = element.projection?.path\n\tif (!path || path.length === 0) return false\n\n\tfor (const p of path) {\n\t\tif (isDistortionTransform(p.latestValues)) return true\n\t}\n\n\treturn false\n}\n\nconst enterExitBackdropAnimation: TargetAndTransition = { opacity: 0 }\nconst targetBackdropAnimation: TargetAndTransition = { opacity: 1 }\n\n/**\n * when browser view transitions support interruptions use that here...\n */\nexport function withLightboxEffect(Component: React.ComponentType<Partial<ImageProps>>) {\n\treturn forwardRef(function LightboxEffect(\n\t\t{\n\t\t\tlightbox,\n\t\t\tlightboxClassName,\n\t\t\tonClick,\n\t\t\t...props\n\t\t}: React.PropsWithChildren<\n\t\t\tPartial<ImageProps> & Partial<{ lightbox: LightboxEffectProps; lightboxClassName: string }>\n\t\t>,\n\t\tforwardedRef: React.RefObject<HTMLDivElement>,\n\t) {\n\t\tconst config = useContext(MotionConfigContext)\n\t\tconst ancestorTickerContext = useContext(TickerContext)\n\t\tconst isInTickerItem = Boolean(ancestorTickerContext)\n\t\tconst fallbackRef = useRef<HTMLDivElement>(null)\n\t\tconst ref = forwardedRef ?? fallbackRef\n\n\t\tconst decodePromiseRef = useRef<{ [src: string]: Promise<void> | undefined } | undefined>()\n\t\tconst image = useMemo(() => createImageWithSrcSet(lightbox, props.background), [lightbox, props.background])\n\n\t\tconst [open, setOpen] = useState<boolean>(false)\n\t\tconst [openOverrides, setOpenOverrides] = useState<\n\t\t\t| {\n\t\t\t\t\taspectRatio?: number\n\t\t\t\t\tborderRadius?: string\n\t\t\t\t\tborderTop?: string\n\t\t\t\t\tborderRight?: string\n\t\t\t\t\tborderBottom?: string\n\t\t\t\t\tborderLeft?: string\n\t\t\t\t\tborderStyle?: string\n\t\t\t\t\tborderColor?: string\n\t\t\t\t\ttransition?: Transition\n\t\t\t\t\timageRendering?: React.CSSProperties[\"imageRendering\"]\n\t\t\t\t\tfilter?: React.CSSProperties[\"filter\"]\n\t\t\t  }\n\t\t\t| undefined\n\t\t>()\n\n\t\tconst onOpen = useCallback(() => {\n\t\t\tif (!lightbox) return\n\n\t\t\tif (open) {\n\t\t\t\t// If the lightbox is already open, we don't need to do anything, we have\n\t\t\t\t// aborted the exit transition.\n\t\t\t\tstartTransition(() => {\n\t\t\t\t\tsetOpen(true)\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tframe.read(() => {\n\t\t\t\tif (!ref.current) return\n\n\t\t\t\tconst style = getComputedStyle(ref.current)\n\t\t\t\tconst hasBorder = ref.current.getAttribute(\"data-border\") === \"true\"\n\t\t\t\tconst borderStyle = hasBorder ? getComputedStyle(ref.current, \"::after\") : undefined\n\t\t\t\tconst width = ref.current.offsetWidth ?? 1\n\t\t\t\tconst height = ref.current.offsetHeight ?? 1\n\n\t\t\t\t// - Transitioning from a distorted image in one tree to a non-distorted image in\n\t\t\t\t// another tree is not supported by motion. It is however supported by layout\n\t\t\t\t// transitions.\n\t\t\t\t// - FIXME: We disable transitions in ticker items because it creates an offset flicker when the lightbox is\n\t\t\t\t// closed. If this is fixed, we can remove the isInTickerItem check.\n\t\t\t\tconst transition = isDistorted(ref) || isInTickerItem ? { duration: 0 } : lightbox.transition\n\n\t\t\t\tstartTransition(() => {\n\t\t\t\t\tsetOpenOverrides({\n\t\t\t\t\t\tborderRadius: style.borderRadius,\n\t\t\t\t\t\taspectRatio: width / (height || 1),\n\t\t\t\t\t\tborderTop: borderStyle?.borderTopWidth,\n\t\t\t\t\t\tborderRight: borderStyle?.borderRightWidth,\n\t\t\t\t\t\tborderBottom: borderStyle?.borderBottomWidth,\n\t\t\t\t\t\tborderLeft: borderStyle?.borderLeftWidth,\n\t\t\t\t\t\tborderStyle: borderStyle?.borderStyle,\n\t\t\t\t\t\tborderColor: borderStyle?.borderColor,\n\t\t\t\t\t\ttransition,\n\t\t\t\t\t\timageRendering: style.imageRendering as React.CSSProperties[\"imageRendering\"],\n\t\t\t\t\t\tfilter: style.filter,\n\t\t\t\t\t})\n\n\t\t\t\t\tsetOpen(true)\n\t\t\t\t\tancestorTickerContext?.stop()\n\t\t\t\t})\n\t\t\t})\n\t\t}, [lightbox, open, ref, ancestorTickerContext?.stop, isInTickerItem])\n\n\t\tconst aspectRatio = openOverrides?.aspectRatio ?? 1\n\n\t\t// Break the rules of setting refs to allow us to create a stable reference to a callback so we only\n\t\t// mount our effect once, and preserve the timer reference. Safe for this particular use case since\n\t\t// concurrent rendering setting different versions of the callback to the ref is not problematic for\n\t\t// the lightbox.\n\t\tconst decode = useStableCallback(() => {\n\t\t\tif (!lightbox || !image || !image.src) return\n\n\t\t\tconst srcDecodePromise = decodePromiseRef.current?.[image.src]\n\n\t\t\t// If we are already decoding, or have decoded, return the promise so as not to request\n\t\t\t// the image multiple times. This should speed up the initial load of the lightbox since\n\t\t\t// we should have started decoding on mouse enter, or pointer down.\n\t\t\tif (srcDecodePromise) return srcDecodePromise\n\n\t\t\t// Calculate the width the image will render at given the current screen size, this\n\t\t\t// allows us to decode the image at the correct size.\n\t\t\tconst width = calculateImageWidth(\n\t\t\t\taspectRatio,\n\t\t\t\tlightbox.maxWidth,\n\t\t\t\tgetTotalHorizontalPadding(lightbox),\n\t\t\t\tgetTotalVerticalPadding(lightbox),\n\t\t\t)\n\n\t\t\tconst promise = optimisticallyDecodeImage(image, { width, height: width * aspectRatio })\n\n\t\t\t// Track against the src so we always await a new promise when the image changes.\n\t\t\tdecodePromiseRef.current = { [image.src]: promise }\n\n\t\t\treturn promise\n\t\t})\n\n\t\tconst handleClick = useCallback(\n\t\t\tasync (e: React.MouseEvent<HTMLDivElement>) => {\n\t\t\t\tonClick?.(e)\n\n\t\t\t\tif (open || !lightbox || !image) return\n\n\t\t\t\t// Await decoding the image before opening the lightbox. This ensures that we never\n\t\t\t\t// have a transparent image during the layout transition.\n\t\t\t\tawait decode()\n\n\t\t\t\tonOpen()\n\t\t\t},\n\t\t\t[onClick, onOpen, open, image, lightbox, decode],\n\t\t)\n\n\t\tconst onClose = useCallback((e?: React.MouseEvent<HTMLDivElement>) => {\n\t\t\te?.stopPropagation()\n\t\t\tstartTransition(() => {\n\t\t\t\tsetOpen(false)\n\t\t\t})\n\t\t}, [])\n\n\t\tuseEscToClose(open, onClose)\n\n\t\tuseEffect(() => {\n\t\t\tif (!lightbox) return\n\n\t\t\tlet timer: number | undefined\n\n\t\t\tfunction enter() {\n\t\t\t\ttimer = setTimeout(() => {\n\t\t\t\t\tvoid decode()\n\t\t\t\t}, 50) as unknown as number\n\t\t\t}\n\n\t\t\tfunction clear() {\n\t\t\t\tclearTimeout(timer)\n\t\t\t}\n\n\t\t\tconst currentRef = ref.current\n\n\t\t\tcurrentRef?.addEventListener(\"mouseenter\", enter)\n\t\t\tcurrentRef?.addEventListener(\"mouseleave\", clear)\n\t\t\tcurrentRef?.addEventListener(\"pointerdown\", decode)\n\n\t\t\treturn () => {\n\t\t\t\tclear()\n\t\t\t\tcurrentRef?.removeEventListener(\"mouseenter\", enter)\n\t\t\t\tcurrentRef?.removeEventListener(\"mouseleave\", clear)\n\t\t\t\tcurrentRef?.removeEventListener(\"pointerdown\", decode)\n\t\t\t}\n\t\t}, [decode, ref, lightbox])\n\n\t\tconst fallbackLayoutId = useId()\n\n\t\t// Use the lightbox transition while open so the exit animation is the same\n\t\t// transition as the enter animation.\n\t\tconst transition = openOverrides?.transition ?? props.transition ?? config.transition\n\t\tconst borderRadius = openOverrides?.borderRadius\n\n\t\tconst imageRendering = openOverrides?.imageRendering\n\t\tconst filter = openOverrides?.filter\n\n\t\tconst borderTop = openOverrides?.borderTop\n\t\tconst borderRight = openOverrides?.borderRight\n\t\tconst borderBottom = openOverrides?.borderBottom\n\t\tconst borderLeft = openOverrides?.borderLeft\n\t\tconst borderStyle = openOverrides?.borderStyle\n\t\tconst borderColor = openOverrides?.borderColor\n\t\tconst hasAnyBorder = Boolean(borderTop || borderRight || borderBottom || borderLeft || borderStyle || borderColor)\n\n\t\tconst border = hasAnyBorder\n\t\t\t? {\n\t\t\t\t\t\"--border-top-width\": borderTop,\n\t\t\t\t\t\"--border-right-width\": borderRight,\n\t\t\t\t\t\"--border-bottom-width\": borderBottom,\n\t\t\t\t\t\"--border-left-width\": borderLeft,\n\t\t\t\t\t\"--border-style\": borderStyle,\n\t\t\t\t\t\"--border-color\": borderColor,\n\t\t\t\t}\n\t\t\t: undefined\n\n\t\t// Set an attribute to allow CustomCursor to traverse from the lightbox to the trigger, and\n\t\t// up to the ancestor that defines a cursor.\n\t\tconst portalProps = { [portalIdAttribute]: props.id }\n\n\t\tconst paddingTop = getSidePadding(lightbox?.paddingTop, lightbox?.padding)\n\t\tconst paddingBottom = getSidePadding(lightbox?.paddingBottom, lightbox?.padding)\n\t\tconst paddingLeft = getSidePadding(lightbox?.paddingLeft, lightbox?.padding)\n\t\tconst paddingRight = getSidePadding(lightbox?.paddingRight, lightbox?.padding)\n\n\t\tconst style = openOverrides?.borderRadius\n\t\t\t? { ...props.style, borderRadius: openOverrides.borderRadius }\n\t\t\t: props.style\n\n\t\t// When the layer has a layoutDependency, we need to modify it when the lightbox is open.\n\t\tconst layoutDependency = open\n\t\t\t? props.layoutDependency\n\t\t\t\t? `${props.layoutDependency}-open`\n\t\t\t\t: \"open\"\n\t\t\t: props.layoutDependency\n\t\t// FIXME: We also have to disable layout animations entirely to avoid the flickering\n\t\tconst layoutId = isInTickerItem && open ? undefined : (props.layoutId ?? (lightbox ? fallbackLayoutId : undefined))\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Component\n\t\t\t\t\t{...props}\n\t\t\t\t\t// Set inline-style border-radius overrides so that motion can read the starting\n\t\t\t\t\t// radius, and scale correct during the transition. We remove these overrides\n\t\t\t\t\t// when the lightbox is closed.\n\t\t\t\t\tstyle={style}\n\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\tlayoutId={layoutId}\n\t\t\t\t\tref={ref}\n\t\t\t\t\tlayoutDependency={layoutDependency}\n\t\t\t\t\ttransition={transition}\n\t\t\t\t/>\n\t\t\t\t<AnimatePresence\n\t\t\t\t\tonExitComplete={() => {\n\t\t\t\t\t\t// Clear the overrides when the backdrop is fully\n\t\t\t\t\t\t// removed.\n\t\t\t\t\t\tstartTransition(() => {\n\t\t\t\t\t\t\tsetOpenOverrides(undefined)\n\t\t\t\t\t\t\tancestorTickerContext?.start()\n\t\t\t\t\t\t})\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{open && lightbox && image && (\n\t\t\t\t\t\t<Fragment key=\"backdrop\">\n\t\t\t\t\t\t\t{createPortal(\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t{...portalProps}\n\t\t\t\t\t\t\t\t\t\tclassName={lightboxClassName}\n\t\t\t\t\t\t\t\t\t\tonClick={onClose}\n\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\tposition: \"fixed\",\n\t\t\t\t\t\t\t\t\t\t\tinset: 0,\n\t\t\t\t\t\t\t\t\t\t\tzIndex: lightbox.zIndex,\n\t\t\t\t\t\t\t\t\t\t\tbackgroundColor: lightbox.backdrop ?? \"transparent\",\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\ttransition={transition}\n\t\t\t\t\t\t\t\t\t\tinitial={enterExitBackdropAnimation}\n\t\t\t\t\t\t\t\t\t\tanimate={targetBackdropAnimation}\n\t\t\t\t\t\t\t\t\t\texit={enterExitBackdropAnimation}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t{...portalProps}\n\t\t\t\t\t\t\t\t\t\tclassName={lightboxClassName}\n\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\talignItems: \"center\",\n\t\t\t\t\t\t\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\t\t\t\t\t\t\tinset: `${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`,\n\t\t\t\t\t\t\t\t\t\t\tjustifyContent: \"center\",\n\t\t\t\t\t\t\t\t\t\t\tpointerEvents: \"none\",\n\t\t\t\t\t\t\t\t\t\t\tposition: \"fixed\",\n\t\t\t\t\t\t\t\t\t\t\tzIndex: lightbox.zIndex,\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\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\talignItems: \"center\",\n\t\t\t\t\t\t\t\t\t\t\t\taspectRatio,\n\t\t\t\t\t\t\t\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\t\t\t\t\t\t\t\tjustifyContent: \"center\",\n\t\t\t\t\t\t\t\t\t\t\t\tmaxHeight: \"100%\",\n\t\t\t\t\t\t\t\t\t\t\t\tposition: \"relative\",\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\tmaxWidth: lightbox.maxWidth,\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<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutId={layoutId}\n\t\t\t\t\t\t\t\t\t\t\t\ttransition={transition}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={onOpen}\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"framer-lightbox-container\"\n\t\t\t\t\t\t\t\t\t\t\t\tdata-border={hasAnyBorder}\n\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\taspectRatio,\n\t\t\t\t\t\t\t\t\t\t\t\t\tborderRadius,\n\t\t\t\t\t\t\t\t\t\t\t\t\tbottom: 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\tposition: \"absolute\",\n\t\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\t\tuserSelect: \"none\",\n\t\t\t\t\t\t\t\t\t\t\t\t\timageRendering,\n\t\t\t\t\t\t\t\t\t\t\t\t\tfilter,\n\t\t\t\t\t\t\t\t\t\t\t\t\t...border,\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\t<BackgroundImageComponent image={image} alt={image.alt} draggable={props.draggable} />\n\t\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t</>,\n\t\t\t\t\t\t\t\tgetPortalContainer(),\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t)}\n\t\t\t\t</AnimatePresence>\n\t\t\t</>\n\t\t)\n\t})\n}\n", "import { useEffect } from \"react\"\n\n/** @private */\nexport function useEscToClose(isOpen: boolean, close: () => void) {\n\tuseEffect(() => {\n\t\tfunction handleKeyDown(e: KeyboardEvent) {\n\t\t\tif (e.key === \"Escape\" && isOpen) {\n\t\t\t\te.preventDefault()\n\t\t\t\te.stopPropagation()\n\t\t\t\tclose()\n\t\t\t}\n\t\t}\n\n\t\twindow.addEventListener(\"keyup\", handleKeyDown)\n\t\treturn () => window.removeEventListener(\"keyup\", handleKeyDown)\n\t}, [isOpen, close])\n}\n", "import type { MotionStyle } from \"framer-motion\"\nimport React, { forwardRef } from \"react\"\n\nexport interface ColumnMasonryLayoutProps extends React.PropsWithChildren {\n\t/** Number of masonry tracks (columns). Defaults to `1`. */\n\ttrackCount: number\n\t/** Vertical spacing between items inside a column (in px). */\n\trowGap?: number\n\t/**\n\t * When the parent is a Data Repeater we need to flatten the first level of\n\t * fragments that Repeaters wrap their items in so that every item is\n\t * considered individually during track distribution.\n\t *\n\t * @default false\n\t */\n\tparentIsDataRepeater?: boolean\n\t/**\n\t * Visual ordering of children based on their original ids.\n\t */\n\titemsOrder?: string[]\n}\n\nconst ColumnMasonryLayout = /* @__PURE__ */ React.memo(function ColumnMasonryLayout({\n\ttrackCount,\n\trowGap,\n\tparentIsDataRepeater = false,\n\titemsOrder,\n\tchildren,\n}: ColumnMasonryLayoutProps): React.ReactElement[] | React.ReactNode {\n\tlet normalizedChildren = prepareChildrenArrayForMasonry(children, parentIsDataRepeater)\n\tif (itemsOrder?.length) {\n\t\tnormalizedChildren = reorderChildrenForItemsOrder(normalizedChildren, itemsOrder)\n\t}\n\n\tconst tracks = groupChildrenIntoTracks(trackCount, normalizedChildren)\n\tconst wrapperStyle = getMasonryColumnStyle(rowGap)\n\n\treturn tracks.map((trackChildren, i) => (\n\t\t<div key={getMasonryColumnKey(i)} style={wrapperStyle}>\n\t\t\t{trackChildren}\n\t\t</div>\n\t))\n})\n\nfunction getChildOrderId(child: React.ReactNode): string | undefined {\n\treturn React.isValidElement(child) ? child.props[\"data-framer-order-id\"] : undefined\n}\n\n/**\n * Reorder children based on the parent's itemsOrder property.\n *\n * We need to do this as our column masonry layout cannot utilize the `order` CSS property due to\n * conflicts with the redistribution of children into flex box tracks. Instead, we're marking each\n * child with a `data-framer-order-id` attribute that we can later extract from the serialized JSX and\n * reorder them based on the itemsOrder prop.\n *\n * @param children Serialized JSX children of the original node.\n * @param itemsOrder Visual ordering of children based on their original ids.\n * @returns Children reordered based on the itemsOrder.\n */\nfunction reorderChildrenForItemsOrder(children: React.ReactNode[], itemsOrder: string[]): React.ReactNode[] {\n\tconst childrenById: Map<string, React.ReactNode> = new Map()\n\tconst remaining: React.ReactNode[] = []\n\tconst orderSet = new Set(itemsOrder)\n\n\tfor (const child of children) {\n\t\tconst id = getChildOrderId(child)\n\t\tif (id && orderSet.has(id)) {\n\t\t\tchildrenById.set(id, child)\n\t\t} else {\n\t\t\tremaining.push(child)\n\t\t}\n\t}\n\n\tconst ordered: React.ReactNode[] = []\n\tfor (const id of itemsOrder) {\n\t\tconst child = childrenById.get(id)\n\t\tif (child) ordered.push(child)\n\t}\n\n\treturn [...ordered, ...remaining]\n}\n\nexport function prepareChildrenArrayForMasonry(\n\tchildren: React.ReactNode,\n\tparentIsDataRepeater: boolean,\n): React.ReactNode[] {\n\tconst array = React.Children.toArray(children)\n\tif (!parentIsDataRepeater) return array\n\treturn array.flatMap(child =>\n\t\tReact.isValidElement(child) && child.type === React.Fragment ? React.Children.toArray(child.props.children) : child,\n\t)\n}\n\n/**\n * Split the given children into Masonry tracks (columns) using the\n * provided distribution algorithm.\n */\nexport function groupChildrenIntoTracks(trackCount: number, children: React.ReactNode[]): React.ReactNode[][] {\n\tconst tracks: React.ReactNode[][] = Array.from({ length: trackCount }, () => [])\n\n\tchildren.forEach((child, idx) => {\n\t\tconst track = pickMasonryTrack(trackCount, idx)\n\t\ttracks[track]?.push(child)\n\t})\n\n\treturn tracks\n}\n\n/**\n * Compute the base column wrapper style for a Masonry stack.\n */\nexport function getMasonryColumnStyle(rowGap?: number): React.CSSProperties {\n\treturn {\n\t\tdisplay: \"flex\",\n\t\tflexDirection: \"column\",\n\t\trowGap,\n\t\twidth: \"100%\",\n\t}\n}\n\n/**\n * Get the key for a Masonry column wrapper.\n */\nfunction getMasonryColumnKey(i: number): `masonry-stack-${number}` {\n\treturn `masonry-stack-${i}`\n}\n\n/**\n * Simple picker function that evenly distributes children into tracks.\n *\n * This approach differs from  the proposed CSS specification, as the latter works with\n * height-aware distribution instead of child order.\n *\n * We're using the child index for a sequential distribution due to the fact that\n * our distribution logic needs to work both on the client and the server, and considering\n * that some nodes would have heights that we would need to measure on the client, we\n * cannot guarantee a consistent distribution on the server.\n *\n * Example:\n *   Suppose there are 3 tracks/columns and 7 children:\n *\n *   | Track 0 | Track 1 | Track 2 |\n *   |---------|---------|---------|\n *   |   0     |   1     |   2     |\n *   |   3     |   4     |   5     |\n *   |   6     |         |         |\n *\n *   Each child is placed in (childIndex % trackCount):\n *     pickMasonryTrack(3, 0) // 0 \u2192 Track 0\n *     pickMasonryTrack(3, 1) // 1 \u2192 Track 1\n *     pickMasonryTrack(3, 2) // 2 \u2192 Track 2\n *     pickMasonryTrack(3, 3) // 0 \u2192 Track 0 (wraps)\n *     ...\n */\nexport function pickMasonryTrack(trackCount: number, childIndex: number): number {\n\tif (trackCount <= 0) return 0\n\treturn childIndex % trackCount\n}\n\n/** @internal */\nexport const withColumnMasonryLayout = /* @__PURE__ */ <\n\tP extends { [key: string]: unknown; style?: MotionStyle },\n\tR = unknown,\n>(\n\tComponent: React.ComponentType<P & React.RefAttributes<R>>,\n) => {\n\treturn forwardRef<\n\t\tR,\n\t\tReact.PropsWithChildren<P & Partial<ColumnMasonryLayoutProps & { columnMasonryLayoutEnabled?: true }>>\n\t>(function MasonryLayout(\n\t\t{\n\t\t\tcolumnMasonryLayoutEnabled,\n\t\t\ttrackCount = 1,\n\t\t\trowGap,\n\t\t\tparentIsDataRepeater,\n\t\t\titemsOrder,\n\t\t\tchildren,\n\t\t\tstyle: existingStyle,\n\t\t\t...rest\n\t\t},\n\t\tref,\n\t) {\n\t\t// If the layout is not enabled for this variant, we avoid mounting the\n\t\t// extra wrapper entirely, and instead render the original component and its\n\t\t// children unmodified.\n\t\tif (!columnMasonryLayoutEnabled) {\n\t\t\treturn (\n\t\t\t\t<Component ref={ref} style={existingStyle} {...(rest as P)}>\n\t\t\t\t\t{children}\n\t\t\t\t</Component>\n\t\t\t)\n\t\t}\n\n\t\tconst mergedStyle: MotionStyle | undefined = {\n\t\t\t...existingStyle,\n\t\t\tgridTemplateColumns: `repeat(${trackCount}, 1fr)`,\n\t\t}\n\n\t\treturn (\n\t\t\t<Component ref={ref} style={mergedStyle} {...(rest as P)}>\n\t\t\t\t<ColumnMasonryLayout\n\t\t\t\t\ttrackCount={trackCount}\n\t\t\t\t\trowGap={rowGap}\n\t\t\t\t\tparentIsDataRepeater={parentIsDataRepeater}\n\t\t\t\t\titemsOrder={itemsOrder}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</ColumnMasonryLayout>\n\t\t\t</Component>\n\t\t)\n\t})\n}\n", "import { memo, startTransition, useEffect, useState } from \"react\"\nimport { useLocaleCode } from \"../../router/useLocale.ts\"\nimport { isValidDate, isWindow } from \"../../utils/utils.ts\"\nimport {\n\ttype RelativeDateFormat,\n\ttype RelativeDateNumeric,\n\ttype RelativeDateStyle,\n\tformatRelativeDate,\n} from \"./formatRelativeDate.ts\"\n\n/**\n * This file defines a `RelativeDate` component that's used by the relative date transform to format\n * dates. The special thing about this component is that it injects a little script that\n * synchronously runs before hydration so we don't flash the absolute date on page load.\n */\n\ninterface RelativeDateProps extends React.HTMLAttributes<HTMLTimeElement> {\n\tdate: string\n\tdateFormat?: RelativeDateFormat\n\tdateStyle?: RelativeDateStyle\n\tdateNumeric?: RelativeDateNumeric\n\tdateCapitalize?: boolean\n\tlocale?: string\n}\n\nexport const RelativeDate = /* @__PURE__ */ memo(function RelativeDate({\n\tdate: dateString,\n\tdateFormat = \"auto\",\n\tdateStyle = \"long\",\n\tdateNumeric = \"auto\",\n\tdateCapitalize = false,\n\tlocale: externalLocale,\n\t...props\n}: RelativeDateProps) {\n\tconst fallbackLocale = useLocaleCode()\n\tconst locale = externalLocale || fallbackLocale\n\n\tconst targetDate = dateString ? new Date(dateString) : null\n\n\tconst [currentDate, setCurrentDate] = useState(getCurrentDate)\n\n\tconst interval = dateFormat === \"second\" ? 1_000 : 60_000\n\n\tuseEffect(() => {\n\t\tconst timeout = setInterval(() => {\n\t\t\tstartTransition(() => {\n\t\t\t\tsetCurrentDate(getCurrentDate)\n\t\t\t})\n\t\t}, interval)\n\n\t\treturn () => {\n\t\t\tclearInterval(timeout)\n\t\t}\n\t}, [interval])\n\n\tif (!isValidDate(targetDate)) return null\n\n\tconst formattedDate = targetDate.toLocaleString(locale, {\n\t\ttimeZone: \"UTC\",\n\t\tdateStyle: \"long\",\n\t\ttimeStyle:\n\t\t\tdateFormat === \"second\"\n\t\t\t\t? \"medium\" // Show \"hh:mm:ss\" when formatting to seconds\n\t\t\t\t: dateFormat === \"minute\" || dateFormat === \"hour\"\n\t\t\t\t\t? \"short\" // Show \"hh:mm\" when formatting to minutes or hours\n\t\t\t\t\t: undefined,\n\t})\n\n\tconst formattedRelativeDate = formatRelativeDate(\n\t\ttargetDate,\n\t\tcurrentDate,\n\t\tdateFormat,\n\t\tdateStyle,\n\t\tdateNumeric,\n\t\tdateCapitalize,\n\t\tlocale,\n\t)\n\n\tconst formattedIsoDate = targetDate.toISOString()\n\n\treturn (\n\t\t<time suppressHydrationWarning dateTime={formattedIsoDate} title={formattedDate} {...props}>\n\t\t\t{isWindow ? formattedRelativeDate : formattedDate}\n\n\t\t\t{isWindow ? null : (\n\t\t\t\t<script\n\t\t\t\t\tdata-relative-date-script=\"inline\"\n\t\t\t\t\t// biome-ignore lint/security/noDangerouslySetInnerHtml: Intentional\n\t\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t\t__html: createHydrationScript(targetDate, dateFormat, dateStyle, dateNumeric, dateCapitalize, locale),\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</time>\n\t)\n})\n\nfunction getCurrentDate() {\n\tconst date = new Date()\n\n\treturn new Date(\n\t\tDate.UTC(\n\t\t\tdate.getFullYear(),\n\t\t\tdate.getMonth(),\n\t\t\tdate.getDate(),\n\t\t\tdate.getHours(),\n\t\t\tdate.getMinutes(),\n\t\t\tdate.getSeconds(),\n\t\t\tdate.getMilliseconds(),\n\t\t),\n\t)\n}\n\nfunction createHydrationScript(\n\tdate: Date,\n\tformat: RelativeDateFormat,\n\tstyle: RelativeDateStyle,\n\tnumeric: RelativeDateNumeric,\n\tcapitalize: boolean,\n\tlocale: string,\n) {\n\tconst serializedDate = date.getTime()\n\tconst serializedFormat = JSON.stringify(format)\n\tconst serializedStyle = JSON.stringify(style)\n\tconst serializedNumeric = JSON.stringify(numeric)\n\tconst serializedCapitalize = JSON.stringify(capitalize)\n\tconst serializedLocale = JSON.stringify(locale)\n\n\t// The `__framer_formatRelativeDate` is injected in the `exportToHTML.ts` file.\n\treturn /* js */ `document.currentScript.parentElement.textContent = window.__framer_formatRelativeDate(new Date(${serializedDate}), new Date(), ${serializedFormat}, ${serializedStyle}, ${serializedNumeric}, ${serializedCapitalize}, ${serializedLocale})`\n}\n", "type RelativeDateUnit = \"second\" | \"minute\" | \"hour\" | \"day\" | \"week\" | \"month\" | \"quarter\" | \"year\"\n\nexport type RelativeDateFormat = \"auto\" | RelativeDateUnit\nexport type RelativeDateStyle = \"narrow\" | \"short\" | \"long\"\nexport type RelativeDateNumeric = \"always\" | \"auto\"\n\nconst formatters = new Map<string, Intl.RelativeTimeFormat>()\n\nfunction getRelativeTimeFormat(\n\tstyle: RelativeDateStyle,\n\tnumeric: RelativeDateNumeric,\n\tlocale: string,\n): Intl.RelativeTimeFormat {\n\tconst options = { numeric, style } as const\n\tconst args = [locale, options] as const\n\tconst key = JSON.stringify(args)\n\n\tconst existing = formatters.get(key)\n\tif (existing) return existing\n\n\tconst formatter = new Intl.RelativeTimeFormat(...args)\n\n\tformatters.set(key, formatter)\n\treturn formatter\n}\n\nexport function formatRelativeDate(\n\ttargetDate: Date,\n\treferenceDate: Date,\n\tformat: RelativeDateFormat,\n\tstyle: RelativeDateStyle,\n\tnumeric: RelativeDateNumeric,\n\tcapitalize: boolean,\n\tlocale: string,\n): string {\n\tconst unit = getRelativeDateUnit(targetDate, referenceDate, format)\n\tconst value = getRelativeDateValue(targetDate, referenceDate, unit)\n\n\tconst formatted = getRelativeTimeFormat(style, numeric, locale).format(value, unit)\n\tif (capitalize) return capitalizeFirstLetter(formatted)\n\treturn formatted\n}\n\nfunction capitalizeFirstLetter(text: string): string {\n\treturn text.charAt(0).toUpperCase() + text.slice(1)\n}\n\nfunction getRelativeDateUnit(targetDate: Date, referenceDate: Date, format: RelativeDateFormat): RelativeDateUnit {\n\tif (format !== \"auto\") return format\n\n\tconst daysDiff = differenceInCalendarDays(targetDate, referenceDate)\n\tif (Math.abs(daysDiff) <= 7) return \"day\"\n\n\tconst weeksDiff = differenceInCalendarWeeks(targetDate, referenceDate)\n\tif (Math.abs(weeksDiff) <= 4) return \"week\"\n\n\tconst monthsDiff = differenceInCalendarMonths(targetDate, referenceDate)\n\tif (Math.abs(monthsDiff) <= 12) return \"month\"\n\n\treturn \"year\"\n}\n\nconst SECOND = 1000\nconst MINUTE = 60_000\nconst HOUR = 3_600_000\nconst DAY = 86_400_000\nconst WEEK = 604_800_000\n\nfunction getRelativeDateValue(targetDate: Date, referenceDate: Date, unit: RelativeDateUnit): number {\n\tconst delta = targetDate.getTime() - referenceDate.getTime()\n\n\tswitch (unit) {\n\t\tcase \"second\":\n\t\t\treturn Math.trunc(delta / SECOND)\n\t\tcase \"minute\":\n\t\t\treturn Math.trunc(delta / MINUTE)\n\t\tcase \"hour\":\n\t\t\treturn Math.trunc(delta / HOUR)\n\t\tcase \"day\":\n\t\t\treturn differenceInCalendarDays(targetDate, referenceDate)\n\t\tcase \"week\":\n\t\t\treturn differenceInCalendarWeeks(targetDate, referenceDate)\n\t\tcase \"month\":\n\t\t\treturn differenceInCalendarMonths(targetDate, referenceDate)\n\t\tcase \"quarter\":\n\t\t\treturn differenceInCalendarQuarters(targetDate, referenceDate)\n\t\tcase \"year\":\n\t\t\treturn differenceInCalendarYears(targetDate, referenceDate)\n\t}\n\n\tconst _: never = unit\n}\n\n// NOTE: We inline the `date-fns` functions to reduce the bundle size of the blocking JavaScript\n// script that runs at the start of the body tag. It also helps with tree shaking as the `date-fns`\n// library is not fully tree-shakeable.\n\n// From https://github.com/date-fns/date-fns/blob/main/src/startOfDay/index.ts\nfunction getUTCStartOfDay(date: Date) {\n\tconst result = new Date(date)\n\tresult.setUTCHours(0, 0, 0, 0)\n\treturn result\n}\n\n// From https://github.com/date-fns/date-fns/blob/main/src/differenceInCalendarDays/index.ts\nexport function differenceInCalendarDays(targetDate: Date, referenceDate: Date) {\n\tconst targetTimestamp = getUTCStartOfDay(targetDate).getTime()\n\tconst referenceTimestamp = getUTCStartOfDay(referenceDate).getTime()\n\n\treturn Math.round((targetTimestamp - referenceTimestamp) / DAY)\n}\n\n// From https://github.com/date-fns/date-fns/blob/main/src/startOfWeek/index.ts\nfunction getUTCStartOfWeek(date: Date) {\n\tconst result = new Date(date)\n\tconst day = result.getUTCDay()\n\tconst diff = (day < 1 ? 7 : 0) + day - 1\n\n\tresult.setUTCDate(result.getUTCDate() - diff)\n\tresult.setUTCHours(0, 0, 0, 0)\n\n\treturn result\n}\n\n// From https://github.com/date-fns/date-fns/blob/main/src/differenceInCalendarWeeks/index.ts\nexport function differenceInCalendarWeeks(targetDate: Date, referenceDate: Date) {\n\tconst targetTimestamp = getUTCStartOfWeek(targetDate).getTime()\n\tconst referenceTimestamp = getUTCStartOfWeek(referenceDate).getTime()\n\n\treturn Math.round((targetTimestamp - referenceTimestamp) / WEEK)\n}\n\n// From https://github.com/date-fns/date-fns/blob/main/src/differenceInCalendarMonths/index.ts\nexport function differenceInCalendarMonths(targetDate: Date, referenceDate: Date) {\n\tconst yearsDiff = targetDate.getUTCFullYear() - referenceDate.getUTCFullYear()\n\tconst monthsDiff = targetDate.getUTCMonth() - referenceDate.getUTCMonth()\n\n\treturn yearsDiff * 12 + monthsDiff\n}\n\n// From https://github.com/date-fns/date-fns/blob/main/src/getQuarter/index.ts\nfunction getUTCQuarter(date: Date) {\n\tconst month = date.getUTCMonth()\n\treturn Math.trunc(month / 3)\n}\n\n// From https://github.com/date-fns/date-fns/blob/main/src/differenceInCalendarQuarters/index.ts\nexport function differenceInCalendarQuarters(targetDate: Date, referenceDate: Date) {\n\tconst yearsDiff = targetDate.getUTCFullYear() - referenceDate.getUTCFullYear()\n\tconst quartersDiff = getUTCQuarter(targetDate) - getUTCQuarter(referenceDate)\n\n\treturn yearsDiff * 4 + quartersDiff\n}\n\n// From https://github.com/date-fns/date-fns/blob/main/src/differenceInCalendarYears/index.ts\nexport function differenceInCalendarYears(targetDate: Date, referenceDate: Date) {\n\treturn targetDate.getUTCFullYear() - referenceDate.getUTCFullYear()\n}\n", "import type { MotionProps, MotionStyle } from \"framer-motion\"\nimport { isMotionComponent, isValidMotionProp, motion, unwrapMotionComponent } from \"framer-motion\"\nimport type React from \"react\"\nimport { Children, Fragment, cloneElement, forwardRef, isValidElement, useContext, useMemo, useRef } from \"react\"\nimport { Animatable } from \"../../animation/Animatable/Animatable.ts\"\nimport { cx } from \"../../modules/cx.ts\"\nimport { asRecord } from \"../../utils/asRecord.ts\"\nimport { isPropValid } from \"../../utils/isPropValid.ts\"\nimport { slugify } from \"../../utils/slugify.ts\"\nimport { isNumber, isObject, isString, isUndefined } from \"../../utils/utils.ts\"\nimport { collectTextShadowsForProps } from \"../style/shadow.tsx\"\nimport type { FilterProperties } from \"../traits/Filters.ts\"\nimport type { TextShadowProperties } from \"../traits/Shadow.ts\"\nimport type { CustomConstraintProperties, NewConstraintProperties } from \"../types/NewConstraints.tsx\"\nimport { ParentSizeState, calculateRect, useParentSize } from \"../types/NewConstraints.tsx\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport { collectFiltersFromProps } from \"../utils/filtersForNode.ts\"\nimport { htmlElementAsMotionComponent } from \"../utils/htmlElementAsMotionComponent.ts\"\nimport { withLibraryCSS } from \"../utils/injectComponentCSSRules.ts\"\nimport { defaultRichTextContainerStyle } from \"../utils/injectRichTextRules.ts\"\nimport { transformTemplate } from \"../utils/transformTemplate.ts\"\nimport { useLayoutId } from \"../utils/useLayoutId.ts\"\nimport { useMeasureLayout } from \"../utils/useMeasureLayout.ts\"\nimport { ComponentContainerContext } from \"./ComponentContainerContext.tsx\"\nimport type { DeprecatedRichTextProps } from \"./DeprecatedRichText.tsx\"\nimport { DeprecatedRichText, convertVerticalAlignment, useLoadFonts } from \"./DeprecatedRichText.tsx\"\nimport type { LayerProps } from \"./Layer.tsx\"\nimport type { TextVerticalAlignment } from \"./Text.tsx\"\nimport type { TextEffect, TextEffectTokenizer } from \"./useTextEffect.tsx\"\nimport { useTextEffect } from \"./useTextEffect.tsx\"\n\n/** @internal */\nexport interface RichTextProps\n\textends\n\t\tPartial<NewConstraintProperties>,\n\t\tPartial<FilterProperties>,\n\t\tOmit<LayerProps, \"children\">,\n\t\tPartial<TextShadowProperties>,\n\t\tMotionProps {\n\t__fromCanvasComponent?: boolean\n\tas?: keyof HTMLElementTagNameMap\n\tchildren?: React.ReactElement\n\tclassName?: string\n\tenvironment?(): RenderTarget\n\tfonts?: string[]\n\tisEditable?: boolean\n\t/** Name of the node. Only provided in the scope of canvas pages. */\n\tname?: string\n\t/** Name of the node. Provided in every scope, assuming the node has a name. */\n\t[\"data-framer-name\"]?: string\n\topacity?: number\n\trotation?: Animatable<number> | number\n\tstylesPresetsClassNames?: Record<string, string>\n\ttext?: React.ReactNode\n\tverticalAlignment?: TextVerticalAlignment\n\tvisible?: boolean\n\t/** Means that we are in code generation and the layout styles are set in \"external\" CSS classes */\n\twithExternalLayout?: boolean\n\tviewBox?: string\n\tviewBoxScale?: number\n\t_initialStyle?: Partial<MotionStyle>\n\tanchorLinkOffsetY?: number\n\teffect?: TextEffect\n}\n\n// Create a custom motion component to give the SVG element the features of a motion\n// div. Otherwise motion.svg behaves differently, animating viewbox changes and ignoring\n// style and layout. Implementation taken from `svgForNode.ts`.\nconst BaseSVG = /* @__PURE__ */ forwardRef<SVGSVGElement, React.SVGProps<SVGSVGElement>>(\n\tfunction BaseSVG(props, forwardedRef) {\n\t\treturn (\n\t\t\t// biome-ignore lint/a11y/noSvgWithoutTitle: FIXME: FitText might be inaccessible to screen readers because it\u2019s wrapped in an svg\n\t\t\t<svg {...props} ref={forwardedRef}>\n\t\t\t\t{props.children}\n\t\t\t</svg>\n\t\t)\n\t},\n)\nconst MotionSVG = /* @__PURE__ */ motion.create(BaseSVG)\n\nconst FitText = /* @__PURE__ */ forwardRef<SVGSVGElement, FitTextProps>(function FitText(\n\t{ viewBoxScale, viewBox, children, ...props },\n\tforwardedRef,\n) {\n\treturn (\n\t\t<MotionSVG {...props} ref={forwardedRef} viewBox={viewBox}>\n\t\t\t<motion.foreignObject\n\t\t\t\twidth=\"100%\"\n\t\t\t\theight=\"100%\"\n\t\t\t\tclassName=\"framer-fit-text\"\n\t\t\t\ttransform={`scale(${viewBoxScale})`}\n\t\t\t\tstyle={{ overflow: \"visible\", transformOrigin: \"center center\" }}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</motion.foreignObject>\n\t\t</MotionSVG>\n\t)\n})\n\nconst defaultFonts: string[] = [] as const\nconst richTextContainerComponentType = \"RichTextContainer\"\n\n// Canvas-internal props (like `blendingMode`, `duplicatedFrom`, `_needsMeasure`,\n// `widthType`, `hueRotate`) are spread into `RichText` by the canvas renderer.\n// Filter the pass-through props to only valid motion/DOM attributes so these\n// don\u2019t leak onto the underlying DOM element and trigger React warnings.\nfunction getValidRestProps(rest: Record<string, unknown>): Record<string, unknown> {\n\tconst validProps: Record<string, unknown> = {}\n\tfor (const key in rest) {\n\t\tif (isValidMotionProp(key) || isPropValid(key)) {\n\t\t\tvalidProps[key] = rest[key]\n\t\t}\n\t}\n\treturn validProps\n}\n\nconst RichTextContainer = /* @__PURE__ */ forwardRef(function RichTextContainer<T extends RichTextProps>(\n\tprops: T,\n\tforwardedRef: React.RefObject<HTMLDivElement | SVGSVGElement> | null,\n) {\n\tconst {\n\t\t__fromCanvasComponent = false,\n\t\t_forwardedOverrideId,\n\t\t_forwardedOverrides,\n\t\t_usesDOMRect,\n\t\tanchorLinkOffsetY,\n\t\tas: _as,\n\t\tbottom,\n\t\tcenter,\n\t\tchildren,\n\t\tenvironment = RenderTarget.current,\n\t\tfonts = defaultFonts,\n\t\theight,\n\t\tisEditable = false,\n\t\tleft,\n\t\tname,\n\t\topacity,\n\t\tpositionSticky,\n\t\tpositionStickyBottom,\n\t\tpositionStickyLeft,\n\t\tpositionStickyRight,\n\t\tpositionStickyTop,\n\t\tright,\n\t\trotation = 0,\n\t\tstyle,\n\t\t_initialStyle,\n\t\tstylesPresetsClassNames,\n\t\ttext: plainText,\n\t\ttop,\n\t\tverticalAlignment = \"top\",\n\t\tvisible = true,\n\t\twidth,\n\t\twithExternalLayout = false,\n\t\tviewBox,\n\t\tviewBoxScale = 1,\n\t\teffect,\n\t\t...rest\n\t} = props\n\n\tconst parentSize = useParentSize()\n\tconst isOnCanvas = environment() === RenderTarget.canvas\n\tconst inCodeComponent = useContext(ComponentContainerContext)\n\tconst layoutId = useLayoutId(props)\n\n\tconst fallbackRef = useRef<HTMLDivElement | SVGSVGElement>(null)\n\tconst containerRef = forwardedRef ?? fallbackRef\n\n\tuseMeasureLayout(props, containerRef)\n\tuseLoadFonts(fonts, __fromCanvasComponent, containerRef)\n\n\tconst textEffect = useTextEffect(effect, containerRef)\n\tconst processedChildren = useMemo(() => {\n\t\tif (!children) return\n\n\t\treturn processRichTextChildren(\n\t\t\tchildren,\n\t\t\tstylesPresetsClassNames,\n\t\t\tplainText,\n\t\t\tanchorLinkOffsetY,\n\t\t\tundefined,\n\t\t\ttextEffect.getTokenizer(),\n\t\t)\n\t}, [children, stylesPresetsClassNames, plainText, anchorLinkOffsetY, textEffect])\n\n\tif (!visible) return null\n\n\tconst isHidden = isEditable && isOnCanvas\n\n\tconst containerStyle: MotionStyle = {\n\t\topacity: isHidden ? 0 : opacity,\n\t}\n\n\t/**\n\t * If the dynamic inline styles match the default static styles, we don't need to set them\n\t * inline. This reduces the size of the published sites' html. We need to be careful not to\n\t * remove animatable motion styles, but justify content is not animated in rich text.\n\t * @see https://www.notion.so/framer/71c2ef9441cf40a39f59d4ad51ec0e29?v=e8e59361f11b404c969372616a0af5a0\n\t */\n\tconst justifyContent = convertVerticalAlignment(verticalAlignment)\n\tif (justifyContent !== defaultRichTextContainerStyle.justifyContent) {\n\t\tcontainerStyle.justifyContent = justifyContent\n\t}\n\n\t// Sometimes on the canvas we use motion transform to position the element. We also\n\t// sometimes provide a style object with effect preview transforms. In those cases we need\n\t// to combine the x and y transforms.\n\tconst positionStyle: MotionStyle = {}\n\n\tconst restrictedRenderTarget = RenderTarget.hasRestrictions()\n\tconst frame = calculateRect(props, parentSize || ParentSizeState.Unknown, false)\n\tconst isAutoSized = _usesDOMRect && (width === \"auto\" || height === \"auto\")\n\tconst hasTransformTemplate =\n\t\t!!props.transformTemplate || !frame || !restrictedRenderTarget || __fromCanvasComponent || isAutoSized\n\tconst template = hasTransformTemplate ? (props.transformTemplate ?? transformTemplate(center)) : undefined\n\n\t// During code generation, we set layout styles in \"external\" CSS, but while editing in the\n\t// canvas we set them inline.\n\tif (!withExternalLayout) {\n\t\tif (frame && restrictedRenderTarget && !isAutoSized) {\n\t\t\tpositionStyle.x = frame.x + (isNumber(style?.x) ? style.x : 0)\n\t\t\tpositionStyle.y = frame.y + (isNumber(style?.y) ? style.y : 0)\n\t\t\tpositionStyle.left = 0\n\t\t\tpositionStyle.top = 0\n\t\t\tcontainerStyle.rotate = Animatable.getNumber(rotation)\n\t\t\tcontainerStyle.width = frame.width\n\t\t\tcontainerStyle.minWidth = frame.width\n\t\t\tcontainerStyle.height = frame.height\n\t\t} else {\n\t\t\tcontainerStyle.left = left\n\t\t\tcontainerStyle.right = right\n\t\t\tcontainerStyle.top = top\n\t\t\tcontainerStyle.bottom = bottom\n\t\t\tcontainerStyle.width = width\n\t\t\tcontainerStyle.height = height\n\t\t\t// I have no idea why this works as a number but not as a string. This is copied from the Text component.\n\t\t\tcontainerStyle.rotate = rotation as number\n\t\t}\n\n\t\tif (positionSticky) {\n\t\t\tif (!isOnCanvas || inCodeComponent) {\n\t\t\t\tcontainerStyle.position = \"sticky\"\n\t\t\t\tcontainerStyle.willChange = \"transform\"\n\t\t\t\tcontainerStyle.top = positionStickyTop\n\t\t\t\tcontainerStyle.right = positionStickyRight\n\t\t\t\tcontainerStyle.bottom = positionStickyBottom\n\t\t\t\tcontainerStyle.left = positionStickyLeft\n\t\t\t}\n\t\t} else if (isOnCanvas && (props.positionFixed || props.positionAbsolute)) {\n\t\t\tcontainerStyle.position = \"absolute\"\n\t\t}\n\t}\n\n\tcollectFiltersFromProps(props, containerStyle)\n\tcollectTextShadowsForProps(props, containerStyle)\n\n\tObject.assign(containerStyle, _initialStyle, style, positionStyle)\n\n\tif (layoutId) {\n\t\trest.layout = \"preserve-aspect\"\n\t}\n\n\tconst Component = htmlElementAsMotionComponent(props.as)\n\tconst dataFramerName = rest[\"data-framer-name\"] ?? name\n\tconst validRestProps = isOnCanvas ? getValidRestProps(asRecord(rest)) : rest\n\n\tif (isString(props.viewBox)) {\n\t\t// Handle the case where an svg is used to fit the text if the text size is set to fit.\n\n\t\tif (props.as !== undefined) {\n\t\t\treturn (\n\t\t\t\t<Component\n\t\t\t\t\t{...validRestProps}\n\t\t\t\t\t// This could another element besides div, but `htmlElementAsMotionComponent`\n\t\t\t\t\t// coerces the type of Component to `motion.div`.\n\t\t\t\t\tref={containerRef as React.RefObject<HTMLDivElement>}\n\t\t\t\t\tstyle={containerStyle}\n\t\t\t\t\tlayoutId={layoutId}\n\t\t\t\t\ttransformTemplate={template}\n\t\t\t\t\tdata-framer-name={dataFramerName}\n\t\t\t\t\tdata-framer-component-type={richTextContainerComponentType}\n\t\t\t\t>\n\t\t\t\t\t<FitText viewBox={viewBox} viewBoxScale={viewBoxScale} style={{ width: \"100%\", height: \"100%\" }}>\n\t\t\t\t\t\t{processedChildren}\n\t\t\t\t\t</FitText>\n\t\t\t\t</Component>\n\t\t\t)\n\t\t} else {\n\t\t\treturn (\n\t\t\t\t<FitText\n\t\t\t\t\t{...validRestProps}\n\t\t\t\t\tref={containerRef as React.RefObject<SVGSVGElement>}\n\t\t\t\t\tstyle={containerStyle}\n\t\t\t\t\tlayoutId={layoutId}\n\t\t\t\t\tviewBox={viewBox}\n\t\t\t\t\tviewBoxScale={viewBoxScale}\n\t\t\t\t\ttransformTemplate={template}\n\t\t\t\t\tdata-framer-name={dataFramerName}\n\t\t\t\t\tdata-framer-component-type={richTextContainerComponentType}\n\t\t\t\t>\n\t\t\t\t\t{processedChildren}\n\t\t\t\t</FitText>\n\t\t\t)\n\t\t}\n\t}\n\n\treturn (\n\t\t<Component\n\t\t\t{...validRestProps}\n\t\t\tref={containerRef as React.RefObject<HTMLDivElement>}\n\t\t\tstyle={containerStyle}\n\t\t\tlayoutId={layoutId}\n\t\t\ttransformTemplate={template}\n\t\t\tdata-framer-name={dataFramerName}\n\t\t\tdata-framer-component-type={richTextContainerComponentType}\n\t\t>\n\t\t\t{processedChildren}\n\t\t</Component>\n\t)\n})\n\ntype FitTextProps = Omit<RichTextProps, \"_constraints\"> & {\n\t// Function components don't support ref, so alias as innerRef so we can pass the ref to the underlying svg.\n\tinnerRef?: React.Ref<SVGSVGElement>\n\t// _constraints is optional in the case where it is being lifted to the wrapping element (using props.as).\n\t_constraints?: CustomConstraintProperties\n}\n\nfunction isFragment(element: React.ReactElement): boolean {\n\treturn element.type === Fragment\n}\n\nfunction isLineBreak(element: React.ReactElement): boolean {\n\treturn element.type === \"br\"\n}\n\nfunction processRichTextChildren(\n\telement: React.ReactElement,\n\tstylesPresetsClassNames: Record<string, string> | undefined,\n\tplainText: React.ReactNode | undefined,\n\tanchorLinkOffsetY: number | undefined,\n\t// biome-ignore lint/style/useDefaultParameterLast: <explanation>\n\tslugCounters: Record<string, number> = {},\n\ttokenizer: TextEffectTokenizer | undefined,\n\t// If the first node is a fragment, we want to offset the initial depth so\n\t// that the first real elements have depth 0. This let's us control where we\n\t// run certain effects.\n\tdepth: number = isFragment(element) ? -1 : 0,\n) {\n\tlet children: React.ReactNode[] = Children.toArray(element.props.children)\n\n\t// If a plain text is passed into the RichText component, trim the children\n\t// to only the first branch and replace the text of its leaf node below.\n\tif (!isUndefined(plainText)) {\n\t\tchildren = children.slice(0, 1)\n\t}\n\n\t// If the only children of this element are <br>, we won't animate the\n\t// element if it has a Text Effect.\n\tlet onlyLineBreaks = true\n\tchildren = children.map(child => {\n\t\t// Recursively process children.\n\t\tif (!isValidElement(child) || !isLineBreak(child)) onlyLineBreaks = false\n\t\tif (isValidElement(child)) {\n\t\t\treturn processRichTextChildren(\n\t\t\t\tchild,\n\t\t\t\tstylesPresetsClassNames,\n\t\t\t\tplainText,\n\t\t\t\tanchorLinkOffsetY,\n\t\t\t\tslugCounters,\n\t\t\t\ttokenizer,\n\t\t\t\tdepth + 1,\n\t\t\t)\n\t\t}\n\n\t\t// Replace the text of the leaf node.\n\t\tconst text = !isUndefined(plainText) ? plainText : child\n\t\treturn isString(text) && tokenizer ? tokenizer.text(text) : text\n\t})\n\n\tconst { [\"data-preset-tag\"]: dataPresetTag, ...props } = element.props\n\n\tif (isString(element.type) || isMotionComponent(element.type)) {\n\t\tconst elementType = unwrapMotionComponent(element.type) || element.type\n\t\tconst tag = dataPresetTag || elementType\n\t\tconst stylesPresetClassName = isString(tag) ? stylesPresetsClassNames?.[tag] : undefined\n\t\tprops.className = cx(\"framer-text\", props.className, stylesPresetClassName)\n\t\t// Apply tokenizer props to the top level elements, excluding line\n\t\t// breaks.\n\t\tif (tokenizer && depth === 0 && !onlyLineBreaks) Object.assign(props, tokenizer.props(props.style))\n\n\t\t// Note that we use the `elementType` instead of `tag`, because we only\n\t\t// are interested in true heading tags.\n\t\tconst isHeading =\n\t\t\telementType === \"h1\" ||\n\t\t\telementType === \"h2\" ||\n\t\t\telementType === \"h3\" ||\n\t\t\telementType === \"h4\" ||\n\t\t\telementType === \"h5\" ||\n\t\t\telementType === \"h6\"\n\n\t\t// Add IDs and anchor links to headings if necessary.\n\t\tconst anchorLinkStylePresetClassName = stylesPresetsClassNames?.[\"anchor\"]\n\t\tif (isHeading && anchorLinkStylePresetClassName) {\n\t\t\tconst slug = generateHeadingSlug(children, slugCounters)\n\t\t\tprops.id = slug\n\n\t\t\tconst className = cx(\"framer-text\", anchorLinkStylePresetClassName)\n\t\t\tconst anchorLink = (\n\t\t\t\t<a href={`#${slug}`} className={className}>\n\t\t\t\t\t{children}\n\t\t\t\t</a>\n\t\t\t)\n\n\t\t\tprops.style = { ...(props.style ?? {}), scrollMarginTop: anchorLinkOffsetY }\n\n\t\t\tchildren = [anchorLink]\n\t\t}\n\t}\n\n\t// Add `framer-text` className and the correct stylesPresetClassName if\n\t// necessary to the element.\n\treturn cloneElement(element, props, ...children)\n}\n\nfunction generateHeadingSlug(children: React.ReactNode[], slugCounters: Record<string, number>): string {\n\tconst headingText = children.map(extractTextFromReactNode).join(\"\")\n\tlet slug = slugify(headingText)\n\n\tconst slugCounter = slugCounters[slug] ?? 0\n\n\t// Append a number to the slug if it's already in use to ensure all IDs are unique.\n\tif (slugCounter > 0) {\n\t\tslug += `-${slugCounter}`\n\t}\n\n\tslugCounters[slug] = slugCounter + 1\n\n\treturn slug\n}\n\nfunction extractTextFromReactNode(node: React.ReactNode): string {\n\tif (isString(node) || isNumber(node)) {\n\t\treturn node.toString()\n\t}\n\n\tif (isValidElement(node)) {\n\t\treturn extractTextFromReactNode(node.props.children)\n\t}\n\n\tif (Array.isArray(node)) {\n\t\treturn node.map(extractTextFromReactNode).join(\"\")\n\t}\n\n\treturn \"\"\n}\n\n/** @internal */\nconst RichTextInner = /* @__PURE__ */ forwardRef(function RichText(\n\t{ children, html, htmlFromDesign, ...props }: RichTextProps & DeprecatedRichTextProps,\n\tforwardedRef: React.RefObject<HTMLDivElement | SVGSVGElement> | null,\n) {\n\tconst content = html || children || htmlFromDesign\n\n\t// The legacy RichText component did accept HTML instead of JSX. This is\n\t// used when VariantComponent hasn't been regenerated or if the user is\n\t// passing a code override that sets the `html` prop.\n\tif (isString(content)) {\n\t\t// The implementation of the collectElementStylesPresets has changed\n\t\t// to pass in a object but the DeprecatedRichText component still\n\t\t// expects a string.\n\t\tif (!props.stylesPresetsClassName && isObject(props.stylesPresetsClassNames)) {\n\t\t\tprops.stylesPresetsClassName = Object.values(props.stylesPresetsClassNames).join(\" \")\n\t\t}\n\n\t\tconst contentProp = {\n\t\t\t// We need to use the original prop name.\n\t\t\t[isString(html) ? \"html\" : \"htmlFromDesign\"]: content,\n\t\t}\n\n\t\treturn (\n\t\t\t<DeprecatedRichText\n\t\t\t\t{...props}\n\t\t\t\t{...contentProp}\n\t\t\t\t// DeprecatedRichText's ref goes directly to a motion.div.\n\t\t\t\tref={forwardedRef as React.RefObject<HTMLDivElement> | null}\n\t\t\t/>\n\t\t)\n\t}\n\n\t// Scenario: If the content has been regenerated but the\n\t// GeneratedVariantComponent is stale.\n\tif (!props.stylesPresetsClassNames && isString(props.stylesPresetsClassName)) {\n\t\t// Previously the collectElementStylesPresets was setting the\n\t\t// stylesPresetsClassName to a string with 5 classNames\n\t\t// representing the different presets. To separate them again we\n\t\t// depend on specific order they were defined in.\n\t\tconst [h1, h2, h3, p, a] = props.stylesPresetsClassName.split(\" \")\n\t\t// If one of them is set, all of them should be set.\n\t\tif (h1 === undefined || h2 === undefined || h3 === undefined || p === undefined || a === undefined) {\n\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\tconsole.warn(`Encountered invalid stylesPresetsClassNames: ${props.stylesPresetsClassNames}`)\n\t\t} else {\n\t\t\tprops.stylesPresetsClassNames = { h1, h2, h3, p, a }\n\t\t}\n\t}\n\n\treturn (\n\t\t<RichTextContainer {...props} ref={forwardedRef}>\n\t\t\t{isValidElement(content) ? content : undefined}\n\t\t</RichTextContainer>\n\t)\n})\n\nexport const RichText = /* @__PURE__ */ withLibraryCSS(RichTextInner)\n", "import { isCommandKeyPressed } from \"@framerjs/shared/src/environment.ts\"\nimport type { MotionProps, MotionStyle } from \"framer-motion\"\nimport { motion } from \"framer-motion\"\nimport * as React from \"react\"\nimport { useRef } from \"react\"\nimport { Animatable } from \"../../animation/Animatable/Animatable.ts\"\nimport { useImplicitPathVariables } from \"../../modules/Link/pathVariables.tsx\"\nimport { AnchorLinkTarget } from \"../../modules/Link/types.ts\"\nimport { cx } from \"../../modules/cx.ts\"\nimport { navigateFromAttributes } from \"../../modules/framerPageLink.ts\"\nimport { replaceFramerPageLinks } from \"../../modules/replaceFramerPageLinks.ts\"\nimport { useIsOnFramerCanvas } from \"../../modules/useIsOnFramerCanvas.ts\"\nimport { useRouter } from \"../../router/RouterContext.tsx\"\nimport { useCurrentRoute } from \"../../router/useCurrentRoute.tsx\"\nimport { useRoutePreloader } from \"../../router/useRoutePreloader.ts\"\nimport { fontStore } from \"../fonts/fontStore.ts\"\nimport { collectTextShadowsForProps } from \"../style/shadow.tsx\"\nimport type { FilterProperties } from \"../traits/Filters.ts\"\nimport type {\n\tNewConstraintProperties,\n\tParentSize,\n\tPositionAbsoluteProperties,\n\tPositionFixedProperties,\n} from \"../types/NewConstraints.tsx\"\nimport { ParentSizeState, calculateRect, useParentSize } from \"../types/NewConstraints.tsx\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport type { Shadow } from \"../types/Shadow.ts\"\nimport { escapeHTML } from \"../utils/dom.ts\"\nimport { collectFiltersFromProps } from \"../utils/filtersForNode.ts\"\nimport { findAnchorElement } from \"../utils/findAnchorElement.ts\"\nimport { withLibraryCSS } from \"../utils/injectComponentCSSRules.ts\"\nimport { isShallowEqualArray } from \"../utils/isShallowEqualArray.ts\"\nimport { transformTemplate } from \"../utils/transformTemplate.ts\"\nimport { useLayoutId } from \"../utils/useLayoutId.ts\"\nimport { measureClosestComponentContainer, useMeasureLayout } from \"../utils/useMeasureLayout.ts\"\nimport { ComponentContainerContext } from \"./ComponentContainerContext.tsx\"\nimport type { LayerProps } from \"./Layer.tsx\"\nimport type { TextVerticalAlignment } from \"./Text.tsx\"\n\n/**\n * @internal\n * Don't change these values as they are used in generated components as well.\n */\nexport const deprecatedRichTextPlaceholder = \"{{ text-placeholder }}\"\nexport const richTextWrapperClassName = \"rich-text-wrapper\"\n\n/** @internal */\nexport interface DeprecatedRichTextProps\n\textends\n\t\tPartial<NewConstraintProperties>,\n\t\tPositionFixedProperties,\n\t\tPositionAbsoluteProperties,\n\t\tPartial<FilterProperties>,\n\t\tLayerProps,\n\t\tPick<MotionProps, \"transformTemplate\"> {\n\t__fromCanvasComponent?: boolean\n\t__htmlStructure?: string\n\tclassName?: string\n\tenvironment?(): RenderTarget\n\tfonts?: string[]\n\thtml?: string\n\thtmlFromDesign?: string\n\tinnerRef?: React.MutableRefObject<HTMLDivElement | null>\n\tisEditable?: boolean\n\t/** Name of the node. Only provided in the scope of canvas pages. */\n\tname?: string\n\topacity?: number\n\tparentSize?: ParentSize\n\tpreload?: string[]\n\trotation?: Animatable<number> | number\n\tshadows?: readonly Shadow[]\n\tstyle?: MotionStyle\n\tstylesPresetsClassName?: string\n\ttext?: string\n\ttextFromDesign?: string\n\tvalue?: string\n\tverticalAlignment?: TextVerticalAlignment\n\tvisible?: boolean\n\twithExternalLayout?: boolean\n}\n\n/** @internal @deprecated */\nconst DeprecatedRichTextInner = /* @__PURE__ */ React.forwardRef<HTMLDivElement, Partial<DeprecatedRichTextProps>>(\n\tfunction Text(props: Partial<DeprecatedRichTextProps>, forwardedRef: React.RefObject<HTMLDivElement> | null) {\n\t\tconst {\n\t\t\tid,\n\t\t\tname,\n\t\t\thtml,\n\t\t\thtmlFromDesign,\n\t\t\ttext,\n\t\t\ttextFromDesign,\n\t\t\tfonts = [],\n\t\t\twidth,\n\t\t\theight,\n\t\t\tleft,\n\t\t\tright,\n\t\t\ttop,\n\t\t\tbottom,\n\t\t\tcenter,\n\t\t\tclassName,\n\t\t\tstylesPresetsClassName,\n\t\t\tvisible = true,\n\t\t\topacity,\n\t\t\trotation = 0,\n\t\t\tverticalAlignment = \"top\",\n\t\t\tisEditable = false,\n\t\t\tenvironment = RenderTarget.current,\n\t\t\twithExternalLayout = false,\n\t\t\tpositionSticky,\n\t\t\tpositionStickyTop,\n\t\t\tpositionStickyRight,\n\t\t\tpositionStickyBottom,\n\t\t\tpositionStickyLeft,\n\t\t\t__htmlStructure,\n\t\t\t__fromCanvasComponent = false,\n\t\t\t_forwardedOverrideId,\n\t\t\t_forwardedOverrides,\n\t\t\t_usesDOMRect,\n\t\t\tchildren: _children,\n\t\t\t...rest\n\t\t} = props\n\n\t\tconst parentSize = useParentSize()\n\t\tconst layoutId = useLayoutId(props)\n\n\t\tconst fallbackLayoutRef = useRef<HTMLDivElement>(null)\n\t\tconst layoutRef = forwardedRef ?? fallbackLayoutRef\n\n\t\tconst { navigate, getRoute } = useRouter()\n\t\tconst currentRoute = useCurrentRoute()\n\n\t\tuseRoutePreloader(props.preload ?? [])\n\t\tuseMeasureLayout(props, layoutRef)\n\n\t\tconst inCodeComponent = React.useContext(ComponentContainerContext)\n\t\tconst isOnCanvas = useIsOnFramerCanvas()\n\n\t\t// Replace HTML with text override or variable\n\t\tlet textOrOverride = text\n\t\tconst forwardedOverrideId = _forwardedOverrideId ?? id\n\t\tif (forwardedOverrideId && _forwardedOverrides) {\n\t\t\tconst override = _forwardedOverrides[forwardedOverrideId]\n\t\t\tif (typeof override === \"string\") {\n\t\t\t\ttextOrOverride = override\n\t\t\t}\n\t\t}\n\n\t\t// The __htmlStructure placeholder is inserted in:\n\t\t// - collectVariantDefinitionForNode.ts\n\t\t// - RichTextNode.getProps\n\t\t// - RichTextNode.getAttributes\n\t\tlet innerHTML = \"\"\n\n\t\tif (textOrOverride) {\n\t\t\tconst escapedText = escapeHTML(textOrOverride)\n\t\t\tinnerHTML = __htmlStructure\n\t\t\t\t? __htmlStructure.replace(deprecatedRichTextPlaceholder, escapedText)\n\t\t\t\t: `<p>${escapedText}</p>`\n\t\t} else if (html) {\n\t\t\tinnerHTML = html\n\t\t} else if (textFromDesign) {\n\t\t\tconst escapedText = escapeHTML(textFromDesign)\n\t\t\tinnerHTML = __htmlStructure\n\t\t\t\t? __htmlStructure.replace(deprecatedRichTextPlaceholder, escapedText)\n\t\t\t\t: `<p>${escapedText}</p>`\n\t\t} else if (htmlFromDesign) {\n\t\t\tinnerHTML = htmlFromDesign\n\t\t}\n\n\t\t// Parse the ProseMirror HTML to replace framer page links in the `data:framer/page-link,`\n\t\t// format with the correct paths their target corresponds to.\n\t\t// This needs to happen whenever the HTML string changes, since smart\n\t\t// components can update the ProseMirror HTML in variants by updating this prop value.\n\t\tconst implicitPathVariables = useImplicitPathVariables()\n\t\tconst innerHTMLWithReplacedFramerPageLinks = React.useMemo(() => {\n\t\t\tif (isOnCanvas || !getRoute || !currentRoute) return innerHTML\n\n\t\t\treturn replaceFramerPageLinks(innerHTML, getRoute, currentRoute, implicitPathVariables)\n\t\t}, [innerHTML, getRoute, currentRoute, implicitPathVariables])\n\n\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated component\n\t\tReact.useEffect(() => {\n\t\t\tconst container = layoutRef.current\n\t\t\tif (container === null) return\n\n\t\t\tfunction interceptPageLinks(event: MouseEvent) {\n\t\t\t\tconst anchorElement = findAnchorElement(event.target, layoutRef.current)\n\t\t\t\t// Don't prevent cmd + click, allowing users to open in new tab.\n\t\t\t\tif (\n\t\t\t\t\tisCommandKeyPressed(event) ||\n\t\t\t\t\t!navigate ||\n\t\t\t\t\t!anchorElement ||\n\t\t\t\t\tanchorElement.getAttribute(\"target\") === AnchorLinkTarget._blank\n\t\t\t\t) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Page links written to the ProseMirror HTML in the `data:framer/page-link,`\n\t\t\t\t// format should have been parsed, and replaced with the correct paths.\n\t\t\t\t// If that has happened, we can access the route id and transition properties\n\t\t\t\t// as data attributes, finally performing a navigation.\n\t\t\t\tconst didNavigate = navigateFromAttributes(navigate, anchorElement, implicitPathVariables)\n\t\t\t\tif (didNavigate) {\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If this is ever changed, please also update the test in the router\n\t\t\t// https://github.com/framer/FramerStudio/blob/d02564051eeb43e6a737f3301439d8efbc4167aa/src/router/src/Router.test.tsx#L89\n\t\t\tcontainer.addEventListener(\"click\", interceptPageLinks)\n\n\t\t\treturn () => {\n\t\t\t\tcontainer.removeEventListener(\"click\", interceptPageLinks)\n\t\t\t}\n\t\t}, [navigate, implicitPathVariables])\n\n\t\tuseLoadFonts(fonts, __fromCanvasComponent, layoutRef)\n\n\t\t// Hooks need to be above this line\n\t\tif (!visible) return null\n\n\t\tconst isHidden = isEditable && environment() === RenderTarget.canvas\n\n\t\tconst style: React.CSSProperties = {\n\t\t\toutline: \"none\",\n\t\t\tdisplay: \"flex\",\n\t\t\tflexDirection: \"column\",\n\t\t\tjustifyContent: convertVerticalAlignment(verticalAlignment),\n\t\t\topacity: isHidden ? 0 : opacity,\n\t\t\tflexShrink: 0,\n\t\t}\n\n\t\tconst restrictedRenderTarget = RenderTarget.hasRestrictions()\n\t\tconst frame = calculateRect(props, parentSize || ParentSizeState.Unknown, false)\n\t\tconst isAutoSized = _usesDOMRect && (width === \"auto\" || height === \"auto\")\n\t\tconst hasTransformTemplate =\n\t\t\t!!props.transformTemplate || !frame || !restrictedRenderTarget || __fromCanvasComponent || isAutoSized\n\t\tconst template = hasTransformTemplate ? (props.transformTemplate ?? transformTemplate(center)) : undefined\n\n\t\tif (!withExternalLayout) {\n\t\t\tif (frame && restrictedRenderTarget && !isAutoSized) {\n\t\t\t\tconst rotate = Animatable.getNumber(rotation).toFixed(4)\n\n\t\t\t\tstyle.transform = `translate(${frame.x}px, ${frame.y}px) rotate(${rotate}deg)`\n\t\t\t\tstyle.width = frame.width\n\t\t\t\tstyle.minWidth = frame.width\n\t\t\t\tstyle.height = frame.height\n\t\t\t} else {\n\t\t\t\tstyle.left = left\n\t\t\t\tstyle.right = right\n\t\t\t\tstyle.top = top\n\t\t\t\tstyle.bottom = bottom\n\t\t\t\tstyle.width = width\n\t\t\t\tstyle.height = height\n\t\t\t\t// I have no idea why this works as a number but not as a string. This is copied from the Text component.\n\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: deprecated component\n\t\t\t\tstyle.rotate = rotation as any\n\t\t\t}\n\n\t\t\tif (positionSticky) {\n\t\t\t\tif (!isOnCanvas || inCodeComponent) {\n\t\t\t\t\tstyle.position = \"sticky\"\n\t\t\t\t\tstyle.willChange = \"transform\"\n\t\t\t\t\tstyle.top = positionStickyTop\n\t\t\t\t\tstyle.right = positionStickyRight\n\t\t\t\t\tstyle.bottom = positionStickyBottom\n\t\t\t\t\tstyle.left = positionStickyLeft\n\t\t\t\t}\n\t\t\t} else if (isOnCanvas && (props.positionFixed || props.positionAbsolute)) {\n\t\t\t\tstyle.position = \"absolute\"\n\t\t\t}\n\t\t}\n\n\t\tcollectFiltersFromProps(props, style)\n\t\tcollectTextShadowsForProps(props, style)\n\n\t\tObject.assign(style, props.style)\n\n\t\treturn (\n\t\t\t<motion.div\n\t\t\t\tid={id}\n\t\t\t\tref={layoutRef}\n\t\t\t\t{...rest}\n\t\t\t\tstyle={style}\n\t\t\t\tlayoutId={layoutId}\n\t\t\t\tdata-framer-name={name}\n\t\t\t\tdata-framer-component-type=\"DeprecatedRichText\"\n\t\t\t\tdata-center={center}\n\t\t\t\tclassName={cx(className, stylesPresetsClassName, richTextWrapperClassName)}\n\t\t\t\ttransformTemplate={template}\n\t\t\t\t// biome-ignore lint/security/noDangerouslySetInnerHtml: intentional\n\t\t\t\tdangerouslySetInnerHTML={{ __html: innerHTMLWithReplacedFramerPageLinks }}\n\t\t\t/>\n\t\t)\n\t},\n)\n\nexport const DeprecatedRichText = /* @__PURE__ */ withLibraryCSS(DeprecatedRichTextInner)\n\nexport function convertVerticalAlignment(\n\tverticalAlignment: TextVerticalAlignment,\n): \"center\" | \"flex-start\" | \"flex-end\" {\n\tswitch (verticalAlignment) {\n\t\tcase \"top\":\n\t\t\treturn \"flex-start\"\n\t\tcase \"center\":\n\t\t\treturn \"center\"\n\t\tcase \"bottom\":\n\t\t\treturn \"flex-end\"\n\t}\n}\n\nexport function useLoadFonts(\n\tfonts: string[],\n\tfromCanvasComponent: boolean,\n\tcontainerRef: React.RefObject<HTMLElement | SVGElement>,\n) {\n\t// The fonts array is typically regenerated for every change to a text node,\n\t// so we need to keep track of previous values to avoid calls to the font\n\t// store when the contents of the array are the same between renders\n\tconst prevFontsRef = useRef<string[]>([])\n\n\tif (!isShallowEqualArray(prevFontsRef.current, fonts)) {\n\t\tprevFontsRef.current = fonts\n\n\t\tvoid fontStore.loadFonts(fonts).then(({ newlyLoadedFontCount }) => {\n\t\t\t// After fonts load, layout is likely to shift in auto-sized\n\t\t\t// elements. Since measurements would have typically already been\n\t\t\t// taken at this point, this can lead to selection outlines\n\t\t\t// appearing out of sync with the rendered component. On the canvas\n\t\t\t// we hook into the font loading process and manually trigger a\n\t\t\t// re-render for the node when it completes, which in turn makes\n\t\t\t// sure that all layout measurements take the latest layout shifts\n\t\t\t// into account. In compiled smart components, however, we can't use\n\t\t\t// the same solution. We'll instead check if new fonts have been\n\t\t\t// loaded, and attempt to add a measure request for the closest\n\t\t\t// component container, which in the case of component instances is\n\t\t\t// the only node whose measurements need updating (we don't track\n\t\t\t// measurements for things rendered inside the component itself,\n\t\t\t// which could also be affected by layout shifts).\n\n\t\t\t// If we're not running on the canvas and from within a smart\n\t\t\t// component, there's no need to measure.\n\t\t\tif (!fromCanvasComponent || !containerRef.current || RenderTarget.current() !== RenderTarget.canvas) return\n\n\t\t\t// We only need to measure if at least one new font has been loaded.\n\t\t\t// Otherwise we assume there was no layout shift.\n\t\t\tif (newlyLoadedFontCount > 0) {\n\t\t\t\tmeasureClosestComponentContainer(containerRef.current)\n\t\t\t}\n\t\t})\n\t}\n}\n", "import { isFirefox } from \"@framerjs/shared/src/environment.ts\"\nimport { safeWindow } from \"../../utils/safeWindow.ts\"\nimport type { Point } from \"../types/Point.ts\"\nimport { Rect } from \"../types/Rect.ts\"\n\nexport const ready = (callback: VoidFunction) => {\n\tif (document.readyState === \"loading\") {\n\t\tdocument.addEventListener(\"DOMContentLoaded\", () => setTimeout(callback))\n\t\treturn\n\t}\n\n\tcallback()\n}\n\n/** @internal */\nexport const frameFromElement = (element: Element): Rect => {\n\tconst frame = Rect.fromRect(element.getBoundingClientRect())\n\tframe.x = frame.x + safeWindow.scrollX\n\tframe.y = frame.y + safeWindow.scrollY\n\treturn frame\n}\n\n/** @internal */\nexport const frameFromElements = (elements: Element[]): Rect => {\n\treturn Rect.merge(...elements.map(frameFromElement))\n}\n\n/** Returns a page frame for the given element */\nexport const convertToPageFrame = (frame: Rect, element: Element): Rect => {\n\tconst point = convertToPagePoint(frame, element)\n\treturn {\n\t\tx: point.x,\n\t\ty: point.y,\n\t\twidth: frame.width,\n\t\theight: frame.height,\n\t}\n}\n\n/** Returns a parent frame for the given element */\nexport const convertFromPageFrame = (frame: Rect, element: Element): Rect => {\n\tconst point = convertFromPagePoint(frame, element)\n\treturn {\n\t\tx: point.x,\n\t\ty: point.y,\n\t\twidth: frame.width,\n\t\theight: frame.height,\n\t}\n}\n\nexport const getPageFrame = (element: Element): Rect => {\n\tconst rect = element.getBoundingClientRect()\n\treturn {\n\t\tx: rect.left + safeWindow.scrollX,\n\t\ty: rect.top + safeWindow.scrollY,\n\t\twidth: rect.width,\n\t\theight: rect.height,\n\t}\n}\n\nexport const fromEventForPage = (event: MouseEvent): Point => {\n\treturn {\n\t\tx: event.pageX,\n\t\ty: event.pageY,\n\t}\n}\n\nexport const fromEventForClient = (event: MouseEvent): Point => {\n\treturn {\n\t\tx: event.clientX,\n\t\ty: event.clientY,\n\t}\n}\n\nexport const convertToPagePoint = (point: Point, element: Element): Point => {\n\tconst frame = getPageFrame(element)\n\treturn {\n\t\tx: point.x + frame.x,\n\t\ty: point.y + frame.y,\n\t}\n}\n\nexport const convertFromPagePoint = (point: Point, element: Element): Point => {\n\tconst frame = getPageFrame(element)\n\treturn {\n\t\tx: point.x - frame.x,\n\t\ty: point.y - frame.y,\n\t}\n}\n\n/** @internal */\nexport const dispatchKeyDownEvent = (keyCode: number, options: Partial<KeyboardEventInit> = {}) => {\n\tconst keyboardEvent = new KeyboardEvent(\"keydown\", {\n\t\tbubbles: true,\n\t\tkeyCode,\n\t\t...options,\n\t} as KeyboardEventInit)\n\tconst activeElement = document.activeElement\n\tif (activeElement) {\n\t\tactiveElement.dispatchEvent(keyboardEvent)\n\t}\n}\n\n/** @internal */\nexport const DOM = {\n\tframeFromElement,\n\tframeFromElements,\n\tconvertToPageFrame,\n\tconvertFromPageFrame,\n\tgetPageFrame,\n\tfromEventForPage,\n\tfromEventForClient,\n\tconvertToPagePoint,\n\tconvertFromPagePoint,\n}\n\nlet parser: DOMParser\n// https://caniuse.com/mdn-api_document_parsehtmlunsafe_static\nconst supportsNativeParseHTML = /* #__PURE__ */ (() =>\n\t// Firefox has rare-random issues with the native parser: https://framer-team.slack.com/archives/C01B14R6E22/p1724159313153969\n\t!isFirefox() && typeof Document !== \"undefined\" && typeof Document.parseHTMLUnsafe === \"function\")()\n\n/**\n * @important Can cause XSS vulnerabilities if the returned document is appended to the current DOM.\n */\nexport function domParser(html: string, type?: DOMParserSupportedType): Document {\n\tif (supportsNativeParseHTML && !type) return Document.parseHTMLUnsafe(html)\n\n\tparser ??= new DOMParser()\n\treturn parser.parseFromString(html, type ?? \"text/html\")\n}\n\nexport function escapeHTML(value: string): string {\n\treturn value\n\t\t.replaceAll(\"&\", \"&amp;\")\n\t\t.replaceAll(\"<\", \"&lt;\")\n\t\t.replaceAll(\">\", \"&gt;\")\n\t\t.replaceAll('\"', \"&quot;\")\n\t\t.replaceAll(\"'\", \"&#39;\")\n}\n\n// inspired by https://github.com/SukkaW/fast-escape-html/blob/master/src/unescape.ts\nconst htmlUnescapeEntitiesRegExp = /&(?:[gl]t|quot|#39|amp|#6[02]|#34|apos|#38);/gu\nconst htmlUnescapeReplacers = {\n\t\"&lt;\": \"<\",\n\t\"&gt;\": \">\",\n\t\"&quot;\": '\"',\n\t\"&#39;\": \"'\",\n\t\"&amp;\": \"&\",\n\t\"&#60;\": \"<\",\n\t\"&#62;\": \">\",\n\t\"&#34;\": '\"',\n\t\"&apos;\": \"'\",\n\t\"&#38;\": \"&\",\n}\n\nexport function unescapeHTML(value: string): string {\n\treturn value.replace(\n\t\thtmlUnescapeEntitiesRegExp,\n\t\tmatch => htmlUnescapeReplacers[match as keyof typeof htmlUnescapeReplacers],\n\t)\n}\n", "import { escapeHTML } from \"../render/utils/dom.ts\"\nimport { computeRelativePath } from \"../router/computeRelativePath.ts\"\nimport { isRoute } from \"../router/isRoute.ts\"\nimport type { ActiveRoute, Route, RouteId } from \"../router/types.ts\"\nimport { getRouteElementId } from \"../router/utils.ts\"\nimport { isString } from \"../utils/utils.ts\"\nimport { linkFromFramerPageLink } from \"./Link/linkFromFramerPageLink.tsx\"\nimport { linkMatchesRoute } from \"./Link/linkMatchesRoute.tsx\"\nimport { pathVariablesRegExp } from \"./Link/pathVariables.tsx\"\nimport { PageLinkAttribute, parseFramerPageLink } from \"./framerPageLink.ts\"\n\n/** A regex that searches for html tags, and href values. */\nconst regex =\n\t/(<([a-z]+)(?:\\s+(?!href[\\s=])[^=\\s]+=(?:'[^']*'|\"[^\"]*\"))*)(?:(\\s+href\\s*=)(?:'([^']*)'|\"([^\"]*)\"))?((?:\\s+[^=\\s]+=(?:'[^']*'|\"[^\"]*\"))*>)/gi\n\n/**\n * @internal @deprecated\n */\nexport function replaceFramerPageLinks(\n\trawHTML: string,\n\tgetRoute: (routeId: RouteId) => Route | undefined,\n\tcurrentRoute: ActiveRoute,\n\timplicitPathVariables?: Record<string, unknown>,\n): string {\n\treturn rawHTML.replace(\n\t\tregex,\n\t\t(original, pre1: string, tag: string, pre2: string, value1: string, value2: string, post: string) => {\n\t\t\tif (tag.toLowerCase() !== \"a\") return original\n\n\t\t\tconst href = value1 || value2\n\t\t\tconst pageLink = parseFramerPageLink(href.replace(/&amp;/gu, \"&\"))\n\t\t\tif (!pageLink || !pageLink.target) return original\n\n\t\t\tconst targetRoute = getRoute(pageLink.target)\n\t\t\tif (!isRoute(targetRoute) || !isRoute(currentRoute)) return original\n\n\t\t\tconst targetPath = targetRoute.path\n\t\t\tconst currentPath = currentRoute.path\n\t\t\tif (!targetPath || !currentPath) return original\n\n\t\t\tlet attributes = ` ${PageLinkAttribute.Page}=\"${pageLink.target}\"`\n\n\t\t\tconst elementId = getRouteElementId(targetRoute, pageLink.element ?? undefined)\n\t\t\tif (elementId) {\n\t\t\t\tattributes += ` ${PageLinkAttribute.Element}=\"${pageLink.element}\"`\n\t\t\t}\n\n\t\t\tconst link = linkFromFramerPageLink(href)\n\t\t\tif (!link || isString(link)) return original\n\t\t\tif (linkMatchesRoute(currentRoute, link, implicitPathVariables)) {\n\t\t\t\tattributes += ` ${PageLinkAttribute.Current}`\n\t\t\t}\n\n\t\t\tlet relativePath = targetPath\n\t\t\tconst pathVariables = Object.assign({}, implicitPathVariables, pageLink.collectionItem?.pathVariables)\n\t\t\tif (Object.keys(pathVariables).length > 0) {\n\t\t\t\trelativePath = relativePath.replace(pathVariablesRegExp, (_, key) => \"\" + pathVariables[key])\n\t\t\t}\n\t\t\tif (pageLink.collectionItem?.pathVariables) {\n\t\t\t\t// Since implicit path variables will be provided when\n\t\t\t\t// navigating this link, we don't want to use the merged path\n\t\t\t\t// variables.\n\t\t\t\tconst params = new URLSearchParams(pageLink.collectionItem.pathVariables)\n\t\t\t\tattributes += ` ${PageLinkAttribute.PathVariables}=\"${params}\"`\n\t\t\t}\n\t\t\t// TODO: For complete correctness, currentPath should also have its path variables filled in.\n\t\t\trelativePath = computeRelativePath(currentPath, relativePath)\n\t\t\treturn pre1 + pre2 + `\"${escapeHTML(relativePath + (elementId ? `#${elementId}` : \"\"))}\"` + attributes + post\n\t\t},\n\t)\n}\n", "/** @internal */\nexport function isShallowEqualArray(a: any[], b: any[]) {\n\treturn a.length === b.length && a.every((v, i) => v === b[i])\n}\n", "import type { Spring, Tween } from \"framer-motion\"\nimport { animate, frame, inView, stagger, useReducedMotionConfig } from \"framer-motion\"\nimport * as React from \"react\"\nimport { useConstant } from \"../../components/utils/useConstant.ts\"\nimport { assertNever } from \"../../utils/assert.ts\"\nimport { isNumber, isUndefined } from \"../../utils/utils.ts\"\nimport type { OverrideableRef } from \"../utils/patchAndWaitForChild.ts\"\nimport { newOverrideableRef, patchAndWaitForChild } from \"../utils/patchAndWaitForChild.ts\"\ntype Transition = Omit<Spring | Tween, \"from\"> & { delay: number }\nimport { isStaticRenderer } from \"../../modules/useIsStaticRenderer.ts\"\n\nconst defaultValues = {\n\topacity: 1,\n\ty: 0,\n\tx: 0,\n\tscale: 1,\n\trotate: 0,\n\trotateX: 0,\n\trotateY: 0,\n\tskewX: 0,\n\tskewY: 0,\n\tfilter: \"none\",\n} as const\n\nfunction isEffectKey(key: string): key is keyof typeof defaultValues {\n\treturn key in defaultValues\n}\n\nfunction createKeyframes(\n\teffect: Partial<Effect>,\n\tshouldReduceMotion: boolean | null,\n): Record<string, [number | string, number | string]> {\n\tconst out: Record<string, [number | string, number | string]> = {}\n\tfor (const key in effect) {\n\t\tif (!isEffectKey(key)) continue\n\t\tconst effectValue = effect[key]\n\t\tconst defaultValue = defaultValues[key]\n\t\tif (isUndefined(effectValue) || isUndefined(defaultValue)) continue\n\t\tif (shouldReduceMotion && key !== \"opacity\") continue\n\t\tout[key] = [effectValue, defaultValue]\n\t}\n\treturn out\n}\n\ninterface Effect {\n\tfilter: string\n\topacity: number\n\trotate: number\n\trotateX: number\n\trotateY: number\n\tscale: number\n\tskewX: number\n\tskewY: number\n\tx: number\n\ty: number\n}\n\ntype Tokenization = \"character\" | \"word\" | \"line\" | \"element\"\n\ninterface Shared {\n\trepeat?: boolean\n\ttrigger: \"onMount\" | \"onInView\" | \"onScrollTarget\"\n\tthreshold?: number\n\ttarget?: { ref: React.MutableRefObject<HTMLElement | null> | undefined; offset?: number }\n}\n\n/** @internal */\nexport type TextEffect = Shared & {\n\ttype: \"appear\"\n\teffect: Partial<Effect>\n\ttransition?: Transition\n\trepeat?: boolean\n\ttokenization?: Tokenization\n\tstartDelay?: number\n}\n\nconst emojiSplitRe = /* @__PURE__ */ (() => {\n\t// eslint-disable-next-line redos-detector/no-unsafe-regex\n\treturn /\\p{Regional_Indicator}{2}|\\p{Emoji}\\p{Emoji_Modifier}?\\p{Variation_Selector}?(?:\\u{200d}\\p{Emoji}\\p{Emoji_Modifier}?\\p{Variation_Selector}?)*|./gu\n})()\n\nfunction tokenizeText(\n\ttext: string,\n\ttokenization: Tokenization = \"character\",\n\telements: Set<OverrideableRef<HTMLSpanElement>>,\n\tshouldReduceMotion: boolean | null,\n\tstyle?: React.CSSProperties,\n) {\n\t// Disable letter-by-letter animations but still respect delay\n\tif (shouldReduceMotion) {\n\t\tconst ref = newOverrideableRef<HTMLSpanElement>()\n\t\telements.add(ref)\n\t\treturn (\n\t\t\t<span ref={ref} style={style}>\n\t\t\t\t{text}\n\t\t\t</span>\n\t\t)\n\t}\n\n\tswitch (tokenization) {\n\t\tcase \"character\":\n\t\t// When we want to animate \"lines\" that aren't split by newlines, but\n\t\t// instead by wrapping, we have to split the text into characters, and\n\t\t// then measure the top offset of each character, creating groups of\n\t\t// characters every time the top offset changes\n\t\t// eslint-disable-next-line no-fallthrough\n\t\tcase \"line\": {\n\t\t\t// To ensure that text-wrap: balance works, we split into words,\n\t\t\t// then into characters.\n\t\t\tconst words = text.split(\" \")\n\t\t\tconst lastWordIndex = words.length - 1\n\t\t\treturn words.map((word, wordIndex) => {\n\t\t\t\tconst isLastWord = wordIndex === lastWordIndex\n\t\t\t\t// Generally we don't want words to wrap. But if they are long\n\t\t\t\t// and more likely to, we allow it. This is a compromise to try\n\t\t\t\t// to get the best of both worlds.\n\t\t\t\tconst short = word.length <= 12\n\t\t\t\treturn (\n\t\t\t\t\t<React.Fragment key={word + wordIndex + isLastWord}>\n\t\t\t\t\t\t<span style={{ whiteSpace: short ? \"nowrap\" : \"unset\" }}>\n\t\t\t\t\t\t\t{word.match(emojiSplitRe)?.map((char, i) => {\n\t\t\t\t\t\t\t\t// we must use our own ref here, as React prevents us from overriding `current` in React < 19\n\t\t\t\t\t\t\t\tconst ref = newOverrideableRef<HTMLSpanElement>()\n\t\t\t\t\t\t\t\telements.add(ref)\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: We are combining index with char.\n\t\t\t\t\t\t\t\t\t<span key={char + i} ref={ref} style={style}>\n\t\t\t\t\t\t\t\t\t\t{char}\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</span>\n\t\t\t\t\t\t{isLastWord ? null : \" \"}\n\t\t\t\t\t</React.Fragment>\n\t\t\t\t)\n\t\t\t})\n\t\t}\n\t\tcase \"word\": {\n\t\t\tconst words = text.split(\" \")\n\t\t\tconst lastWordIndex = words.length - 1\n\t\t\treturn words.map((char, i) => {\n\t\t\t\tconst isLastWord = i === lastWordIndex\n\n\t\t\t\t// we must use our own ref here, as React prevents us from overriding `current` in React < 19\n\t\t\t\tconst ref = newOverrideableRef<HTMLSpanElement>()\n\t\t\t\telements.add(ref)\n\t\t\t\treturn (\n\t\t\t\t\t<React.Fragment key={char + i + isLastWord}>\n\t\t\t\t\t\t<span ref={ref} style={style}>\n\t\t\t\t\t\t\t{char}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{isLastWord ? null : \" \"}\n\t\t\t\t\t</React.Fragment>\n\t\t\t\t)\n\t\t\t})\n\t\t}\n\t\t// Per: Element doesn't require text to be split.\n\t\tcase \"element\":\n\t\tdefault:\n\t\t\treturn text\n\t}\n}\n\nfunction tokenizationForEffect(effect: TextEffect): Tokenization | undefined {\n\tconst type = effect.type\n\tswitch (type) {\n\t\tcase \"appear\":\n\t\t\treturn effect.tokenization ?? \"character\"\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nfunction transformString(effect: Partial<Effect>): string {\n\tconst transforms: string[] = []\n\tif (isNumber(effect.x)) transforms.push(`translateX(${effect.x}px)`)\n\tif (isNumber(effect.y)) transforms.push(`translateY(${effect.y}px)`)\n\tif (isNumber(effect.scale)) transforms.push(`scale(${effect.scale})`)\n\tif (isNumber(effect.rotate)) transforms.push(`rotate(${effect.rotate}deg)`)\n\tif (isNumber(effect.rotateX)) transforms.push(`rotateX(${effect.rotateX}deg)`)\n\tif (isNumber(effect.rotateY)) transforms.push(`rotateY(${effect.rotateY}deg)`)\n\tif (isNumber(effect.skewX)) transforms.push(`skewX(${effect.skewX}deg)`)\n\tif (isNumber(effect.skewY)) transforms.push(`skewY(${effect.skewY}deg)`)\n\treturn transforms.join(\" \")\n}\n\nfunction getInitialEffectStyle(\n\tcanPlay: boolean,\n\tcanAnimate: boolean,\n\teffect: TextEffect | undefined,\n\tshouldReduceMotion: boolean | null,\n) {\n\tif (!effect || !effect.effect) return undefined\n\n\tconst type = effect.type\n\tswitch (type) {\n\t\tcase \"appear\":\n\t\t\tswitch (effect.tokenization) {\n\t\t\t\tcase \"element\":\n\t\t\t\t\tif (!canPlay || !canAnimate) return undefined\n\t\t\t\t\treturn {\n\t\t\t\t\t\topacity: effect.effect.opacity,\n\t\t\t\t\t\tfilter: shouldReduceMotion ? undefined : effect.effect.filter,\n\t\t\t\t\t\ttransform: shouldReduceMotion ? undefined : transformString(effect.effect),\n\t\t\t\t\t}\n\t\t\t\tcase \"line\":\n\t\t\t\tcase \"word\":\n\t\t\t\tcase \"character\":\n\t\t\t\tdefault:\n\t\t\t\t\t// Elements must always have inline-block so that they are\n\t\t\t\t\t// layed out identically on the canvas and preview. It's\n\t\t\t\t\t// required in the preview to apply transforms.\n\t\t\t\t\tif (!canPlay || !canAnimate) return { display: \"inline-block\" }\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdisplay: \"inline-block\",\n\t\t\t\t\t\topacity: effect.effect.opacity,\n\t\t\t\t\t\tfilter: shouldReduceMotion ? undefined : effect.effect.filter,\n\t\t\t\t\t\ttransform: shouldReduceMotion ? undefined : transformString(effect.effect),\n\t\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nexport interface TextEffectTokenizer {\n\ttext: (text: string) => string | JSX.Element | JSX.Element[]\n\tprops: <T extends HTMLElement = HTMLSpanElement>(\n\t\tstyle?: React.CSSProperties,\n\t) => { ref: React.Ref<T>; style: React.CSSProperties } | undefined\n}\n\n/** @internal */\nexport function useTextEffect(\n\tconfig: TextEffect | undefined,\n\tref?: React.RefObject<HTMLSpanElement | SVGSVGElement>,\n\tpreview?: boolean,\n) {\n\tconst elements = useConstant<Set<OverrideableRef<HTMLSpanElement>>>(() => new Set())\n\tconst isRenderingStaticContent = isStaticRenderer()\n\tconst canPlay = preview || !isRenderingStaticContent\n\tconst shouldReduceMotion = useReducedMotionConfig()\n\n\tconst state = React.useRef<{\n\t\thasMounted: boolean\n\t\thasAnimatedOnce: boolean\n\t\tisAnimating: boolean\n\t\teffect?: TextEffect\n\t}>({\n\t\thasMounted: false,\n\t\thasAnimatedOnce: false,\n\t\tisAnimating: false,\n\t\teffect: config,\n\t})\n\n\t// To ensure that we always access the latest effect without breaking the\n\t// memo, copy the current effect config into a ref.\n\tstate.current.effect = config\n\n\t// Rerun the effect if any of the props that require inView to be cleaned\n\t// up.\n\tconst trigger = config?.trigger ?? \"onMount\"\n\tconst target = config?.target\n\tconst threshold = config?.threshold\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: It depends on elements which is used inside the play function.\n\tReact.useEffect(() => {\n\t\tif (!canPlay || preview) return\n\n\t\tstate.current.hasMounted = true\n\n\t\tfunction play() {\n\t\t\tconst { effect } = state.current\n\t\t\tif (!canPlay || !effect) return\n\n\t\t\tif (effect?.repeat !== true && state.current.hasAnimatedOnce) return\n\t\t\tif (effect?.type === \"appear\" && state.current.isAnimating) return\n\n\t\t\tObject.assign(state.current, {\n\t\t\t\thasAnimatedOnce: true,\n\t\t\t\tisAnimating: true,\n\t\t\t})\n\n\t\t\tconst type = effect.type\n\t\t\tswitch (type) {\n\t\t\t\tcase \"appear\": {\n\t\t\t\t\tconst { transition, startDelay, repeat, tokenization } = effect\n\t\t\t\t\tconst cleanupRef: { current?: () => void } = { current: undefined }\n\t\t\t\t\tvoid runAppearEffect(\n\t\t\t\t\t\ttokenization,\n\t\t\t\t\t\teffect.effect,\n\t\t\t\t\t\telements,\n\t\t\t\t\t\ttransition,\n\t\t\t\t\t\tstartDelay,\n\t\t\t\t\t\trepeat,\n\t\t\t\t\t\tshouldReduceMotion,\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tObject.assign(state.current, { isAnimating: false })\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcleanupRef,\n\t\t\t\t\t)\n\t\t\t\t\treturn () => cleanupRef.current?.()\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(type)\n\t\t\t}\n\t\t}\n\n\t\tswitch (trigger) {\n\t\t\tcase \"onMount\":\n\t\t\t\tplay()\n\t\t\t\treturn\n\t\t\tcase \"onInView\": {\n\t\t\t\tconst element = ref?.current\n\t\t\t\tif (!element) return\n\t\t\t\treturn inView(element, play, { amount: threshold ?? 0 })\n\t\t\t}\n\t\t\tcase \"onScrollTarget\": {\n\t\t\t\tconst element = target?.ref?.current\n\t\t\t\tif (!element) return\n\t\t\t\treturn inView(element, play, {\n\t\t\t\t\tamount: threshold ?? 0,\n\t\t\t\t\troot: document,\n\t\t\t\t\tmargin: target?.offset ? `${target.offset}px 0px 0px 0px` : undefined,\n\t\t\t\t})\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(trigger)\n\t\t}\n\t}, [canPlay, elements, preview, ref, target, threshold, trigger])\n\n\tconst effectEnabled = !!config\n\tconst tokenization = config ? tokenizationForEffect(config) : undefined\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: It depends on elements which is used inside the getTokenizer and play functions.\n\treturn React.useMemo(\n\t\t() => ({\n\t\t\t// The tokenizer is memoized such that it won't trigger RichText to\n\t\t\t// be rerendered if the effect changes in a way that doesn't effect\n\t\t\t// the tokenization.\n\t\t\tgetTokenizer: (): TextEffectTokenizer | undefined => {\n\t\t\t\telements.clear()\n\n\t\t\t\t// Don't tokenize text if the effect is not enabled.\n\t\t\t\tif (!effectEnabled) return undefined\n\n\t\t\t\tconst { hasMounted, hasAnimatedOnce, effect } = state.current\n\t\t\t\t// Don't set initial style if the effect won't run at some point\n\t\t\t\t// after tokenizing. We still tokenize the text so that the dom\n\t\t\t\t// doesn't change which can impact kerning.\n\t\t\t\tconst effectStyle = getInitialEffectStyle(\n\t\t\t\t\tcanPlay,\n\t\t\t\t\tpreview || mayAnimate(hasMounted, hasAnimatedOnce, effect),\n\t\t\t\t\tstate.current.effect,\n\t\t\t\t\tshouldReduceMotion,\n\t\t\t\t)\n\n\t\t\t\treturn {\n\t\t\t\t\ttext: (text: string) => tokenizeText(text, tokenization, elements, shouldReduceMotion, effectStyle),\n\t\t\t\t\tprops: <T extends HTMLElement = HTMLSpanElement>(style: React.CSSProperties) => {\n\t\t\t\t\t\tif (effect?.tokenization !== \"element\") return undefined\n\t\t\t\t\t\tconst r = newOverrideableRef<T>()\n\t\t\t\t\t\telements.add(r)\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tref: r,\n\t\t\t\t\t\t\tstyle: { ...style, ...effectStyle },\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\tplay: () => {\n\t\t\t\tconst { effect } = state.current\n\t\t\t\tif (!effect) return\n\n\t\t\t\tconst type = effect.type\n\t\t\t\tswitch (type) {\n\t\t\t\t\tcase \"appear\": {\n\t\t\t\t\t\tconst { transition, startDelay } = effect\n\t\t\t\t\t\tvoid runAppearEffect(\n\t\t\t\t\t\t\ttokenization,\n\t\t\t\t\t\t\teffect.effect,\n\t\t\t\t\t\t\telements,\n\t\t\t\t\t\t\ttransition,\n\t\t\t\t\t\t\tstartDelay,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\tshouldReduceMotion,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(type)\n\t\t\t\t}\n\t\t\t},\n\t\t}),\n\t\t[canPlay, effectEnabled, elements, preview, tokenization],\n\t)\n}\n\nfunction mayAnimate(hasMounted: boolean, hasAnimatedOnce: boolean, effect: TextEffect | undefined) {\n\treturn !(\n\t\t// If either the component has mounted and the trigger is\n\t\t// onMount, or if the component has run an animation to\n\t\t// completion, the effect is not repeatable, and the trigger\n\t\t// is one that is impacted by repeated effects, we don't\n\t\t// need to set initial style again.\n\t\t(\n\t\t\t(hasMounted && effect?.trigger === \"onMount\") ||\n\t\t\t(hasAnimatedOnce && !effect?.repeat && (effect?.trigger === \"onInView\" || effect?.trigger === \"onScrollTarget\"))\n\t\t)\n\t)\n}\n\nasync function runAppearEffect(\n\ttokenization: Tokenization = \"character\",\n\teffect: Partial<Effect>,\n\telements: Set<OverrideableRef<HTMLSpanElement>>,\n\ttransition: Transition | undefined,\n\tstartDelay: number = 0,\n\trepeat: boolean = false,\n\tshouldReduceMotion: boolean | null,\n\tcallback?: () => void,\n\n\t/**\n\t * The cleanup ref is used to make sure cleanup functions are called when the component unmounts, even if the flow inside this function is async (= promise returning).\n\t */\n\tcleanupRef?: { current?: () => void },\n): Promise<void> {\n\tconst enter = createKeyframes(effect, shouldReduceMotion)\n\t// ensure we're able to clean up the promises / timeouts\n\tconst controller = new AbortController()\n\tif (cleanupRef) cleanupRef.current = () => controller.abort()\n\n\tswitch (tokenization) {\n\t\tcase \"character\":\n\t\tcase \"element\":\n\t\tcase \"word\": {\n\t\t\tconst list = await createElementList(elements, controller)\n\t\t\tif (list === null) return // list is empty or promise has been rejected, so nothing to run anymore\n\n\t\t\tvoid animate(list, enter, {\n\t\t\t\t...transition,\n\t\t\t\trestDelta: 0.001,\n\t\t\t\tdelay: stagger(transition?.delay ?? 0, { startDelay }),\n\t\t\t}).then(() => callback?.())\n\n\t\t\tif (!repeat || !cleanupRef) return\n\n\t\t\t// The groups have already been created, so the cleanup function can now be reassigned from a cleanup function that aborts the promises awaiting refs, to a function that animates out the elements.\n\t\t\tcleanupRef.current = () => {\n\t\t\t\tconst actualEffect = shouldReduceMotion ? { opacity: effect.opacity } : effect\n\t\t\t\tvoid animate(list, actualEffect, {\n\t\t\t\t\t...transition,\n\t\t\t\t\trestDelta: 0.001,\n\t\t\t\t\tdelay: stagger(transition?.delay ?? 0, { startDelay }),\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tcase \"line\": {\n\t\t\ttry {\n\t\t\t\t// wait for all children to mount\n\t\t\t\tfor (const element of elements) {\n\t\t\t\t\t// this either resolves when React has mounted the element and attached the ref, or rejects then the component unmounts\n\t\t\t\t\tawait patchAndWaitForChild(element, controller)\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// loop was aborted\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlet list: HTMLElement[][]\n\t\t\t// Perform the creation of groups in motion's read phase so that the\n\t\t\t// reads are batched with any other reads on the site.\n\t\t\tframe.read(() => {\n\t\t\t\tlist = createLineGroups(elements)\n\t\t\t\tif (list.length === 0) return\n\t\t\t\tframe.update(() => {\n\t\t\t\t\tconst animations = list.map((group, i) => {\n\t\t\t\t\t\treturn animate(group, enter, {\n\t\t\t\t\t\t\t...transition,\n\t\t\t\t\t\t\trestDelta: 0.001,\n\t\t\t\t\t\t\t// Since text tokenized into lines are groups of individual\n\t\t\t\t\t\t\t// characters where each group is animated at once, we can't use\n\t\t\t\t\t\t\t// motion's built in `stagger()` function, and have to manage the\n\t\t\t\t\t\t\t// outer delay ourselves.\n\t\t\t\t\t\t\tdelay: startDelay + i * (transition?.delay ?? 0),\n\t\t\t\t\t\t})\n\t\t\t\t\t})\n\t\t\t\t\tvoid Promise.all(animations).then(() => callback?.())\n\t\t\t\t})\n\t\t\t})\n\n\t\t\tif (!repeat || !cleanupRef) return\n\n\t\t\tcleanupRef.current = () => {\n\t\t\t\tif (list.length === 0) return\n\t\t\t\tconst actualEffect = shouldReduceMotion ? { opacity: effect.opacity } : effect\n\t\t\t\tlist.forEach((group, i) => {\n\t\t\t\t\tvoid animate(group, actualEffect, {\n\t\t\t\t\t\t...transition,\n\t\t\t\t\t\trestDelta: 0.001,\n\t\t\t\t\t\tdelay: startDelay + i * (transition?.delay ?? 0),\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(tokenization)\n\t}\n}\n\nasync function createElementList(\n\telements: Set<OverrideableRef<HTMLSpanElement>>,\n\tcontroller: AbortController,\n): Promise<HTMLElement[] | null> {\n\tif (elements.size === 0) return null\n\n\tconst list: HTMLElement[] = []\n\tfor (const element of elements) {\n\t\ttry {\n\t\t\t// this either resolves when React has mounted the element and attached the ref, or rejects then the component unmounts\n\t\t\tconst node = await patchAndWaitForChild(element, controller)\n\t\t\tif (node) list.push(node)\n\t\t} catch {\n\t\t\t// loop was aborted\n\t\t\treturn null\n\t\t}\n\t}\n\n\treturn list\n}\n\nfunction createLineGroups(elements: Set<OverrideableRef<HTMLSpanElement>>) {\n\tconst groups: HTMLElement[][] = []\n\n\tlet currentGroup: HTMLElement[] = []\n\tlet lastOffset: number | null = null\n\tfor (const element of elements) {\n\t\tif (!element.current) continue\n\n\t\tconst top = element.current.offsetTop\n\t\t// Spaces can have no height, so should just be considered part of the\n\t\t// current group, and since their offset can disturb the line grouping,\n\t\t// we don't consider the top offset of a space span when comparing\n\t\t// offsets.\n\t\tconst height = element.current.offsetHeight\n\t\tif (!height || lastOffset === null || top === lastOffset) {\n\t\t\t// The first element, or an element with the same top as the previous\n\t\t\t// element, is on the same line.\n\t\t\tcurrentGroup.push(element.current)\n\t\t} else {\n\t\t\t// Otherwise we have encountered a new line. We consolidate the\n\t\t\t// previous group, and start a new one.\n\t\t\tgroups.push(currentGroup)\n\t\t\tcurrentGroup = [element.current]\n\t\t}\n\t\tif (height) lastOffset = top\n\t}\n\n\t// Finally consolidate the last group to the list.\n\tgroups.push(currentGroup)\n\n\treturn groups\n}\n", "/**\n * Ref created by `newOverrideableRef` and not `React.createRef`, as React won't allow us to override `current` in React < 19\n */\nexport interface OverrideableRef<T> {\n\tcurrent: T | null\n\t\" tag\": \"OverrideableRef\"\n}\n\nexport function newOverrideableRef<T>(): OverrideableRef<T> {\n\t// FIXME: With React 19, we can use `React.createRef` instead of this\n\treturn { current: null } as OverrideableRef<T>\n}\n\n/**\n * Overrides the ref's `current` property, and resolves the returned promise when the ref is set for the first time.\n * Rejects the returned promise if the controller's signal is aborted, or if the ref unmounts.\n */\nexport async function patchAndWaitForChild(\n\tref: OverrideableRef<HTMLElement>,\n\tcontroller: AbortController,\n): Promise<HTMLElement> {\n\tlet current: HTMLElement | null = ref.current\n\tif (current) return current\n\n\t/**\n\t * The elements in the set are refs of children. If they're wrapped in Suspense, they could mount later than the container.\n\t * Thus, we wait for each ref to be set.\n\t * We do that step by step (awaiting 1 ref at a time) as optimization, as it's likely that all refs mount at once.\n\t */\n\tlet refCallbackResolve: (element: HTMLElement) => void\n\tconst refCallbackPromise = new Promise<HTMLElement>((resolve, reject) => {\n\t\trefCallbackResolve = resolve\n\t\tcontroller.signal.addEventListener(\"abort\", () => reject())\n\t})\n\n\t// we need to listen to the ref setter, so let's override `current` - we can do that, because we don't use React's `useRef` hook for those refs.\n\tObject.defineProperty(ref, \"current\", {\n\t\tget() {\n\t\t\treturn current\n\t\t},\n\t\tset(element) {\n\t\t\tcurrent = element\n\t\t\tif (element === null) {\n\t\t\t\t// React calls with null when the element is unmounted\n\t\t\t\tcontroller.abort()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\trefCallbackResolve(element)\n\t\t},\n\t\tconfigurable: true,\n\t})\n\n\treturn refCallbackPromise\n}\n", "import type { Transition, Variants } from \"framer-motion\"\nimport React, { forwardRef } from \"react\"\nimport { Animatable } from \"../../animation/Animatable/Animatable.ts\"\nimport type { PropsAddedByLink } from \"../../modules/Link/types.ts\"\nimport { safeWindow } from \"../../utils/safeWindow.ts\"\nimport { encodeSVGForCSS } from \"../../utils/utils.ts\"\nimport { useProvidedWindow } from \"../WindowContext.ts\"\nimport type { BackgroundFilterProperties } from \"../traits/BackdropFilters.ts\"\nimport type { Background } from \"../traits/Background.ts\"\nimport type { FilterProperties } from \"../traits/Filters.ts\"\nimport type { WithOpacity } from \"../traits/Opacity.ts\"\nimport { collectOpacityFromProps } from \"../traits/Opacity.ts\"\nimport type { RadiusProperties } from \"../traits/Radius.ts\"\nimport { BackgroundImage } from \"../types/BackgroundImage.ts\"\nimport { Color } from \"../types/Color/Color.ts\"\nimport { LinearGradient } from \"../types/LinearGradient.ts\"\nimport type { NewConstraintProperties, ParentSize } from \"../types/NewConstraints.tsx\"\nimport { ParentSizeState, calculateRect, constraintsEnabled, useParentSize } from \"../types/NewConstraints.tsx\"\nimport { RadialGradient } from \"../types/RadialGradient.ts\"\nimport type { Rect } from \"../types/Rect.ts\"\nimport { RenderEnvironment, RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport type { Shadow } from \"../types/Shadow.ts\"\nimport type { Size } from \"../types/Size.ts\"\nimport {\n\telementPropertiesForLinearGradient,\n\telementPropertiesForRadialGradient,\n} from \"../utils/elementPropertiesForGradient.ts\"\nimport { collectFiltersFromProps } from \"../utils/filtersForNode.ts\"\nimport { htmlElementAsMotionComponent } from \"../utils/htmlElementAsMotionComponent.ts\"\nimport { imagePatternPropsForFill } from \"../utils/imagePatternPropsForFill.tsx\"\nimport { withLibraryCSS } from \"../utils/injectComponentCSSRules.ts\"\nimport { isFiniteNumber } from \"../utils/isFiniteNumber.ts\"\nimport { layoutHintDataPropsForCenter } from \"../utils/layoutHintDataPropsForCenter.ts\"\nimport { countNodeRender } from \"../utils/performanceDebugging.ts\"\nimport { transformTemplate } from \"../utils/transformTemplate.ts\"\nimport { useLayoutId } from \"../utils/useLayoutId.ts\"\nimport { useMeasureLayout } from \"../utils/useMeasureLayout.ts\"\nimport { resetSetStyle } from \"../utils/useWebkitFixes.ts\"\nimport { ImagePatternElement } from \"./ImagePatternElement.tsx\"\nimport type { LayerProps } from \"./Layer.tsx\"\nimport { Layer } from \"./Layer.tsx\"\nimport { sharedSVGManager } from \"./SharedSVGManager.ts\"\n\n/**\n * @internal\n */\nexport interface SVGProps\n\textends\n\t\tPartial<NewConstraintProperties>,\n\t\tPartial<FilterProperties & BackgroundFilterProperties & RadiusProperties & WithOpacity>,\n\t\tPropsAddedByLink {\n\trotation: Animatable<number> | number\n\tvisible: boolean\n\tname?: string\n\tfill?: Animatable<Background> | Background | null\n\tsvg: string\n\tintrinsicWidth?: number\n\tintrinsicHeight?: number\n\tshadows: readonly Shadow[]\n\tparentSize?: ParentSize\n\twithExternalLayout?: boolean\n\tclassName?: string\n\tstyle?: React.CSSProperties\n\tvariants?: Variants\n\ttransition?: Transition\n\t/** If nonzero indicates a managed SVG of fixed size and with unique internal ids. */\n\tsvgContentId?: number\n\n\t// Accessibility\n\ttitle?: string\n\tdescription?: string\n\ttabIndex?: number\n\n\t// Custom html tag support\n\tas?: keyof HTMLElementTagNameMap\n\n\t/**\n\t * If set to true, we can't render the SVG as images, and needs overflow: visible on the SVG.\n\t * This is used for inline shapes (without a user-defined viewBox) which might have centered\n\t * strokes that could get cropped without overflow: visible.\n\t */\n\trequiresOverflowVisible?: boolean\n}\n\n/**\n * @internal\n */\nexport interface SVGProperties extends SVGProps, LayerProps {\n\tlayoutId?: string | undefined\n\t/** @internal */\n\tinnerRef?: React.RefObject<HTMLDivElement>\n\t/** @internal */\n\t// eslint-disable-next-line no-undef\n\tprovidedWindow?: typeof window | null\n}\n\n// Before migrating to functional components we need to get parentSize data from context\n/**\n * @internal\n */\nconst SVGInner = /* @__PURE__ */ forwardRef(function SVG(\n\tprops: Partial<SVGProperties>,\n\tforwardedRef: React.RefObject<HTMLDivElement>,\n): React.ReactElement {\n\tconst parentSize = useParentSize()\n\tconst layoutId = useLayoutId(props)\n\tconst layoutRef = React.useRef<HTMLDivElement>(null)\n\tconst ref = forwardedRef ?? layoutRef\n\tconst providedWindow = useProvidedWindow()\n\n\tuseMeasureLayout(props, layoutRef)\n\n\treturn (\n\t\t<SVGComponent\n\t\t\t{...props}\n\t\t\tinnerRef={ref}\n\t\t\tparentSize={parentSize}\n\t\t\tlayoutId={layoutId}\n\t\t\tprovidedWindow={providedWindow}\n\t\t/>\n\t)\n})\n\nconst MAX_BACKGROUND_SVG_TEXT_LENGTH = 50_000\n\nfunction containsImageReference(svg: string) {\n\treturn svg.indexOf(\"image\") >= 0\n}\n\nfunction containsCustomPropertyReference(svg: string) {\n\treturn svg.indexOf(\"var(--\") >= 0\n}\n\nfunction hasBorderRadius(style: React.CSSProperties): boolean {\n\treturn !!(\n\t\tstyle.borderRadius ||\n\t\tstyle.borderBottomLeftRadius ||\n\t\tstyle.borderBottomRightRadius ||\n\t\tstyle.borderTopLeftRadius ||\n\t\tstyle.borderTopRightRadius\n\t)\n}\n\nfunction sizeSVG(container: React.RefObject<HTMLDivElement>, props: SVGProperties) {\n\tconst div = container.current\n\tif (!div) return\n\n\t// The ResponsiveScreenContainer.tsx of vekter allows content to be rendered into an iframe via\n\t// a react portal. This means that the javascript is executed by react outside of the iframe,\n\t// but the html elements are mounted inside the iframe. That means that attempting to do checks\n\t// by reference between dom nodes and dom classes will fail. To work around this, we need to\n\t// make sure that we use the same reference. We do this by creating a context that captures the\n\t// value of the iframe's window, we then use that to reference the correct dom node class.\n\tconst localWindow = props.providedWindow ?? safeWindow\n\tconst svg = div.firstElementChild\n\tif (!svg || !(svg instanceof localWindow.SVGSVGElement)) return\n\n\t// Workaround for Firefox mostly: Sometimes react dehydration does not update\n\t// dangerouslySetInnerHTML properties. And ssg produces templates without viewBoxes, as there is\n\t// no DOMParser on the server side. And Firefox does not render the SVG correctly without a\n\t// viewBox that is the size of the svg referenced by <use ... />\n\t// See also: https://github.com/framer/company/issues/24019\n\tif (!svg.getAttribute(\"viewBox\")) {\n\t\tconst viewBox = sharedSVGManager.getViewBox(props.svg)\n\t\tif (viewBox) {\n\t\t\tsvg.setAttribute(\"viewBox\", viewBox)\n\t\t}\n\t}\n\n\tconst { withExternalLayout, parentSize } = props\n\t// SVGs rendered on the canvas will already have an explicit size calculated\n\t// and set by the `collectLayout()` method, so we don't need to resize them\n\t// again. When in a DOM Layout Stack or a code component parent size will be\n\t// disabled for the current level, so sizes won't be calculated, and SVGs\n\t// will be treated as if they have external layout.\n\tconst canUseCalculatedOnCanvasSize =\n\t\t!withExternalLayout &&\n\t\tconstraintsEnabled(props) &&\n\t\tparentSize !== ParentSizeState.Disabled &&\n\t\tparentSize !== ParentSizeState.DisabledForCurrentLevel\n\n\tif (canUseCalculatedOnCanvasSize) return\n\n\tconst { intrinsicWidth, intrinsicHeight, _constraints } = props\n\tif (\n\t\tsvg.viewBox?.baseVal?.width === 0 &&\n\t\tsvg.viewBox?.baseVal?.height === 0 &&\n\t\tisFiniteNumber(intrinsicWidth) &&\n\t\tisFiniteNumber(intrinsicHeight)\n\t) {\n\t\tsvg.setAttribute(\"viewBox\", `0 0 ${intrinsicWidth} ${intrinsicHeight}`)\n\t}\n\t// XXX TODO take the value from _constraints.aspectRatio into account\n\tif (_constraints && _constraints.aspectRatio) {\n\t\tsvg.setAttribute(\"preserveAspectRatio\", \"\")\n\t} else {\n\t\tsvg.setAttribute(\"preserveAspectRatio\", \"none\")\n\t}\n\tsvg.setAttribute(\"width\", \"100%\")\n\tsvg.setAttribute(\"height\", \"100%\")\n}\n\ndeclare class SVGComponentType extends Layer<SVGProperties, object> {\n\tstatic supportsConstraints: boolean\n\tstatic frame(props: Partial<SVGProperties>): Rect | null\n\tstatic defaultSVGProps: SVGProps\n\tstatic readonly defaultProps: SVGProperties\n\tsetSVGElement(element: SVGSVGElement | null): void\n\tget frame(): Rect | null\n}\n\nexport const SVGComponent: typeof SVGComponentType = /* @__PURE__ */ (() => {\n\treturn class SVGComponentInner extends Layer<SVGProperties, object> {\n\t\tstatic supportsConstraints = true\n\t\tstatic defaultSVGProps: SVGProps = {\n\t\t\tleft: undefined,\n\t\t\tright: undefined,\n\t\t\ttop: undefined,\n\t\t\tbottom: undefined,\n\t\t\tstyle: undefined,\n\t\t\t_constraints: {\n\t\t\t\tenabled: true,\n\t\t\t\taspectRatio: null,\n\t\t\t},\n\t\t\tparentSize: ParentSizeState.Unknown,\n\t\t\trotation: 0,\n\t\t\tvisible: true,\n\t\t\tsvg: \"\",\n\t\t\tshadows: [],\n\t\t}\n\n\t\tstatic override readonly defaultProps: SVGProperties = {\n\t\t\t...Layer.defaultProps,\n\t\t\t...SVGComponentInner.defaultSVGProps,\n\t\t}\n\n\t\tstatic frame(props: Partial<SVGProperties>) {\n\t\t\treturn calculateRect(props, props.parentSize || ParentSizeState.Unknown)\n\t\t}\n\n\t\tcontainer = React.createRef<HTMLDivElement>()\n\t\tsvgElement: SVGSVGElement | null = null\n\n\t\tsetSVGElement = (element: SVGSVGElement | null) => {\n\t\t\tthis.svgElement = element\n\t\t\tthis.setLayerElement(element)\n\t\t}\n\n\t\tpreviouslyRenderedSVG: string = \"\"\n\n\t\tget frame(): Rect | null {\n\t\t\treturn calculateRect(this.props, this.props.parentSize || ParentSizeState.Unknown)\n\t\t}\n\n\t\tprivate unmountedSVG: string | undefined = \"\"\n\t\toverride componentDidMount() {\n\t\t\t// This normally isn't called, but in strict+dev mode, react will call will did mount,\n\t\t\t// will unmount, did mount. If no render follows afterwards, the svg will disappear from the\n\t\t\t// page after 5 seconds.\n\t\t\tif (this.unmountedSVG) {\n\t\t\t\tconst { svgContentId } = this.props\n\t\t\t\tconst contentid = svgContentId ? `svg${svgContentId}` : null\n\t\t\t\tsharedSVGManager.subscribe(this.unmountedSVG, !svgContentId, contentid)\n\t\t\t\tthis.previouslyRenderedSVG = this.unmountedSVG\n\t\t\t}\n\n\t\t\tif (this.props.svgContentId) return\n\t\t\tsizeSVG(this.container, this.props)\n\t\t}\n\n\t\toverride componentWillUnmount() {\n\t\t\tsharedSVGManager.unsubscribe(this.previouslyRenderedSVG)\n\t\t\tthis.unmountedSVG = this.previouslyRenderedSVG\n\t\t\tthis.previouslyRenderedSVG = \"\"\n\t\t}\n\n\t\toverride componentDidUpdate(prevProps: SVGProperties) {\n\t\t\tsuper.componentDidUpdate(prevProps)\n\t\t\tif (this.props.svgContentId) return\n\n\t\t\tconst { fill } = this.props\n\t\t\tif (\n\t\t\t\tBackgroundImage.isImageObject(fill) &&\n\t\t\t\tBackgroundImage.isImageObject(prevProps.fill) &&\n\t\t\t\tfill.src !== prevProps.fill.src\n\t\t\t) {\n\t\t\t\tresetSetStyle(this.svgElement, \"fill\", null, false)\n\t\t\t}\n\t\t\tsizeSVG(this.container, this.props)\n\t\t}\n\n\t\tprivate collectLayout(style: React.CSSProperties, innerStyle: React.CSSProperties) {\n\t\t\tif (this.props.withExternalLayout) {\n\t\t\t\t// When the outer element is already sized correclty the inner element needs to fill it.\n\t\t\t\tinnerStyle.width = \"100%\"\n\t\t\t\tinnerStyle.height = \"100%\"\n\t\t\t\tinnerStyle.aspectRatio = \"inherit\"\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst frame = this.frame\n\t\t\tconst { rotation, intrinsicWidth, intrinsicHeight, width, height } = this.props\n\t\t\tconst rotate = Animatable.getNumber(rotation)\n\n\t\t\tstyle.opacity = isFiniteNumber(this.props.opacity) ? this.props.opacity : 1\n\n\t\t\t/**\n\t\t\t * The if-statement below switches between positioning the SVG with\n\t\t\t * transforms or (in the else statement) with DOM-layout.\n\t\t\t *\n\t\t\t * On the canvas (when RenderTarget.hasRestrictions()) we want to\n\t\t\t * position with transforms for performance reasons. When dragging an\n\t\t\t * SVG around, if we can reposition an SVG using transforms, it won't\n\t\t\t * trigger a browser layout.\n\t\t\t *\n\t\t\t * In the preview we always position with DOM-layout, to not interfere\n\t\t\t * with Magic Motion that uses the transforms for animating.\n\t\t\t *\n\t\t\t * However, there might be cases where we do not have a frame to use for\n\t\t\t * positioning the SVG using transforms. For example when rendering\n\t\t\t * inside a Scroll component (that uses DOM-layout for it's children,\n\t\t\t * also on the canvas), we cannot always calculate a frame. In these\n\t\t\t * cases we do use DOM-layout to position the SVG, even on the canvas.\n\t\t\t */\n\t\t\tif (RenderTarget.hasRestrictions() && frame) {\n\t\t\t\tObject.assign(style, {\n\t\t\t\t\ttransform: `translate(${frame.x}px, ${frame.y}px) rotate(${rotate.toFixed(4)}deg)`,\n\t\t\t\t\twidth: `${frame.width}px`,\n\t\t\t\t\theight: `${frame.height}px`,\n\t\t\t\t})\n\t\t\t\tif (constraintsEnabled(this.props)) {\n\t\t\t\t\tstyle.position = \"absolute\"\n\t\t\t\t}\n\t\t\t\tconst xFactor = frame.width / (intrinsicWidth || 1)\n\t\t\t\tconst yFactor = frame.height / (intrinsicHeight || 1)\n\n\t\t\t\tinnerStyle.transformOrigin = \"top left\"\n\n\t\t\t\tconst { zoom, target } = RenderEnvironment\n\t\t\t\tif (target === RenderTarget.export) {\n\t\t\t\t\tconst zoomFactor = zoom > 1 ? zoom : 1\n\t\t\t\t\tinnerStyle.transform = `scale(${xFactor * zoomFactor}, ${yFactor * zoomFactor})`\n\t\t\t\t\tinnerStyle.zoom = 1 / zoomFactor\n\t\t\t\t} else {\n\t\t\t\t\tinnerStyle.transform = `scale(${xFactor}, ${yFactor})`\n\t\t\t\t}\n\n\t\t\t\tif (intrinsicWidth && intrinsicHeight) {\n\t\t\t\t\tinnerStyle.width = intrinsicWidth\n\t\t\t\t\tinnerStyle.height = intrinsicHeight\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst { left, right, top, bottom } = this.props\n\t\t\tObject.assign(style, {\n\t\t\t\tleft,\n\t\t\t\tright,\n\t\t\t\ttop,\n\t\t\t\tbottom,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\trotate,\n\t\t\t})\n\n\t\t\tObject.assign(innerStyle, {\n\t\t\t\tleft: 0,\n\t\t\t\ttop: 0,\n\t\t\t\tbottom: 0,\n\t\t\t\tright: 0,\n\t\t\t\tposition: \"absolute\",\n\t\t\t})\n\t\t}\n\n\t\toverride render() {\n\t\t\tcountNodeRender()\n\n\t\t\tconst {\n\t\t\t\tid,\n\t\t\t\tvisible,\n\t\t\t\tstyle,\n\t\t\t\tfill,\n\t\t\t\tsvg,\n\t\t\t\tintrinsicHeight,\n\t\t\t\tintrinsicWidth,\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tlayoutId,\n\t\t\t\tclassName,\n\t\t\t\tvariants,\n\t\t\t\twithExternalLayout,\n\t\t\t\tinnerRef,\n\t\t\t\tsvgContentId,\n\t\t\t\theight: _height,\n\t\t\t\topacity: _opacity,\n\t\t\t\twidth: _width,\n\t\t\t\trequiresOverflowVisible,\n\t\t\t\t...rest\n\t\t\t} = this.props\n\n\t\t\tif (!withExternalLayout && (!visible || !id)) return null\n\n\t\t\tconst identifier = id ?? layoutId ?? \"svg\"\n\t\t\tconst frame = this.frame\n\n\t\t\t// XXX find another way to not need these defaults\n\t\t\tconst size: Size = frame || { width: intrinsicWidth || 100, height: intrinsicHeight || 100 }\n\n\t\t\tconst outerStyle: React.CSSProperties = { ...style, imageRendering: \"pixelated\", flexShrink: 0 }\n\t\t\tconst innerStyle: React.CSSProperties = {}\n\n\t\t\tthis.collectLayout(outerStyle, innerStyle)\n\n\t\t\tcollectOpacityFromProps(this.props, outerStyle)\n\t\t\tcollectFiltersFromProps(this.props, outerStyle)\n\n\t\t\tLayer.applyWillChange(this.props, outerStyle, false)\n\n\t\t\t/** The fillElement will be used an all paths in the SVG that have no fill set. */\n\t\t\tlet fillElement: JSX.Element | null = null\n\t\t\tif (typeof fill === \"string\" || Color.isColorObject(fill)) {\n\t\t\t\tconst fillColor = Color.isColorObject(fill) ? fill.initialValue || Color.toRgbString(fill) : fill\n\t\t\t\touterStyle.fill = fillColor\n\t\t\t\touterStyle.color = fillColor\n\t\t\t} else if (LinearGradient.isLinearGradient(fill)) {\n\t\t\t\tconst gradient = fill\n\t\t\t\t// We need encodeURI() here to handle our old id's that contained special characters like ';'\n\t\t\t\t// Creating an url() entry for those id's unescapes them, so we need to use the URI encoded version\n\t\t\t\tconst gradientId = `${encodeURI(id || \"\")}g${LinearGradient.hash(gradient)}`\n\t\t\t\touterStyle.fill = `url(#${gradientId})`\n\t\t\t\tconst { stops, x1, x2, y1, y2 } = elementPropertiesForLinearGradient(gradient, identifier)\n\n\t\t\t\tfillElement = (\n\t\t\t\t\t<svg ref={this.setSVGElement} width=\"100%\" height=\"100%\" style={{ position: \"absolute\" }} role=\"presentation\">\n\t\t\t\t\t\t<linearGradient id={gradientId} x1={x1} x2={x2} y1={y1} y2={y2}>\n\t\t\t\t\t\t\t{stops.map((stop, idx) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<stop\n\t\t\t\t\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: other properties might not be unique\n\t\t\t\t\t\t\t\t\t\tkey={idx}\n\t\t\t\t\t\t\t\t\t\toffset={stop.position}\n\t\t\t\t\t\t\t\t\t\tstopColor={stop.color}\n\t\t\t\t\t\t\t\t\t\tstopOpacity={stop.alpha}\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</linearGradient>\n\t\t\t\t\t</svg>\n\t\t\t\t)\n\t\t\t} else if (RadialGradient.isRadialGradient(fill)) {\n\t\t\t\tconst gradient = fill\n\t\t\t\t// We need encodeURI() here to handle our old id's that contained special characters like ';'\n\t\t\t\t// Creating an url() entry for those id's unescapes them, so we need to use the URI encoded version\n\t\t\t\tconst gradientId = `${encodeURI(id || \"\")}g${RadialGradient.hash(gradient)}`\n\t\t\t\touterStyle.fill = `url(#${gradientId})`\n\t\t\t\tconst elementProperties = elementPropertiesForRadialGradient(gradient, identifier)\n\t\t\t\tfillElement = (\n\t\t\t\t\t<svg ref={this.setSVGElement} width=\"100%\" height=\"100%\" style={{ position: \"absolute\" }} role=\"presentation\">\n\t\t\t\t\t\t<radialGradient\n\t\t\t\t\t\t\tid={gradientId}\n\t\t\t\t\t\t\tcy={gradient.centerAnchorY}\n\t\t\t\t\t\t\tcx={gradient.centerAnchorX}\n\t\t\t\t\t\t\tr={gradient.widthFactor}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{elementProperties.stops.map((stop, idx) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<stop\n\t\t\t\t\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: other properties might not be unique\n\t\t\t\t\t\t\t\t\t\tkey={idx}\n\t\t\t\t\t\t\t\t\t\toffset={stop.position}\n\t\t\t\t\t\t\t\t\t\tstopColor={stop.color}\n\t\t\t\t\t\t\t\t\t\tstopOpacity={stop.alpha}\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</radialGradient>\n\t\t\t\t\t</svg>\n\t\t\t\t)\n\t\t\t} else if (BackgroundImage.isImageObject(fill)) {\n\t\t\t\tconst imagePattern = imagePatternPropsForFill(fill, size, identifier)\n\t\t\t\tif (imagePattern) {\n\t\t\t\t\touterStyle.fill = `url(#${imagePattern.id})`\n\t\t\t\t\tfillElement = (\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tref={this.setSVGElement}\n\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\theight=\"100%\"\n\t\t\t\t\t\t\tstyle={{ position: \"absolute\" }}\n\t\t\t\t\t\t\trole=\"presentation\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<defs>\n\t\t\t\t\t\t\t\t<ImagePatternElement {...imagePattern} />\n\t\t\t\t\t\t\t</defs>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst dataProps = {\n\t\t\t\t\"data-framer-component-type\": \"SVG\",\n\t\t\t}\n\n\t\t\tconst hasTransformTemplate = !frame\n\t\t\tif (hasTransformTemplate) {\n\t\t\t\tObject.assign(dataProps, layoutHintDataPropsForCenter(this.props.center))\n\t\t\t}\n\n\t\t\t// If the svg is smallish, and doesn't contain images, and there is no fill defined, and no\n\t\t\t// background is defined, then we can use a much cheaper method to render this svg by using\n\t\t\t// a backgroundImage data url.\n\t\t\tconst svgAsBackgroundImage =\n\t\t\t\t// If requiresOverflowVisible is true, we cannot safely render the SVG as background\n\t\t\t\t// images, as it might cropped any centered stroke that exceeds the bounding box.\n\t\t\t\t!requiresOverflowVisible &&\n\t\t\t\t!fillElement &&\n\t\t\t\t!outerStyle.fill &&\n\t\t\t\t!outerStyle.background &&\n\t\t\t\t!outerStyle.backgroundImage &&\n\t\t\t\tsvg.length < MAX_BACKGROUND_SVG_TEXT_LENGTH &&\n\t\t\t\t!containsImageReference(svg) &&\n\t\t\t\t!containsCustomPropertyReference(svg)\n\n\t\t\tlet content: JSX.Element | null = null\n\t\t\tif (svgAsBackgroundImage) {\n\t\t\t\touterStyle.backgroundSize = \"100% 100%\"\n\t\t\t\touterStyle.backgroundImage = encodeSVGForCSS(svg)\n\t\t\t\tsharedSVGManager.unsubscribe(this.previouslyRenderedSVG)\n\t\t\t\tthis.previouslyRenderedSVG = \"\"\n\t\t\t} else {\n\t\t\t\tconst contentid = svgContentId ? `svg${svgContentId}` : null\n\t\t\t\tconst __html = sharedSVGManager.subscribe(svg, !svgContentId, contentid, requiresOverflowVisible)\n\t\t\t\tsharedSVGManager.unsubscribe(this.previouslyRenderedSVG)\n\t\t\t\tthis.previouslyRenderedSVG = svg\n\n\t\t\t\tif (hasBorderRadius(outerStyle)) {\n\t\t\t\t\t// Border radius will have no effect on nested elements, unless we add overflow hidden\n\t\t\t\t\touterStyle.overflow = \"hidden\"\n\t\t\t\t}\n\n\t\t\t\t// Note how the fillElement and fill is used below, via css a fill is set, then any svg\n\t\t\t\t// path that doesn't have a fill set will take on this fill.\n\n\t\t\t\tcontent = (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{fillElement}\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={BackgroundImage.isImageObject(fill) ? fill.src : \"\"} // Webkit doesn't update when a new image is set\n\t\t\t\t\t\t\tclassName=\"svgContainer\" // Style for this class is added by `withLibraryCSS`\n\t\t\t\t\t\t\tstyle={innerStyle}\n\t\t\t\t\t\t\tref={this.container}\n\t\t\t\t\t\t\t// biome-ignore lint/security/noDangerouslySetInnerHtml: intentional for svg template\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={{ __html }}\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\t// Tag support, aria support, link support\n\t\t\tconst MotionComponent = htmlElementAsMotionComponent(this.props.as)\n\t\t\tconst { href, target, rel, onClick, onTap } = this.props as PropsAddedByLink\n\t\t\tconst hasTitleOrDescription = title || description\n\n\t\t\treturn (\n\t\t\t\t<MotionComponent\n\t\t\t\t\t{...dataProps}\n\t\t\t\t\t{...rest}\n\t\t\t\t\tlayoutId={layoutId}\n\t\t\t\t\ttransformTemplate={hasTransformTemplate ? transformTemplate(this.props.center) : undefined}\n\t\t\t\t\tid={id}\n\t\t\t\t\tref={innerRef}\n\t\t\t\t\tstyle={outerStyle}\n\t\t\t\t\tclassName={className}\n\t\t\t\t\tvariants={variants}\n\t\t\t\t\ttabIndex={this.props.tabIndex}\n\t\t\t\t\trole={hasTitleOrDescription ? \"img\" : undefined}\n\t\t\t\t\taria-label={title}\n\t\t\t\t\t// eslint-disable-next-line jsx-a11y/aria-props -- this is a draft prop\n\t\t\t\t\taria-description={description}\n\t\t\t\t\taria-hidden={hasTitleOrDescription ? undefined : \"true\"}\n\t\t\t\t\tonTap={onTap}\n\t\t\t\t\tonClick={onClick}\n\t\t\t\t\t{...{ href, target, rel }}\n\t\t\t\t>\n\t\t\t\t\t{content}\n\t\t\t\t</MotionComponent>\n\t\t\t)\n\t\t}\n\t}\n})()\n\nexport const SVG = /* @__PURE__ */ withLibraryCSS(SVGInner)\n", "import { interpolate } from \"framer-motion\"\nimport { Line } from \"../../render/types/Line.ts\"\nimport { Point } from \"../../render/types/Point.ts\"\nimport { Rect } from \"../../render/types/Rect.ts\"\nimport { assert } from \"../../utils/assert.ts\"\nimport { ConvertColor } from \"../types/Color/ConvertColor.ts\"\nimport { LinearGradient, RadialGradient } from \"../types/Gradient.ts\"\nimport { gradientColorStops } from \"./gradientColorStops.ts\"\n\n/** @internal */\ninterface ColorStop {\n\tcolor: string\n\talpha: number\n\tposition: number\n}\n\n/** @internal */\nexport interface LinearGradientElementProperties {\n\tid: string\n\tstops: ColorStop[]\n\tx1: number\n\ty1: number\n\tx2: number\n\ty2: number\n}\n\n/**\n * Get a line made up of the 2 points where a line from the center of the layer\n * along the angle of the gradient would intersect with a 1x1 rectangle.\n */\nexport function linearGradientLine(angle: number): Line {\n\tconst rad = (angle * Math.PI) / 180\n\tconst offset = {\n\t\tx: -Math.sin(rad) * 100,\n\t\ty: Math.cos(rad) * 100,\n\t}\n\n\tconst anglePoint = Point(offset.x, offset.y)\n\tconst angleLine = Line(Point(0.5, 0.5), anglePoint)\n\n\t// Get points from a 1x1 rectangle.\n\tconst points = Rect.points({ x: 0, y: 0, width: 1, height: 1 })\n\n\t// Find the two closest points. These should always be the points that form\n\t// the side of the 1x1 square that the angled line travels through. This is\n\t// only true because we are using a square, and would not hold true for a\n\t// rectangle.\n\tconst sortedPoints = points\n\t\t.map(point => ({ point, distance: Point.distance(anglePoint, point) }))\n\t\t.sort((a, b) => a.distance - b.distance)\n\n\tconst a = sortedPoints[0]?.point\n\tconst b = sortedPoints[1]?.point\n\tassert(a && b, \"linearGradientLine: Must have 2 closest points.\")\n\n\t// Find the other points, together they should form the line of the opposing side.\n\tconst [c, d] = points.filter(point => !Point.isEqual(point, a) && !Point.isEqual(point, b))\n\tassert(c && d, \"linearGradientLine: Must have 2 opposing points.\")\n\n\t// The start and end point of the line of the gradient are defined by where\n\t// the angle line would intersect with our sides.\n\tconst start = Line.intersection(angleLine, Line(a, b))\n\tconst end = Line.intersection(angleLine, Line(c, d))\n\tassert(start && end, \"linearGradientLine: Must have a start and end point.\")\n\n\treturn Line(start, end)\n}\n\nexport function elementPropertiesForLinearGradient(\n\tgradient: LinearGradient,\n\tid: string,\n): LinearGradientElementProperties {\n\tconst line = linearGradientLine(gradient.angle)\n\tconst stops = gradientColorStops(gradient)\n\n\tconst startPosition = stops[0]?.position ?? 0\n\tconst endPosition = stops[stops.length - 1]?.position ?? 1\n\n\tconst startPoint = Line.pointAtPercentDistance(line, startPosition)\n\tconst endPoint = Line.pointAtPercentDistance(line, endPosition)\n\n\t// Since the gradient will be positioned by the coordinates of the start and\n\t// end point, we normalize the other points into that range.\n\tconst interpolator = interpolate([startPosition, endPosition], [0, 1])\n\n\treturn {\n\t\tid: `id${id}g${LinearGradient.hash(gradient)}`,\n\t\tx1: startPoint.x,\n\t\ty1: startPoint.y,\n\t\tx2: endPoint.x,\n\t\ty2: endPoint.y,\n\t\tstops: stops.map(stop => ({\n\t\t\tcolor: stop.value,\n\t\t\talpha: ConvertColor.getAlpha(stop.value) * gradient.alpha,\n\t\t\tposition: interpolator(stop.position),\n\t\t})),\n\t}\n}\n\n/** @internal */\nexport interface RadialGradientElementProperties {\n\tid: string\n\twidthFactor: number\n\theightFactor: number\n\tcenterAnchorX: number\n\tcenterAnchorY: number\n\tstops: ColorStop[]\n}\n\nexport function elementPropertiesForRadialGradient(\n\tgradient: RadialGradient,\n\tid: string,\n): RadialGradientElementProperties {\n\treturn {\n\t\tid: `id${id}g${RadialGradient.hash(gradient)}`,\n\t\twidthFactor: gradient.widthFactor,\n\t\theightFactor: gradient.heightFactor,\n\t\tcenterAnchorX: gradient.centerAnchorX,\n\t\tcenterAnchorY: gradient.centerAnchorY,\n\t\tstops: gradientColorStops(gradient).map(stop => ({\n\t\t\tcolor: stop.value,\n\t\t\talpha: ConvertColor.getAlpha(stop.value) * gradient.alpha,\n\t\t\tposition: stop.position,\n\t\t})),\n\t}\n}\n", "import { isNumber, isString } from \"../../utils/utils.ts\"\n\n/** @public */\nexport type RelativeNumber = `${number}%`\n\n/** @public */\nexport function isRelativeNumber(value: unknown): value is RelativeNumber {\n\tif (!isString(value)) return false\n\tconst lastChar = value.charAt(value.length - 1)\n\tif (lastChar !== \"%\") return false\n\tconst withoutLastChar = value.slice(0, -1)\n\tconst float = parseFloat(withoutLastChar)\n\treturn isNumber(float)\n}\n\n/** @public */\nexport function getRelativeNumberValue(value: RelativeNumber): number {\n\tconst withoutLastChar = value.slice(0, -1)\n\tconst float = parseFloat(withoutLastChar)\n\treturn isNumber(float) ? float : 50\n}\n", "import { Animatable } from \"../../animation/Animatable/Animatable.ts\"\nimport type { ImagePatternElementProperties } from \"../presentation/ImagePatternElement.tsx\"\nimport type { Background } from \"../traits/Background.ts\"\nimport { BackgroundImage } from \"../types/BackgroundImage.ts\"\nimport { getRelativeNumberValue, isRelativeNumber } from \"../types/RelativeNumber.ts\"\nimport type { Size } from \"../types/Size.ts\"\nimport type { TransformValues } from \"../types/TransformValues.ts\"\n\nfunction getPositionXFraction(positionX: BackgroundImage[\"positionX\"]) {\n\tif (isRelativeNumber(positionX)) return getRelativeNumberValue(positionX) / 100\n\tif (positionX === \"left\") return 0\n\tif (positionX === \"right\") return 1\n\treturn 0.5\n}\n\nfunction getPositionYFraction(positionY: BackgroundImage[\"positionY\"]) {\n\tif (isRelativeNumber(positionY)) return getRelativeNumberValue(positionY) / 100\n\tif (positionY === \"top\") return 0\n\tif (positionY === \"bottom\") return 1\n\treturn 0.5\n}\n\n/** @internal */\nexport function imagePatternPropsForFill(\n\tfill: Background | Animatable<Background>,\n\tframe: Size & Partial<TransformValues>,\n\tid: string,\n\tincludeTransform?: boolean,\n): ImagePatternElementProperties | undefined {\n\tfill = Animatable.get(fill, \"#09F\")\n\n\tif (!BackgroundImage.isImageObject(fill)) return undefined\n\tif (!fill.pixelWidth || !fill.pixelHeight) return undefined\n\n\tconst imageWidth = fill.pixelWidth\n\tconst imageHeight = fill.pixelHeight\n\n\tlet transform: string | undefined\n\tconst { fit } = fill\n\tlet width = 1,\n\t\theight = 1\n\tlet offsetX = 0\n\tlet offsetY = 0\n\n\tif (fit === \"fill\" || fit === \"fit\" || fit === \"tile\" || !fit) {\n\t\tlet scaleX = 1\n\t\tlet scaleY = 1\n\n\t\tconst imageRatio = imageWidth / imageHeight\n\t\tconst realWidth = frame.height * imageRatio\n\t\tconst realHeight = frame.width / imageRatio\n\t\tconst validScaleX = realWidth / frame.width\n\t\tconst validScaleY = realHeight / frame.height\n\n\t\tif (fit === \"tile\") {\n\t\t\tfill.backgroundSize ??= 1\n\n\t\t\t// We divide the pixel width/height by 2 because we assume that most designers\n\t\t\t// will be working with 2x (retina) assets.\n\t\t\twidth = Math.round(fill.backgroundSize * (imageWidth / 2))\n\t\t\theight = Math.round(fill.backgroundSize * (imageHeight / 2))\n\n\t\t\tconst layerPositionX = frame.x ?? 0\n\t\t\tconst layerPositionY = frame.y ?? 0\n\n\t\t\tlet extraOffsetX = 0\n\t\t\tlet extraOffsetY = 0\n\t\t\tif (includeTransform) {\n\t\t\t\textraOffsetX = layerPositionX\n\t\t\t\textraOffsetY = layerPositionY\n\t\t\t}\n\n\t\t\t// We calculate the offset based on the height and width of the tile (which is a function of the image size and the backgroundSize)\n\t\t\toffsetX = (frame.width - width) * getPositionXFraction(fill.positionX) + extraOffsetX\n\t\t\toffsetY = (frame.height - height) * getPositionYFraction(fill.positionY) + extraOffsetY\n\n\t\t\ttransform = `translate(${offsetX + layerPositionX}, ${offsetY + layerPositionY})`\n\t\t} else {\n\t\t\tif (fit === \"fill\" || !fit ? validScaleY > validScaleX : validScaleY < validScaleX) {\n\t\t\t\tscaleY = validScaleY\n\t\t\t\toffsetY = (1 - validScaleY) * getPositionYFraction(fill.positionY)\n\t\t\t} else {\n\t\t\t\tscaleX = validScaleX\n\t\t\t\toffsetX = (1 - validScaleX) * getPositionXFraction(fill.positionX)\n\t\t\t}\n\n\t\t\ttransform = `translate(${offsetX}, ${offsetY}) scale(${scaleX}, ${scaleY})`\n\t\t}\n\t}\n\n\tconst imageId = `id${id}g${\"-fillImage\"}`\n\treturn { id: imageId, path: fill.src ?? \"\", transform, width, height, offsetX, offsetY }\n}\n", "import { runtime } from \"../../utils/runtimeInjection.ts\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\n\n// #region copied from src/app/assets/src/assetReference.ts to remove dependency on assets.\n// This includes the comma that separates the media type from the data.\nconst mediaType = \"framer/asset-reference,\"\n\nexport function isAssetReference(value: string): boolean {\n\treturn value.startsWith(`data:${mediaType}`)\n}\n// #endregion\n\n/**\n * @internal\n */\nexport function imageUrlForAsset(asset: string, pixelSize?: number) {\n\tif (/^\\w+:/u.test(asset) && !isAssetReference(asset)) return asset\n\n\tif (typeof pixelSize !== \"number\") pixelSize = undefined\n\telse if (pixelSize <= 512) pixelSize = 512\n\telse if (pixelSize <= 1024) pixelSize = 1024\n\telse if (pixelSize <= 2048) pixelSize = 2048\n\telse pixelSize = 4096\n\n\tconst isExport = RenderTarget.current() === RenderTarget.export\n\treturn runtime.assetResolver(asset, { pixelSize, isExport }) ?? \"\"\n}\n", "import { imageUrlForAsset } from \"../utils/imageUrlForAsset.ts\"\n\nexport interface ImagePatternElementProperties {\n\tid: string\n\tpath: string\n\ttransform?: string\n\trepeat?: boolean\n\t// Optional width and height for setting the tile size when repeat is true.\n\twidth?: number\n\theight?: number\n\n\t// Optional offset for the tile when repeat is true.\n\t// The offset is the same value as is interpolated into\n\t// transform: translate(x, y) in imagePatternPropsForFill, but\n\t// when tiling a svg pattern we need to use x and y attributes.\n\toffsetX?: number\n\toffsetY?: number\n}\n\nexport const ImagePatternElement = ({\n\tid,\n\tpath,\n\ttransform,\n\trepeat,\n\twidth,\n\theight,\n\toffsetX,\n\toffsetY,\n}: ImagePatternElementProperties) => {\n\tconst href = imageUrlForAsset(path)\n\n\treturn (\n\t\t<pattern\n\t\t\tid={id}\n\t\t\twidth={repeat ? width : \"100%\"}\n\t\t\theight={repeat ? height : \"100%\"}\n\t\t\tpatternContentUnits={repeat ? undefined : \"objectBoundingBox\"}\n\t\t\tpatternUnits={repeat ? \"userSpaceOnUse\" : undefined}\n\t\t\t// We only want to set the x and y values if we are tiling.\n\t\t\tx={repeat ? offsetX : undefined}\n\t\t\ty={repeat ? offsetY : undefined}\n\t\t>\n\t\t\t<image\n\t\t\t\tkey={href}\n\t\t\t\twidth={repeat ? width : 1}\n\t\t\t\theight={repeat ? height : 1}\n\t\t\t\thref={href}\n\t\t\t\tpreserveAspectRatio=\"none\"\n\t\t\t\ttransform={repeat ? undefined : transform}\n\t\t\t\tx={repeat ? 0 : undefined}\n\t\t\t\ty={repeat ? 0 : undefined}\n\t\t\t/>\n\t\t</pattern>\n\t)\n}\n", "import { isBrowser } from \"@framerjs/shared/src/environment.ts\"\nimport { useEffect } from \"react\"\nimport type { Size } from \"../../render/types/Size.ts\"\nimport { domParser } from \"../../render/utils/dom.ts\"\nimport { hash } from \"../../utils/string.ts\"\n\nconst useDOM = /* @__PURE__ */ isBrowser()\n\nclass SharedSVGEntry {\n\tconstructor(\n\t\tpublic id: string,\n\t\tpublic svg: string,\n\t\tpublic innerHTML: string,\n\t\tpublic viewBox: string | undefined,\n\t\tpublic count = 0,\n\t) {}\n}\n\n// due to browser bugs, we cannot use display:none or content-visibility:hidden for the templates div,\n// see https://issues.chromium.org/issues/40209403, https://bugs.webkit.org/show_bug.cgi?id=118376, https://bugzilla.mozilla.org/show_bug.cgi?id=376027\n// to work around that, we use:\n// - position: absolute + left/bottom -> makes sure we remove it from the document flow.\n// - height, width, overflow: hidden -> makes sure nothing is visible visually from the templates div.\n// - z-index: 0 -> makes sure browsers don't guess it could overlap other elements (= don't promote it to a layer).\n// - contain: strict -> makes sure it's cheaper to paint the node.\nconst visuallyHiddenStyle =\n\t\"position: absolute; overflow: hidden; bottom: 0; left: 0; width: 0; height: 0; z-index: 0; contain: strict\"\n\n/** Complex SVGs are placed once in a container and used as a template for all instances.\n * Notice the manager uses the svg string itself as the key to manage global instances with. */\nclass SharedSVGManager {\n\tprivate entries = new Map<string, SharedSVGEntry>()\n\tprivate vectorSetItems = new Map<string, { svg: string; count: number }>()\n\n\tdebugGetEntries(): Map<string, SharedSVGEntry> {\n\t\treturn this.entries\n\t}\n\n\t/** Request to render a svg, this will ensure there is a global instance and will return a\n\t * template referencing the image. Must be balanced with `unsubscribe()` calls using the same\n\t * svg. If called multiple times while the shared SVG exists, the generateUniqueIds and\n\t * contentId parameters are ignored. */\n\tsubscribe(svg: string, generateUniqueIds: boolean, contentId: string | null, overflowVisible?: boolean): string {\n\t\tif (!svg || svg === \"\") return \"\"\n\n\t\tlet entry = this.entries.get(svg)\n\t\tif (!entry) {\n\t\t\t// Create a new entry, computing a content id if needed, rewriting ids to be globally\n\t\t\t// unique if needed.\n\t\t\tif (!contentId) {\n\t\t\t\tcontentId = `svg${String(hash(svg))}_${String(svg.length)}`\n\t\t\t}\n\n\t\t\tlet uniqueSVG = svg\n\t\t\tlet svgSize: Size | undefined\n\n\t\t\tconst svgDom = parseSVG(svg)\n\t\t\tif (svgDom) {\n\t\t\t\tif (generateUniqueIds) {\n\t\t\t\t\tprefixIdsInSVG(svgDom, contentId)\n\t\t\t\t}\n\n\t\t\t\tsvgDom.id = contentId\n\t\t\t\tsvgSize = getSVGSize(svgDom)\n\t\t\t\t// we embed the svg in the document, so we don't need the xml namespace\n\t\t\t\tsvgDom.removeAttribute(\"xmlns\")\n\t\t\t\tsvgDom.removeAttribute(\"xlink\")\n\t\t\t\tsvgDom.removeAttribute(\"xmlns:xlink\")\n\n\t\t\t\tuniqueSVG = svgDom.outerHTML\n\t\t\t}\n\n\t\t\tentry = this.createDOMElementFor(uniqueSVG, contentId, svgSize, overflowVisible)\n\t\t\tthis.entries.set(svg, entry)\n\t\t}\n\n\t\tentry.count += 1\n\t\treturn entry.innerHTML\n\t}\n\n\t/** Returns the viewBox for the svg, or undefined if there is no viewBox. */\n\tgetViewBox(svg: string): string | undefined {\n\t\tif (!svg || svg === \"\") return\n\t\tconst entry = this.entries.get(svg)\n\t\treturn entry?.viewBox\n\t}\n\n\t/** When no longer rendering an svg it must be unsubscribed from so resources can be cleaned up.\n\t * Pass in the same svg as used with `subscribe()`. */\n\tunsubscribe(svg: string) {\n\t\tif (!svg || svg === \"\") return\n\n\t\tconst entry = this.entries.get(svg)\n\t\tif (!entry) return\n\n\t\tentry.count -= 1\n\t\tif (entry.count > 0) return\n\n\t\t// When the last use of the svg goes away, after a delay, we see if it should be removed.\n\t\tsetTimeout(() => this.maybeRemoveEntry(svg), 5000)\n\t}\n\n\tprivate maybeRemoveEntry(svg: string) {\n\t\tconst entry = this.entries.get(svg)\n\t\tif (!entry) return\n\t\tif (entry.count > 0) return\n\n\t\tthis.entries.delete(svg)\n\t\tthis.removeDOMElement(entry)\n\t}\n\n\tprivate removeDOMElement(entry: SharedSVGEntry): void {\n\t\tif (useDOM) {\n\t\t\tconst container = document?.getElementById(entry.id)\n\t\t\tcontainer?.remove()\n\t\t}\n\t}\n\n\tprivate getOrCreateTemplateContainer(): HTMLDivElement {\n\t\tconst container = document.getElementById(\"svg-templates\") as HTMLDivElement\n\t\tif (container) return container\n\n\t\tconst newContainer = document.createElement(\"div\")\n\t\tnewContainer.id = \"svg-templates\"\n\t\tnewContainer.ariaHidden = \"true\"\n\t\tnewContainer.style.cssText = visuallyHiddenStyle\n\t\tdocument.body.appendChild(newContainer)\n\t\treturn newContainer\n\t}\n\n\tprivate maybeAppendTemplate(id: string, svg: string) {\n\t\tif (document.getElementById(id)) return\n\t\tconst container = document.createElement(\"div\")\n\t\tcontainer.innerHTML = svg\n\t\tconst svgElement = container.firstElementChild\n\t\tif (!svgElement) return\n\n\t\tsvgElement.id = id\n\t\tthis.getOrCreateTemplateContainer().appendChild(svgElement)\n\t}\n\n\tprivate createDOMElementFor(\n\t\tsvg: string,\n\t\tid: string,\n\t\tsize: Size | undefined,\n\t\toverflowVisible?: boolean,\n\t): SharedSVGEntry {\n\t\tif (useDOM) this.maybeAppendTemplate(id, svg)\n\n\t\t// An svg referencing a shared template by id. For firefox, if the SVG has a width/height, we use that as our viewBox.\n\t\tconst box = size ? `0 0 ${size.width} ${size.height}` : undefined\n\t\tconst viewBox = box ? ` viewBox=\"${box}\"` : \"\"\n\t\tconst innerHTML = `<svg style=\"width:100%;height:100%;${overflowVisible ? \"overflow: visible;\" : \"\"}\"${viewBox}><use href=\"#${id}\"/></svg>`\n\n\t\treturn new SharedSVGEntry(id, svg, innerHTML, box)\n\t}\n\n\t/**\n\t * Vectors are serialized in such a way that they don't need to be parsed again, instead they\n\t * just need to provide their template. The hash is already known.\n\t *\n\t * VECTOR @TODO - Unsubscribe from vector set items.\n\t */\n\ttemplate(revision: string, svg: string): string {\n\t\tconst entry = this.vectorSetItems.get(revision)\n\t\tif (entry) return `#${revision}`\n\n\t\tthis.vectorSetItems.set(revision, { svg, count: 0 })\n\n\t\tif (!useDOM) return `#${revision}`\n\n\t\tthis.maybeAppendTemplate(revision, svg)\n\n\t\treturn `#${revision}`\n\t}\n\n\tsubscribeToTemplate(revision: string) {\n\t\tconst entry = this.vectorSetItems.get(revision)\n\t\tif (!entry) return\n\n\t\tentry.count++\n\n\t\treturn () => {\n\t\t\tconst latest = this.vectorSetItems.get(revision)\n\t\t\tif (!latest) return\n\n\t\t\tlatest.count--\n\n\t\t\tif (latest.count > 0) return\n\n\t\t\t// When the last use of the svg goes away, after a delay, we see if it should be removed.\n\t\t\tsetTimeout(() => {\n\t\t\t\tif (this.vectorSetItems.get(revision)?.count) return\n\t\t\t\tthis.vectorSetItems.delete(revision)\n\t\t\t\tif (useDOM) document?.getElementById(revision)?.remove()\n\t\t\t}, 5000)\n\t\t}\n\t}\n\n\tclear(): void {\n\t\tthis.entries.clear()\n\t}\n\n\t/** Returns a string containing a div#svg-templates and all the current svg templates. Can be\n\t * used after running `ReactDOMServer.renderToString()` */\n\tgenerateTemplates(): string {\n\t\tconst output: string[] = []\n\n\t\t// we cannot use e.g. `<svg><defs><symbol ...>` here, because <svg> allows to nest <svg>s, but you cannot nest <defs> or <symbol>s.\n\t\toutput.push(`<div id=\"svg-templates\" style=\"${visuallyHiddenStyle}\" aria-hidden=\"true\">`)\n\t\tthis.entries.forEach(value => output.push(value.svg))\n\t\tthis.vectorSetItems.forEach(value => output.push(value.svg))\n\t\toutput.push(\"</div>\")\n\t\treturn output.join(\"\\n\")\n\t}\n}\n\n/**\n * @internal\n */\nexport function useSVGTemplate(revision: string, svg: string): string {\n\t// Sub/unsub in an effect to ensure that in strict mode, we always unsubscribe for every subscription.\n\tuseEffect(() => sharedSVGManager.subscribeToTemplate(revision), [revision])\n\treturn sharedSVGManager.template(revision, svg)\n}\n\n/**\n * @internal\n */\nexport const sharedSVGManager = /* @__PURE__ */ new SharedSVGManager()\n\n// SVG Helper methods\nexport function parseSVG(svg: string): SVGSVGElement | undefined {\n\ttry {\n\t\t// We parse SVGs as text/html. That is more forgiving and the Deno DOMParser so far doesn't\n\t\t// support image/xml-svg. Output will differ slightly like elements don't autoclose: eg\n\t\t// instead of `<path .../>` it will become `<path ...></path>`.\n\t\tconst doc = domParser(svg)\n\t\tconst node = doc.getElementsByTagName(\"svg\")[0]\n\t\tif (!node) throw Error(\"no svg element found\")\n\t\treturn node\n\t} catch {\n\t\t// ignore errors\n\t\treturn\n\t}\n}\n\n/* Takes an SVG string and prefix all the ids and their occurrence with the given string */\nexport function prefixIdsInSVG(svg: SVGSVGElement, prefix: string): void {\n\tconst sanitizedPrefix = sanitizeString(prefix)\n\trecursivelyPrefixId(svg, sanitizedPrefix)\n}\n\n// Valid SVG IDs only include designated characters (letters, digits, and a few punctuation marks),\n// and do not start with a digit, a full stop (.) character, or a hyphen-minus (-) character.\n// https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/id\nfunction sanitizeString(str: string): string {\n\treturn str.replace(/[^\\w\\-:.]|^[^a-z]+/gi, \"\") // source: https://stackoverflow.com/a/9635731/9300219\n}\n\nfunction recursivelyPrefixId(el: Element, prefix: string) {\n\t// element itself\n\tprefixId(el, prefix)\n\n\t// handle children\n\tconst childNodes = Array.from(el.children)\n\tchildNodes.forEach(node => {\n\t\trecursivelyPrefixId(node, prefix)\n\t})\n}\n\nfunction prefixId(el: Element, prefix: string) {\n\tconst attributes = el.getAttributeNames()\n\tattributes.forEach(attr => {\n\t\tconst value = el.getAttribute(attr)\n\t\tif (!value) return\n\t\t// prefix the id\n\t\tif (attr === \"id\") {\n\t\t\tel.setAttribute(attr, `${prefix}_${value}`)\n\t\t}\n\n\t\t// prefix occurrence in href (SVG2) or xlink:href\n\t\tif (attr === \"href\" || attr === \"xlink:href\") {\n\t\t\tconst [base, fragmentIdentifier] = value.split(\"#\")\n\t\t\t// The value might have a base URL in two cases:\n\t\t\t// 1. It's a hyperlink\n\t\t\t// 2. It's referencing the fragment from another document\n\t\t\t// In both cases we don't want to touch the value\n\t\t\tif (base) return\n\n\t\t\tel.setAttribute(attr, `#${prefix}_${fragmentIdentifier}`)\n\t\t\treturn\n\t\t}\n\n\t\t// prefix occurrence in url()\n\t\tconst URL_REF = \"url(#\"\n\t\tif (value.includes(URL_REF)) {\n\t\t\tconst prefixedValue = value.replace(URL_REF, `${URL_REF}${prefix}_`)\n\t\t\tel.setAttribute(attr, prefixedValue)\n\t\t}\n\t})\n}\n\n// Absolute units converted to px according to the CSS3 specification:\n// https://www.w3.org/TR/css-values-3/#absolute-lengths\n// (1 inch is 2.54 centimeters is 96 pixels)\nconst unitsToPixels: { [unit: string]: number } = /* @__PURE__ */ (() => ({\n\tcm: 96 / 2.54,\n\tmm: 96 / 2.54 / 10,\n\tQ: 96 / 2.54 / 40,\n\tin: 96,\n\tpc: 96 / 6,\n\tpt: 96 / 72,\n\tpx: 1,\n\n\t// A few assumptions about relative units.\n\tem: 16,\n\tex: 8,\n\tch: 8,\n\trem: 16,\n}))()\n\n/** Parses values like 10cm in `<svg ... width=\"10cm\" ...>` turning them into pixel sizes. Ignoring\n * percentage values or unparsable values. Should at least parse anything browsers parse. */\nfunction parseLength(value: string | null | undefined): number | undefined {\n\tif (!value) return\n\tconst m = /(-?[\\d.]+)([a-z%]*)/u.exec(value)\n\tif (m?.[1] === undefined || m?.[2] === undefined) return\n\tif (m[2]?.startsWith(\"%\")) return\n\treturn Math.round(parseFloat(m[1]) * (unitsToPixels[m[2]] || 1))\n}\n\n/** Tries to return something sensible from the <svg width=\"X\" height=\"X\"> attributes. We use that\n * to give the outer svg a matching viewbox.\n *\n * Note, this is not a perfect solution. Ideally we know our SVGs better and we only use viewBoxes,\n * removed any percentage based sizes, etc. But at least we should be consistent between how canvas,\n * preview, and publish render.\n * */\nexport function getSVGSize(svg: SVGSVGElement): { width: number; height: number } | undefined {\n\tconst width = parseLength(svg.getAttribute(\"width\"))\n\tconst height = parseLength(svg.getAttribute(\"height\"))\n\tif (typeof width !== \"number\" || typeof height !== \"number\") return\n\tif (width <= 0 || height <= 0) return\n\treturn { width, height }\n}\n", "import { isCommandKeyPressed } from \"@framerjs/shared/src/environment.ts\"\nimport type { MotionProps, MotionStyle, Transition, Variants } from \"framer-motion\"\nimport { motion } from \"framer-motion\"\nimport React, { useEffect, useRef } from \"react\"\nimport { Animatable } from \"../../animation/Animatable/Animatable.ts\"\nimport { useLinkMatchesRoute } from \"../../modules/Link/linkMatchesRoute.tsx\"\nimport { useImplicitPathVariables } from \"../../modules/Link/pathVariables.tsx\"\nimport { cx } from \"../../modules/cx.ts\"\nimport { navigateFromAttributes } from \"../../modules/framerPageLink.ts\"\nimport { replaceFramerPageLinks } from \"../../modules/replaceFramerPageLinks.ts\"\nimport { useIsOnFramerCanvas } from \"../../modules/useIsOnFramerCanvas.ts\"\nimport { useRouter } from \"../../router/RouterContext.tsx\"\nimport { useCurrentRoute } from \"../../router/useCurrentRoute.tsx\"\nimport { useRoutePreloader } from \"../../router/useRoutePreloader.ts\"\nimport { asRecord } from \"../../utils/asRecord.ts\"\nimport { isString } from \"../../utils/utils.ts\"\nimport { fontStore } from \"../fonts/fontStore.ts\"\nimport type { FontLoadStatus } from \"../fonts/useFontLoadStatus.tsx\"\nimport { useFontLoadStatus } from \"../fonts/useFontLoadStatus.tsx\"\nimport { collectTextShadowsForProps } from \"../style/shadow.tsx\"\nimport type { FilterProperties } from \"../traits/Filters.ts\"\nimport { isAutoDimensionType } from \"../types/Constraints.ts\"\nimport type {\n\tNewConstraintProperties,\n\tParentSize,\n\tPositionAbsoluteProperties,\n\tPositionFixedProperties,\n} from \"../types/NewConstraints.tsx\"\nimport { ParentSizeState, calculateRect, useParentSize } from \"../types/NewConstraints.tsx\"\nimport type { Rect } from \"../types/Rect.ts\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport type { Shadow } from \"../types/Shadow.ts\"\nimport type { Size } from \"../types/Size.ts\"\nimport { collectFiltersFromProps } from \"../utils/filtersForNode.ts\"\nimport { findAnchorElement } from \"../utils/findAnchorElement.ts\"\nimport { withLibraryCSS } from \"../utils/injectComponentCSSRules.ts\"\nimport { isFiniteNumber } from \"../utils/isFiniteNumber.ts\"\nimport { isShallowEqualArray } from \"../utils/isShallowEqualArray.ts\"\nimport { layoutHintDataPropsForCenter } from \"../utils/layoutHintDataPropsForCenter.ts\"\nimport { countNodeRender } from \"../utils/performanceDebugging.ts\"\nimport { transformTemplate } from \"../utils/transformTemplate.ts\"\nimport { useLayoutId } from \"../utils/useLayoutId.ts\"\nimport { measureClosestComponentContainer, useMeasureLayout } from \"../utils/useMeasureLayout.ts\"\nimport { ComponentContainerContext } from \"./ComponentContainerContext.tsx\"\nimport type { LayerProps } from \"./Layer.tsx\"\nimport { Layer } from \"./Layer.tsx\"\n\n/**\n * @internal\n */\nexport type TextAlignment = \"left\" | \"right\" | \"center\" | undefined\n\n/**\n * @internal\n */\nexport type TextVerticalAlignment = \"top\" | \"center\" | \"bottom\"\n\n/**\n * @internal\n */\nexport interface TextProps\n\textends NewConstraintProperties, PositionFixedProperties, PositionAbsoluteProperties, Partial<FilterProperties> {\n\trotation: Animatable<number> | number\n\tvisible: boolean\n\t/** Name of the node. Only provided in the scope of canvas pages. */\n\tname?: string\n\t/** Name of the node. Provided in every scope, assuming the node has a name. */\n\t[\"data-framer-name\"]?: string\n\talignment: TextAlignment\n\tverticalAlignment: TextVerticalAlignment\n\t// The single autoSize property will only be passed in when the\n\t// supportsDomLayout platform check is NOT on, and will ultimately be\n\t// removed. The removal might not be possible because we've now got compiled\n\t// smart components that depend on this property.\n\t/**\n     * @deprecated The single autoSize property will only be passed in when the\n       supportsDomLayout platform check is NOT on, and will ultimately be\n       removed\n     */\n\tautoSize?: boolean\n\topacity?: number\n\tshadows: readonly Shadow[]\n\tstyle?: MotionStyle\n\ttext?: string\n\tfont?: string\n\tparentSize?: ParentSize\n\tviewportSize?: Size | null\n}\n\n/**\n * @internal\n */\nexport interface TextProperties extends TextProps, LayerProps, Pick<MotionProps, \"transformTemplate\"> {\n\trawHTML?: string\n\tisEditable?: boolean\n\tfonts?: string[]\n\tfontLoadStatus: FontLoadStatus\n\tlayoutId?: string | undefined\n\tclassName?: string\n\t/** @internal */\n\twithExternalLayout?: boolean\n\t/** @internal for testing */\n\tenvironment?(): RenderTarget\n\t/** @internal */\n\tinnerRef?: React.MutableRefObject<HTMLDivElement | null>\n\ttransition?: Transition\n\tvariants?: Variants\n\t/** @internal */\n\t__fromCanvasComponent?: boolean\n\t/** @internal */\n\t_initialStyle?: Partial<MotionStyle>\n\t/** @internal */\n\tpreload?: string[]\n\t/** @internal */\n\t__link?: string\n\t/** @internal */\n\ttabIndex?: number\n}\n\n/**\n * @internal\n * @deprecated this is the legacy text component.\n */\nconst TextInner = /* @__PURE__ */ React.forwardRef<HTMLDivElement, Partial<TextProperties>>(function Text(\n\tprops: Partial<TextProperties>,\n\tforwardedRef: React.RefObject<HTMLDivElement> | null,\n) {\n\tconst parentSize = useParentSize()\n\tconst layoutId = useLayoutId(props)\n\tconst fallbackLayoutRef = useRef<HTMLDivElement>(null)\n\tconst layoutRef = forwardedRef ?? fallbackLayoutRef\n\n\tconst { navigate, getRoute } = useRouter()\n\tconst currentRoute = useCurrentRoute()\n\n\tuseRoutePreloader(props.preload ?? [])\n\n\tconst onCanvas = useIsOnFramerCanvas()\n\n\tconst matchesCurrentRoute = useLinkMatchesRoute(props.__link)\n\n\tconst fontLoadStatus: FontLoadStatus = useFontLoadStatus(props.fonts)\n\n\tuseMeasureLayout(props, layoutRef)\n\n\tconst { fonts, __fromCanvasComponent } = props\n\n\t// The fonts array is typically regenerated for every change to a text node,\n\t// so we need to keep track of previous values to avoid calls to the font\n\t// store when the contents of the array are the same between renders\n\tconst prevFontsRef = useRef<string[] | undefined>([])\n\tconst fontsDidChange = !isShallowEqualArray(prevFontsRef.current ?? [], fonts ?? [])\n\tprevFontsRef.current = fonts\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: legacy text component\n\tuseEffect(() => {\n\t\tif (!fontsDidChange || !fonts) return\n\n\t\tvoid fontStore.loadFonts(fonts).then(({ newlyLoadedFontCount }) => {\n\t\t\t// After fonts load, layout is likely to shift in auto-sized\n\t\t\t// elements. Since measurements would have typically already been\n\t\t\t// taken at this point, this can lead to selection outlines\n\t\t\t// appearing out of sync with the rendered component. On the canvas\n\t\t\t// we hook into the font loading process and manually trigger a\n\t\t\t// re-render for the node when it completes, which in turn makes\n\t\t\t// sure that all layout measurements take the latest layout shifts\n\t\t\t// into account. In compiled smart components, however, we can't use\n\t\t\t// the same solution. We'll instead check if new fonts have been\n\t\t\t// loaded, and attempt to add a measure request for the closest\n\t\t\t// component container, which in the case of component instances is\n\t\t\t// the only node whose measurements need updating (we don't track\n\t\t\t// measurements for things rendered inside the component itself,\n\t\t\t// which could also be affected by layout shifts).\n\n\t\t\t// If we're not running on the canvas and from within a smart\n\t\t\t// component, there's no need to measure.\n\t\t\tif (!__fromCanvasComponent || !layoutRef.current || RenderTarget.current() !== RenderTarget.canvas) return\n\n\t\t\t// We only need to measure if at least one new font has been loaded.\n\t\t\t// Otherwise we assume there was no layout shift.\n\t\t\tif (newlyLoadedFontCount === 0) return\n\n\t\t\tmeasureClosestComponentContainer(layoutRef.current)\n\t\t})\n\t}, [fonts])\n\n\tconst implicitPathVariables = useImplicitPathVariables()\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: legacy text component\n\tconst interceptPageLinks = React.useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tconst anchorElement = findAnchorElement(event.target, layoutRef.current)\n\n\t\t\t// Don't prevent cmd + click, allowing users to open in new tab.\n\t\t\tif (isCommandKeyPressed(event) || !navigate || !anchorElement) return\n\n\t\t\t// Page links written to the draft text in the\n\t\t\t// data:framer/page-link, format should have been parsed, and\n\t\t\t// replaced with paths. If that has happened, we can access the\n\t\t\t// route id and transition properties as data attributes, finally\n\t\t\t// performing a navigation.\n\t\t\tconst didNavigate = navigateFromAttributes(navigate, anchorElement, implicitPathVariables)\n\t\t\tif (didNavigate) {\n\t\t\t\tevent.preventDefault()\n\t\t\t}\n\t\t},\n\t\t[navigate, implicitPathVariables],\n\t)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: @TODO: This should be a ref callback\n\tuseEffect(() => {\n\t\tconst ref = layoutRef.current\n\t\tif (!ref) return\n\t\tref.addEventListener(\"click\", interceptPageLinks)\n\t\treturn () => ref.removeEventListener(\"click\", interceptPageLinks)\n\t}, [interceptPageLinks])\n\n\t// Parse the raw draft html to replace framer page links in the\n\t// data:framer/page-link, format with the paths their target corresponds to.\n\t// This needs to happen whenever the rawHTML string changes, since smart\n\t// components can update the draft text in variants by updating this prop\n\t// value.\n\t//\n\t// In future, for generated code, it might be better to try to convert the\n\t// draft html to a react tree during generation. We could do that in code\n\t// generation since we are already converting strings to jsx, and that would\n\t// allow us to do this replacement without a regex.\n\tconst rawHTML = React.useMemo(() => {\n\t\tif (!props.rawHTML || onCanvas || !getRoute || !currentRoute) return props.rawHTML\n\t\treturn replaceFramerPageLinks(props.rawHTML, getRoute, currentRoute, implicitPathVariables)\n\t}, [props.rawHTML, getRoute, currentRoute, implicitPathVariables])\n\n\treturn (\n\t\t<TextComponent\n\t\t\t{...props}\n\t\t\tinnerRef={layoutRef}\n\t\t\tlayoutId={layoutId}\n\t\t\tparentSize={parentSize}\n\t\t\tfontLoadStatus={fontLoadStatus}\n\t\t\trawHTML={rawHTML}\n\t\t\tmatchesCurrentRoute={matchesCurrentRoute}\n\t\t/>\n\t)\n})\n\n// biome-ignore lint/complexity/noBannedTypes: legacy text component\ndeclare class TextComponentType extends Layer<TextProperties & { matchesCurrentRoute: boolean }, {}> {\n\tstatic supportsConstraints: boolean\n\tstatic defaultTextProps: TextProps\n\tstatic readonly defaultProps: TextProperties\n\teditorText: string | undefined\n\tget frame(): Rect | null\n\tgetOverrideText(): void\n\t// biome-ignore lint/suspicious/noExplicitAny: legacy text component\n\tget transformTemplate(): ((_: any, generated: string) => string) | undefined\n}\n\nexport const TextComponent: typeof TextComponentType = /* @__PURE__ */ (() => {\n\t// biome-ignore lint/complexity/noBannedTypes: legacy text component\n\treturn class TextComponentInner extends Layer<TextProperties & { matchesCurrentRoute: boolean }, {}> {\n\t\tstatic supportsConstraints = true\n\t\tstatic defaultTextProps: TextProps = {\n\t\t\topacity: undefined,\n\t\t\tleft: undefined,\n\t\t\tright: undefined,\n\t\t\ttop: undefined,\n\t\t\tbottom: undefined,\n\t\t\t_constraints: {\n\t\t\t\tenabled: true,\n\t\t\t\taspectRatio: null,\n\t\t\t},\n\t\t\trotation: 0,\n\t\t\tvisible: true,\n\t\t\talignment: undefined,\n\t\t\tverticalAlignment: \"top\",\n\t\t\tshadows: [],\n\t\t\tfont: \"16px Arial\",\n\t\t}\n\n\t\tstatic override readonly defaultProps: TextProperties = {\n\t\t\t...Layer.defaultProps,\n\t\t\t...TextComponentInner.defaultTextProps,\n\t\t\tisEditable: false,\n\t\t\tenvironment: RenderTarget.current,\n\t\t\twithExternalLayout: false,\n\t\t\tfontLoadStatus: \"loading\",\n\t\t}\n\n\t\teditorText: string | undefined\n\n\t\tget frame(): Rect | null {\n\t\t\treturn calculateRect(this.props, this.props.parentSize || ParentSizeState.Unknown, false)\n\t\t}\n\n\t\tgetOverrideText() {\n\t\t\tconst { _forwardedOverrideId, _forwardedOverrides, id } = this.props\n\t\t\tconst forwardedOverrideId = _forwardedOverrideId ?? id\n\t\t\tif (forwardedOverrideId && _forwardedOverrides) {\n\t\t\t\tconst text = _forwardedOverrides[forwardedOverrideId]\n\t\t\t\tif (isString(text)) {\n\t\t\t\t\treturn text\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\toverride render() {\n\t\t\t// Refactor to use React.useContext()\n\t\t\treturn <ComponentContainerContext.Consumer>{this.renderMain}</ComponentContainerContext.Consumer>\n\t\t}\n\n\t\tprivate collectLayout(style: React.CSSProperties, inCodeComponent: boolean) {\n\t\t\tif (this.props.withExternalLayout) return\n\n\t\t\tconst frame = this.frame\n\t\t\tconst {\n\t\t\t\trotation,\n\t\t\t\tautoSize,\n\t\t\t\tpositionSticky,\n\t\t\t\tpositionStickyTop,\n\t\t\t\tpositionStickyRight,\n\t\t\t\tpositionStickyBottom,\n\t\t\t\tpositionStickyLeft,\n\t\t\t\twidth: externalWidth,\n\t\t\t\theight: externalHeight,\n\t\t\t\t_usesDOMRect,\n\t\t\t\tpositionFixed,\n\t\t\t\tpositionAbsolute,\n\t\t\t} = this.props\n\t\t\tconst rotate = Animatable.getNumber(rotation)\n\n\t\t\tconst isDOMLayoutAutoSized = _usesDOMRect && (externalWidth === \"auto\" || externalHeight === \"auto\")\n\t\t\tif (frame && !isDOMLayoutAutoSized && RenderTarget.hasRestrictions()) {\n\t\t\t\tObject.assign(style, {\n\t\t\t\t\ttransform: `translate(${frame.x}px, ${frame.y}px) rotate(${rotate.toFixed(4)}deg)`,\n\t\t\t\t\t// Using \u201Cauto\u201D fixes wrapping problems where our size calculation does not work out well when zooming the\n\t\t\t\t\t// text (due to rendering differences).\n\t\t\t\t\t// TODO: When the `autoSize` prop is removed, it's safe to leave\n\t\t\t\t\t// this at `${frame.width}px`, because all auto cases will be\n\t\t\t\t\t// handled by DOM layout in the `else` side of the conditional\n\t\t\t\t\twidth: autoSize ? \"auto\" : `${frame.width}px`,\n\t\t\t\t\tminWidth: `${frame.width}px`,\n\t\t\t\t\theight: `${frame.height}px`,\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tconst { left, right, top, bottom } = this.props\n\n\t\t\t\tlet width: number | string | undefined\n\t\t\t\tlet height: number | string | undefined\n\t\t\t\tif (autoSize) {\n\t\t\t\t\twidth = \"auto\"\n\t\t\t\t\theight = \"auto\"\n\t\t\t\t} else {\n\t\t\t\t\tif (!isFiniteNumber(left) || !isFiniteNumber(right)) {\n\t\t\t\t\t\twidth = externalWidth\n\t\t\t\t\t}\n\t\t\t\t\tif (!isFiniteNumber(top) || !isFiniteNumber(bottom)) {\n\t\t\t\t\t\theight = externalHeight\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tObject.assign(style, {\n\t\t\t\t\tleft,\n\t\t\t\t\tright,\n\t\t\t\t\ttop,\n\t\t\t\t\tbottom,\n\t\t\t\t\twidth,\n\t\t\t\t\theight,\n\t\t\t\t\trotate,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tconst onCanvas = RenderTarget.current() === RenderTarget.canvas\n\t\t\tif (positionSticky) {\n\t\t\t\tif (!onCanvas || inCodeComponent) {\n\t\t\t\t\tstyle.position = \"sticky\"\n\t\t\t\t\tstyle.willChange = \"transform\"\n\t\t\t\t\tstyle.top = positionStickyTop\n\t\t\t\t\tstyle.right = positionStickyRight\n\t\t\t\t\tstyle.bottom = positionStickyBottom\n\t\t\t\t\tstyle.left = positionStickyLeft\n\t\t\t\t}\n\t\t\t} else if (onCanvas && (positionFixed || positionAbsolute)) {\n\t\t\t\tstyle.position = \"absolute\"\n\t\t\t}\n\t\t}\n\n\t\tprivate setElement = (element: HTMLDivElement | null) => {\n\t\t\tif (this.props.innerRef) {\n\t\t\t\tthis.props.innerRef.current = element\n\t\t\t}\n\n\t\t\tthis.setLayerElement(element)\n\t\t}\n\n\t\t// biome-ignore lint/suspicious/useGetterReturn: legacy text component\n\t\tget transformTemplate() {\n\t\t\tconst { _usesDOMRect, widthType, heightType, __fromCanvasComponent } = this.props\n\n\t\t\tif (this.props.transformTemplate) return this.props.transformTemplate\n\n\t\t\tconst frame = this.frame\n\n\t\t\tconst isDOMLayoutAutoSized = _usesDOMRect && (isAutoDimensionType(widthType) || isAutoDimensionType(heightType))\n\t\t\tconst hasTransformTemplate =\n\t\t\t\t!frame || !RenderTarget.hasRestrictions() || __fromCanvasComponent || isDOMLayoutAutoSized\n\n\t\t\tif (hasTransformTemplate) return transformTemplate(this.props.center)\n\t\t}\n\n\t\t/** Used by the ComponentContainerContext */\n\t\tprivate renderMain = (inCodeComponent: boolean) => {\n\t\t\tcountNodeRender()\n\n\t\t\tconst {\n\t\t\t\tfont,\n\t\t\t\tvisible,\n\t\t\t\talignment,\n\t\t\t\topacity,\n\t\t\t\tid,\n\t\t\t\tlayoutId,\n\t\t\t\tclassName,\n\t\t\t\ttransition,\n\t\t\t\tvariants,\n\t\t\t\tname,\n\t\t\t\t__fromCanvasComponent,\n\t\t\t\t_initialStyle,\n\t\t\t\twidthType: _widthType,\n\t\t\t\theightType: _heightType,\n\t\t\t\t_usesDOMRect,\n\t\t\t\tautoSize,\n\t\t\t\tstyle: styleProp,\n\t\t\t\tfontLoadStatus,\n\t\t\t\tmatchesCurrentRoute,\n\t\t\t\tpreload: _preload,\n\t\t\t\ttabIndex,\n\t\t\t\t...rest\n\t\t\t} = this.props\n\n\t\t\tif (!visible) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\t// We want to hide the Text component underneath the TextEditor when editing.\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: legacy text component\n\t\t\tconst isHidden = this.props.isEditable && this.props.environment!() === RenderTarget.canvas\n\n\t\t\tconst justifyContent = convertVerticalAlignment(this.props.verticalAlignment)\n\n\t\t\t// Add more styling and support vertical text alignment\n\t\t\tconst style: React.CSSProperties = {\n\t\t\t\toutline: \"none\",\n\t\t\t\tdisplay: \"flex\",\n\t\t\t\tflexDirection: \"column\",\n\t\t\t\tjustifyContent: justifyContent,\n\t\t\t\topacity: isHidden ? 0 : opacity,\n\t\t\t\tflexShrink: 0,\n\t\t\t}\n\n\t\t\t// QUICKFIX: Legacy code overrides pass the style from the text node as _initialStyle.\n\t\t\t// We have only consumed that object in FrameWithMotion but never in the Text component.\n\t\t\t// With the new WithTextStyle we need to render some CSS custom properties that are passed by the TextNode.\n\t\t\t// As the _initialStyle object contains additional styles that could break old projects we can't spread it.\n\t\t\tif (_initialStyle) {\n\t\t\t\tfor (const key in _initialStyle) {\n\t\t\t\t\tif (key.startsWith(\"--framer\")) {\n\t\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: legacy text component\n\t\t\t\t\t\tasRecord(style)[key] = asRecord(_initialStyle)[key] as any\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst dataProps = {\n\t\t\t\t\"data-framer-component-type\": \"Text\",\n\t\t\t\t\"data-framer-name\": rest[\"data-framer-name\"] ?? name,\n\t\t\t}\n\n\t\t\t// Compatibility for Smart Components generated before\n\t\t\t// https://github.com/framer/FramerStudio/pull/8270.\n\t\t\tif (autoSize) {\n\t\t\t\tasRecord(dataProps)[\"data-framer-component-text-autosized\"] = \"true\"\n\t\t\t}\n\n\t\t\tthis.collectLayout(style, inCodeComponent)\n\n\t\t\tcollectFiltersFromProps(this.props, style)\n\t\t\tcollectTextShadowsForProps(this.props, style)\n\n\t\t\tif (style.opacity === 1 || style.opacity === undefined) {\n\t\t\t\t// Wipe opacity setting if it's the default (1 or undefined)\n\t\t\t\tdelete style.opacity\n\t\t\t}\n\n\t\t\tlet rawHTML = this.props.rawHTML\n\t\t\tconst text = this.getOverrideText() || this.props.text\n\n\t\t\tif (isString(text)) {\n\t\t\t\tif (rawHTML) {\n\t\t\t\t\trawHTML = replaceDraftHTMLWithText(rawHTML, text)\n\t\t\t\t} else {\n\t\t\t\t\trawHTML = `<p style=\"font: ${font}\">${text}</p>`\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.props.style) {\n\t\t\t\tObject.assign(style, this.props.style)\n\t\t\t}\n\n\t\t\tconst centeringTransformTemplate = this.transformTemplate\n\t\t\tif (centeringTransformTemplate) Object.assign(dataProps, layoutHintDataPropsForCenter(this.props.center))\n\n\t\t\tif (rawHTML) {\n\t\t\t\tstyle.lineHeight = \"1px\"\n\t\t\t\tstyle.fontSize = \"0px\"\n\n\t\t\t\t// Hide the fonts while loading to avoid layout flashes\n\t\t\t\tif (RenderTarget.current() === RenderTarget.canvas && fontLoadStatus === \"loading\") {\n\t\t\t\t\tstyle.visibility = \"hidden\"\n\t\t\t\t}\n\n\t\t\t\t// On the canvas, color the text background red if a font could not be loaded\n\t\t\t\tif (RenderTarget.current() === RenderTarget.canvas && fontLoadStatus === \"timeout\") {\n\t\t\t\t\tstyle.backgroundColor = \"rgba(255, 0, 0, 0.3)\"\n\t\t\t\t}\n\n\t\t\t\tObject.assign(style, styleProp)\n\n\t\t\t\t// Old compiled smart components use the dedicated alignment prop which should get preference over the property in style\n\t\t\t\tif (alignment) asRecord(style)[\"--framer-text-alignment\"] = alignment\n\n\t\t\t\t// Only render a tabindex attribute if its explicitely requested.\n\t\t\t\tconst tabIndexProps = getTabIndexProps(tabIndex)\n\n\t\t\t\treturn (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tlayoutId={layoutId}\n\t\t\t\t\t\tid={id}\n\t\t\t\t\t\t{...tabIndexProps}\n\t\t\t\t\t\t{...dataProps}\n\t\t\t\t\t\t{...rest}\n\t\t\t\t\t\tstyle={style}\n\t\t\t\t\t\ttransformTemplate={centeringTransformTemplate}\n\t\t\t\t\t\t// biome-ignore lint/security/noDangerouslySetInnerHtml: intentional\n\t\t\t\t\t\tdangerouslySetInnerHTML={{ __html: rawHTML }}\n\t\t\t\t\t\tdata-center={this.props.center}\n\t\t\t\t\t\tclassName={cx(className, matchesCurrentRoute && \"isCurrent\")}\n\t\t\t\t\t\ttransition={transition}\n\t\t\t\t\t\tvariants={variants}\n\t\t\t\t\t\tref={this.setElement}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n})()\n\nexport const Text = /* @__PURE__ */ withLibraryCSS(TextInner)\n\n// Wrapping link tag is optional.\nconst linkTag = \"(?:<a[^>]*>)?\"\nconst linkClosingTag = \"(?:</a>)?\"\n// Outer tag can be div, span, or other semantic tag.\nconst outerTag = \"<[^>]+>\"\nconst outerClosingTag = \"</[^>]+>\"\n// Block tag can be div (older components), or span (newer components).\nconst blockTag = \"<(?:div|span)[^>]*>\"\nconst blockClosingTag = \"</(?:div|span)>\"\n// Insidie a block there is one or more tags for inline styles.\nconst inlineTag = \"<[^>]+>\"\nconst inlineClosingTag = \"</[^>]+>\"\nconst textContentRegex = /* @__PURE__ */ (() =>\n\tnew RegExp(\n\t\t`^(${linkTag}${outerTag}${blockTag}${inlineTag}).*?(${inlineClosingTag}).*?(${blockClosingTag}${outerClosingTag}${linkClosingTag})$`,\n\t\t//                                              ^^^ this is the content we want to replace\n\t\t//                                                                      ^^^ this is the content we want to discard\n\n\t\t\"su\", // let the \".\" also match newlines\n\t))()\n/**\n * If text is overriden in an override or by a variable, we take the rawHTML,\n * find the first styled span inside the first block, put the text in there, and\n * discard everything else. For example:\n *\n *     <p>\n *         <span>\n *             <span style=\"BOLD\">Hello </span>\n *             <span>World from the 1st block</span>\n *             <br>\n *         </span>\n *         <span>\n *             <!-- Second block is an empty line -->\n *             <span><br></span>\n *         </span>\n *         <span>\n *             <span>More text in third block</span>\n *             <br>\n *         </span>\n *     </p>\n *\n * will become:\n *\n *     <h1>\n *         <span>\n *             <span style=\"BOLD\">Text from the text prop, e.g., a variable or an override</span>\n *             <br>\n *         </span>\n *     </h1>\n */\nexport function replaceDraftHTMLWithText(rawHTML: string, text: string): string {\n\t// We're going to hell for parsing HTML with regex, but using a DOMParser\n\t// won't work during SSR...\n\treturn rawHTML.replace(\n\t\ttextContentRegex,\n\t\t(_, openingTags, inlineClosingTag, closingTags) => openingTags + text + inlineClosingTag + \"<br>\" + closingTags,\n\t)\n}\n\nfunction convertVerticalAlignment(verticalAlignment: TextVerticalAlignment): \"center\" | \"flex-start\" | \"flex-end\" {\n\tswitch (verticalAlignment) {\n\t\tcase \"top\":\n\t\t\treturn \"flex-start\"\n\t\tcase \"center\":\n\t\t\treturn \"center\"\n\t\tcase \"bottom\":\n\t\t\treturn \"flex-end\"\n\t}\n}\n\n// biome-ignore lint/complexity/noBannedTypes: legacy text component\nfunction getTabIndexProps(tabIndex: undefined | number): { readonly tabIndex: number } | {} {\n\tif (tabIndex === undefined) return {}\n\n\treturn { tabIndex }\n}\n", "import React from \"react\"\nimport { fontStore } from \"./fontStore.ts\"\n\nexport type FontLoadStatus = \"loading\" | \"done\" | \"timeout\"\n\n/**\n * @internal\n * Hook to subscribe to font store and get the current font loading status.\n * @deprecated only used in legacy text\n * */\nexport function useFontLoadStatus(fontSelectors: string[] = [], timeout = 5000): FontLoadStatus {\n\tconst missingFontSelectors = fontSelectors.filter(s => !fontStore.isSelectorLoaded(s))\n\tconst [fontLoadStatus, setFontLoadStatus] = React.useState<FontLoadStatus>(\n\t\tmissingFontSelectors.length ? \"loading\" : \"done\",\n\t)\n\n\t// This is a poor mans version of shallow equal both arrays\n\t// We need both the used and the missing font selectors\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated\n\tReact.useEffect(() => {\n\t\tif (!missingFontSelectors.length) return\n\n\t\t// This may need startTransition to avoid synchronous, blocking re-renders.\n\t\t// However, this component is only used in the deprecated text component. Let's not modify the behavior.\n\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition -- deprecated hook\n\t\tsetFontLoadStatus(\"loading\")\n\n\t\tconst timer = setTimeout(() => {\n\t\t\t// This may need startTransition to avoid synchronous, blocking re-renders.\n\t\t\t// However, this component is only used in the deprecated text component. Let's not modify the behavior.\n\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition -- deprecated hook\n\t\t\tsetFontLoadStatus(\"timeout\")\n\t\t}, timeout)\n\n\t\t// @TODO: Ignored for now, but should re-check later.\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tfontStore.loadFonts(missingFontSelectors).then(() => {\n\t\t\tclearTimeout(timer)\n\t\t\t// This may need startTransition to avoid synchronous, blocking re-renders.\n\t\t\t// However, this component is only used in the deprecated text component. Let's not modify the behavior.\n\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition -- deprecated hook\n\t\t\tsetFontLoadStatus(\"done\")\n\t\t})\n\t}, [fontSelectors.join(\", \"), missingFontSelectors.join(\", \")])\n\n\treturn fontLoadStatus\n}\n", "import { motion } from \"framer-motion\"\nimport { useTickerItem } from \"./motionplus/Ticker.tsx\"\n\n/**\n * @internal\n */\nexport interface TickerItemProps {\n\twidth?: string\n\theight?: string\n\tchildren: React.ReactNode\n}\n\n/**\n * @internal\n * To support relative sizes for ticker items we have to control the ticker item that is rendered in the ticker.\n * Ticker provides the props to us and we override the width and height to be relative.\n */\nexport function TickerItem({ height, width, children }: TickerItemProps) {\n\tconst itemProps = useSafeTickerItem()\n\tif (!itemProps || !children) return children\n\n\tconst { props } = itemProps\n\n\treturn (\n\t\t<motion.li\n\t\t\t{...props}\n\t\t\t// for percentage based sizing we set the height and width here, but other dimension types will be on the child element\n\t\t\t// and we will fit that instead\n\t\t\tstyle={{ ...props.style, width: width ?? \"fit-content\", height: height ?? \"fit-content\" }}\n\t\t>\n\t\t\t{children}\n\t\t</motion.li>\n\t)\n}\n\nfunction useSafeTickerItem() {\n\ttry {\n\t\t// biome-ignore lint/correctness/useHookAtTopLevel: not conditional, the same number of hooks are called whether an error occurs or not\n\t\tconst value = useTickerItem()\n\t\treturn value\n\t} catch {\n\t\t// not inside ticker so possibly a variant has no ticker effect, safe to return nothing\n\t\treturn undefined\n\t}\n}\n", "// used to generate id's and links to ids, they are stable per key, but only on runtime\n\nconst keys = new Map<string, InternalID>()\n\n/** @internal */\nexport class InternalID {\n\tprivate _link: string | null = null\n\tprivate _urllink: string | null = null\n\n\tconstructor(public id: string) {}\n\n\tadd(str: string): InternalID {\n\t\treturn InternalID.forKey(this.id + str)\n\t}\n\n\ttoString() {\n\t\treturn this.id\n\t}\n\n\tget link() {\n\t\tconst res = this._link\n\t\tif (res) return res\n\t\treturn (this._link = \"#\" + this.id)\n\t}\n\tget urlLink() {\n\t\tconst res = this._urllink\n\t\tif (res) return res\n\t\treturn (this._urllink = \"url(#\" + this.id + \")\")\n\t}\n\tstatic forKey(key: string): InternalID {\n\t\tlet res = keys.get(key)\n\t\tif (res) return res\n\t\tres = new InternalID(\"a\" + (1000 + keys.size) + \"z\")\n\t\tkeys.set(key, res)\n\t\treturn res\n\t}\n}\n", "const first = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\"\nconst letters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_\"\n\nfunction f(): string {\n\treturn first[Math.floor(Math.random() * first.length)] as string\n}\n\nfunction l(): string {\n\treturn letters[Math.floor(Math.random() * letters.length)] as string\n}\n\n// most js engines should be able to inline upto 64 / 8 - 1 = 7 characters\nexport function randomID(): string {\n\treturn f() + l() + l() + l() + l() + l() + l() + l() + l()\n}\n", "import { assert } from \"./../../utils/assert.ts\"\nimport { Point } from \"./Point.ts\"\nimport { randomID } from \"./randomID.ts\"\n\nexport type HandleMirroring = \"straight\" | \"symmetric\" | \"disconnected\" | \"asymmetric\"\n\nconst PathSegmentOuter = /* @__PURE__ */ (() => {\n\t// We\u2019re wrapping the whole PathSegment class with `@__PURE__` because esbuild\n\t// can\u2019t compile static class properties in a tree-shakeable way: https://github.com/evanw/esbuild/issues/3765.\n\t// The wrapper allows them to stay in the IIFE and be tree-shaken.\n\t// If/when esbuild fixes that issue, we can remove `export type PathSegment`\n\t// and `export const PathSegment` and just export the class directly.\n\tclass PathSegment {\n\t\t// #region withClassDiscriminator\n\t\t// NOTE: this implementation carefully copies the implementation of `withClassDiscriminator`\n\t\t// from Vekter. If making changes here, make sure to sync them to `withClassDiscriminator` as well.\n\t\treadonly __class = \"PathSegment\" as string\n\t\tstatic displayName = \"WithClassDiscriminatorMixin(PathSegment)\"\n\t\t// #endregion\n\n\t\tdeclare readonly id: string\n\t\treadonly x: number = 0 // The anchor point of the segment.\n\t\treadonly y: number = 0\n\t\treadonly handleMirroring: HandleMirroring = \"straight\"\n\t\treadonly handleOutX: number = 0 // Describes the out tangent of the segment.\n\t\treadonly handleOutY: number = 0\n\t\treadonly handleInX: number = 0 // Describes the in tangent of the segment.\n\t\treadonly handleInY: number = 0\n\t\treadonly radius: number = 0\n\n\t\tconstructor(value?: Partial<PathSegment>) {\n\t\t\tif (value) {\n\t\t\t\tObject.assign(this, value)\n\t\t\t}\n\t\t\tif (!value?.id) {\n\t\t\t\tthis.id = randomID()\n\t\t\t}\n\t\t}\n\n\t\tmerge(value: Partial<PathSegment>): PathSegment {\n\t\t\treturn Object.assign(Object.create(Object.getPrototypeOf(this)), this, value)\n\t\t}\n\n\t\tstatic point = (pathSegment: PathSegment) => {\n\t\t\treturn { x: pathSegment.x, y: pathSegment.y }\n\t\t}\n\n\t\tstatic handleOut = (pathSegment: PathSegment) => {\n\t\t\treturn { x: pathSegment.handleOutX, y: pathSegment.handleOutY }\n\t\t}\n\n\t\tstatic handleIn = (pathSegment: PathSegment) => {\n\t\t\treturn { x: pathSegment.handleInX, y: pathSegment.handleInY }\n\t\t}\n\n\t\tstatic calculatedHandleOut = (pathSegment: PathSegment): Point => {\n\t\t\tswitch (pathSegment.handleMirroring) {\n\t\t\t\tcase \"symmetric\":\n\t\t\t\tcase \"disconnected\":\n\t\t\t\tcase \"asymmetric\":\n\t\t\t\t\treturn Point.add(PathSegment.point(pathSegment), PathSegment.handleOut(pathSegment))\n\t\t\t\tdefault:\n\t\t\t\t\treturn { x: pathSegment.x, y: pathSegment.y }\n\t\t\t}\n\t\t}\n\n\t\tstatic calculatedHandleIn = (pathSegment: PathSegment): Point => {\n\t\t\tswitch (pathSegment.handleMirroring) {\n\t\t\t\tcase \"symmetric\":\n\t\t\t\t\treturn Point.subtract(PathSegment.point(pathSegment), PathSegment.handleOut(pathSegment))\n\t\t\t\tcase \"disconnected\":\n\t\t\t\tcase \"asymmetric\":\n\t\t\t\t\treturn Point.add(PathSegment.point(pathSegment), PathSegment.handleIn(pathSegment))\n\t\t\t\tdefault:\n\t\t\t\t\treturn PathSegment.point(pathSegment)\n\t\t\t}\n\t\t}\n\n\t\tstatic curveDefault = (points: readonly PathSegment[], index: number): Point => {\n\t\t\tif (points.length > 2) {\n\t\t\t\tlet pointBefore: PathSegment | undefined\n\t\t\t\tlet pointAfter: PathSegment | undefined\n\n\t\t\t\tif (index === 0) {\n\t\t\t\t\tpointBefore = points[points.length - 1]\n\t\t\t\t} else {\n\t\t\t\t\tpointBefore = points[index - 1]\n\t\t\t\t}\n\n\t\t\t\tif (index === points.length - 1) {\n\t\t\t\t\tpointAfter = points[0]\n\t\t\t\t} else {\n\t\t\t\t\tpointAfter = points[index + 1]\n\t\t\t\t}\n\n\t\t\t\tassert(pointBefore, \"pointBefore should be defined\")\n\t\t\t\tassert(pointAfter, \"pointAfter should be defined\")\n\t\t\t\tconst delta = Point.subtract(PathSegment.point(pointAfter), PathSegment.point(pointBefore))\n\t\t\t\treturn { x: delta.x / 4, y: delta.y / 4 }\n\t\t\t}\n\n\t\t\treturn { x: 10, y: 10 }\n\t\t}\n\t}\n\t// #region withClassDiscriminator\n\t// NOTE: this implementation carefully copies the implementation of `withClassDiscriminator`\n\t// from Vekter. If making changes here, make sure to sync them to `withClassDiscriminator` as well.\n\t// @ts-expect-error - __class is readonly\n\tPathSegment.prototype.__class = \"PathSegment\"\n\t// #endregion\n\n\treturn PathSegment\n})()\n\n// Confused how two definitions with the same name work? See https://stackoverflow.com/a/67697999\n/** @internal */\nexport type PathSegment = InstanceType<typeof PathSegmentOuter>\n/** @internal */\nexport const PathSegment = PathSegmentOuter\n", "import { assert } from \"../../utils/assert.ts\"\nimport { PathSegment } from \"../types/PathSegment.ts\"\nimport { RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport { isFiniteNumber } from \"../utils/isFiniteNumber.ts\"\nimport { roundedNumberString } from \"../utils/roundedNumber.ts\"\n\n/**\n * @internal\n */\nexport interface WithPath {\n\tpathSegments: readonly PathSegment[]\n\tpathClosed: boolean\n}\n\nconst key: keyof WithPath = \"pathSegments\"\n\n/**\n * @internal\n */\nexport function withPath(target: any): target is WithPath {\n\treturn key in target\n}\n\n/**\n * @internal\n */\nexport type WithPaths = WithPath[]\n\n/**\n * @internal\n */\nexport const pathDefaults: WithPath = {\n\tpathSegments: [],\n\tpathClosed: false,\n}\n\n/**\n * @internal\n */\nexport function toSVGPath(\n\twithPaths: WithPaths | WithPath,\n\ttranslate: { x: number; y: number } = { x: 0, y: 0 },\n\tcanvasMode: RenderTarget = RenderTarget.canvas,\n): string {\n\tlet pathElements: (number | string)[] = []\n\n\tlet paths: WithPaths = []\n\n\tif (Array.isArray(withPaths)) {\n\t\tpaths = withPaths\n\t} else {\n\t\tpaths = [withPaths]\n\t}\n\n\tpaths.forEach(path => {\n\t\tconst { pathClosed, pathSegments } = path\n\t\tconst segmentCount = pathSegments.length\n\t\tif (segmentCount === 0) return \"\"\n\n\t\tfor (let i = 0; i < segmentCount; i++) {\n\t\t\tconst segment = pathSegments[i]\n\t\t\tassert(segment, \"Path segment must be defined\")\n\t\t\tlet nextSegment: PathSegment | undefined\n\t\t\tlet prevSegment: PathSegment | undefined\n\n\t\t\tconst isFirstSegment = i === 0\n\t\t\tconst isLastSegment = i === segmentCount - 1\n\n\t\t\tif (!isLastSegment) {\n\t\t\t\tnextSegment = pathSegments[i + 1]\n\t\t\t} else if (pathClosed) {\n\t\t\t\tnextSegment = pathSegments[0]\n\t\t\t}\n\n\t\t\tif (!isFirstSegment) {\n\t\t\t\tprevSegment = pathSegments[i - 1]\n\t\t\t} else if (pathClosed) {\n\t\t\t\tprevSegment = pathSegments[segmentCount - 1]\n\t\t\t}\n\n\t\t\tif (i === 0) {\n\t\t\t\tpathElements.push(\"M\")\n\t\t\t} else if (prevSegment && isStraightCurve(prevSegment, segment)) {\n\t\t\t\tpathElements.push(\"L\")\n\t\t\t}\n\n\t\t\tpathElements.push(segment.x + translate.x, segment.y + translate.y)\n\n\t\t\tif (nextSegment && !isStraightCurve(segment, nextSegment)) {\n\t\t\t\tconst handleOut = PathSegment.calculatedHandleOut(segment)\n\t\t\t\tconst handleIn = PathSegment.calculatedHandleIn(nextSegment)\n\t\t\t\tpathElements.push(\n\t\t\t\t\t\"C\",\n\t\t\t\t\thandleOut.x + translate.x,\n\t\t\t\t\thandleOut.y + translate.y,\n\t\t\t\t\thandleIn.x + translate.x,\n\t\t\t\t\thandleIn.y + translate.y,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tif (isLastSegment && nextSegment) {\n\t\t\t\tif (isStraightCurve(segment, nextSegment)) {\n\t\t\t\t\tpathElements.push(\"Z\")\n\t\t\t\t} else {\n\t\t\t\t\tpathElements.push(nextSegment.x + translate.x, nextSegment.y + translate.y, \"Z\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\tif (canvasMode === RenderTarget.export || canvasMode === RenderTarget.preview) {\n\t\tpathElements = pathElements.map(value => (isFiniteNumber(value) ? roundedNumberString(value, 3) : value))\n\t}\n\treturn pathElements.join(\" \")\n}\n\n/**\n * @internal\n */\nexport function isStraightCurve(fromSegment: PathSegment, toSegment: PathSegment): boolean {\n\tconst fromStraight =\n\t\tfromSegment.handleMirroring === \"straight\" || (fromSegment.handleOutX === 0 && fromSegment.handleOutY === 0)\n\tconst toStraight =\n\t\ttoSegment.handleMirroring === \"straight\" || (toSegment.handleInX === 0 && toSegment.handleInY === 0)\n\treturn fromStraight && toStraight\n}\n", "import type React from \"react\"\n\n// These are the default values for the properties as found on the\n// browser's SVG element:\nexport const svgElementAttributeDefaults: React.SVGAttributes<SVGElement> = {\n\tstroke: \"none\",\n\tstrokeWidth: 1,\n\tstrokeLinecap: \"butt\",\n\tstrokeLinejoin: \"miter\",\n\tstrokeMiterlimit: 4,\n\tstrokeDasharray: \"0\",\n\tstrokeDashoffset: 0,\n\tstrokeOpacity: 1,\n\tfill: \"black\",\n\tfillRule: \"nonzero\",\n\tfillOpacity: 1,\n}\n", "import type { Rect } from \"../types/Rect.ts\"\nimport type { TransformValues } from \"../types/TransformValues.ts\"\n\ntype CreateTransformValuesMode = \"asIs\" | \"resetXY\"\n\nfunction createTransformValues(baseTransform: TransformValues, mode: CreateTransformValuesMode) {\n\tlet { x, y } = baseTransform\n\tconst { width, height, rotation } = baseTransform\n\n\tif (mode === \"resetXY\") {\n\t\tx = 0\n\t\ty = 0\n\t}\n\n\treturn { x, y, width, height, rotation }\n}\n\nfunction getTransformMode(isRootVectorNode: boolean, includeTransform?: boolean): CreateTransformValuesMode {\n\tif (includeTransform !== undefined) {\n\t\tif (includeTransform) {\n\t\t\treturn \"asIs\"\n\t\t}\n\t} else {\n\t\tif (!isRootVectorNode) {\n\t\t\treturn \"asIs\"\n\t\t}\n\t}\n\n\treturn \"resetXY\"\n}\n\nexport function transformValues(\n\trect: Rect,\n\trotation: number,\n\tisRootVectorNode: boolean,\n\tincludeTransform?: boolean,\n): TransformValues {\n\tconst transformMode = getTransformMode(isRootVectorNode, includeTransform)\n\tconst baseTransform = { ...rect, rotation: includeTransform === false ? 0 : rotation }\n\tconst transform = createTransformValues(baseTransform, transformMode)\n\treturn transform\n}\n", "import type { TransformValues } from \"../types/TransformValues.ts\"\nimport { roundedNumberString } from \"./roundedNumber.ts\"\n\n/** @internal */\nexport function transformString(transform: TransformValues | undefined): string | undefined {\n\tif (transform === undefined) {\n\t\treturn undefined\n\t}\n\tconst { x, y, rotation, width, height } = transform\n\tlet result: string | undefined\n\tif (x !== 0 || y !== 0) {\n\t\tresult = `translate(${roundedNumberString(x, 3)} ${roundedNumberString(y, 3)})`\n\t}\n\tif (rotation !== 0) {\n\t\tconst roundedRotation = roundedNumberString(rotation, 4)\n\t\tconst roundedWidth = roundedNumberString(width / 2, 3)\n\t\tconst roundedHeight = roundedNumberString(height / 2, 3)\n\t\tconst rotationString = `rotate(${roundedRotation} ${roundedWidth} ${roundedHeight})`\n\t\tresult = result ? `${result} ${rotationString}` : rotationString\n\t}\n\treturn result\n}\n", "import { Component } from \"react\"\nimport type {\n\tLinearGradientElementProperties,\n\tRadialGradientElementProperties,\n} from \"../utils/elementPropertiesForGradient.ts\"\n\nexport class LinearGradientElement extends Component<LinearGradientElementProperties, object> {\n\toverride render() {\n\t\tconst { id, stops, x1, x2, y1, y2 } = this.props\n\t\treturn (\n\t\t\t<linearGradient id={id} x1={x1} x2={x2} y1={y1} y2={y2}>\n\t\t\t\t{stops.map((stop, idx) => {\n\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: Intentional\n\t\t\t\t\treturn <stop key={idx} offset={stop.position} stopColor={stop.color} stopOpacity={stop.alpha} />\n\t\t\t\t})}\n\t\t\t</linearGradient>\n\t\t)\n\t}\n}\n\nexport class RadialGradientElement extends Component<RadialGradientElementProperties, object> {\n\toverride render() {\n\t\tconst { centerAnchorX, centerAnchorY, id, widthFactor, heightFactor, stops } = this.props\n\t\treturn (\n\t\t\t<radialGradient\n\t\t\t\tid={id}\n\t\t\t\tcy={centerAnchorY}\n\t\t\t\tcx={centerAnchorX}\n\t\t\t\tr={widthFactor}\n\t\t\t\tgradientTransform={getRadialGradientTransform(heightFactor, widthFactor, centerAnchorX, centerAnchorY)}\n\t\t\t>\n\t\t\t\t{stops.map((stop, idx) => {\n\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: Intentional\n\t\t\t\t\treturn <stop key={idx} offset={stop.position} stopColor={stop.color} stopOpacity={stop.alpha} />\n\t\t\t\t})}\n\t\t\t</radialGradient>\n\t\t)\n\t}\n}\n\nexport function getRadialGradientTransform(\n\theightFactor: number,\n\twidthFactor: number,\n\tcenterAnchorX: number,\n\tcenterAnchorY: number,\n) {\n\t// When the widthFactor is 0, we want the scale factor to be big enough, without using a 0 divisor.\n\tconst scaleWidth = widthFactor ? heightFactor / widthFactor : 1000\n\treturn `translate(${centerAnchorX}, ${centerAnchorY}) scale(1 ${\n\t\tscaleWidth\n\t}) translate(-${centerAnchorX}, -${centerAnchorY})`\n}\n", "import { isSafari } from \"@framerjs/shared/src/environment.ts\"\nimport React from \"react\"\nimport { useMeasureLayout } from \"../utils/useMeasureLayout.ts\"\nimport { ComponentContainerContext } from \"./ComponentContainerContext.tsx\"\nimport type { DOMLayoutProps } from \"./Layer.tsx\"\n\n/**\n * @internal\n */\nexport interface SVGRootProps extends DOMLayoutProps {\n\twidth: number\n\theight: number\n\tleft: number\n\ttop: number\n\tid?: string | undefined\n\tstyle?: React.CSSProperties\n}\n\n/**\n * @internal\n */\nexport const SVGRoot = (props: React.PropsWithChildren<SVGRootProps>) => {\n\tconst { id, children, left, width, height, top, style, _needsMeasure } = props\n\n\tconst inCodeComponent = React.useContext(ComponentContainerContext)\n\tconst ref = React.useRef<SVGSVGElement>(null)\n\n\tuseMeasureLayout(\n\t\t{\n\t\t\tid,\n\t\t\t// SVGRoot won't be rendered if the node is invisible.\n\t\t\tvisible: true,\n\t\t\t_needsMeasure,\n\t\t},\n\t\tref,\n\t)\n\t/**\n\t * @TODO These styles need to animate if changed by a Generated Variant.\n\t * However, we cannot use `animate` since that will block the children\n\t * from reacting to the active variant. We also have to consider canvas\n\t * performance.\n\t */\n\tconst svgStyle: React.CSSProperties = {\n\t\tposition: \"absolute\",\n\t\twidth,\n\t\theight,\n\t\tleft,\n\t\ttop,\n\t\toverflow: \"visible\",\n\t\tdisplay: \"block\",\n\t\t...style,\n\t}\n\n\tconst svgProps: React.SVGProps<SVGSVGElement> = {\n\t\t// Avoid duplicating IDs when the SVG is rendered through slots. We only need the ID for\n\t\t// measurement so code component descendants don't matter.\n\t\tid: inCodeComponent ? undefined : id,\n\t\tviewBox: `0 0 ${width} ${height}`,\n\t\tref,\n\t}\n\n\t// On a DPR=1 screen, browsers won't render SVG paths on half-pixels (both for position and\n\t// size), they snap them to the nearest full pixel. As a workaround for sub-pixel sizes, we\n\t// scale the SVG by 2x and counter-scale its descendants, so that the transform forces shapes\n\t// with sub-pixel sizes to sit on half-pixels instead. And then we translate the shape back to\n\t// the correct position as it should be without the browser rounding.\n\t//\n\t// Safari in particular behaves inconsistently:\n\t// - On DPR=1 screens, it renders sub-pixel sizes correctly but requires position correction via\n\t//   translate.\n\t// - On DPR=2 screens, it rounds sub-pixel sizes (why?!) but handles sub-pixel positions fine\n\t//   without translation.\n\tconst needsScale = isSafari() ? window.devicePixelRatio !== 1 : window.devicePixelRatio === 1\n\tconst needsTranslate = window.devicePixelRatio === 1\n\tif (!needsScale && !needsTranslate) {\n\t\treturn (\n\t\t\t<svg role=\"presentation\" {...svgProps} style={svgStyle}>\n\t\t\t\t{children}\n\t\t\t</svg>\n\t\t)\n\t}\n\n\tconst svgTransform = needsScale ? { transform: \"scale(2)\" } : undefined\n\n\treturn (\n\t\t<svg role=\"presentation\" {...svgProps} style={{ ...svgStyle, ...svgTransform }}>\n\t\t\t<g\n\t\t\t\tstyle={{\n\t\t\t\t\t// The default value of transform-origin is 0 0 for all SVG elements except\n\t\t\t\t\t// for root <svg> elements:\n\t\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Attribute/transform-origin\n\t\t\t\t\ttransformOrigin: \"center\",\n\t\t\t\t\ttransform: getShapeTransform(needsScale, needsTranslate, left, top),\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n\nfunction getShapeTransform(needsScale: boolean, needsTranslate: boolean, left: number, top: number) {\n\tconst l = Math.floor(left) - left\n\tconst t = Math.floor(top) - top\n\n\tconst transforms: string[] = []\n\t// It's important that the scale applies later (transforms operate from right to left), so that\n\t// the final visual translate would be halved as well, putting the scaled shape back to the\n\t// origin.\n\tif (needsScale) transforms.push(\"scale(0.5)\")\n\tif (needsTranslate && (l || t)) transforms.push(`translate(${l}px, ${t}px)`)\n\treturn transforms.length ? transforms.join(\" \") : undefined\n}\n", "import type { Transition, Variants } from \"framer-motion\"\nimport { motion } from \"framer-motion\"\nimport type React from \"react\"\nimport { asRecord } from \"../../utils/asRecord.ts\"\nimport { InternalID } from \"../../utils/internalId.ts\"\nimport { isString } from \"../../utils/utils.ts\"\nimport { shadowForShape } from \"../style/shadow.tsx\"\nimport type { FillProperties } from \"../traits/Fill.ts\"\nimport type { WithPath } from \"../traits/Path.ts\"\nimport { toSVGPath } from \"../traits/Path.ts\"\nimport { BackgroundImage } from \"../types/BackgroundImage.ts\"\nimport { Color, ConvertColor } from \"../types/Color/index.ts\"\nimport { LinearGradient, RadialGradient } from \"../types/Gradient.ts\"\nimport type { Rect } from \"../types/Rect.ts\"\nimport { RenderEnvironment, RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport type { BoxShadow } from \"../types/Shadow.ts\"\nimport type { LineCap, LineJoin } from \"../types/Stroke.ts\"\nimport type { StrokeAlignment } from \"../types/StrokeAlignment.ts\"\nimport { svgElementAttributeDefaults } from \"../types/svgElementAttributeDefaults.ts\"\nimport { transformValues } from \"../utils/createTransformValues.ts\"\nimport type {\n\tLinearGradientElementProperties,\n\tRadialGradientElementProperties,\n} from \"../utils/elementPropertiesForGradient.ts\"\nimport {\n\telementPropertiesForLinearGradient,\n\telementPropertiesForRadialGradient,\n} from \"../utils/elementPropertiesForGradient.ts\"\nimport { imagePatternPropsForFill } from \"../utils/imagePatternPropsForFill.tsx\"\nimport { countNodeRender } from \"../utils/performanceDebugging.ts\"\nimport { transformString } from \"../utils/transformString.ts\"\nimport { LinearGradientElement, RadialGradientElement } from \"./GradientElement.tsx\"\nimport type { ImagePatternElementProperties } from \"./ImagePatternElement.tsx\"\nimport { ImagePatternElement } from \"./ImagePatternElement.tsx\"\nimport type { LayerProps } from \"./Layer.tsx\"\nimport { Layer } from \"./Layer.tsx\"\nimport { SVGRoot } from \"./SVGRoot.tsx\"\n\n/**\n * @internal\n */\nexport interface VectorProps extends Partial<FillProperties> {\n\tisRootVectorNode: boolean\n\tname: string | null\n\tincludeTransform?: boolean\n\tdefaultFillColor?: string\n\tdefaultStrokeColor?: string\n\tdefaultStrokeWidth?: number\n\tdefaultStrokeAlignment?: StrokeAlignment\n\tx: number\n\ty: number\n\tleft: number\n\ttop: number\n\twidth: number\n\theight: number\n\trotation: number\n\t/**\n\t * For simplicity in Framer, accept `rotate`, (the framer-motion\n\t * property key), and prefer it when provided over the `rotation` prop.\n\t */\n\trotate?: number\n\topacity?: number\n\tcalculatedPath: WithPath[]\n\tcalculatedPathBoundingBox: Rect\n\td?: string\n\tinsideStroke: boolean\n\tstrokeEnabled: boolean\n\tstrokeClipId?: string\n\tstrokeWidth?: number\n\tidAttribute?: string\n\tshadows: BoxShadow[]\n\tstrokeAlpha: number\n\tlineCap: LineCap\n\tlineJoin: LineJoin\n\tstrokeColor: string\n\tstrokeMiterLimit: number\n\tstrokeDashArray: string\n\tstrokeDashOffset: number\n\tvariants?: Variants\n\ttransition?: Transition\n\tfillOpacity?: number\n\tvisible?: boolean\n}\n\n/**\n * @internal\n */\nexport interface VectorProperties extends VectorProps, LayerProps {\n\tstyle?: React.CSSProperties\n}\n\n// This type is used to collect attributes for both <use> and <motion.path>,\n// which is why we use SVGElement (the shared ancestor of SVGUseElement and\n// SVGPathElement) as the generic type for SVGAttributes. From this type we omit\n// all the keys from the DOMAttributes type, which contains handlers that we\n// currently do not set on this attributes type. If included, they would prevent\n// us from using one combined type as attributes for the two tags, because these\n// handlers are generic to the element.\ntype SVGStrokeAttributes = Omit<React.SVGAttributes<SVGElement>, keyof React.DOMAttributes<SVGElement> | \"values\">\n\ndeclare class VectorType extends Layer<VectorProperties, object> {\n\tstatic defaultVectorProps: VectorProps\n\tstatic readonly defaultProps: VectorProperties\n}\n\n/**\n * @internal\n */\nexport const Vector: typeof VectorType = /* @__PURE__ */ (() => {\n\treturn class VectorInner extends Layer<VectorProperties, object> {\n\t\tstatic defaultVectorProps: VectorProps = {\n\t\t\tisRootVectorNode: false,\n\t\t\tname: null,\n\t\t\tincludeTransform: undefined,\n\t\t\tdefaultFillColor: undefined,\n\t\t\tdefaultStrokeColor: undefined,\n\t\t\tdefaultStrokeWidth: undefined,\n\t\t\tdefaultStrokeAlignment: \"center\",\n\t\t\twidth: 100,\n\t\t\theight: 100,\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tleft: 0,\n\t\t\ttop: 0,\n\t\t\trotation: 0,\n\t\t\trotate: undefined,\n\t\t\topacity: undefined,\n\t\t\tcalculatedPath: [],\n\t\t\tcalculatedPathBoundingBox: { x: 0, y: 0, width: 0, height: 0 },\n\t\t\td: undefined,\n\t\t\tinsideStroke: false,\n\t\t\tstrokeEnabled: true,\n\t\t\tstrokeClipId: undefined,\n\t\t\tstrokeWidth: undefined,\n\t\t\tidAttribute: undefined,\n\t\t\ttransition: undefined,\n\t\t\tshadows: [],\n\t\t\tstrokeAlpha: 1,\n\t\t\tlineCap: \"butt\",\n\t\t\tstrokeColor: \"#0AF\",\n\t\t\tlineJoin: \"miter\",\n\t\t\tstrokeMiterLimit: 4,\n\t\t\tstrokeDashArray: \"0\",\n\t\t\tstrokeDashOffset: 0,\n\t\t\tfill: \"rgba(0,170,255,0.5)\",\n\t\t\tvisible: undefined,\n\t\t}\n\n\t\tstatic override readonly defaultProps: VectorProperties = {\n\t\t\t...Layer.defaultProps,\n\t\t\t...VectorInner.defaultVectorProps,\n\t\t}\n\n\t\toverride render(): React.ReactElement<unknown> | null {\n\t\t\tcountNodeRender()\n\n\t\t\tconst {\n\t\t\t\topacity,\n\t\t\t\tcalculatedPath,\n\t\t\t\tcalculatedPathBoundingBox,\n\t\t\t\td,\n\t\t\t\tinsideStroke,\n\t\t\t\tstrokeEnabled,\n\t\t\t\tstrokeClipId,\n\t\t\t\tstrokeWidth,\n\t\t\t\tidAttribute,\n\t\t\t\tshadows,\n\t\t\t\tname,\n\t\t\t\tincludeTransform,\n\t\t\t\tisRootVectorNode,\n\t\t\t\trotation,\n\t\t\t\tid,\n\t\t\t\tlineCap,\n\t\t\t\tlineJoin,\n\t\t\t\tstrokeColor,\n\t\t\t\tstrokeMiterLimit,\n\t\t\t\tstrokeDashArray,\n\t\t\t\tstrokeDashOffset,\n\t\t\t\tfill,\n\t\t\t\tvariants,\n\t\t\t\ttransition,\n\t\t\t\tfillOpacity,\n\t\t\t\tvisible,\n\t\t\t\tx,\n\t\t\t\ty,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t} = this.props\n\t\t\tif (!visible) return null\n\t\t\tif (!id || !strokeClipId) return null\n\n\t\t\tconst rotate = this.props.rotate ?? rotation ?? 0\n\t\t\tconst { target } = RenderEnvironment\n\t\t\tconst rect = { x, y, width, height }\n\t\t\t/**\n\t\t\t * @TODO For Vectors to animate smoothly in Generated Components, we\n\t\t\t * need to reconsider how we set this transform. This transform needs to\n\t\t\t * be set on changes for the image fill to update, but also used in an\n\t\t\t * `initial` prop, and set by `variants` so that rotation animates. We\n\t\t\t * also have to consider canvas performance.\n\t\t\t */\n\t\t\tconst transform = transformValues(rect, rotate, isRootVectorNode, includeTransform)\n\n\t\t\tlet vectorFill: string | undefined\n\t\t\tlet fillAlpha = 0\n\t\t\tlet imagePattern: ImagePatternElementProperties | undefined\n\t\t\tlet linearGradient: LinearGradientElementProperties | undefined\n\t\t\tlet radialGradient: RadialGradientElementProperties | undefined\n\n\t\t\tif (isString(fill) || Color.isColorObject(fill)) {\n\t\t\t\tconst fillColor = Color.isColorObject(fill) ? fill.initialValue || Color.toRgbString(fill) : fill\n\t\t\t\tif (fillColor !== \"transparent\") {\n\t\t\t\t\tvectorFill = fillColor\n\t\t\t\t\tfillAlpha = ConvertColor.getAlpha(vectorFill)\n\t\t\t\t}\n\t\t\t} else if (LinearGradient.isLinearGradient(fill)) {\n\t\t\t\tlinearGradient = elementPropertiesForLinearGradient(fill, id)\n\t\t\t\tvectorFill = `url(#${linearGradient.id})`\n\t\t\t\tfillAlpha = 1\n\t\t\t} else if (RadialGradient.isRadialGradient(fill)) {\n\t\t\t\tradialGradient = elementPropertiesForRadialGradient(fill, id)\n\t\t\t\tvectorFill = `url(#${radialGradient.id})`\n\t\t\t\tfillAlpha = 1\n\t\t\t} else if (BackgroundImage.isImageObject(fill)) {\n\t\t\t\timagePattern = imagePatternPropsForFill(fill, transform, id, includeTransform)\n\n\t\t\t\tif (imagePattern) {\n\t\t\t\t\tvectorFill = `url(#${imagePattern.id})`\n\t\t\t\t\tfillAlpha = 1\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (vectorFill === svgElementAttributeDefaults.fill) {\n\t\t\t\tvectorFill = undefined\n\t\t\t}\n\n\t\t\tif (vectorFill === undefined) {\n\t\t\t\tvectorFill = \"transparent\"\n\t\t\t}\n\n\t\t\tconst fillEnabled = vectorFill !== undefined && vectorFill !== \"transparent\" && fillAlpha !== 0\n\n\t\t\t// If both fill and stroke are disabled, pretend there\u2019s a fill for the shadow\n\t\t\tif (!fillEnabled && !strokeEnabled) {\n\t\t\t\tfillAlpha = 1\n\t\t\t}\n\n\t\t\tlet mainElement: JSX.Element\n\t\t\tlet strokeClipPath: JSX.Element | null = null\n\t\t\tlet shapeReference: JSX.Element | null = null\n\t\t\tlet strokeElement: JSX.Element | null = null\n\n\t\t\tlet pathTranslate: { x: number; y: number } | undefined\n\t\t\tlet elementTransform: string | undefined\n\n\t\t\tconst translatePaths = target === RenderTarget.export\n\t\t\tif (transform.rotation === 0 && translatePaths) {\n\t\t\t\tpathTranslate = transform\n\t\t\t} else {\n\t\t\t\tpathTranslate = { x: 0, y: 0 }\n\t\t\t\telementTransform = transformString(transform)\n\t\t\t}\n\t\t\tconst pathAttributes: Omit<\n\t\t\t\tReact.SVGAttributes<SVGPathElement>,\n\t\t\t\tkeyof React.DOMAttributes<SVGPathElement> | \"values\"\n\t\t\t> = {\n\t\t\t\td: d ?? toSVGPath(calculatedPath, pathTranslate, target),\n\t\t\t\ttransform: elementTransform,\n\t\t\t}\n\n\t\t\t// When used from the Preview, we need to revive BoxShadow instances:\n\t\t\tconst svgStrokeAttributes: SVGStrokeAttributes = {}\n\t\t\tif (strokeEnabled && strokeWidth !== 0) {\n\t\t\t\tsvgStrokeAttributes.strokeWidth = strokeWidth\n\t\t\t\tsvgStrokeAttributes.stroke = strokeColor\n\t\t\t\tsvgStrokeAttributes.strokeLinecap = lineCap\n\t\t\t\tsvgStrokeAttributes.strokeLinejoin = lineJoin\n\t\t\t\tif (lineJoin === \"miter\") {\n\t\t\t\t\tsvgStrokeAttributes.strokeMiterlimit = strokeMiterLimit\n\t\t\t\t}\n\t\t\t\tsvgStrokeAttributes.strokeDasharray = strokeDashArray\n\t\t\t\tif (strokeDashOffset !== 0) {\n\t\t\t\t\tsvgStrokeAttributes.strokeDashoffset = strokeDashOffset\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const key in svgElementAttributeDefaults) {\n\t\t\t\tif (asRecord(svgStrokeAttributes)[key] === asRecord(svgElementAttributeDefaults)[key]) {\n\t\t\t\t\tasRecord(svgStrokeAttributes)[key] = undefined\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst internalShapeId = InternalID.forKey(id)\n\t\t\tconst internalStrokeClipId = InternalID.forKey(strokeClipId)\n\t\t\tconst shadow = shadowForShape(\n\t\t\t\tshadows,\n\t\t\t\t// Shadow filter uses 'objectBoundingBox' as filter units, so calculations should be\n\t\t\t\t// relative to the referenced object itself (path), instead of the node rect, which\n\t\t\t\t// can be larger than the path bounding box.\n\t\t\t\tcalculatedPathBoundingBox,\n\t\t\t\tinternalShapeId,\n\t\t\t\tBoolean(fill),\n\t\t\t\tstrokeEnabled,\n\t\t\t\tstrokeWidth,\n\t\t\t\tinternalStrokeClipId,\n\t\t\t\tsvgStrokeAttributes,\n\t\t\t)\n\n\t\t\tconst currentName = target === RenderTarget.preview ? name || undefined : undefined\n\n\t\t\tif (shadow.insetElement !== null || shadow.outsetElement !== null || insideStroke) {\n\t\t\t\tpathAttributes.id = internalShapeId.id\n\t\t\t\tshapeReference = <motion.path {...{ ...pathAttributes }} variants={variants} transition={transition} />\n\n\t\t\t\tif (shadow.needsStrokeClip || insideStroke) {\n\t\t\t\t\tstrokeClipPath = (\n\t\t\t\t\t\t<clipPath id={internalStrokeClipId.id}>\n\t\t\t\t\t\t\t<use xlinkHref={internalShapeId.link} />\n\t\t\t\t\t\t</clipPath>\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tif (shadow.insetElement !== null && strokeEnabled && strokeWidth && strokeWidth > 0) {\n\t\t\t\t\tmainElement = (\n\t\t\t\t\t\t<use\n\t\t\t\t\t\t\txlinkHref={internalShapeId.link}\n\t\t\t\t\t\t\tfill={vectorFill}\n\t\t\t\t\t\t\tfillOpacity={fillOpacity}\n\t\t\t\t\t\t\tstrokeOpacity=\"0\"\n\t\t\t\t\t\t\tname={currentName}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t\tstrokeElement = (\n\t\t\t\t\t\t<use\n\t\t\t\t\t\t\txlinkHref={internalShapeId.link}\n\t\t\t\t\t\t\tclipPath={internalStrokeClipId.urlLink}\n\t\t\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\t\t\t{...svgStrokeAttributes}\n\t\t\t\t\t\t\tstrokeWidth={strokeWidth}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\tmainElement = (\n\t\t\t\t\t\t<use\n\t\t\t\t\t\t\txlinkHref={internalShapeId.link}\n\t\t\t\t\t\t\tfill={vectorFill}\n\t\t\t\t\t\t\tfillOpacity={fillOpacity}\n\t\t\t\t\t\t\tclipPath={internalStrokeClipId.urlLink}\n\t\t\t\t\t\t\t{...svgStrokeAttributes}\n\t\t\t\t\t\t\tstrokeWidth={strokeWidth}\n\t\t\t\t\t\t\tname={currentName}\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\tpathAttributes.id = idAttribute\n\t\t\t\tmainElement = (\n\t\t\t\t\t<motion.path\n\t\t\t\t\t\t{...{\n\t\t\t\t\t\t\t...pathAttributes,\n\t\t\t\t\t\t\tfill: vectorFill,\n\t\t\t\t\t\t\t...svgStrokeAttributes,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tname={currentName}\n\t\t\t\t\t\tfillOpacity={fillOpacity}\n\t\t\t\t\t\tvariants={variants}\n\t\t\t\t\t\ttransition={transition}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst imagePatternElement = imagePattern ? (\n\t\t\t\t<ImagePatternElement {...imagePattern} repeat={BackgroundImage.isImageObject(fill) && fill.fit === \"tile\"} />\n\t\t\t) : undefined\n\t\t\tlet gradient: JSX.Element | undefined\n\t\t\tif (linearGradient) {\n\t\t\t\tgradient = <LinearGradientElement {...linearGradient} />\n\t\t\t} else if (radialGradient) {\n\t\t\t\tgradient = <RadialGradientElement {...radialGradient} />\n\t\t\t}\n\n\t\t\tlet defs: JSX.Element | null = null\n\t\t\tif (\n\t\t\t\tshapeReference ||\n\t\t\t\tstrokeClipPath ||\n\t\t\t\t(shadow.definition && shadow.definition.length) ||\n\t\t\t\tgradient ||\n\t\t\t\timagePatternElement\n\t\t\t) {\n\t\t\t\tdefs = (\n\t\t\t\t\t<defs>\n\t\t\t\t\t\t{shapeReference}\n\t\t\t\t\t\t{strokeClipPath}\n\t\t\t\t\t\t{shadow.definition}\n\t\t\t\t\t\t{gradient}\n\t\t\t\t\t\t{imagePatternElement}\n\t\t\t\t\t</defs>\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// Generated Components with variants require a default value to animate to/from.\n\t\t\tconst opacityValue = opacity ?? (variants ? 1 : undefined)\n\t\t\tif (defs === null && shadow.outsetElement === null && shadow.insetElement === null && strokeElement === null) {\n\t\t\t\t// Render the mainElement with opacity\n\t\t\t\tmainElement = (\n\t\t\t\t\t<motion.path\n\t\t\t\t\t\t{...{\n\t\t\t\t\t\t\t...pathAttributes,\n\t\t\t\t\t\t\tfill: vectorFill,\n\t\t\t\t\t\t\t...svgStrokeAttributes,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tfillOpacity={fillOpacity}\n\t\t\t\t\t\topacity={opacityValue}\n\t\t\t\t\t\tvariants={variants}\n\t\t\t\t\t\ttransition={transition}\n\t\t\t\t\t\tname={currentName}\n\t\t\t\t\t/>\n\t\t\t\t)\n\n\t\t\t\t// Don't group the main element if not needed:\n\t\t\t\treturn this.renderElement(mainElement)\n\t\t\t}\n\n\t\t\treturn this.renderElement(\n\t\t\t\t<motion.g opacity={opacityValue} variants={variants} transition={transition}>\n\t\t\t\t\t{defs}\n\t\t\t\t\t{shadow.maskElement}\n\t\t\t\t\t{shadow.outsetElement}\n\t\t\t\t\t{mainElement}\n\t\t\t\t\t{shadow.insetElement}\n\t\t\t\t\t{strokeElement}\n\t\t\t\t</motion.g>,\n\t\t\t)\n\t\t}\n\n\t\tprivate renderElement(element: JSX.Element) {\n\t\t\tconst { id, isRootVectorNode, width, height, includeTransform, left, top, style, _needsMeasure } = this.props\n\n\t\t\tif (!isRootVectorNode) return element\n\t\t\tif (includeTransform) return element\n\n\t\t\t/**\n\t\t\t * @TODO For generated components, this <svg> wrapper needs to become a\n\t\t\t * <motion.svg> and animate it's changes to width/height with layout,\n\t\t\t * and translate x & y with variants.\n\t\t\t */\n\t\t\treturn (\n\t\t\t\t<SVGRoot\n\t\t\t\t\tid={id}\n\t\t\t\t\twidth={width}\n\t\t\t\t\theight={height}\n\t\t\t\t\tleft={left}\n\t\t\t\t\ttop={top}\n\t\t\t\t\tstyle={style}\n\t\t\t\t\t_needsMeasure={_needsMeasure}\n\t\t\t\t>\n\t\t\t\t\t{element}\n\t\t\t\t</SVGRoot>\n\t\t\t)\n\t\t}\n\t}\n})()\n", "import { RenderEnvironment, RenderTarget } from \"../types/RenderEnvironment.ts\"\nimport { transformValues } from \"../utils/createTransformValues.ts\"\nimport { countNodeRender } from \"../utils/performanceDebugging.ts\"\nimport { transformString } from \"../utils/transformString.ts\"\nimport type { LayerProps } from \"./Layer.tsx\"\nimport { Layer } from \"./Layer.tsx\"\nimport { SVGRoot } from \"./SVGRoot.tsx\"\n\n/**\n * @internal\n */\nexport interface VectorGroupProps {\n\tname?: string\n\topacity?: number\n\tx: number\n\ty: number\n\t// left & top is only used for root level shapes to position the SVG. They would be rounded to\n\t// half pixels to avoid SVG rendering issues.\n\tleft: number\n\ttop: number\n\trotation: number\n\twidth: number\n\theight: number\n\ttargetName?: string\n\tdefaultName: string\n\tisRootVectorNode: boolean\n\tincludeTransform?: boolean\n\tvisible?: boolean\n}\n/**\n * @internal\n */\nexport interface VectorGroupProperties extends VectorGroupProps, LayerProps {\n\tstyle?: React.CSSProperties\n}\n\ndeclare class VectorGroupType extends Layer<VectorGroupProperties, Record<string, never>> {\n\tstatic defaultVectorGroupProps: VectorGroupProps\n\tstatic readonly defaultProps: VectorGroupProperties\n}\n\n/**\n * @internal\n */\nexport const VectorGroup: typeof VectorGroupType = /* @__PURE__ */ (() => {\n\treturn class VectorGroupInner extends Layer<VectorGroupProperties, Record<string, never>> {\n\t\tstatic defaultVectorGroupProps: VectorGroupProps = {\n\t\t\tname: undefined,\n\t\t\topacity: undefined,\n\t\t\tvisible: true,\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tleft: 0,\n\t\t\ttop: 0,\n\t\t\trotation: 0,\n\t\t\twidth: 100,\n\t\t\theight: 100,\n\t\t\ttargetName: undefined,\n\t\t\tdefaultName: \"\",\n\t\t\tisRootVectorNode: false,\n\t\t\tincludeTransform: undefined,\n\t\t}\n\n\t\tstatic override readonly defaultProps: VectorGroupProperties = {\n\t\t\t...Layer.defaultProps,\n\t\t\t...VectorGroupInner.defaultVectorGroupProps,\n\t\t}\n\n\t\toverride render(): JSX.Element | null {\n\t\t\tcountNodeRender()\n\n\t\t\tconst {\n\t\t\t\tname: nameProp,\n\t\t\t\topacity,\n\t\t\t\tvisible,\n\t\t\t\ttargetName,\n\t\t\t\tdefaultName,\n\t\t\t\tchildren,\n\t\t\t\tincludeTransform,\n\t\t\t\tx,\n\t\t\t\ty,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\trotation,\n\t\t\t\tisRootVectorNode,\n\t\t\t} = this.props\n\n\t\t\tif (!visible) return null\n\t\t\tconst { target } = RenderEnvironment\n\n\t\t\tconst rect = { x, y, width, height }\n\t\t\tconst transform = transformValues(rect, rotation, isRootVectorNode, includeTransform)\n\n\t\t\tconst addNames = target === RenderTarget.preview\n\t\t\tlet name: string | undefined = undefined\n\t\t\tif (addNames) {\n\t\t\t\tif (targetName) {\n\t\t\t\t\tname = targetName\n\t\t\t\t} else if (nameProp) {\n\t\t\t\t\tname = nameProp\n\t\t\t\t} else {\n\t\t\t\t\tname = defaultName\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this.renderElement(\n\t\t\t\t<g transform={transformString(transform)} {...{ name, opacity }}>\n\t\t\t\t\t{children}\n\t\t\t\t</g>,\n\t\t\t)\n\t\t}\n\n\t\tprivate renderElement(element: JSX.Element) {\n\t\t\tconst { id, isRootVectorNode, width, height, includeTransform, left, top, style, _needsMeasure } = this.props\n\n\t\t\tif (!isRootVectorNode) return element\n\t\t\tif (includeTransform) return element\n\n\t\t\treturn (\n\t\t\t\t<SVGRoot\n\t\t\t\t\tid={id}\n\t\t\t\t\tleft={left}\n\t\t\t\t\ttop={top}\n\t\t\t\t\twidth={width}\n\t\t\t\t\theight={height}\n\t\t\t\t\tstyle={style}\n\t\t\t\t\t_needsMeasure={_needsMeasure}\n\t\t\t\t>\n\t\t\t\t\t{element}\n\t\t\t\t</SVGRoot>\n\t\t\t)\n\t\t}\n\t}\n})()\n", "import { isObject } from \"../../utils/utils.ts\"\nimport type { WithPaths } from \"./Path.ts\"\n\n/**\n * @internal\n */\nexport interface WithShape {\n\tcalculatedPaths(): WithPaths\n}\n\nconst key: keyof WithShape = \"calculatedPaths\"\n\n/**\n * @internal\n */\nexport function withShape(target: unknown): target is WithShape {\n\tif (!isObject(target)) return false\n\treturn key in target\n}\n", "/**\n * @public\n */\nexport interface Size {\n\twidth: number\n\theight: number\n}\n\nexport const Size = /* @__PURE__ */ (() => {\n\t/**\n\t * @public\n\t */\n\tfunction Size(width: number, height: number): Size {\n\t\treturn { width, height }\n\t}\n\n\t/**\n\t * @param sizeA -\n\t * @param sizeB -\n\t * @internal\n\t */\n\tSize.equals = (sizeA: Size | null, sizeB: Size | null) => {\n\t\tif (sizeA === sizeB) return true\n\t\tif (!sizeA || !sizeB) return false\n\t\treturn sizeA.width === sizeB.width && sizeA.height === sizeB.height\n\t}\n\n\t/**\n\t *\n\t * @param fromSize - The initial size\n\t * @param toSize - The size to update to\n\t * @param keepAspectRatio - If the updating should preserve the aspect ratio\n\t * @remarks\n\t * keepAspectRatio only works if passing a toSize with only a width or height\n\t * @internal\n\t */\n\tSize.update = (fromSize: Size, toSize: Partial<Size>, keepAspectRatio = false) => {\n\t\tlet { width, height } = fromSize\n\t\tconst sizeRatio = width / height\n\n\t\t// Update from partial\n\t\twidth = toSize.width !== undefined ? toSize.width : width\n\t\theight = toSize.height !== undefined ? toSize.height : height\n\n\t\t// Overwrite if we want and can keep the aspect ratio\n\t\tif (keepAspectRatio) {\n\t\t\tif (toSize.width === undefined && toSize.height !== undefined) {\n\t\t\t\twidth = toSize.height * sizeRatio\n\t\t\t}\n\t\t\tif (toSize.width !== undefined && toSize.height === undefined && sizeRatio !== 0) {\n\t\t\t\theight = toSize.width / sizeRatio\n\t\t\t}\n\t\t}\n\n\t\treturn { width, height }\n\t}\n\n\t/**\n\t *\n\t * @param sizeA -\n\t * @param sizeB -\n\t * @internal\n\t */\n\tSize.subtract = (sizeA: Size, sizeB: Size) => {\n\t\treturn {\n\t\t\twidth: Math.max(0, sizeA.width - sizeB.width),\n\t\t\theight: Math.max(0, sizeA.height - sizeB.height),\n\t\t}\n\t}\n\n\t/**\n\t * @public\n\t */\n\tSize.zero = Size(0, 0)\n\n\t/**\n\t * Checks if the size has a zero width and zero height\n\t * @param size - size to check\n\t * @public\n\t */\n\tSize.isZero = function (size: Size) {\n\t\treturn size === Size.zero || (size.width === 0 && size.height === 0)\n\t}\n\n\t/**\n\t * @param width -\n\t * @param height -\n\t * @param size -\n\t * @internal\n\t */\n\tSize.defaultIfZero = function (width: number, height: number, size: Size) {\n\t\tif (Size.isZero(size)) {\n\t\t\treturn Size(width, height)\n\t\t} // else\n\t\treturn size\n\t}\n\n\treturn Size\n})()\n", "// When applied to a type, JSON.stringify will append a \"__type__\" field to the outputted JSON string. This\n// can be used to re-instatiate an object of the correct type when deserializing the JSON.\n/** @internal */\nexport function annotateTypeOnStringify<T>(ctor: new (...args: any[]) => T, typeName: string) {\n\tconst existingToJSON = ctor.prototype.toJSON\n\tctor.prototype.toJSON = function () {\n\t\tconst base = existingToJSON ? existingToJSON.apply(this) : this\n\t\treturn Object.assign({}, base, { __type__: typeName })\n\t}\n\treturn ctor // moot; but seems like the sensical thing to do.\n}\n\n/** @internal */\nexport function isOfAnnotatedType(object: any, typeName: string) {\n\treturn object && object.__type__ && object.__type__ === typeName\n}\n", "const LOADING_LAZY_THRESHOLD = 1000\n\n/** @internal */\nexport function getLoadingLazyAtYPosition(offset: number) {\n\treturn offset > LOADING_LAZY_THRESHOLD ? \"lazy\" : undefined\n}\n", "import type { FillProperties } from \"../traits/Fill.ts\"\nimport type { WithShape } from \"../traits/Shape.ts\"\nimport { LinearGradient, RadialGradient } from \"../types/Gradient.ts\"\nimport type {\n\tLinearGradientElementProperties,\n\tRadialGradientElementProperties,\n} from \"./elementPropertiesForGradient.ts\"\nimport {\n\telementPropertiesForLinearGradient,\n\telementPropertiesForRadialGradient,\n} from \"./elementPropertiesForGradient.ts\"\n\n/**\n * @internal\n */\nexport function gradientForShape(\n\tnodeId: string,\n\tnode: WithShape & FillProperties,\n): LinearGradientElementProperties | RadialGradientElementProperties | undefined {\n\tif (LinearGradient.isLinearGradient(node.fill)) {\n\t\treturn elementPropertiesForLinearGradient(node.fill, nodeId)\n\t}\n\tif (RadialGradient.isRadialGradient(node.fill)) {\n\t\treturn elementPropertiesForRadialGradient(node.fill, nodeId)\n\t}\n\treturn undefined\n}\n", "import { safeWindow } from \"../../utils/safeWindow.ts\"\n\n/**\n *  @internal\n *  @deprecated - don't use outside of Library anymore.\n */\nexport function throttle<T extends any[]>(fn: (...args: T) => void, time: number): (...args: T) => void {\n\tlet previous = 0\n\tlet timeout: number | undefined\n\n\tconst later = (...args: T) => {\n\t\tprevious = Date.now()\n\t\ttimeout = undefined\n\t\tfn(...args)\n\t}\n\n\treturn (...args: T) => {\n\t\tconst now = Date.now()\n\t\tconst remaining = time - (now - previous)\n\t\tif (remaining <= 0 || remaining > time) {\n\t\t\tif (timeout) {\n\t\t\t\tsafeWindow.clearTimeout(timeout)\n\t\t\t\ttimeout = undefined\n\t\t\t}\n\t\t\tprevious = now\n\t\t\tfn(...args)\n\t\t} else if (!timeout) {\n\t\t\ttimeout = safeWindow.setTimeout(later, remaining, ...args)\n\t\t}\n\t}\n}\n", "import type { Action, ActionControls } from \"../render/types/Action.ts\"\nimport { runtime } from \"./runtimeInjection.ts\"\n\n/**\n * @internal\n */\nexport interface ActionInfo {\n\tcontrols: ActionControls<any>\n\ttitle?: string\n}\n\n/**\n * Provide a title and controls for an action, used in the Framer UI\n * @param action - a reference to an {@link Action}\n * @param title - the display title of the action\n * @param controls - the action controls\n * @internal\n */\nexport function addActionControls<Options extends { [key: string]: any }>(\n\taction: Action<Options>,\n\ttitle: string,\n\tcontrols: ActionControls<Options>,\n) {\n\truntime.addActionControls(action, title, controls)\n}\n", "import { emptyArray } from \"@framerjs/shared/src/emptyArray.ts\"\nimport type React from \"react\"\nimport { FRAMER_VARIABLE_FONT_SUFFIX } from \"../render/fonts/css.ts\"\nimport type { FontSourceName, ReadonlyFontVariationAxes } from \"../render/fonts/types.ts\"\nimport { FontSourceNames } from \"../render/fonts/types.ts\"\n\n/**\n * An older (pre-Feb 2024) version of ComponentFont that doesn\u2019t include the `source` field. This\n * version was introduced in the same PR that introduced ComponentFontBundle, thus upgrading from\n * ComponentFontV1 to ComponentFontV2 also involves wrapping ComponentFontV1s into a\n * ComponentFontBundle.\n *\n * While this version of ComponentFont is not used internally, it may still be passed into\n * `addFonts()` by older versions of smart components.\n */\nexport interface ComponentFontV1 {\n\turl: string\n\tfamily: string\n\n\t/**\n\t * Provides an alternative way to determine the font's URL in local modules,\n\t * by resolving `moduleAsset.url` (e.g., `assets/font.otf`) against the base\n\t * URL of the module given by the `localModuleIdentifier`.\n\t *\n\t * This exists to solve [a very specific problem with fonts in exported\n\t * prototypes][1], so even if we decide to make `addFonts` public, this\n\t * should probably stay internal.\n\t *\n\t * [1]: https://framer-team.slack.com/archives/C01UY26JGBB/p1623924715174900\n\t *\n\t * @internal\n\t *\n\t * @deprecated These days, we use absolute framerusercontent.com/assets URLs\n\t * for fonts, so there's no need to populate this field anymore\u2014but note\n\t * that existing components might still be using old module-relative URLs.\n\t */\n\tmoduleAsset?: { url: string; localModuleIdentifier?: string }\n\n\t// Font descriptors should match the [FontFaceDescriptors][1] defined in the\n\t// CSS Font Loading spec. This will allow us to use them as-is in FontFace\n\t// and `@font-face`, without the need for any further conversions.\n\t//\n\t// [1]: https://drafts.csswg.org/css-font-loading/#dictdef-fontfacedescriptors\n\tstyle?: string\n\tweight?: string\n\tstretch?: string\n\tunicodeRange?: string\n}\n\n/**\n * An older (pre-Sep 2025) version of ComponentFont that doesn\u2019t include the `cssFontFamily` field.\n *\n * While this version of ComponentFont is not used internally, it may still be passed into\n * `addFonts()` by older versions of smart components.\n */\nexport interface ComponentFontV2 extends ComponentFontV1 {\n\tsource: FontSourceName\n\tvariationAxes?: ReadonlyFontVariationAxes\n\t/**\n\t * This flag specifies whether the font has any applied OpenType features on\n\t * the node that uses it.\n\t *\n\t * This flag solves a very narrow problem: Google Fonts CSS API subsetting strips\n\t * OpenType features off fonts [1]. Therefore, when any component enables OpenType\n\t * on a Google font, we should disable subsetting. This flag signals us to do that.\n\t * It\u2019s very specific, is used only for Google Fonts, and is tightly coupled to how we do\n\t * font generation when publishing a site, so it should stay internal.\n\t *\n\t * [1] https://www.notion.so/framer/OpenType-Features-for-Google-Fonts-176adf6e8c968049af7afda39fab11b3?pvs=4#17cadf6e8c968000b86ee910b236c37a\n\t *\n\t * @internal\n\t */\n\topenType?: boolean\n}\n\n/**\n * Describes a single font used by a component. Unlike [Font](../render/fonts/types.ts) objects\n * which are fetched from the Google/Fontshare/etc APIs every time the canvas is loaded (and die\n * when the canvas is unloaded), these objects get serialized into codegenerated web pages and\n * components.\n *\n * @public\n */\nexport interface ComponentFont extends Omit<ComponentFontV2, \"family\"> {\n\t/**\n\t * Font family name, as defined in the source that provides the font.\n\t *\n\t * @internal\n\t */\n\tuiFamilyName: string\n\t/**\n\t * Defines a font\u2019s `font-family` property. The value of this field:\n\t * - must go into `@font-face` when loading the font\n\t * - will be used by DOM nodes inside the component (e.g. `style={fontFamily: \"XXX\"}`).\n\t *\n\t * In generated code, this will often (but not always) match the `uiFamilyName` field. E.g., as\n\t * of Sep 2025, most regular fonts will have the same `uiFamilyName` and `cssFamilyName`,\n\t * but variable fonts will have `cssFamilyName` as `${uiFamilyName} Variable`, and custom\n\t * fonts will have `cssFamilyName` as the selector.\n\t *\n\t * @internal\n\t */\n\tcssFamilyName: string\n}\n\n/**\n * Describes a bundle of fonts used by a single component, together with feature\n * flags to indicate which font features that component supported at the time of\n * codegen.\n */\nexport interface ComponentFontBundle<T extends ComponentFontV2 | ComponentFont = ComponentFont> {\n\t/**\n\t * This flag specifies whether the font bundle includes the specific font\n\t * weights of Framer\u2019s Inter font that the component uses. New smart\n\t * components do that (which means we can emit CSS only for Inter fonts that\n\t * are actually used); older smart components don\u2019t (which means some places\n\t * will emit CSS for all Inter fonts if this flag is not set).\n\t * https://www.notion.so/framer/RFC-ComponentFont-v2-d5fd3e822fb049ffb6971554ab0e4e42\n\t */\n\texplicitInter: boolean\n\tfonts: T[]\n}\n\n/** @public */\nexport function addFonts(\n\tcomponent: React.ComponentType<unknown>,\n\tfontsOrBundles: (ComponentFontV1 | ComponentFontBundle<ComponentFontV2 | ComponentFont>)[],\n\tflags?: { supportsExplicitInterCodegen?: boolean },\n): void {\n\tconst bundles = upgradeFontBundlesAsNeeded(fontsOrBundles)\n\n\t// Upgrade path (v1 -> v2): old components will call `addFonts` like this:\n\t//   addFonts(MyComponent, [<component\u2019s own fonts>, ...getFonts(ChildComponent1), ...getFonts(ChildComponent2), ...fontPreset1.fonts, ...fontPreset2.fonts])\n\t// With this notation, we can\u2019t distinguish between fontPreset1.fonts being empty\n\t// (which means the preset might use Inter) and missing. So as a precaution,\n\t// we make sure we always emit Inter if `addFonts` is called from an old component.\n\tif (\n\t\t!flags?.supportsExplicitInterCodegen &&\n\t\t// Only emit an `explicitInter: false` bundle if we don\u2019t already have one.\n\t\t!bundles.some(font => font.explicitInter === false)\n\t) {\n\t\tbundles.push({ explicitInter: false, fonts: [] })\n\t}\n\n\tObject.assign(component, { fonts: bundles })\n}\n\n/** @public */\nexport function getFonts(component: React.ComponentType<unknown>): ComponentFontBundle[] {\n\tif (!component) return emptyArray() as ComponentFontBundle[]\n\n\t// No need to transform fonts using `convertMixedFontArrayToFontBundles` here,\n\t// since this was already done in `addFonts`.\n\tconst fonts = (component as { fonts?: ComponentFontBundle[] }).fonts\n\treturn fonts ?? (emptyArray() as ComponentFontBundle[])\n}\n\n/** @internal */\nexport function getFontsFromSharedStyle(\n\tfontsOrBundles: (ComponentFontV1 | ComponentFontBundle<ComponentFontV2 | ComponentFont>)[],\n): ComponentFontBundle[] {\n\t// Upgrade path: old shared style arrays might emit an empty array both when\n\t// they have no fonts at all, and when they only use Inter. We can\u2019t\n\t// differentiate between these cases, so as a precaution, we emit a font\n\t// bundle with `explicitInter: false`.\n\t//\n\t// (Modern shared style arrays will never emit an empty array \u2013 instead, when\n\t// they use no fonts, they\u2019ll emit an array with an empty\n\t// ComponentFontBundle.)\n\tif (fontsOrBundles.length === 0) return [{ explicitInter: false, fonts: [] }]\n\n\treturn upgradeFontBundlesAsNeeded(fontsOrBundles)\n}\n\n/** @internal */\nexport function getFontsFromComponentPreset(\n\tfonts: (ComponentFontV1 | ComponentFontBundle<ComponentFontV2 | ComponentFont>)[],\n): ComponentFontBundle[] {\n\t// Upgrade path: same as in `getFontsFromSharedStyle()`.\n\tif (fonts.length === 0) return [{ explicitInter: false, fonts: [] }]\n\n\treturn upgradeFontBundlesAsNeeded(fonts)\n}\n\nfunction upgradeFontBundlesAsNeeded(\n\tfonts: (ComponentFontV1 | ComponentFontBundle<ComponentFontV2 | ComponentFont>)[],\n): ComponentFontBundle[] {\n\tconst oldFontBundle: ComponentFontBundle = { explicitInter: false, fonts: [] }\n\tconst fontBundles: ComponentFontBundle[] = []\n\n\t// To avoid iterating over all fonts several times, we\u2019re doing all upgrades in a single pass:\n\t// 1) v1 -> v2: upgrade any individual fonts into font bundles. Only old components (those that\n\t//    don\u2019t emit Inter explicitly) emit fonts as plain ComponentFont objects. (All modern ones\n\t//    will emit a ComponentFontBundle.) So if we receive any regular fonts, we wrap them into a\n\t//    single bundle with `explicitInter: false`.\n\t// 2) v1 \u2192 v2: also add the source field to the fonts\n\t// 3) v2 \u2192 v3: also add the cssFontFamily field to the fonts\n\tfor (const fontOrBundle of fonts) {\n\t\tif (isComponentFontBundle(fontOrBundle)) {\n\t\t\tfontBundles.push({\n\t\t\t\texplicitInter: fontOrBundle.explicitInter,\n\t\t\t\tfonts: fontOrBundle.fonts.map(upgradeComponentFont),\n\t\t\t})\n\t\t} else {\n\t\t\toldFontBundle.fonts.push(upgradeComponentFont(fontOrBundle))\n\t\t}\n\t}\n\n\tif (oldFontBundle.fonts.length > 0) fontBundles.push(oldFontBundle)\n\n\treturn fontBundles\n}\n\nconst componentFontBundleKey: keyof ComponentFontBundle = \"explicitInter\"\n/** @internal */\nexport function isComponentFontBundle<T extends ComponentFontV2 | ComponentFont>(\n\tfont: ComponentFontV1 | ComponentFontBundle<T>,\n): font is ComponentFontBundle<T> {\n\treturn componentFontBundleKey in font\n}\n\nfunction upgradeComponentFont(font: ComponentFontV1 | ComponentFontV2 | ComponentFont): ComponentFont {\n\tconst fontV2 = hasComponentFontV2(font) || hasComponentFontV3(font) ? font : upgradeToComponentFontV2(font)\n\tconst fontV3 = hasComponentFontV3(fontV2) ? fontV2 : upgradeToComponentFontV3(fontV2)\n\treturn fontV3\n}\n\nfunction hasComponentFontV2(font: ComponentFontV1 | ComponentFontV2 | ComponentFont): font is ComponentFontV2 {\n\tconst key: keyof ComponentFontV2 = \"source\"\n\treturn key in font\n}\n\nfunction hasComponentFontV3(font: ComponentFontV1 | ComponentFontV2 | ComponentFont): font is ComponentFont {\n\tconst key: keyof ComponentFont = \"cssFamilyName\"\n\treturn key in font\n}\n\n/** Upgrades an older ComponentFontV1 present in code-generated sources to the modern ComponentFont version. */\nfunction upgradeToComponentFontV2(font: ComponentFontV1): ComponentFontV2 | ComponentFont {\n\tlet source: FontSourceName\n\t// These strings are safe to hard-code, since this code path will only get\n\t// invoked by smart components compiled before Feb 2024. Any changes to the\n\t// URLs will require recompiling the smart components, which will also\n\t// update font objects and switch to a different code path.\n\tif (font.url.startsWith(\"https://fonts.gstatic.com/s/\")) {\n\t\tsource = FontSourceNames.Google\n\t} else if (font.url.startsWith(\"https://framerusercontent.com/third-party-assets/fontshare/\")) {\n\t\tsource = FontSourceNames.Fontshare\n\t} else {\n\t\t// We don\u2019t expect anyone to link directly to Framer Inter or local fonts\n\t\tsource = FontSourceNames.Custom\n\t}\n\n\treturn {\n\t\t...font,\n\t\tsource,\n\t}\n}\n\nfunction upgradeToComponentFontV3(font: ComponentFontV2): ComponentFont {\n\tconst { family, ...rest } = font\n\tconst cssFamilyName =\n\t\t// `font.source !== FontSourceNames.Custom` mimics the pre-ComponentFontV3 Vekter logic.\n\t\t// Without this, CSS font families used in `style={{ fontFamily: ... }}` won\u2019t match\n\t\t// `ComponentFont.cssFontFamily`s\n\t\tfont.variationAxes && font.source !== FontSourceNames.Custom ? `${family} ${FRAMER_VARIABLE_FONT_SUFFIX}` : family\n\treturn {\n\t\t...rest,\n\t\tuiFamilyName: family,\n\t\tcssFamilyName,\n\t}\n}\n", "export function withPerformanceMarks(prefix: string, callback: CallableFunction) {\n\tconst markStart = `${prefix}-start`\n\tperformance.mark(markStart)\n\tcallback()\n\tconst markEnd = `${prefix}-end`\n\tperformance.mark(markEnd)\n\tperformance.measure(prefix, markStart, markEnd)\n}\n", "// Re-export environment utilities from @framerjs/shared for backwards compatibility.\n// Do not import this file in library code. Internal library code should import directly\n// from @framerjs/shared/src/environment.ts.\nimport {\n\tchromeMainVersion,\n\tdeviceType,\n\tisAndroid,\n\tisBrowser,\n\tisChrome,\n\tisDataUrl,\n\tisDesktop,\n\tisEdge,\n\tisEmbedded,\n\tisFileUrl,\n\tisFirefox,\n\tisFramerX,\n\tisIOS,\n\tisLocalServerUrl,\n\tisLocalUrl,\n\tisMacOS,\n\tisMobile,\n\tisPhone,\n\tisRelativeUrl,\n\tisSafari,\n\tisTablet,\n\tisTest,\n\tisTouch,\n\tisWebKit,\n\tisWindows,\n\tsafariVersion,\n} from \"@framerjs/shared/src/environment.ts\"\n\n// The below utils are not used anywhere and thus are only defined for backwards compatibility\n// with the `environment` export.\ntype DeviceOS = \"macos\" | \"ios\" | \"android\" | \"windows\"\n\nfunction deviceOS(): DeviceOS | undefined {\n\tif (isMacOS()) return \"macos\"\n\tif (isIOS()) return \"ios\"\n\tif (isAndroid()) return \"android\"\n\tif (isWindows()) return \"windows\"\n\treturn undefined\n}\n\nfunction deviceFont(os?: DeviceOS): string {\n\t// https://github.com/jonathantneal/system-font-css\n\tif (!os) {\n\t\tos = deviceOS()\n\t}\n\n\tconst fonts = {\n\t\tapple: \"-apple-system, BlinkMacSystemFont, SF Pro Text, SF UI Text, Helvetica Neue\",\n\t\tgoogle: \"Roboto, Helvetica Neue\",\n\t\tmicrosoft: \"Segoe UI, Helvetica Neue\",\n\t}\n\n\tif (os === \"macos\") return fonts.apple\n\tif (os === \"ios\") return fonts.apple\n\tif (os === \"android\") return fonts.google\n\tif (os === \"windows\") return fonts.microsoft\n\n\treturn fonts.apple\n}\n\n// XXX: Workaround for https://github.com/microsoft/rushstack/issues/1029\n/** @internal */\n/** @deprecated Exported only for backwards compatibility; import directly from @framerjs/shared/src/environment.ts instead. */\nexport const environment = {\n\tchromeMainVersion,\n\tdeviceFont,\n\tdeviceOS,\n\tdeviceType,\n\tisAndroid,\n\tisBrowser,\n\tisChrome,\n\tisDataUrl,\n\tisDesktop,\n\tisEdge,\n\tisEmbedded,\n\tisFileUrl,\n\tisFirefox,\n\tisFramerX,\n\tisIOS,\n\tisLocalServerUrl,\n\tisLocalUrl,\n\tisMacOS,\n\tisMobile,\n\tisPhone,\n\tisRelativeUrl,\n\tisSafari,\n\tisTablet,\n\tisTest,\n\tisTouch,\n\tisWebKit,\n\tisWindows,\n\tsafariVersion,\n}\n", "/**\n * @internal\n */\nexport function loadJSON<T>(url: string): Promise<T> {\n\treturn fetch(url, { mode: \"cors\" }).then(res => res.json())\n}\n", "// Direct port of the old Framer equivalent:\n// https://github.com/koenbok/Framer/blob/master/framer/Utils.coffee#L225\n\nexport function inspectObjectType(item: any) {\n\t// This is a hacky way to get nice object names, it tries to\n\t// parse them from the .toString methods for objects.\n\n\tlet className\n\tif (\n\t\t(item.constructor !== null ? item.constructor.name : undefined) !== null &&\n\t\t(item.constructor !== null ? item.constructor.name : undefined) !== \"Object\"\n\t) {\n\t\treturn item.constructor.name\n\t}\n\n\tconst extract = function (str: string) {\n\t\tif (!str) {\n\t\t\treturn null\n\t\t}\n\t\tconst regex = /\\[object (\\w+)\\]/u\n\t\tconst match = regex.exec(str)\n\t\tif (match) {\n\t\t\treturn match[1]\n\t\t}\n\t\treturn null\n\t}\n\n\tif (item.toString) {\n\t\tclassName = extract(item.toString())\n\t\tif (className) {\n\t\t\treturn className\n\t\t}\n\t}\n\n\tif (item.constructor !== null ? item.constructor.toString : undefined) {\n\t\tclassName = extract(item.constructor !== null ? item.constructor.toString() : undefined)\n\t\tif (className) {\n\t\t\treturn className.replace(\"Constructor\", \"\")\n\t\t}\n\t}\n\n\treturn \"Object\"\n}\n", "// Direct port of the old Framer equivalent:\n// https://github.com/koenbok/Framer/blob/master/framer/Utils.coffee#L249\n\nimport { inspectObjectType } from \"./inspectObjectType.ts\"\nimport { isArray, isFunction, isNumber, isObject, isString } from \"./utils.ts\"\n\nexport function inspect(item: unknown, max?: number, l?: number): string {\n\tif (max === undefined) {\n\t\tmax = 5\n\t}\n\tif (l === undefined) {\n\t\tl = 0\n\t}\n\tif (item === null) {\n\t\treturn \"null\"\n\t}\n\tif (item === undefined) {\n\t\treturn \"undefined\"\n\t}\n\n\tif (isObject(item) && isFunction(item.toInspect)) {\n\t\treturn (item.toInspect as () => string)()\n\t}\n\tif (isString(item)) {\n\t\treturn `\"${item}\"`\n\t}\n\tif (isNumber(item)) {\n\t\treturn `${item}`\n\t}\n\tif (isFunction(item)) {\n\t\tlet code = item.toString().slice(\"function \".length).replace(/\\n/gu, \"\").replace(/\\s+/gu, \" \")\n\t\t// We limit the size of a function body if it's in a structure\n\t\tconst limit = 50\n\t\tif (code.length > limit && l > 0) {\n\t\t\tcode = `${code.slice(0, limit + 1).trim()}\u2026 }`\n\t\t}\n\t\treturn `<Function ${code}>`\n\t}\n\tif (isArray(item)) {\n\t\tif (l > max) {\n\t\t\treturn \"[...]\"\n\t\t}\n\t\treturn `[${item.map(i => inspect(i, max, (l || 0) + 1)).join(\", \")}]`\n\t}\n\tif (isObject(item)) {\n\t\tlet objectInfo\n\t\tconst objectType = inspectObjectType(item)\n\t\t// We should not loop over dom trees because we will have a bad time\n\t\tif (/HTML\\w+?Element/u.test(objectType)) {\n\t\t\treturn `<${objectType}>`\n\t\t}\n\t\tif (l > max) {\n\t\t\tobjectInfo = \"{...}\"\n\t\t} else {\n\t\t\tconst itemKeys = Object.keys(item)\n\t\t\tobjectInfo = `{${itemKeys.map(k => `${k}:${inspect(item[k], max, (l || 0) + 1)}`).join(\", \")}}`\n\t\t}\n\t\tif (objectType === \"Object\") {\n\t\t\treturn objectInfo\n\t\t}\n\t\treturn `<${objectType} ${objectInfo}>`\n\t}\n\n\treturn `${item}`\n}\n", "import { inspect } from \"./inspect.ts\"\n\n/**\n * Prints to the console.\n *\n * @param args - Arguments to print\n * @public\n */\nexport function print(...args: any[]) {\n\tconst line = args\n\t\t.map(arg => {\n\t\t\treturn inspect(arg)\n\t\t})\n\t\t.join(\", \")\n\n\t// For now, output to console. Further work tracked under:\n\t// https://github.com/framer/company/issues/8142\n\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\tconsole.log(line)\n}\n", "import { useEffect, useState } from \"react\"\nimport { withPreload } from \"../modules/usePrototypeNavigate.tsx\"\nimport type { RouteComponent, Routes } from \"../router/types.ts\"\n\nfunction initialRouteComponent(component: RouteComponent | undefined): RouteComponent | null {\n\tif (!component) return null\n\tif (withPreload(component)) return null\n\treturn component\n}\n\n/**\n * Workaround for SSG + React.Suspense \uD83D\uDCA5 ReactDomServer currently does not support Suspense in\n * React 17, and will fail if it encounters Suspense. To work around this, we have to implement a\n * simple version of Suspense ourselves. To do this we use this hook to fetch the initial route of a\n * prototype, and only render the component after it has been fetched.\n * @internal\n * @deprecated used by canvas pages only\n */\nexport function useInitialRouteComponent(routes: Routes, homeNodeId: string): RouteComponent | null {\n\tconst InitialRouteComponent = routes[homeNodeId]?.page\n\tconst [RouteComponent, setRouteComponent] = useState<RouteComponent | null>(() =>\n\t\tinitialRouteComponent(InitialRouteComponent),\n\t)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: deprecated\n\tuseEffect(() => {\n\t\tif (withPreload(InitialRouteComponent)) {\n\t\t\tvoid (async () => {\n\t\t\t\tawait InitialRouteComponent.preload()\n\t\t\t\t// eslint-disable-next-line framer-studio/no-setstate-without-transition -- deprecated\n\t\t\t\tsetRouteComponent(InitialRouteComponent)\n\t\t\t})()\n\t\t}\n\t}, [])\n\n\treturn RouteComponent\n}\n", "import type { ComponentLoader } from \"./loaderTypes.ts\"\n\n/**\n * Attaches a loader function to a component for data preloading.\n *\n * @example\n * ```tsx\n * addLoader(ParentComponent, async (props, context) => {\n *   return Promise.allSettled([\n *     forwardLoader(ChildComponent, {\n *       ...props,\n *       url: \"https://api.example.com/data\"\n *     }, context),\n *     fetch(props.url ?? \"https://api.example.com/data\", { signal: context.signal, cache: \"force-cache\" })\n *   ])\n * })\n * ```\n *\n * @public\n */\nexport function addLoader<P>(component: React.ComponentType<P>, loaderFn: ComponentLoader<P>[\"load\"]): void {\n\tObject.assign(component, { loader: { load: loaderFn } })\n}\n\n/**\n * Get the loader for a component if it exists.\n * @internal\n */\nexport function getLoader<P>(\n\tcomponent: React.ComponentType<P> | { loader?: ComponentLoader<P> },\n): ComponentLoader<P> | undefined {\n\treturn (component as { loader?: ComponentLoader<P> }).loader\n}\n", "import { getLoader } from \"./addLoader.ts\"\nimport type { ComponentLoader, LoaderContext } from \"./loaderTypes.ts\"\n\n/**\n * Forwards a loader call to a child component if it has a loader defined.\n *\n * @example\n * ```tsx\n * addLoader(ParentComponent, async (props, context) => {\n *   return Promise.allSettled([\n *     forwardLoader(ChildComponent, {\n *       ...props,\n *       url: \"https://api.example.com/data\"\n *     }, context),\n *     fetch(props.url ?? \"https://api.example.com/data\", { signal: context.signal, cache: \"force-cache\" })\n *   ])\n * })\n * ```\n *\n * @public\n */\nexport function forwardLoader<P>(\n\tcomponent: React.ComponentType<P> | { loader?: ComponentLoader<P> },\n\tprops: P,\n\tcontext: LoaderContext,\n): Promise<unknown> {\n\tconst loader = getLoader(component)\n\tif (!loader) return Promise.resolve(undefined)\n\treturn loader.load(props, context)\n}\n", "{\n\t\"name\": \"framer\",\n\t\"version\": \"2.4.1\",\n\t\"private\": true,\n\t\"type\": \"module\",\n\t\"author\": \"Framer\",\n\t\"license\": \"MIT\",\n\t\"scripts\": {\n\t\t\"coverage\": \"yarn :jest --coverage\",\n\t\t\"lint\": \"yarn :lint ./src --ext .ts,.tsx --format gha-codeframe --quiet --cache\",\n\t\t\"lint:ci\": \"yarn lint --cache-strategy content --cache-location $HOME/.cache/eslint/framer-library\",\n\t\t\"lint:fix\": \"yarn lint --fix\",\n\t\t\"test\": \"TZ=UTC yarn :jest\",\n\t\t\"watch\": \"yarn :jest --watch\"\n\t},\n\t\"dependencies\": {\n\t\t\"@sqlite.org/sqlite-wasm\": \"^3.50.4-build1\",\n\t\t\"devalue\": \"^5.6.4\",\n\t\t\"eventemitter3\": \"^5.0.1\",\n\t\t\"fontfaceobserver\": \"2.2.0\",\n\t\t\"hoist-non-react-statics\": \"^3.3.2\",\n\t\t\"hsluv\": \"^1.0.1\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@juggle/resize-observer\": \"^3.4.0\",\n\t\t\"@microsoft/api-extractor\": \"^7.58.2\",\n\t\t\"@testing-library/dom\": \"^8.19.1\",\n\t\t\"@testing-library/jest-dom\": \"^5.16.5\",\n\t\t\"@testing-library/react\": \"^13.4.0\",\n\t\t\"@testing-library/user-event\": \"patch:@testing-library/user-event@npm%3A14.6.1#~/.yarn/patches/@testing-library-user-event-npm-14.6.1-5da7e1d4e2.patch\",\n\t\t\"@types/dom-navigation\": \"^1.0.6\",\n\t\t\"@types/fontfaceobserver\": \"2.1\",\n\t\t\"@types/google.fonts\": \"1.0\",\n\t\t\"@types/node\": \"24.10.15\",\n\t\t\"@types/react\": \"18.2\",\n\t\t\"@types/react-dom\": \"18.2\",\n\t\t\"@types/yargs\": \"^17.0.33\",\n\t\t\"chalk\": \"^4.1.2\",\n\t\t\"eslint-plugin-framer-studio\": \"workspace:*\",\n\t\t\"framer-motion\": \"12.39.0\",\n\t\t\"immutable\": \"^3.8.3\",\n\t\t\"jest-diff\": \"^29.3.1\",\n\t\t\"jest-environment-jsdom\": \"^29.3.1\",\n\t\t\"jest-environment-jsdom-global\": \"^4.0.0\",\n\t\t\"react\": \"^18.2.0\",\n\t\t\"react-dom\": \"^18.2.0\",\n\t\t\"semver\": \"^7.7.1\",\n\t\t\"typescript\": \"^5.9.2\",\n\t\t\"yargs\": \"^17.7.2\"\n\t},\n\t\"tsdoc\": {\n\t\t\"tsdocFlavor\": \"AEDoc\"\n\t},\n\t\"browserslist\": [\n\t\t\"extends @framer/browserslist-config/sites\"\n\t]\n}\n", "import packageJSON from \"../package.json\" with { type: \"json\" }\n\n/**\n * @public\n */\nexport const version = /* @__PURE__ */ (() => packageJSON.version)()\n", "import { MotionValue, motionValue } from \"framer-motion\"\n\ninterface AddChildProps {\n\ttransformer: (v: any) => any\n}\n// Lord forgive me for my sins\n// This is a hack to support addChild when providing MotionValues created in the latest\n// version of framer-motion to older versions, where its expected. This should be removed\n// when we can guarantee 3rd party modules are using a single version of framer-motion\n// as this will also manifest in less obvious bugs due to multiple contexts etc\n;(MotionValue.prototype as any).addChild = function ({ transformer = v => v }: AddChildProps): MotionValue {\n\tconst child = motionValue(transformer(this.get()))\n\tthis.onChange((v: any) => child.set(transformer(v)))\n\n\treturn child\n}\n", "/**\n * Main entrypoint bundled with published sites and the app runtime.\n * When adding exports, you must also update `src/app/vekter/static/scripts/framer.esm.js`.\n * Exported functions/props MUST use jsdoc:\n * - `@public` if also exported in `indexEditor.ts`\n * - `@internal` otherwise\n *\n * ! Important: **Removing or changing behavior of `index.ts` exports can (and will!) break published Framer sites**. This means whatever you add can in 99.999% of times NEVER be removed.\n * Best practices:\n * - Be mindful when you add `@public` exports. Do code authors really need it?\n * - Exports that should not be updated any longer shall be marked with `@deprecated <reason>`, because code-generated components might still make use of it\n * - When changing function arguments, ensure they're always backwards compatible\n * - Only add exports to `index.ts` if they're needed from code-generated components or on published sites. In other cases (e.g. regular code in vekter), import the needed file directly.\n *\n * Somewhen in the future, the intention is to break this up and create a series of specific\n * entrypoints for `sites`, `sandbox` and further more to remove unnecessary\n * internal API's from the library.\n *\n * See also\n * https://www.notion.so/framer/Framer-Library-Know-How-916501891bf24593a2cc2ea7cfbeeebe\n *\n * @internal\n * @module\n */\n\n// biome-ignore lint/performance/noBarrelFile: this is the entrypoint to the library bundled with sites\nexport { lazy } from \"./router/lazy.tsx\"\nexport { useRouteElementId } from \"./router/useRouteElementId.ts\"\nexport { useCurrentPathVariables } from \"./router/useCurrentPathVariables.tsx\"\nexport { useRouteHandler } from \"./router/useRouteHandler.ts\"\nexport { pushLoadMoreHistory } from \"./router/history.ts\"\nexport { useRouter } from \"./router/RouterContext.tsx\"\nexport { useTracking, type TrackCustomEvent } from \"./modules/useTracking.ts\"\nexport {\n\tuseBooleanQueryParam,\n\tuseDateQueryParam,\n\tuseEnumQueryParam,\n\tuseNumberQueryParam,\n\tuseStringQueryParam,\n\tuseCollectionReferenceQueryParam,\n\tuseMultiCollectionReferenceQueryParam,\n} from \"./router/queryParameters.tsx\"\nexport { useRouteAnchor } from \"./router/useRouteAnchor.ts\"\nexport { useCurrentRoute, useCurrentRouteId } from \"./router/useCurrentRoute.tsx\"\nexport {\n\tuseLayoutDirection,\n\tuseLocale,\n\tuseLocaleCode,\n\tuseLocaleInfo,\n\tuseLocalesForCurrentRoute,\n\tuseLocalizationInfo,\n} from \"./router/useLocale.ts\"\nexport { useRoute } from \"./router/useRoute.ts\"\nexport { turnOffReactEventHandling } from \"./router/hydration/reactHydrationINPOptimizer.ts\"\nexport { markHydrationStart } from \"./router/hydration/hydrationTimings.ts\"\nexport { PageEffectsProvider, usePageEffects } from \"./router/pageEffects/PageEffectsContext.tsx\"\nexport { NotFoundError } from \"./router/error-boundary/NotFoundErrorBoundary.tsx\"\nexport { inferInitialRouteFromPath } from \"./router/inferInitialRouteFromPath.ts\"\nexport { patchRoutesForABTesting } from \"./router/routeVariants.ts\"\nexport type { Locale, LocaleId, LocaleInfo } from \"./router/types.ts\"\nexport { useMetadata } from \"./router/useMetadata.ts\"\n// biome-ignore lint/performance/noReExportAll: Motion, duplicated in `indexEditor.ts`\nexport * from \"framer-motion\"\nexport {\n\tDeprecatedLayoutGroupContext as LayoutGroupContext,\n\tuseDeprecatedAnimatedState as useAnimatedState,\n\tuseDeprecatedInvertedScale as useInvertedScale,\n} from \"framer-motion\"\nexport { Animatable, isAnimatable } from \"./animation/Animatable/Animatable.ts\"\nexport type { AnimatableObject, Cancel, DeprecatedAnimationTarget } from \"./animation/Animatable/Animatable.ts\"\nexport { BezierAnimator, SpringAnimator } from \"./animation/Animators/index.ts\"\nexport { FramerAnimation } from \"./animation/FramerAnimation.ts\"\nexport { MotionSetup } from \"./animation/Motion/MotionSetup.tsx\"\nexport { patchBorderRadiusScaleCorrector } from \"./animation/Motion/patchBorderRadiusScaleCorrector.ts\"\nexport { startAnimation } from \"./animation/Motion/startAnimation.ts\"\nexport { animate } from \"./animation/animate.ts\"\nexport { AutomaticLayoutIds, LayoutIdContext } from \"./components/AnimateLayout/LayoutIdContext.tsx\"\n// These are only used by DeviceNode and should be removed when that is removed\nexport { convertPropsToDeviceOptions, getComponentSize } from \"./components/Device/index.ts\"\nexport { EmptyState } from \"./components/EmptyState.tsx\"\nexport { NavigationCallbackProvider, NavigationConsumer } from \"./components/Navigation.tsx\"\nexport type { NavigationInterface, NavigationProps } from \"./components/Navigation.tsx\"\nexport type {\n\tFadeTransitionOptions,\n\tFlipTransitionOptions,\n\tModalTransitionOptions,\n\tNavigationTransition,\n\tNavigationTransitionAnimation,\n\tNavigationTransitionAppearsFrom,\n\tNavigationTransitionBackdropColor,\n\tNavigationTransitionPosition,\n\tNavigationTransitionSide,\n\tOverlayTransitionOptions,\n\tPushTransitionOptions,\n} from \"./components/NavigationTransitions.ts\"\nexport type { StackAlignment, StackDirection, StackDistribution } from \"./components/Stack/types.ts\"\nexport { WithNavigator } from \"./components/hoc/WithNavigator.tsx\"\nexport { withMeasuredSize } from \"./components/hoc/withMeasuredSize.tsx\"\nexport {\n\tAnimateSharedLayout,\n\tDevice,\n\tDeviceCodeComponent,\n\tDraggable,\n\tErrorPlaceholder,\n\twithInfiniteScroll,\n\tNavigation,\n\tPage,\n\tScroll,\n\tStack,\n\tdefaultDeviceProps,\n\tdevicePresets,\n\tfraction,\n\tgetDevicePreset,\n\tisFractionDimension,\n\tisGapEnabled,\n\ttoFlexDirection,\n\ttoJustifyOrAlignment,\n\tuseIsInCurrentNavigationTarget,\n\tuseOnCurrentTargetChange,\n} from \"./components/index.ts\"\nexport type {\n\tDeviceCodeComponentProps,\n\tDeviceColor,\n\tDeviceOptions,\n\tDevicePreset,\n\tDevicePresetID,\n\tDeviceProps,\n\tEmulatedScrollProps,\n\tNativeScrollProps,\n\tPageAlignment,\n\tPageEffect,\n\tPageEffectInfo,\n\tPageEvents,\n\tPageProperties,\n\tPageProps,\n\tScrollConfig,\n\tScrollEvents,\n\tScrollProps,\n\tStackProperties,\n\tStackSpecificProps,\n} from \"./components/index.ts\"\nexport { useNavigation } from \"./components/useNavigation.ts\"\nexport { makePaddingString, paddingFromProps, parsePaddingString } from \"./components/utils/paddingFromProps.ts\"\nexport { useConstant } from \"./components/utils/useConstant.ts\"\nexport { Data } from \"./data/Data.ts\"\nexport { ObservableObject } from \"./data/ObservableObject.ts\"\nexport { PropertyStore } from \"./data/PropertyStore.ts\"\nexport { DataContext, createData } from \"./data/useData/index.ts\"\nexport { DataObserver, DataObserverContext, useObserveData } from \"./deprecated/DataObserver.tsx\"\nexport { WithOverride } from \"./deprecated/WithOverride.tsx\"\nexport type { Override, OverrideFunction, OverrideObject } from \"./deprecated/WithOverride.tsx\"\nexport { withParallaxTransform, withStyleAppearEffect } from \"./deprecated/deprecatedEffects.ts\"\nexport { FramerEvent, FramerEventListener, FramerEventSession } from \"./events/index.ts\"\nexport { AnyInterpolation, ValueInterpolation } from \"./interpolation/index.ts\"\nexport { ComponentPresetsConsumer, ComponentPresetsProvider } from \"./modules/ComponentPresetsContext.tsx\"\nexport { ComponentViewportProvider, useComponentViewport } from \"./modules/ComponentViewportContext.tsx\"\nexport { Container, SmartComponentScopedContainer } from \"./modules/Container.tsx\"\nexport { CustomCursorHost, useCustomCursors } from \"./modules/CustomCursor.tsx\"\nexport { Floating } from \"./modules/Floating.tsx\"\nexport { Instance } from \"./modules/Instance.tsx\"\nexport { GeneratedComponentContext } from \"./modules/GeneratedComponentContext.ts\"\nexport { AutoBreakpointVariant } from \"./modules/AutoBreakpointVariant.tsx\"\nexport { InjectSelectionStyle } from \"./modules/InjectSelectionStyle.tsx\"\nexport { GracefullyDegradingErrorBoundary } from \"./modules/GracefullyDegradingErrorBoundary.tsx\"\nexport { LazyValue } from \"./modules/LazyValue.ts\"\nexport { LibraryFeaturesProvider } from \"./modules/LibraryFeaturesContext.ts\"\nexport { Link } from \"./modules/Link/index.tsx\"\nexport { AnchorLinkTarget } from \"./modules/Link/types.ts\"\nexport { PathVariablesContext } from \"./modules/Link/pathVariables.tsx\"\nexport { ResetOuterLinkContext } from \"./modules/Link/useReplaceNestedLinks.tsx\"\nexport { propsForLink } from \"./modules/Link/propsForLink.tsx\"\nexport { resolveLink } from \"./modules/Link/resolveLink.ts\"\nexport { resolvePageScope } from \"./modules/Link/resolvePageScope.tsx\"\nexport { nestedLinksCollector } from \"./modules/NestedLinksCollector.ts\"\nexport { handoverCollector } from \"./modules/dataHandover/dataHandover.ts\"\nexport { lazyModulesCollector } from \"./router/lazyModulesCollector.ts\"\nexport { PageRoot } from \"./modules/PageRoot.tsx\"\nexport { PropertyOverrides, SSRVariants } from \"./modules/PropertyOverrides.tsx\"\nexport { ResolveLinks } from \"./modules/ResolveLinks.tsx\"\nexport { Fetcher } from \"./modules/Fetcher.tsx\"\nexport { usePrefetch } from \"./modules/FetchClient.tsx\"\nexport { callEach } from \"./modules/callEach.ts\"\nexport { QueryEngine } from \"./modules/cms/QueryEngine.ts\"\nexport { QueryCache } from \"./modules/cms/QueryCache.ts\"\nexport { CollectionUtilsCache } from \"./modules/cms/CollectionUtilsCache.tsx\"\nexport { executeServerDatabaseQuery } from \"./modules/cms/server-database/mock/executeServerDatabaseQuery.ts\"\nexport { useFormSelectVariableBinding } from \"./modules/cms/useFormSelectVariableBinding.tsx\"\nexport { ChildrenCanSuspend } from \"./modules/ChildrenCanSuspend.tsx\"\nexport { cx } from \"./modules/cx.ts\"\nexport {\n\tcreateFramerPageLink,\n\tisFramerPageLink,\n\tparseFramerPageLink,\n\tshouldOpenLinkInNewTab,\n} from \"./modules/framerPageLink.ts\"\nexport type { FramerPageLinkAttributes } from \"./modules/framerPageLink.ts\"\nexport {\n\tframerAppearAnimationScriptKey,\n\tframerAppearEffects,\n\tframerAppearIdKey,\n\tframerAppearTransformTemplateToken,\n\twithOptimizedAppearEffect,\n\toptimizeAppear,\n\toptimizeAppearTransformTemplate,\n} from \"./modules/optimizeAppear.tsx\"\nexport { createTrigger } from \"./utils/createTrigger.ts\"\nexport { isEmptyTrigger } from \"./utils/triggerActions.ts\"\nexport { TriggerSubscription, useTriggers } from \"./modules/TriggerSubscription.tsx\"\nexport { useActiveTargetCallback, useActiveVariantCallback } from \"./modules/useActiveVariantCallback.ts\"\nexport { useAddVariantProps } from \"./modules/useAddVariantProps.ts\"\nexport {\n\tremoveHiddenBreakpointLayers,\n\tremoveHiddenBreakpointLayersV2,\n\tuseBreakpointVariants,\n\tuseHydratedBreakpointVariants,\n} from \"./modules/useBreakpointVariants.ts\"\nexport { useDataRecord } from \"./modules/useDataRecord.ts\"\nexport { useDynamicRefs, useSiteRefs } from \"./modules/useDynamicRefs.ts\"\nexport { GamepadContext, isFramerGamepadKeydownData, useGamepad } from \"./modules/useGamepad.ts\"\nexport type { FramerGamepadKeydownData } from \"./modules/useGamepad.ts\"\nexport { useHotkey } from \"./modules/useHotkey.ts\"\nexport { useIsOnFramerCanvas } from \"./modules/useIsOnFramerCanvas.ts\"\nexport { isStaticRenderer, useIsStaticRenderer } from \"./modules/useIsStaticRenderer.ts\"\nexport { useNavigate } from \"./modules/useNavigate.tsx\"\nexport { useOnAppear, useOnVariantChange } from \"./modules/useOnVariantChange.ts\"\nexport { useOverlayState } from \"./modules/useOverlayState.tsx\"\nexport { usePrototypeNavigate } from \"./modules/usePrototypeNavigate.tsx\"\nexport {\n\tgetWhereExpressionFromPathVariables,\n\tuseQueryData,\n\tusePreloadQuery,\n\tqueryCache,\n} from \"./modules/useQueryData.ts\"\nexport { useLoadMorePaginatedQuery } from \"./components/utils/useLoadMorePaginatedQuery.tsx\"\nexport { useLoadMorePagination } from \"./components/utils/useLoadMorePagination.tsx\"\nexport { CycleVariantState, VariantSelector, useVariantState } from \"./modules/useVariantState.ts\"\nexport { withCSS, framerCSSMarker, cssCollector } from \"./modules/withCSS.tsx\"\nexport { safeCSSValue } from \"./modules/safeCSSValue.ts\"\nexport { withCodeBoundaryForOverrides } from \"./modules/code-boundary/withCodeBoundaryForOverrides.tsx\"\nexport { withFX } from \"./modules/withFX.tsx\"\nexport { withV1StrokeFX } from \"./modules/withStrokeFX.tsx\"\nexport { withTickerFX } from \"./modules/withTickerFX.tsx\"\nexport { withFlowFX } from \"./modules/withFlowFX.tsx\"\nexport { withMappedReactProps } from \"./modules/withMappedReactProps.tsx\"\nexport { defineShader, isShaderConfig } from \"./modules/defineShader.ts\"\nexport type {\n\tShaderConfig,\n\tShaderControls,\n\tShaderControlDescription,\n\tShaderResolutionScale,\n} from \"./modules/defineShader.ts\"\nexport { Shader } from \"./render/presentation/Shader/Shader.tsx\"\nexport { withVariantAppearEffect } from \"./modules/withVariantAppearEffect.tsx\"\nexport { withVariantFX } from \"./modules/withVariantFX.tsx\"\nexport { installFlexboxGapWorkaroundIfNeeded } from \"./modules/workaroundFlexboxGapNotSupported.ts\"\nexport { StyleSheetContext } from \"./render/StyleSheetContext.ts\"\nexport type { StylesheetContextValue } from \"./render/StyleSheetContext.ts\"\nexport { WindowContext, useProvidedWindow } from \"./render/WindowContext.ts\"\nexport { systemFontFamilyName } from \"./render/fonts/LocalFontSource.ts\"\nexport { fontStore } from \"./render/fonts/fontStore.ts\"\nexport { loadFont } from \"./render/fonts/loadFont.ts\"\nexport { FontSourceNames } from \"./render/fonts/types.ts\"\nexport type {\n\tFont,\n\tFontFamily,\n\tFontFamilyLocator,\n\tFontSelector,\n\tFontSourceName,\n\tReadonlyFont,\n\tReadonlyFontFamily,\n\tWebFontFamilyLocator,\n} from \"./render/fonts/types.ts\"\nexport { ComponentContainerContext } from \"./render/presentation/ComponentContainerContext.tsx\"\nexport { CustomProperties } from \"./render/presentation/CustomProperties.tsx\"\nexport { cssBackgroundSize } from \"./render/presentation/Frame/DeprecatedFrame.tsx\"\nexport { DeprecatedFrameWithEvents, Frame } from \"./render/presentation/Frame/index.tsx\"\nexport { FrameWithMotion } from \"./render/presentation/Frame/FrameWithMotion.tsx\"\nexport { FormContainer } from \"./render/presentation/Forms/FormContainer.tsx\"\nexport { FormPlainTextInput } from \"./render/presentation/Forms/FormPlainTextInput.tsx\"\nexport { FormBooleanInput } from \"./render/presentation/Forms/FormBooleanInput.tsx\"\nexport { FormSelect } from \"./render/presentation/Forms/FormSelect.tsx\"\nexport type {\n\tBaseFrameProps,\n\tCSSTransformProperties,\n\tDeprecatedCoreFrameProps,\n\tDeprecatedFrameProperties,\n\tDeprecatedFrameWithEventsProps,\n\tFrameLayoutProperties,\n\tFrameProps,\n\tVisualProperties,\n} from \"./render/presentation/Frame/index.tsx\"\nexport type { DeprecatedFrame } from \"./render/presentation/Frame/DeprecatedFrame.tsx\"\nexport { Image } from \"./render/presentation/Image.tsx\"\nexport { Layer } from \"./render/presentation/Layer.tsx\"\nexport type { DOMLayoutProps, IdentityProps, LayerProps } from \"./render/presentation/Layer.tsx\"\nexport { withColumnMasonryLayout } from \"./render/presentation/withColumnMasonryLayout.tsx\"\nexport { RelativeDate } from \"./render/presentation/RelativeDate.tsx\"\nexport { RichText } from \"./render/presentation/RichText.tsx\"\nexport type { RichTextProps } from \"./render/presentation/RichText.tsx\"\nexport { SVG } from \"./render/presentation/SVG.tsx\"\nexport type { SVGProperties } from \"./render/presentation/SVG.tsx\"\nexport { sharedSVGManager, useSVGTemplate } from \"./render/presentation/SharedSVGManager.ts\"\nexport { Text } from \"./render/presentation/Text.tsx\"\nexport { TickerItem } from \"./render/presentation/TickerItem.tsx\"\nexport type { TextAlignment, TextProperties, TextVerticalAlignment } from \"./render/presentation/Text.tsx\"\nexport { Vector } from \"./render/presentation/Vector.tsx\"\nexport type { VectorProperties } from \"./render/presentation/Vector.tsx\"\nexport { VectorGroup } from \"./render/presentation/VectorGroup.tsx\"\nexport type { VectorGroupProperties } from \"./render/presentation/VectorGroup.tsx\"\nexport type { BorderComponentProps, BorderStyle } from \"./render/style/BorderComponent.tsx\"\nexport { backgroundImageFromProps } from \"./render/style/backgroundImageFromProps.ts\"\nexport { collectVisualStyleFromProps } from \"./render/style/collectVisualStyleFromProps.ts\"\nexport type { DeprecatedVisualProperties } from \"./render/style/collectVisualStyleFromProps.ts\"\nexport { localShadowFrame } from \"./render/style/shadow.tsx\"\nexport type { BackgroundFilterProperties } from \"./render/traits/BackdropFilters.ts\"\nexport type { Background, BackgroundProperties } from \"./render/traits/Background.ts\"\nexport type { BlendingMode, BlendingProperties } from \"./render/traits/Blending.ts\"\nexport type { BoxShadowProperties } from \"./render/traits/BoxShadow.ts\"\nexport type { FillProperties } from \"./render/traits/Fill.ts\"\nexport type { FilterNumberProperties, FilterProperties } from \"./render/traits/Filters.ts\"\nexport type { WithFractionOfFreeSpace } from \"./render/traits/FreeSpace.ts\"\nexport { withOpacity } from \"./render/traits/Opacity.ts\"\nexport type { WithOpacity } from \"./render/traits/Opacity.ts\"\nexport { isStraightCurve, pathDefaults, toSVGPath, withPath } from \"./render/traits/Path.ts\"\nexport type { WithPath, WithPaths } from \"./render/traits/Path.ts\"\nexport type { RadiusProperties } from \"./render/traits/Radius.ts\"\nexport { withShape } from \"./render/traits/Shape.ts\"\nexport type { WithShape } from \"./render/traits/Shape.ts\"\nexport type { TextColorProperties } from \"./render/traits/TextColor.ts\"\nexport type { Action, ActionControlDescription, ActionControls, ActionHandler } from \"./render/types/Action.ts\"\nexport { BackgroundImage } from \"./render/types/BackgroundImage.ts\"\nexport type { ImageFit } from \"./render/types/BackgroundImage.ts\"\nexport { modulate } from \"./render/types/Color/Utils.ts\"\nexport { Color, ConvertColor } from \"./render/types/Color/index.ts\"\nexport type { ColorMixOptions } from \"./render/types/Color/index.ts\"\nexport { ColorFormat, ColorMixModelType } from \"./render/types/Color/types.ts\"\nexport type { ColorHSL, ColorHSLA, ColorHSVA, ColorRGBA, IncomingColor } from \"./render/types/Color/types.ts\"\nexport { ConstraintMask, ConstraintValues, DimensionType, valueToDimensionType } from \"./render/types/Constraints.ts\"\nexport type { ConstraintPercentage, ConstraintProperties, DefaultProps } from \"./render/types/Constraints.ts\"\nexport { LinearGradient, RadialGradient } from \"./render/types/Gradient.ts\"\nexport type { Gradient, LinearGradientBase, RadialGradientBase } from \"./render/types/Gradient.ts\"\nexport { Line } from \"./render/types/Line.ts\"\nexport { NavigateTo, NavigationTransitionType } from \"./render/types/NavigationLink.ts\"\nexport type { NavigationLink, NavigationTarget, NavigationTransitionDirection } from \"./render/types/NavigationLink.ts\"\nexport { ParentSizeState, calculateRect, constraintsEnabled } from \"./render/types/NewConstraints.tsx\"\nexport type { NewConstraintProperties, PositionStickyProperties } from \"./render/types/NewConstraints.tsx\"\nexport { PathSegment } from \"./render/types/PathSegment.ts\"\nexport type { PathSegments } from \"./render/types/PathSegments.ts\"\nexport { Point } from \"./render/types/Point.ts\"\nexport { ControlType } from \"./render/types/PropertyControls.ts\"\nexport type {\n\tArrayControlDescription,\n\tArrayItemControlDescription,\n\tBaseControlDescription,\n\tBooleanControlDescription,\n\tBorderControlDescription,\n\tBoxShadowControlDescription,\n\tColorControlDescription,\n\tComponentInstanceDescription,\n\tControlDescription,\n\tDateControlDescription,\n\tEnumControlDescription,\n\tEventHandlerControlDescription,\n\tFileControlDescription,\n\tFusedNumberControlDescription,\n\tImageControlDescription,\n\tKeyable,\n\tNumberControlDescription,\n\tObjectControlDescription,\n\tObjectPropertyControlDescription,\n\tPageScopeControlDescription,\n\tPropertyControls,\n\tSegmentedControlIcon,\n\tSegmentedEnumControlDescription,\n\tStringControlDescription,\n\tTransitionControlDescription,\n} from \"./render/types/PropertyControls.ts\"\nexport { Rect } from \"./render/types/Rect.ts\"\nexport { Polygon } from \"./render/types/Polygon.ts\"\nexport { isRelativeNumber } from \"./render/types/RelativeNumber.ts\"\nexport type { RelativeNumber } from \"./render/types/RelativeNumber.ts\"\nexport {\n\tRenderTarget,\n\texecuteInRenderEnvironment,\n\tsetGlobalRenderEnvironment,\n\tuseRenderEnvironment,\n} from \"./render/types/RenderEnvironment.ts\"\nexport { BoxShadow, Shadow } from \"./render/types/Shadow.ts\"\nexport { Size } from \"./render/types/Size.ts\"\nexport type { LineCap, LineJoin } from \"./render/types/Stroke.ts\"\nexport type { StrokeAlignment } from \"./render/types/StrokeAlignment.ts\"\nexport type { TransformValues } from \"./render/types/TransformValues.ts\"\nexport { annotateTypeOnStringify, isOfAnnotatedType } from \"./render/utils/annotateTypeOnStringify.ts\"\nexport { debounce } from \"./render/utils/debounce.ts\"\nexport { DOM, dispatchKeyDownEvent, frameFromElement, frameFromElements } from \"./render/utils/dom.ts\"\nexport type { LinearGradientElementProperties } from \"./render/utils/elementPropertiesForGradient.ts\"\nexport { getLoadingLazyAtYPosition } from \"./render/utils/getLoadingLazyAtYPosition.ts\"\nexport { getMeasurableCodeComponentChildren } from \"./render/utils/getMeasurableCodeComponentChildren.ts\"\nexport { preloadImage } from \"./render/utils/preloadImage.ts\"\nexport { gradientForShape } from \"./render/utils/gradientForShape.tsx\"\nexport { imagePatternPropsForFill } from \"./render/utils/imagePatternPropsForFill.tsx\"\nexport { imageUrlForAsset } from \"./render/utils/imageUrlForAsset.ts\"\nexport { combinedCSSRulesForPreview } from \"./render/utils/injectComponentCSSRules.ts\"\nexport { isEqual } from \"./render/utils/isEqual.ts\"\nexport { finiteNumber, isFiniteNumber } from \"./render/utils/isFiniteNumber.ts\"\nexport { isMotionValue } from \"./render/utils/isMotionValue.ts\"\nexport { isShallowEqualArray } from \"./render/utils/isShallowEqualArray.ts\"\nexport { roundWithOffset, roundedNumber, roundedNumberString } from \"./render/utils/roundedNumber.ts\"\nexport { forceLayerBackingWithCSSProperties } from \"./render/utils/setLayerBacked.ts\"\nexport { throttle } from \"./render/utils/throttle.ts\"\nexport { transformString } from \"./render/utils/transformString.ts\"\nexport { transformTemplate } from \"./render/utils/transformTemplate.ts\"\nexport { useMeasureLayout } from \"./render/utils/useMeasureLayout.ts\"\nexport { withGeneratedLayoutId } from \"./render/utils/withGeneratedLayoutId.tsx\"\nexport { degreesToRadians } from \"./render/utils/degreesToRadians.ts\"\nexport { addActionControls } from \"./utils/addActionControls.ts\"\nexport type { ActionInfo } from \"./utils/addActionControls.ts\"\nexport { addFonts, getFonts, getFontsFromComponentPreset, getFontsFromSharedStyle } from \"./utils/addFonts.ts\"\nexport type { ComponentFont } from \"./utils/addFonts.ts\"\nexport { addPropertyControls, getPropertyControls } from \"./utils/addPropertyControls.ts\"\nexport { withPerformanceMarks } from \"./utils/withPerformanceMarks.ts\"\nexport { clampRGB } from \"./render/types/Color/Color.ts\"\n// XXX: Workaround for https://github.com/microsoft/rushstack/issues/1029\n//\n// When fixed, replace with `export { environment } from \"./utils.js\"`, and remove\n// the `environment` export from ./utils/environment.ts\nexport { environment } from \"./utils/environment.ts\"\nexport { InternalID } from \"./utils/internalId.ts\"\nexport { memoize } from \"./utils/memoize.ts\"\nexport { loadJSON } from \"./utils/network.ts\"\nexport { print } from \"./utils/print.ts\"\nexport { _injectRuntime } from \"./utils/runtimeInjection.ts\"\nexport type { Runtime } from \"./utils/runtimeInjection.ts\"\nexport { useInitialRouteComponent } from \"./utils/useInitialRouteComponent.ts\"\nexport { yieldToMain } from \"./utils/yield.ts\"\nexport { initLazyModulesCache } from \"./router/lazyModulesCache.ts\"\nexport { forwardLoader } from \"./modules/loader/forwardLoader.ts\"\nexport { addLoader } from \"./modules/loader/addLoader.ts\"\n\nexport { version } from \"./version.ts\"\nexport { MainLoop } from \"./core/Loop.ts\"\n\nimport \"./animation/Motion/addChildHack.ts\"\nimport { MainLoop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Element", "Fragment", "Memo", "Suspense", "isFragment", "keys", "key", "x", "l", "m", "y", "f", "isObject", "isGenerator", "noop", "hash", "noop", "Component", "React", "React", "useMemo", "key", "keys", "React", "jsx", "React", "jsx", "React", "useMemo", "React", "hash", "React", "React", "useEffect", "React", "useContext", "useMemo", "x", "keys", "key", "data", "map", "key", "key", "keys", "index", "value", "m", "key", "data", "map", "jsx", "cache", "useMemo", "useContext", "data", "noop", "useEffect", "React", "useCallback", "useEffect", "useLayoutEffect", "useRef", "hash", "key", "useCallback", "useEffect", "React", "jsx", "time", "keyframes", "x", "y", "progress", "progress", "keyframes", "noop", "useEffect", "useCallback", "useCallback", "useRef", "useRef", "useCallback", "hash", "data", "isObject", "useLayoutEffect", "startViewTransition", "useRef", "useCallback", "useEffect", "m", "relative", "prefix", "useCallback", "useContext", "React", "useContext", "useCallback", "createContext", "useCallback", "useContext", "useMemo", "useRef", "useState", "useEffect", "createContext", "useContext", "jsx", "Context", "useEffect", "useRef", "useRef", "cache", "useEffect", "React", "Context", "React", "jsx", "Context", "createContext", "useState", "useCallback", "useRef", "useContext", "useMemo", "key", "cache", "getCollectionUtilsCache", "useEffect", "map", "React", "hash", "React", "useEffect", "useEffect", "useRef", "useSyncExternalStore", "useRef", "useSyncExternalStore", "useEffect", "event", "useEffect", "useEffect", "useLayoutEffect", "useLayoutEffect", "useEffect", "React", "jsx", "Page", "key", "React", "warnOnce", "warnOnce", "Animatable", "key", "progress", "x", "y", "Point", "x", "epsilon", "x2", "initialState", "progress", "maxDuration", "f", "ColorFormat", "ColorMixModelType", "l", "hex", "f", "color", "color", "x", "y", "m", "f", "color", "alpha", "Color", "isObject", "l", "hex", "key", "progress", "fraction", "progress", "keys", "key", "progress", "isMotionValue", "Defaults", "time", "f", "environment", "frame", "isMotionValue", "key", "jsx", "separator", "correctBorderRadius", "x", "pixelsToPercent", "y", "warnOnce", "isMotionValue", "animate", "React", "useCallback", "useContext", "useMemo", "useRef", "Fragment", "jsx", "React", "useContext", "cache", "useRef", "useCallback", "useMemo", "React", "Component", "useRef", "jsx", "jsx", "jsx", "jsxs", "scale", "Component", "ResizeObserver", "React", "containerStyle", "React", "React", "degrees", "Line", "x", "y", "alpha", "distance", "x", "y", "x2", "y2", "distance", "DimensionType", "aspectRatio", "x", "y", "f", "Fragment", "jsx", "aspectRatio", "ParentSizeState", "React", "jsx", "ControlType", "isBrowser", "version", "React", "useInsertionEffect", "React", "cache", "jsx", "isBrowser", "Component", "React", "cache", "useInsertionEffect", "css", "React", "FormInputStyleVariableNames", "css", "key", "React", "anySafariVersion", "Component", "isObject", "map", "transform", "color", "React", "jsx", "React", "defaultWidth", "defaultHeight", "React", "React", "forwardRef", "useContext", "useRef", "useState", "useState", "cache", "useMemo", "warnOnce", "useMemo", "key", "React", "useCallback", "step", "scale", "jsx", "x", "y", "React", "useCallback", "jsx", "isChrome", "React", "useContext", "useMemo", "useContext", "useMemo", "useContext", "useEffect", "useLayoutEffect", "useIsomorphicLayoutEffect", "React", "React", "useEffect", "React", "useForceUpdate", "jsx", "isBrowser", "useForceUpdate", "useEffect", "React", "useIsomorphicLayoutEffect", "Component", "useContext", "useIsomorphicLayoutEffect", "Component", "transform", "key", "microtask", "Layer", "Component", "cache", "key", "memoize", "color", "alpha", "key", "memoize", "alpha", "key", "key", "isObject", "key", "isObject", "key", "alpha", "isMotionValue", "Fragment", "jsx", "jsxs", "key", "useContext", "React", "forwardRef", "VisibleFrame", "useRef", "FrameWithMotion", "jsx", "jsxs", "React", "FrameWithMotion", "React", "Component", "React", "Component", "jsx", "React", "Component", "jsx", "React", "useContext", "useEffect", "useRef", "React", "createContext", "useContext", "useRef", "isObject", "useRef", "createContext", "key", "useContext", "noop", "React", "React", "Component", "jsx", "Component", "React", "React", "useContext", "createContext", "useCallback", "useContext", "useEffect", "useRef", "jsx", "createContext", "useCallback", "useRef", "useEffect", "useContext", "jsx", "jsxs", "React", "NavigationContainer", "animate", "useContext", "useRef", "useEffect", "animations", "FrameWithMotion", "createContext", "warnOnce", "createContext", "key", "jsx", "jsxs", "React", "Component", "key", "FrameWithMotion", "isObject", "React", "NavigateTo", "NavigationTransitionType", "jsx", "React", "hoistNonReactStatic", "forwardRef", "import_hoist_non_react_statics", "React", "scale", "import_hoist_non_react_statics", "React", "clamp", "jsx", "React", "Component", "clamp", "x", "y", "scale", "key", "hoistNonReactStatic", "jsx", "React", "hoistNonReactStatic", "React", "ObservableObject", "key", "keys", "key", "key", "color", "key", "inset", "Fragment", "jsx", "jsxs", "distance", "frame", "x", "y", "scale", "jsx", "jsxs", "key", "className", "React", "jsx", "forwardRef", "FrameInner", "FrameWithMotion", "React", "useEffect", "useRef", "jsx", "useRef", "React", "useEffect", "Component", "React", "startTransition", "useCallback", "useRef", "time", "useRef", "useCallback", "data", "clampX", "clamp", "clampY", "updateX", "updateY", "x", "y", "number", "React", "jsx", "React", "StackInner", "wrap", "className", "FrameWithMotion", "jsx", "FrameWithMotion", "jsx", "jsxs", "React", "warnOnce", "isMotionValue", "startTransition", "key", "useIsomorphicLayoutEffect", "x", "y", "FrameWithMotion", "Page", "Page", "React", "Component", "time", "Component", "Component", "Component", "Component", "jsx", "React", "React", "useCallback", "useMemo", "useRef", "jsx", "jsxs", "useMemo", "React", "x", "isMotionValue", "y", "useRef", "useIsomorphicLayoutEffect", "useCallback", "data", "isEmpty", "FrameWithMotion", "EmulatedScroll", "React", "React", "useEffect", "animations", "React", "useEffect", "time", "useIsomorphicLayoutEffect", "isMotionValue", "jsx", "jsxs", "React", "className", "isMotionValue", "useIsomorphicLayoutEffect", "FrameWithMotion", "NativeScroll", "jsx", "React", "ScrollInner", "NativeScroll", "EmulatedScroll", "useContext", "useContext", "Data", "PropertyStore", "createContext", "useContext", "useEffect", "useMemo", "useState", "key", "data", "initialState", "version", "createContext", "defaultState", "initialState", "useContext", "useMemo", "useState", "useEffect", "React", "Component", "jsx", "React", "Component", "import_hoist_non_react_statics", "useContext", "isMotionValue", "jsx", "Component", "useContext", "hoistNonReactStatic", "React", "keys", "key", "React", "React", "React", "React", "Fragment", "jsx", "React", "Fragment", "jsx", "cloneAsElement", "jsx", "React", "key", "SSRVariants", "isBrowser", "className", "React", "isBrowser", "PropertyOverrides", "jsx", "className", "transformTemplate", "animate", "isObject", "Component", "React", "isBrowser", "React", "key", "React", "startTransition", "useCallback", "useEffect", "useMemo", "useRef", "useState", "useRef", "useEffect", "delay", "useCallback", "key", "useState", "startTransition", "useMemo", "React", "useContext", "React", "transform", "useContext", "useMemo", "useRef", "key", "motionValue", "useRef", "isObject", "useMemo", "React", "useMemo", "React", "React", "_", "animateVariant", "React", "key", "_", "useMemo", "React", "useLayoutEffect", "defaultRanges", "spring", "React", "key", "startAnimation", "m", "useLayoutEffect", "_", "jsx", "key", "keys", "add", "isObject", "isVariantOrVariantList", "Component", "React", "transformValues", "scale", "x", "y", "animate", "createContext", "useContext", "useRef", "jsx", "createContext", "useRef", "useContext", "React", "jsx", "React", "ComponentViewportProvider", "y", "React", "React", "jsx", "Component", "React", "Component", "Suspense", "createContext", "useContext", "Component", "Component", "Fragment", "jsx", "createContext", "useContext", "jsx", "Fragment", "jsx", "jsx", "Component", "Suspense", "Component", "Component", "React", "jsx", "jsx", "jsx", "React", "ContainerInner", "SmartComponentScopedContainer", "Component", "Suspense", "createContext", "memo", "startTransition", "useCallback", "useContext", "useEffect", "useLayoutEffect", "useRef", "useState", "jsx", "jsxs", "createContext", "map", "hash", "memo", "x", "y", "CustomCursorComponent", "useContext", "useState", "useRef", "useForceUpdate", "useLayoutEffect", "startTransition", "useEffect", "spring", "transformTemplate", "useCallback", "Suspense", "React", "useContext", "Children", "createContext", "isValidElement", "useCallback", "useContext", "useMemo", "pathVariablesKey", "jsx", "createContext", "useContext", "useMemo", "useCallback", "Children", "isValidElement", "React", "styles", "el", "React", "polygonPoints", "intersection", "x", "y", "jsx", "jsxs", "x", "y", "Context", "React", "isObject", "container", "className", "useContext", "React", "jsx", "Instance", "Component", "createElement", "useContext", "jsx", "useContext", "createElement", "PropertyOverrides", "Component", "jsx", "Component", "forwardRef", "isValidElement", "useMemo", "forwardRef", "jsx", "Component", "forwardRef", "hash", "useContext", "createContext", "useContext", "createContext", "useContext", "hash", "key", "useContext", "AnchorLinkTarget", "useCallback", "result", "useCallback", "useCallback", "useCallback", "forwardRef", "Link", "resolveSlugsWithSuspense", "useMemo", "navigate", "isValidElement", "isObject", "resolveSlugs", "hash", "React", "React", "startTransition", "useContext", "salt", "difficulty", "tokenLength", "maxTime", "hash", "data", "document", "key", "React", "Fragment", "jsx", "React", "React", "React", "jsx", "jsxs", "React", "FormContainer", "useContext", "matchingRoute", "routeId", "elementId", "pathVariables", "data", "startTransition", "key", "isObject", "Fragment", "startTransition", "useCallback", "useEffect", "useLayoutEffect", "useMemo", "useRef", "Suspense", "useContext", "useMemo", "useSyncExternalStore", "Component", "Component", "jsx", "useContext", "useSyncExternalStore", "useMemo", "key", "Suspense", "createContext", "useContext", "useEffect", "useRef", "useState", "key", "map", "safeWindow", "noop", "jsx", "Context", "createContext", "useRef", "useEffect", "initialState", "useState", "useContext", "useCallback", "React", "jsx", "useCallback", "key", "key", "useContext", "useEffect", "useRef", "useContext", "useRef", "useEffect", "React", "useForceUpdate", "jsx", "jsxs", "hash", "useRef", "useLayoutEffect", "useCallback", "noop", "startViewTransition", "useForceUpdate", "useMemo", "startTransition", "loadSnippets", "switchLocale", "isObject", "currentRouteId", "currentRoute", "key", "currentPathVariables", "useEffect", "Fragment", "React", "jsx", "noop", "data", "key", "isBrowser", "_subscribers", "noop", "jsx", "environment", "React", "forwardRef", "forwardRef", "resolveSlugsWithSuspense", "React", "Fetcher", "keys", "key", "isGenerator", "isObject", "isObject", "collation", "number", "key", "key", "data", "prefix", "data", "hash", "isObject", "isObject", "key", "cache", "data", "data", "keys", "key", "collation", "node", "collation", "collation", "collation", "hash", "key", "collation", "collation", "assert", "intersection", "assert", "collation", "memo", "collation", "collation", "cache", "key", "handoverDataType", "isObject", "queryEngine", "key", "startTransition", "useCallback", "useMemo", "useRef", "useCallback", "useCallback", "isObject", "useRef", "useMemo", "useCallback", "startTransition", "safeWindow", "startTransition", "useEffect", "useMemo", "useState", "useInsertionEffect", "useRef", "useRef", "useInsertionEffect", "noop", "useEffect", "useState", "startTransition", "useMemo", "useEffect", "useRef", "useEffect", "useRef", "React", "variantProps", "startTransition", "useCallback", "useContext", "useEffect", "useRef", "hash", "useContext", "isStaticRenderer", "isBrowser", "useRef", "useForceUpdate", "useCallback", "updateStateAndRerender", "startTransition", "useIsomorphicLayoutEffect", "useEffect", "requestIdleCallback", "useMemo", "useMemo", "key", "isObject", "React", "useMemo", "map", "React", "key", "useMemo", "React", "isObject", "React", "React", "keys", "key", "React", "React", "map", "React", "React", "startTransition", "React", "startTransition", "React", "key", "isObject", "React", "preloadKey", "isObject", "Component", "useMemo", "startTransition", "useCallback", "useEffect", "useMemo", "useRef", "useState", "hash", "useState", "useRef", "useMemo", "useEffect", "useCallback", "startTransition", "hash", "useMemo", "startTransition", "useCallback", "useContext", "useEffect", "useMemo", "useRef", "nextVariant", "VariantSelector", "hover", "useRef", "useCallback", "useEffect", "useContext", "variantProps", "useForceUpdate", "isHovered", "isPressed", "isError", "enabledGestures", "defaultVariant", "baseVariant", "gestureVariant", "startTransition", "useMemo", "React", "jsx", "Component", "React", "forwardRef", "useEffect", "jsx", "Component", "forwardRef", "useEffect", "forwardRef", "useState", "Children", "Fragment", "isValidElement", "forwardRef", "createContext", "forwardRef", "useCallback", "useContext", "useEffect", "useMemo", "useRef", "useState", "Fragment", "jsx", "jsxs", "transform", "Context", "invariant", "inset", "isHTMLElement", "renderedOffset", "defaultOffset", "offset", "jsx", "forwardRef", "BasicTicker", "Component", "forwardRef", "useEffect", "useRef", "jsx", "forwardRef", "DraggableTicker", "Component", "useRef", "isDragging", "useEffect", "createContext", "startTransition", "useMemo", "jsx", "TickerContext", "Context", "jsx", "Ticker", "forwardRef", "useState", "jsx", "Component", "Ticker", "React", "useMemo", "jsx", "Component", "jsx", "Component", "key", "noop", "data", "key", "key", "isObject", "key", "forwardRef", "startTransition", "useCallback", "useEffect", "useId", "useLayoutEffect", "useState", "memo", "jsx", "memo", "ShaderFallbackImage", "memo", "startTransition", "useEffect", "useLayoutEffect", "useRef", "useState", "parseCSSVariable", "key", "map", "getCacheKey", "scale", "x", "y", "color", "parseCSSVariable", "rgba", "scale", "isObject", "jsx", "jsxs", "memo", "ShaderSandboxFallbackImage", "useState", "useRef", "useLayoutEffect", "useEffect", "startTransition", "containerStyle", "memo", "startTransition", "useCallback", "useEffect", "useLayoutEffect", "useRef", "useState", "useCallback", "useEffect", "useLayoutEffect", "useRef", "startTransition", "useCallback", "useEffect", "useLayoutEffect", "useRef", "useState", "createContext", "useContext", "useState", "useEffect", "startTransition", "useCallback", "useLayoutEffect", "useRef", "useIsomorphicLayoutEffect", "jsx", "singleFrame", "useRef", "useLayoutEffect", "useCallback", "animate", "time", "useEffect", "Fragment", "jsx", "jsxs", "memo", "ShaderWithFallbackOverlay", "singleFrame", "useState", "useRef", "useLayoutEffect", "useCallback", "startTransition", "useEffect", "useCallback", "useEffect", "useRef", "spring", "x", "y", "useRef", "useCallback", "useEffect", "time", "startTransition", "useEffect", "useState", "useState", "useEffect", "startTransition", "jsx", "jsxs", "forwardRef", "Shader", "useState", "useCallback", "startTransition", "useId", "useEffect", "useLayoutEffect", "ShaderContainerFrame", "styles", "FrameWithMotion", "React", "jsx", "defaultRanges", "createInputOutputRanges", "Component", "React", "React", "jsx", "Component", "React", "animate", "React", "FontSourceNames", "key", "fontFamilies", "styles", "key", "isVariableFont", "f", "version", "log", "weightName", "key", "weightNameToNumber", "key", "isVariableFont", "key", "mapToKnownCategory", "data", "FontFaceObserver", "data", "isObject", "isVariationAxis", "key", "warnOnce", "jsx", "forwardRef", "startTransition", "useCallback", "React", "React", "jsx", "jsxs", "forwardRef", "className", "step", "useCallback", "startTransition", "jsx", "jsxs", "FormPlainTextInput", "React", "useState", "jsx", "React", "styles", "FormBooleanInput", "React", "jsx", "React", "Select", "className", "styles", "React", "useMemo", "useState", "Fragment", "forwardRef", "startTransition", "useCallback", "useContext", "useEffect", "useId", "useMemo", "useRef", "useState", "useEffect", "Fragment", "jsx", "jsxs", "aspectRatio", "getPortalContainer", "Component", "forwardRef", "useContext", "TickerContext", "useRef", "useMemo", "useState", "useCallback", "startTransition", "style", "borderStyle", "transition", "useEffect", "useId", "borderRadius", "jsx", "jsxs", "Component", "React", "Image", "useMemo", "useState", "React", "forwardRef", "jsx", "ColumnMasonryLayout", "wrapperStyle", "Component", "memo", "startTransition", "useEffect", "useState", "key", "jsx", "jsxs", "memo", "RelativeDate", "useState", "useEffect", "startTransition", "Children", "Fragment", "cloneElement", "forwardRef", "isValidElement", "useContext", "useMemo", "useRef", "React", "useRef", "frame", "key", "jsx", "className", "environment", "useRef", "frame", "isAutoSized", "React", "jsx", "jsxs", "defaultValues", "key", "tokenization", "animations", "groups", "jsx", "forwardRef", "BaseSVG", "FitText", "key", "RichTextContainer", "environment", "useContext", "useRef", "useMemo", "containerStyle", "frame", "isAutoSized", "Component", "Fragment", "Children", "isValidElement", "className", "cloneElement", "isObject", "RichText", "React", "forwardRef", "a", "b", "frame", "transform", "mediaType", "jsx", "transform", "useEffect", "isBrowser", "useEffect", "prefix", "m", "Fragment", "jsx", "jsxs", "forwardRef", "React", "frame", "className", "SVG", "React", "useEffect", "useRef", "React", "React", "jsx", "React", "Text", "useRef", "useEffect", "className", "convertVerticalAlignment", "key", "frame", "inlineClosingTag", "jsx", "keys", "key", "PathSegment", "key", "x", "y", "transform", "transformString", "transform", "x", "y", "Component", "jsx", "React", "jsx", "React", "l", "jsx", "jsxs", "x", "y", "transform", "transformString", "key", "jsx", "x", "y", "transform", "transformString", "key", "isObject", "Size", "time", "key", "prefix", "isBrowser", "className", "regex", "l", "isObject", "useEffect", "useState", "useState", "useEffect", "MainLoop"]
}
