@trail-ui/react
Version:
1,292 lines (1,212 loc) • 293 kB
JavaScript
import {
__require
} from "./chunk-AKU6F3WT.mjs";
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/motion/index.mjs
import { jsxs, jsx } from "react/jsx-runtime";
import { forwardRef, useContext as useContext3 } from "react";
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/context/MotionConfigContext.mjs
import { createContext } from "react";
var MotionConfigContext = createContext({
transformPagePoint: (p) => p,
isStatic: false,
reducedMotion: "never"
});
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/context/MotionContext/index.mjs
import { createContext as createContext2 } from "react";
var MotionContext = createContext2({});
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/motion/utils/use-visual-element.mjs
import { useContext, useRef, useInsertionEffect, useEffect as useEffect2 } from "react";
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/context/PresenceContext.mjs
import { createContext as createContext3 } from "react";
var PresenceContext = createContext3(null);
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.mjs
import { useLayoutEffect, useEffect } from "react";
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/utils/is-browser.mjs
var isBrowser = typeof window !== "undefined";
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.mjs
var useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/context/LazyContext.mjs
import { createContext as createContext4 } from "react";
var LazyContext = createContext4({ strict: false });
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs
var camelToDash = (str) => str.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase();
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/animation/optimized-appear/data-id.mjs
var optimizedAppearDataId = "framerAppearId";
var optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId);
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/utils/GlobalConfig.mjs
var MotionGlobalConfig = {
skipAnimations: false,
useManualTiming: false
};
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/frameloop/render-step.mjs
function createRenderStep(runNextFrame) {
let thisFrame = /* @__PURE__ */ new Set();
let nextFrame = /* @__PURE__ */ new Set();
let isProcessing = false;
let flushNextFrame = false;
const toKeepAlive = /* @__PURE__ */ new WeakSet();
let latestFrameData = {
delta: 0,
timestamp: 0,
isProcessing: false
};
function triggerCallback(callback) {
if (toKeepAlive.has(callback)) {
step.schedule(callback);
runNextFrame();
}
callback(latestFrameData);
}
const step = {
/**
* Schedule a process to run on the next frame.
*/
schedule: (callback, keepAlive = false, immediate = false) => {
const addToCurrentFrame = immediate && isProcessing;
const queue = addToCurrentFrame ? thisFrame : nextFrame;
if (keepAlive)
toKeepAlive.add(callback);
if (!queue.has(callback))
queue.add(callback);
return callback;
},
/**
* Cancel the provided callback from running on the next frame.
*/
cancel: (callback) => {
nextFrame.delete(callback);
toKeepAlive.delete(callback);
},
/**
* Execute all schedule callbacks.
*/
process: (frameData2) => {
latestFrameData = frameData2;
if (isProcessing) {
flushNextFrame = true;
return;
}
isProcessing = true;
[thisFrame, nextFrame] = [nextFrame, thisFrame];
nextFrame.clear();
thisFrame.forEach(triggerCallback);
isProcessing = false;
if (flushNextFrame) {
flushNextFrame = false;
step.process(frameData2);
}
}
};
return step;
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/frameloop/batcher.mjs
var stepsOrder = [
"read",
// Read
"resolveKeyframes",
// Write/Read/Write/Read
"update",
// Compute
"preRender",
// Compute
"render",
// Write
"postRender"
// Compute
];
var maxElapsed = 40;
function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
let runNextFrame = false;
let useDefaultElapsed = true;
const state = {
delta: 0,
timestamp: 0,
isProcessing: false
};
const flagRunNextFrame = () => runNextFrame = true;
const steps2 = stepsOrder.reduce((acc, key) => {
acc[key] = createRenderStep(flagRunNextFrame);
return acc;
}, {});
const { read, resolveKeyframes, update, preRender, render, postRender } = steps2;
const processBatch = () => {
const timestamp = MotionGlobalConfig.useManualTiming ? state.timestamp : performance.now();
runNextFrame = false;
state.delta = useDefaultElapsed ? 1e3 / 60 : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);
state.timestamp = timestamp;
state.isProcessing = true;
read.process(state);
resolveKeyframes.process(state);
update.process(state);
preRender.process(state);
render.process(state);
postRender.process(state);
state.isProcessing = false;
if (runNextFrame && allowKeepAlive) {
useDefaultElapsed = false;
scheduleNextBatch(processBatch);
}
};
const wake = () => {
runNextFrame = true;
useDefaultElapsed = true;
if (!state.isProcessing) {
scheduleNextBatch(processBatch);
}
};
const schedule = stepsOrder.reduce((acc, key) => {
const step = steps2[key];
acc[key] = (process2, keepAlive = false, immediate = false) => {
if (!runNextFrame)
wake();
return step.schedule(process2, keepAlive, immediate);
};
return acc;
}, {});
const cancel = (process2) => {
for (let i = 0; i < stepsOrder.length; i++) {
steps2[stepsOrder[i]].cancel(process2);
}
};
return { schedule, cancel, state, steps: steps2 };
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/frameloop/microtask.mjs
var { schedule: microtask, cancel: cancelMicrotask } = createRenderBatcher(queueMicrotask, false);
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/utils/is-ref-object.mjs
function isRefObject(ref) {
return ref && typeof ref === "object" && Object.prototype.hasOwnProperty.call(ref, "current");
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/context/SwitchLayoutGroupContext.mjs
import { createContext as createContext5 } from "react";
var SwitchLayoutGroupContext = createContext5({});
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/motion/utils/use-visual-element.mjs
var scheduleHandoffComplete = false;
function useVisualElement(Component3, visualState, props, createVisualElement, ProjectionNodeConstructor) {
var _a;
const { visualElement: parent } = useContext(MotionContext);
const lazyContext = useContext(LazyContext);
const presenceContext = useContext(PresenceContext);
const reducedMotionConfig = useContext(MotionConfigContext).reducedMotion;
const visualElementRef = useRef();
createVisualElement = createVisualElement || lazyContext.renderer;
if (!visualElementRef.current && createVisualElement) {
visualElementRef.current = createVisualElement(Component3, {
visualState,
parent,
props,
presenceContext,
blockInitialAnimation: presenceContext ? presenceContext.initial === false : false,
reducedMotionConfig
});
}
const visualElement = visualElementRef.current;
const initialLayoutGroupConfig = useContext(SwitchLayoutGroupContext);
if (visualElement && !visualElement.projection && ProjectionNodeConstructor && (visualElement.type === "html" || visualElement.type === "svg")) {
createProjectionNode(visualElementRef.current, props, ProjectionNodeConstructor, initialLayoutGroupConfig);
}
useInsertionEffect(() => {
visualElement && visualElement.update(props, presenceContext);
});
const optimisedAppearId = props[optimizedAppearDataAttribute];
const wantsHandoff = useRef(Boolean(optimisedAppearId) && !window.MotionHandoffIsComplete && ((_a = window.MotionHasOptimisedAnimation) === null || _a === void 0 ? void 0 : _a.call(window, optimisedAppearId)));
useIsomorphicLayoutEffect(() => {
if (!visualElement)
return;
visualElement.updateFeatures();
microtask.render(visualElement.render);
if (wantsHandoff.current && visualElement.animationState) {
visualElement.animationState.animateChanges();
}
});
useEffect2(() => {
if (!visualElement)
return;
if (!wantsHandoff.current && visualElement.animationState) {
visualElement.animationState.animateChanges();
}
wantsHandoff.current = false;
if (!scheduleHandoffComplete) {
scheduleHandoffComplete = true;
queueMicrotask(completeHandoff);
}
});
return visualElement;
}
function completeHandoff() {
window.MotionHandoffIsComplete = true;
}
function createProjectionNode(visualElement, props, ProjectionNodeConstructor, initialPromotionConfig) {
const { layoutId, layout: layout2, drag: drag2, dragConstraints, layoutScroll, layoutRoot } = props;
visualElement.projection = new ProjectionNodeConstructor(visualElement.latestValues, props["data-framer-portal-id"] ? void 0 : getClosestProjectingNode(visualElement.parent));
visualElement.projection.setOptions({
layoutId,
layout: layout2,
alwaysMeasureLayout: Boolean(drag2) || dragConstraints && isRefObject(dragConstraints),
visualElement,
/**
* TODO: Update options in an effect. This could be tricky as it'll be too late
* to update by the time layout animations run.
* We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
* ensuring it gets called if there's no potential layout animations.
*
*/
animationType: typeof layout2 === "string" ? layout2 : "both",
initialPromotionConfig,
layoutScroll,
layoutRoot
});
}
function getClosestProjectingNode(visualElement) {
if (!visualElement)
return void 0;
return visualElement.options.allowProjection !== false ? visualElement.projection : getClosestProjectingNode(visualElement.parent);
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.mjs
import { useCallback } from "react";
function useMotionRef(visualState, visualElement, externalRef) {
return useCallback(
(instance) => {
instance && visualState.mount && visualState.mount(instance);
if (visualElement) {
if (instance) {
visualElement.mount(instance);
} else {
visualElement.unmount();
}
}
if (externalRef) {
if (typeof externalRef === "function") {
externalRef(instance);
} else if (isRefObject(externalRef)) {
externalRef.current = instance;
}
}
},
/**
* Only pass a new ref callback to React if we've received a visual element
* factory. Otherwise we'll be mounting/remounting every time externalRef
* or other dependencies change.
*/
[visualElement]
);
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/context/MotionContext/create.mjs
import { useContext as useContext2, useMemo } from "react";
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/utils/is-variant-label.mjs
function isVariantLabel(v) {
return typeof v === "string" || Array.isArray(v);
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/animation/utils/is-animation-controls.mjs
function isAnimationControls(v) {
return v !== null && typeof v === "object" && typeof v.start === "function";
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/utils/variant-props.mjs
var variantPriorityOrder = [
"animate",
"whileInView",
"whileFocus",
"whileHover",
"whileTap",
"whileDrag",
"exit"
];
var variantProps = ["initial", ...variantPriorityOrder];
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/utils/is-controlling-variants.mjs
function isControllingVariants(props) {
return isAnimationControls(props.animate) || variantProps.some((name) => isVariantLabel(props[name]));
}
function isVariantNode(props) {
return Boolean(isControllingVariants(props) || props.variants);
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/context/MotionContext/utils.mjs
function getCurrentTreeVariants(props, context) {
if (isControllingVariants(props)) {
const { initial, animate } = props;
return {
initial: initial === false || isVariantLabel(initial) ? initial : void 0,
animate: isVariantLabel(animate) ? animate : void 0
};
}
return props.inherit !== false ? context : {};
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/context/MotionContext/create.mjs
function useCreateMotionContext(props) {
const { initial, animate } = getCurrentTreeVariants(props, useContext2(MotionContext));
return useMemo(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
}
function variantLabelsAsDependency(prop) {
return Array.isArray(prop) ? prop.join(" ") : prop;
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/motion/features/definitions.mjs
var featureProps = {
animation: [
"animate",
"variants",
"whileHover",
"whileTap",
"exit",
"whileInView",
"whileFocus",
"whileDrag"
],
exit: ["exit"],
drag: ["drag", "dragControls"],
focus: ["whileFocus"],
hover: ["whileHover", "onHoverStart", "onHoverEnd"],
tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
layout: ["layout", "layoutId"]
};
var featureDefinitions = {};
for (const key in featureProps) {
featureDefinitions[key] = {
isEnabled: (props) => featureProps[key].some((name) => !!props[name])
};
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/motion/features/load-features.mjs
function loadFeatures(features) {
for (const key in features) {
featureDefinitions[key] = {
...featureDefinitions[key],
...features[key]
};
}
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/context/LayoutGroupContext.mjs
import { createContext as createContext6 } from "react";
var LayoutGroupContext = createContext6({});
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/motion/utils/symbol.mjs
var motionComponentSymbol = Symbol.for("motionComponentSymbol");
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/utils/noop.mjs
var noop = (any) => any;
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/utils/errors.mjs
var warning = noop;
var invariant = noop;
if (process.env.NODE_ENV !== "production") {
warning = (check, message) => {
if (!check && typeof console !== "undefined") {
console.warn(message);
}
};
invariant = (check, message) => {
if (!check) {
throw new Error(message);
}
};
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/motion/index.mjs
function createMotionComponent({ preloadedFeatures: preloadedFeatures2, createVisualElement, useRender, useVisualState, Component: Component3 }) {
preloadedFeatures2 && loadFeatures(preloadedFeatures2);
function MotionComponent(props, externalRef) {
let MeasureLayout2;
const configAndProps = {
...useContext3(MotionConfigContext),
...props,
layoutId: useLayoutId(props)
};
const { isStatic } = configAndProps;
const context = useCreateMotionContext(props);
const visualState = useVisualState(props, isStatic);
if (!isStatic && isBrowser) {
useStrictMode(configAndProps, preloadedFeatures2);
const layoutProjection = getProjectionFunctionality(configAndProps);
MeasureLayout2 = layoutProjection.MeasureLayout;
context.visualElement = useVisualElement(Component3, visualState, configAndProps, createVisualElement, layoutProjection.ProjectionNode);
}
return jsxs(MotionContext.Provider, { value: context, children: [MeasureLayout2 && context.visualElement ? jsx(MeasureLayout2, { visualElement: context.visualElement, ...configAndProps }) : null, useRender(Component3, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, context.visualElement)] });
}
const ForwardRefComponent = forwardRef(MotionComponent);
ForwardRefComponent[motionComponentSymbol] = Component3;
return ForwardRefComponent;
}
function useLayoutId({ layoutId }) {
const layoutGroupId = useContext3(LayoutGroupContext).id;
return layoutGroupId && layoutId !== void 0 ? layoutGroupId + "-" + layoutId : layoutId;
}
function useStrictMode(configAndProps, preloadedFeatures2) {
const isStrict = useContext3(LazyContext).strict;
if (process.env.NODE_ENV !== "production" && preloadedFeatures2 && isStrict) {
const strictMessage = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
configAndProps.ignoreStrict ? warning(false, strictMessage) : invariant(false, strictMessage);
}
}
function getProjectionFunctionality(props) {
const { drag: drag2, layout: layout2 } = featureDefinitions;
if (!drag2 && !layout2)
return {};
const combined = { ...drag2, ...layout2 };
return {
MeasureLayout: (drag2 === null || drag2 === void 0 ? void 0 : drag2.isEnabled(props)) || (layout2 === null || layout2 === void 0 ? void 0 : layout2.isEnabled(props)) ? combined.MeasureLayout : void 0,
ProjectionNode: combined.ProjectionNode
};
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/dom/motion-proxy.mjs
function createMotionProxy(createConfig) {
function custom(Component3, customMotionComponentConfig = {}) {
return createMotionComponent(createConfig(Component3, customMotionComponentConfig));
}
if (typeof Proxy === "undefined") {
return custom;
}
const componentCache = /* @__PURE__ */ new Map();
return new Proxy(custom, {
/**
* Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
* The prop name is passed through as `key` and we can use that to generate a `motion`
* DOM component with that name.
*/
get: (_target, key) => {
if (!componentCache.has(key)) {
componentCache.set(key, custom(key));
}
return componentCache.get(key);
}
});
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/svg/lowercase-elements.mjs
var lowercaseSVGElements = [
"animate",
"circle",
"defs",
"desc",
"ellipse",
"g",
"image",
"line",
"filter",
"marker",
"mask",
"metadata",
"path",
"pattern",
"polygon",
"polyline",
"rect",
"stop",
"switch",
"symbol",
"svg",
"text",
"tspan",
"use",
"view"
];
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/dom/utils/is-svg-component.mjs
function isSVGComponent(Component3) {
if (
/**
* If it's not a string, it's a custom React component. Currently we only support
* HTML custom React components.
*/
typeof Component3 !== "string" || /**
* If it contains a dash, the element is a custom HTML webcomponent.
*/
Component3.includes("-")
) {
return false;
} else if (
/**
* If it's in our list of lowercase SVG tags, it's an SVG component
*/
lowercaseSVGElements.indexOf(Component3) > -1 || /**
* If it contains a capital letter, it's an SVG component
*/
/[A-Z]/u.test(Component3)
) {
return true;
}
return false;
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/dom/use-render.mjs
import { Fragment, useMemo as useMemo4, createElement } from "react";
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/html/use-props.mjs
import { useMemo as useMemo2 } from "react";
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/projection/styles/scale-correction.mjs
var scaleCorrectors = {};
function addScaleCorrector(correctors) {
Object.assign(scaleCorrectors, correctors);
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/html/utils/transform.mjs
var transformPropOrder = [
"transformPerspective",
"x",
"y",
"z",
"translateX",
"translateY",
"translateZ",
"scale",
"scaleX",
"scaleY",
"rotate",
"rotateX",
"rotateY",
"rotateZ",
"skew",
"skewX",
"skewY"
];
var transformProps = new Set(transformPropOrder);
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs
function isForcedMotionValue(key, { layout: layout2, layoutId }) {
return transformProps.has(key) || key.startsWith("origin") || (layout2 || layoutId !== void 0) && (!!scaleCorrectors[key] || key === "opacity");
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/value/utils/is-motion-value.mjs
var isMotionValue = (value) => Boolean(value && value.getVelocity);
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/dom/value-types/get-as-type.mjs
var getValueAsType = (value, type) => {
return type && typeof value === "number" ? type.transform(value) : value;
};
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/utils/clamp.mjs
var clamp = (min, max, v) => {
if (v > max)
return max;
if (v < min)
return min;
return v;
};
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/value/types/numbers/index.mjs
var number = {
test: (v) => typeof v === "number",
parse: parseFloat,
transform: (v) => v
};
var alpha = {
...number,
transform: (v) => clamp(0, 1, v)
};
var scale = {
...number,
default: 1
};
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/value/types/utils.mjs
var sanitize = (v) => Math.round(v * 1e5) / 1e5;
var floatRegex = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
var colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
var singleColorRegex = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;
function isString(v) {
return typeof v === "string";
}
function isNullish(v) {
return v == null;
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/value/types/numbers/units.mjs
var createUnitType = (unit) => ({
test: (v) => isString(v) && v.endsWith(unit) && v.split(" ").length === 1,
parse: parseFloat,
transform: (v) => `${v}${unit}`
});
var degrees = createUnitType("deg");
var percent = createUnitType("%");
var px = createUnitType("px");
var vh = createUnitType("vh");
var vw = createUnitType("vw");
var progressPercentage = {
...percent,
parse: (v) => percent.parse(v) / 100,
transform: (v) => percent.transform(v * 100)
};
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/dom/value-types/type-int.mjs
var int = {
...number,
transform: Math.round
};
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/dom/value-types/number.mjs
var numberValueTypes = {
// Border props
borderWidth: px,
borderTopWidth: px,
borderRightWidth: px,
borderBottomWidth: px,
borderLeftWidth: px,
borderRadius: px,
radius: px,
borderTopLeftRadius: px,
borderTopRightRadius: px,
borderBottomRightRadius: px,
borderBottomLeftRadius: px,
// Positioning props
width: px,
maxWidth: px,
height: px,
maxHeight: px,
size: px,
top: px,
right: px,
bottom: px,
left: px,
// Spacing props
padding: px,
paddingTop: px,
paddingRight: px,
paddingBottom: px,
paddingLeft: px,
margin: px,
marginTop: px,
marginRight: px,
marginBottom: px,
marginLeft: px,
// Transform props
rotate: degrees,
rotateX: degrees,
rotateY: degrees,
rotateZ: degrees,
scale,
scaleX: scale,
scaleY: scale,
scaleZ: scale,
skew: degrees,
skewX: degrees,
skewY: degrees,
distance: px,
translateX: px,
translateY: px,
translateZ: px,
x: px,
y: px,
z: px,
perspective: px,
transformPerspective: px,
opacity: alpha,
originX: progressPercentage,
originY: progressPercentage,
originZ: px,
// Misc
zIndex: int,
backgroundPositionX: px,
backgroundPositionY: px,
// SVG
fillOpacity: alpha,
strokeOpacity: alpha,
numOctaves: int
};
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/html/utils/build-transform.mjs
var translateAlias = {
x: "translateX",
y: "translateY",
z: "translateZ",
transformPerspective: "perspective"
};
var numTransforms = transformPropOrder.length;
function buildTransform(latestValues, transform, transformTemplate) {
let transformString = "";
let transformIsDefault = true;
for (let i = 0; i < numTransforms; i++) {
const key = transformPropOrder[i];
const value = latestValues[key];
if (value === void 0)
continue;
let valueIsDefault = true;
if (typeof value === "number") {
valueIsDefault = value === (key.startsWith("scale") ? 1 : 0);
} else {
valueIsDefault = parseFloat(value) === 0;
}
if (!valueIsDefault || transformTemplate) {
const valueAsType = getValueAsType(value, numberValueTypes[key]);
if (!valueIsDefault) {
transformIsDefault = false;
const transformName = translateAlias[key] || key;
transformString += `${transformName}(${valueAsType}) `;
}
if (transformTemplate) {
transform[key] = valueAsType;
}
}
}
transformString = transformString.trim();
if (transformTemplate) {
transformString = transformTemplate(transform, transformIsDefault ? "" : transformString);
} else if (transformIsDefault) {
transformString = "none";
}
return transformString;
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/dom/utils/is-css-variable.mjs
var checkStringStartsWith = (token) => (key) => typeof key === "string" && key.startsWith(token);
var isCSSVariableName = checkStringStartsWith("--");
var startsAsVariableToken = checkStringStartsWith("var(--");
var isCSSVariableToken = (value) => {
const startsWithToken = startsAsVariableToken(value);
if (!startsWithToken)
return false;
return singleCssVariableRegex.test(value.split("/*")[0].trim());
};
var singleCssVariableRegex = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/html/utils/build-styles.mjs
function buildHTMLStyles(state, latestValues, transformTemplate) {
const { style, vars, transformOrigin } = state;
let hasTransform2 = false;
let hasTransformOrigin = false;
for (const key in latestValues) {
const value = latestValues[key];
if (transformProps.has(key)) {
hasTransform2 = true;
continue;
} else if (isCSSVariableName(key)) {
vars[key] = value;
continue;
} else {
const valueAsType = getValueAsType(value, numberValueTypes[key]);
if (key.startsWith("origin")) {
hasTransformOrigin = true;
transformOrigin[key] = valueAsType;
} else {
style[key] = valueAsType;
}
}
}
if (!latestValues.transform) {
if (hasTransform2 || transformTemplate) {
style.transform = buildTransform(latestValues, state.transform, transformTemplate);
} else if (style.transform) {
style.transform = "none";
}
}
if (hasTransformOrigin) {
const { originX = "50%", originY = "50%", originZ = 0 } = transformOrigin;
style.transformOrigin = `${originX} ${originY} ${originZ}`;
}
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/html/utils/create-render-state.mjs
var createHtmlRenderState = () => ({
style: {},
transform: {},
transformOrigin: {},
vars: {}
});
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/html/use-props.mjs
function copyRawValuesOnly(target, source, props) {
for (const key in source) {
if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {
target[key] = source[key];
}
}
}
function useInitialMotionValues({ transformTemplate }, visualState) {
return useMemo2(() => {
const state = createHtmlRenderState();
buildHTMLStyles(state, visualState, transformTemplate);
return Object.assign({}, state.vars, state.style);
}, [visualState]);
}
function useStyle(props, visualState) {
const styleProp = props.style || {};
const style = {};
copyRawValuesOnly(style, styleProp, props);
Object.assign(style, useInitialMotionValues(props, visualState));
return style;
}
function useHTMLProps(props, visualState) {
const htmlProps = {};
const style = useStyle(props, visualState);
if (props.drag && props.dragListener !== false) {
htmlProps.draggable = false;
style.userSelect = style.WebkitUserSelect = style.WebkitTouchCallout = "none";
style.touchAction = props.drag === true ? "none" : `pan-${props.drag === "x" ? "y" : "x"}`;
}
if (props.tabIndex === void 0 && (props.onTap || props.onTapStart || props.whileTap)) {
htmlProps.tabIndex = 0;
}
htmlProps.style = style;
return htmlProps;
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/motion/utils/valid-prop.mjs
var validMotionProps = /* @__PURE__ */ new Set([
"animate",
"exit",
"variants",
"initial",
"style",
"values",
"variants",
"transition",
"transformTemplate",
"custom",
"inherit",
"onBeforeLayoutMeasure",
"onAnimationStart",
"onAnimationComplete",
"onUpdate",
"onDragStart",
"onDrag",
"onDragEnd",
"onMeasureDragConstraints",
"onDirectionLock",
"onDragTransitionEnd",
"_dragX",
"_dragY",
"onHoverStart",
"onHoverEnd",
"onViewportEnter",
"onViewportLeave",
"globalTapTarget",
"ignoreStrict",
"viewport"
]);
function isValidMotionProp(key) {
return key.startsWith("while") || key.startsWith("drag") && key !== "draggable" || key.startsWith("layout") || key.startsWith("onTap") || key.startsWith("onPan") || key.startsWith("onLayout") || validMotionProps.has(key);
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/dom/utils/filter-props.mjs
var shouldForward = (key) => !isValidMotionProp(key);
function loadExternalIsValidProp(isValidProp) {
if (!isValidProp)
return;
shouldForward = (key) => key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key);
}
try {
loadExternalIsValidProp(__require("@emotion/is-prop-valid").default);
} catch (_a) {
}
function filterProps(props, isDom, forwardMotionProps) {
const filteredProps = {};
for (const key in props) {
if (key === "values" && typeof props.values === "object")
continue;
if (shouldForward(key) || forwardMotionProps === true && isValidMotionProp(key) || !isDom && !isValidMotionProp(key) || // If trying to use native HTML drag events, forward drag listeners
props["draggable"] && key.startsWith("onDrag")) {
filteredProps[key] = props[key];
}
}
return filteredProps;
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/svg/use-props.mjs
import { useMemo as useMemo3 } from "react";
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/svg/utils/transform-origin.mjs
function calcOrigin(origin, offset, size) {
return typeof origin === "string" ? origin : px.transform(offset + size * origin);
}
function calcSVGTransformOrigin(dimensions, originX, originY) {
const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
return `${pxOriginX} ${pxOriginY}`;
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/svg/utils/path.mjs
var dashKeys = {
offset: "stroke-dashoffset",
array: "stroke-dasharray"
};
var camelKeys = {
offset: "strokeDashoffset",
array: "strokeDasharray"
};
function buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true) {
attrs.pathLength = 1;
const keys = useDashCase ? dashKeys : camelKeys;
attrs[keys.offset] = px.transform(-offset);
const pathLength = px.transform(length);
const pathSpacing = px.transform(spacing);
attrs[keys.array] = `${pathLength} ${pathSpacing}`;
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/svg/utils/build-attrs.mjs
function buildSVGAttrs(state, {
attrX,
attrY,
attrScale,
originX,
originY,
pathLength,
pathSpacing = 1,
pathOffset = 0,
// This is object creation, which we try to avoid per-frame.
...latest
}, isSVGTag2, transformTemplate) {
buildHTMLStyles(state, latest, transformTemplate);
if (isSVGTag2) {
if (state.style.viewBox) {
state.attrs.viewBox = state.style.viewBox;
}
return;
}
state.attrs = state.style;
state.style = {};
const { attrs, style, dimensions } = state;
if (attrs.transform) {
if (dimensions)
style.transform = attrs.transform;
delete attrs.transform;
}
if (dimensions && (originX !== void 0 || originY !== void 0 || style.transform)) {
style.transformOrigin = calcSVGTransformOrigin(dimensions, originX !== void 0 ? originX : 0.5, originY !== void 0 ? originY : 0.5);
}
if (attrX !== void 0)
attrs.x = attrX;
if (attrY !== void 0)
attrs.y = attrY;
if (attrScale !== void 0)
attrs.scale = attrScale;
if (pathLength !== void 0) {
buildSVGPath(attrs, pathLength, pathSpacing, pathOffset, false);
}
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/svg/utils/create-render-state.mjs
var createSvgRenderState = () => ({
...createHtmlRenderState(),
attrs: {}
});
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/svg/utils/is-svg-tag.mjs
var isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/svg/use-props.mjs
function useSVGProps(props, visualState, _isStatic, Component3) {
const visualProps = useMemo3(() => {
const state = createSvgRenderState();
buildSVGAttrs(state, visualState, isSVGTag(Component3), props.transformTemplate);
return {
...state.attrs,
style: { ...state.style }
};
}, [visualState]);
if (props.style) {
const rawStyles = {};
copyRawValuesOnly(rawStyles, props.style, props);
visualProps.style = { ...rawStyles, ...visualProps.style };
}
return visualProps;
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/dom/use-render.mjs
function createUseRender(forwardMotionProps = false) {
const useRender = (Component3, props, ref, { latestValues }, isStatic) => {
const useVisualProps = isSVGComponent(Component3) ? useSVGProps : useHTMLProps;
const visualProps = useVisualProps(props, latestValues, isStatic, Component3);
const filteredProps = filterProps(props, typeof Component3 === "string", forwardMotionProps);
const elementProps = Component3 !== Fragment ? { ...filteredProps, ...visualProps, ref } : {};
const { children } = props;
const renderedChildren = useMemo4(() => isMotionValue(children) ? children.get() : children, [children]);
return createElement(Component3, {
...elementProps,
children: renderedChildren
});
};
return useRender;
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/html/utils/render.mjs
function renderHTML(element, { style, vars }, styleProp, projection) {
Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp));
for (const key in vars) {
element.style.setProperty(key, vars[key]);
}
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs
var camelCaseAttributes = /* @__PURE__ */ new Set([
"baseFrequency",
"diffuseConstant",
"kernelMatrix",
"kernelUnitLength",
"keySplines",
"keyTimes",
"limitingConeAngle",
"markerHeight",
"markerWidth",
"numOctaves",
"targetX",
"targetY",
"surfaceScale",
"specularConstant",
"specularExponent",
"stdDeviation",
"tableValues",
"viewBox",
"gradientTransform",
"pathLength",
"startOffset",
"textLength",
"lengthAdjust"
]);
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/svg/utils/render.mjs
function renderSVG(element, renderState, _styleProp, projection) {
renderHTML(element, renderState, void 0, projection);
for (const key in renderState.attrs) {
element.setAttribute(!camelCaseAttributes.has(key) ? camelToDash(key) : key, renderState.attrs[key]);
}
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs
function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
var _a;
const { style } = props;
const newValues = {};
for (const key in style) {
if (isMotionValue(style[key]) || prevProps.style && isMotionValue(prevProps.style[key]) || isForcedMotionValue(key, props) || ((_a = visualElement === null || visualElement === void 0 ? void 0 : visualElement.getValue(key)) === null || _a === void 0 ? void 0 : _a.liveStyle) !== void 0) {
newValues[key] = style[key];
}
}
if (visualElement && style && typeof style.willChange === "string") {
visualElement.applyWillChange = false;
}
return newValues;
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs
function scrapeMotionValuesFromProps2(props, prevProps, visualElement) {
const newValues = scrapeMotionValuesFromProps(props, prevProps, visualElement);
for (const key in props) {
if (isMotionValue(props[key]) || isMotionValue(prevProps[key])) {
const targetKey = transformPropOrder.indexOf(key) !== -1 ? "attr" + key.charAt(0).toUpperCase() + key.substring(1) : key;
newValues[targetKey] = props[key];
}
}
return newValues;
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/motion/utils/use-visual-state.mjs
import { useContext as useContext4 } from "react";
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/utils/resolve-variants.mjs
function getValueState(visualElement) {
const state = [{}, {}];
visualElement === null || visualElement === void 0 ? void 0 : visualElement.values.forEach((value, key) => {
state[0][key] = value.get();
state[1][key] = value.getVelocity();
});
return state;
}
function resolveVariantFromProps(props, definition, custom, visualElement) {
if (typeof definition === "function") {
const [current, velocity] = getValueState(visualElement);
definition = definition(custom !== void 0 ? custom : props.custom, current, velocity);
}
if (typeof definition === "string") {
definition = props.variants && props.variants[definition];
}
if (typeof definition === "function") {
const [current, velocity] = getValueState(visualElement);
definition = definition(custom !== void 0 ? custom : props.custom, current, velocity);
}
return definition;
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/utils/use-constant.mjs
import { useRef as useRef2 } from "react";
function useConstant(init) {
const ref = useRef2(null);
if (ref.current === null) {
ref.current = init();
}
return ref.current;
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs
var isKeyframesTarget = (v) => {
return Array.isArray(v);
};
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/utils/resolve-value.mjs
var isCustomValue = (v) => {
return Boolean(v && typeof v === "object" && v.mix && v.toValue);
};
var resolveFinalValueInKeyframes = (v) => {
return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v;
};
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/value/utils/resolve-motion-value.mjs
function resolveMotionValue(value) {
const unwrappedValue = isMotionValue(value) ? value.get() : value;
return isCustomValue(unwrappedValue) ? unwrappedValue.toValue() : unwrappedValue;
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/animation/animators/utils/accelerated-values.mjs
var acceleratedValues = /* @__PURE__ */ new Set([
"opacity",
"clipPath",
"filter",
"transform"
// TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
// or until we implement support for linear() easing.
// "background-color"
]);
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/value/use-will-change/get-will-change-name.mjs
function getWillChangeName(name) {
if (transformProps.has(name)) {
return "transform";
} else if (acceleratedValues.has(name)) {
return camelToDash(name);
}
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/utils/array.mjs
function addUniqueItem(arr, item) {
if (arr.indexOf(item) === -1)
arr.push(item);
}
function removeItem(arr, item) {
const index = arr.indexOf(item);
if (index > -1)
arr.splice(index, 1);
}
// ../../node_modules/.pnpm/framer-motion@11.3.30_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/motion/utils/use-visual-state.mjs
function makeState({ applyWillChange = false, scrapeMotionValuesFromProps: scrapeMotionValuesFromProps3, createRenderState, onMount }, props, context, presenceContext, isStatic) {
const state = {
latestValues: makeLatestValues(props, context, presenceContext, isStatic ? false : applyWillChange, scrapeMotionValuesFromProps3),
renderState: createRenderState()
};
if (onMount) {
state.mount = (instance) => onMount(props, instance, state);
}
return state;
}
var makeUseVisualState = (config) => (props, isStatic) => {
const context = useContext4(MotionContext);
const presenceContext = useContext4(PresenceContext);
const make = () => makeState(config, props, context, presenceContext, isStatic);
return isStatic ? make() : useConstant(make);
};
function addWillChange(willChange, name) {
const memberName = getWillChangeName(name);
if (memberName) {
addUniqueItem(willChange, memberName);
}
}
function forEachDefinition(props, definition, callback) {
const list = Array.isArray(definition) ? definition : [definition];
for (let i = 0; i < list.length; i++) {
const resolved = resolveVariantFromProps(props, list[i]);
if (resolved) {
const { transitionEnd, transition, ...target } = resolved;
callback(target, transitionEnd);
}
}
}
function makeLatestValues(props, context, presenceContext, shouldApplyWillChange, scrapeMotionValues) {
var _a;
const values = {};
const willChange = [];
const applyWillChange = shouldApplyWillChange && ((_a = props.style) === null || _a === void 0 ? void 0 : _a.willChange) === void 0;
const motionValues = scrapeMotionValues(props, {});
for (const key in motionValues) {
values[key] = resolveMotionValue(motionValues[key]);
}
let { initial, animate } = props;
const isControllingVariants$1 = isControllingVariants(props);
const isVariantNode$1 = isVariantNode(props);
if (context && isVariantNode$1 && !isControllingVariants$1 && props.inherit !== false) {
if (initial === void 0)
initial = context.initial;
if (animate === void 0)
animate = context.animate;
}
let isInitialAnimationBlocked = presenceContext ? presenceContext.initial === false : false;
isInitialAnimationBlocked = isInitialAnimationBlocked || initial === false;
const variantToSet = isInitialAnimationBlocked ? animate : initial;
if (variantToSet && typeof variantToSet !== "boolean" && !isAnimationControls(variantToSet)) {
forEachDefinition(props, variantToSet, (target, transitionEnd) => {
for (const key in target) {
let valueTarget = target[key];
if (Array.isArray(valueTarget)) {
const index = isInitialAnimationBlocked ? valueTarget.length - 1 : 0;
valueTarget = valueTarget[index];
}
if (valueTarget !== null) {
values[key] = valueTarget;
}
}
for (const key in transitionEnd) {
values[key] = transitionEnd[key];
}
});
}
if (applyWillChange) {
if (animate && initial !== false && !isAnimationControls(animate)) {
forEachDefinition(props, animate, (target) => {
for (const key in target) {
addWillChange(willChange, key);
}
});
}
if (willChange.length) {
values.willChange = willChange.join(",");
}
}
return values;
}
// ../../node_modules/.pn