unframer 2.6.3 → 2.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/framer.js CHANGED
@@ -18,7 +18,7 @@ var __rest = (this && this.__rest) || function (s, e) {
18
18
  }
19
19
  return t;
20
20
  };
21
- // https :https://app.framerstatic.com/chunk-HCJ5X5Q7.js
21
+ // https :https://app.framerstatic.com/chunk-VMMGJNOV.js
22
22
  import { createContext, } from 'react';
23
23
  import { useEffect, useLayoutEffect, } from 'react';
24
24
  import { jsx, jsxs, } from 'react/jsx-runtime';
@@ -30,8 +30,8 @@ import { useId, } from 'react';
30
30
  import { createElement, Fragment, } from 'react';
31
31
  import { Component, } from 'react';
32
32
  import { useState, } from 'react';
33
- import { Children, cloneElement as cloneElement2, isValidElement, } from 'react';
34
33
  import * as React2 from 'react';
34
+ import { Children, isValidElement, } from 'react';
35
35
  var __create = Object.create;
36
36
  var __defProp = Object.defineProperty;
37
37
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -144,7 +144,7 @@ var MotionConfigContext = createContext({
144
144
  });
145
145
  var MotionContext = createContext({});
146
146
  var PresenceContext = createContext(null);
147
- var isBrowser = typeof document !== 'undefined';
147
+ var isBrowser = typeof window !== 'undefined';
148
148
  var useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
149
149
  var camelToDash = (str) => str.replace(/([a-z])([A-Z])/gu, '$1-$2').toLowerCase();
150
150
  var optimizedAppearDataId = 'framerAppearId';
@@ -314,6 +314,7 @@ function isRefObject(ref) {
314
314
  }
315
315
  var scheduleHandoffComplete = false;
316
316
  function useVisualElement(Component33, visualState, props, createVisualElement2, ProjectionNodeConstructor) {
317
+ var _a;
317
318
  const { visualElement: parent, } = useContext3(MotionContext);
318
319
  const lazyContext = useContext3(LazyContext);
319
320
  const presenceContext = useContext3(PresenceContext);
@@ -339,7 +340,9 @@ function useVisualElement(Component33, visualState, props, createVisualElement2,
339
340
  useInsertionEffect(() => {
340
341
  visualElement && visualElement.update(props, presenceContext);
341
342
  });
342
- const wantsHandoff = useRef(Boolean(props[optimizedAppearDataAttribute] && !window.HandoffComplete));
343
+ const optimisedAppearId = props[optimizedAppearDataAttribute];
344
+ const wantsHandoff = useRef(Boolean(optimisedAppearId) && !window.MotionHandoffIsComplete &&
345
+ ((_a = window.MotionHasOptimisedAnimation) === null || _a === void 0 ? void 0 : _a.call(window, optimisedAppearId)));
343
346
  useIsomorphicLayoutEffect(() => {
344
347
  if (!visualElement)
345
348
  return;
@@ -355,18 +358,16 @@ function useVisualElement(Component33, visualState, props, createVisualElement2,
355
358
  if (!wantsHandoff.current && visualElement.animationState) {
356
359
  visualElement.animationState.animateChanges();
357
360
  }
358
- if (wantsHandoff.current) {
359
- wantsHandoff.current = false;
360
- if (!scheduleHandoffComplete) {
361
- scheduleHandoffComplete = true;
362
- queueMicrotask(completeHandoff);
363
- }
361
+ wantsHandoff.current = false;
362
+ if (!scheduleHandoffComplete) {
363
+ scheduleHandoffComplete = true;
364
+ queueMicrotask(completeHandoff);
364
365
  }
365
366
  });
366
367
  return visualElement;
367
368
  }
368
369
  function completeHandoff() {
369
- window.HandoffComplete = true;
370
+ window.MotionHandoffIsComplete = true;
370
371
  }
371
372
  function createProjectionNode(visualElement, props, ProjectionNodeConstructor, initialPromotionConfig) {
372
373
  const { layoutId, layout: layout2, drag: drag2, dragConstraints, layoutScroll, layoutRoot, } = props;
@@ -532,6 +533,34 @@ function addScaleCorrector(correctors) {
532
533
  Object.assign(scaleCorrectors, correctors);
533
534
  }
534
535
  var isMotionValue = (value) => Boolean(value && value.getVelocity);
536
+ var clamp = (min, max, v) => {
537
+ if (v > max)
538
+ return max;
539
+ if (v < min)
540
+ return min;
541
+ return v;
542
+ };
543
+ var sanitize = (v) => Math.round(v * 1e5) / 1e5;
544
+ var floatRegex = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
545
+ var colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
546
+ var singleColorRegex = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;
547
+ function isString(v) {
548
+ return typeof v === 'string';
549
+ }
550
+ function isNullish(v) {
551
+ return v == null;
552
+ }
553
+ var createUnitType = (unit) => ({
554
+ test: (v) => isString(v) && v.endsWith(unit) && v.split(' ').length === 1,
555
+ parse: parseFloat,
556
+ transform: (v) => `${v}${unit}`,
557
+ });
558
+ var degrees = createUnitType('deg');
559
+ var percent = createUnitType('%');
560
+ var px = createUnitType('px');
561
+ var vh = createUnitType('vh');
562
+ var vw = createUnitType('vw');
563
+ var progressPercentage = Object.assign(Object.assign({}, percent), { parse: (v) => percent.parse(v) / 100, transform: (v) => percent.transform(v * 100) });
535
564
  var transformPropOrder = [
536
565
  'transformPerspective',
537
566
  'x',
@@ -552,6 +581,85 @@ var transformPropOrder = [
552
581
  'skewY',
553
582
  ];
554
583
  var transformProps = new Set(transformPropOrder);
584
+ var getValueAsType = (value, type) => {
585
+ return type && typeof value === 'number' ? type.transform(value) : value;
586
+ };
587
+ var number = {
588
+ test: (v) => typeof v === 'number',
589
+ parse: parseFloat,
590
+ transform: (v) => v,
591
+ };
592
+ var alpha = Object.assign(Object.assign({}, number), { transform: (v) => clamp(0, 1, v) });
593
+ var scale = Object.assign(Object.assign({}, number), { default: 1 });
594
+ var int = Object.assign(Object.assign({}, number), { transform: Math.round });
595
+ var numberValueTypes = {
596
+ // Border props
597
+ borderWidth: px,
598
+ borderTopWidth: px,
599
+ borderRightWidth: px,
600
+ borderBottomWidth: px,
601
+ borderLeftWidth: px,
602
+ borderRadius: px,
603
+ radius: px,
604
+ borderTopLeftRadius: px,
605
+ borderTopRightRadius: px,
606
+ borderBottomRightRadius: px,
607
+ borderBottomLeftRadius: px,
608
+ // Positioning props
609
+ width: px,
610
+ maxWidth: px,
611
+ height: px,
612
+ maxHeight: px,
613
+ size: px,
614
+ top: px,
615
+ right: px,
616
+ bottom: px,
617
+ left: px,
618
+ // Spacing props
619
+ padding: px,
620
+ paddingTop: px,
621
+ paddingRight: px,
622
+ paddingBottom: px,
623
+ paddingLeft: px,
624
+ margin: px,
625
+ marginTop: px,
626
+ marginRight: px,
627
+ marginBottom: px,
628
+ marginLeft: px,
629
+ // Transform props
630
+ rotate: degrees,
631
+ rotateX: degrees,
632
+ rotateY: degrees,
633
+ rotateZ: degrees,
634
+ scale,
635
+ scaleX: scale,
636
+ scaleY: scale,
637
+ scaleZ: scale,
638
+ skew: degrees,
639
+ skewX: degrees,
640
+ skewY: degrees,
641
+ distance: px,
642
+ translateX: px,
643
+ translateY: px,
644
+ translateZ: px,
645
+ x: px,
646
+ y: px,
647
+ z: px,
648
+ perspective: px,
649
+ transformPerspective: px,
650
+ opacity: alpha,
651
+ originX: progressPercentage,
652
+ originY: progressPercentage,
653
+ originZ: px,
654
+ // Misc
655
+ zIndex: int,
656
+ backgroundPositionX: px,
657
+ backgroundPositionY: px,
658
+ // SVG
659
+ fillOpacity: alpha,
660
+ strokeOpacity: alpha,
661
+ numOctaves: int,
662
+ };
555
663
  var translateAlias = {
556
664
  x: 'translateX',
557
665
  y: 'translateY',
@@ -559,13 +667,31 @@ var translateAlias = {
559
667
  transformPerspective: 'perspective',
560
668
  };
561
669
  var numTransforms = transformPropOrder.length;
562
- function buildTransform(transform2, transformIsDefault, transformTemplate2) {
670
+ function buildTransform(latestValues, transform2, transformTemplate2) {
563
671
  let transformString3 = '';
672
+ let transformIsDefault = true;
564
673
  for (let i = 0; i < numTransforms; i++) {
565
674
  const key7 = transformPropOrder[i];
566
- if (transform2[key7] !== void 0) {
567
- const transformName = translateAlias[key7] || key7;
568
- transformString3 += `${transformName}(${transform2[key7]}) `;
675
+ const value = latestValues[key7];
676
+ if (value === void 0)
677
+ continue;
678
+ let valueIsDefault = true;
679
+ if (typeof value === 'number') {
680
+ valueIsDefault = value === (key7.startsWith('scale') ? 1 : 0);
681
+ }
682
+ else {
683
+ valueIsDefault = parseFloat(value) === 0;
684
+ }
685
+ if (!valueIsDefault || transformTemplate2) {
686
+ const valueAsType = getValueAsType(value, numberValueTypes[key7]);
687
+ if (!valueIsDefault) {
688
+ transformIsDefault = false;
689
+ const transformName = translateAlias[key7] || key7;
690
+ transformString3 += `${transformName}(${valueAsType}) `;
691
+ }
692
+ if (transformTemplate2) {
693
+ transform2[key7] = valueAsType;
694
+ }
569
695
  }
570
696
  }
571
697
  transformString3 = transformString3.trim();
@@ -577,34 +703,6 @@ function buildTransform(transform2, transformIsDefault, transformTemplate2) {
577
703
  }
578
704
  return transformString3;
579
705
  }
580
- var clamp = (min, max, v) => {
581
- if (v > max)
582
- return max;
583
- if (v < min)
584
- return min;
585
- return v;
586
- };
587
- var sanitize = (v) => Math.round(v * 1e5) / 1e5;
588
- var floatRegex = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
589
- var colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
590
- var singleColorRegex = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;
591
- function isString(v) {
592
- return typeof v === 'string';
593
- }
594
- function isNullish(v) {
595
- return v == null;
596
- }
597
- var createUnitType = (unit) => ({
598
- test: (v) => isString(v) && v.endsWith(unit) && v.split(' ').length === 1,
599
- parse: parseFloat,
600
- transform: (v) => `${v}${unit}`,
601
- });
602
- var degrees = createUnitType('deg');
603
- var percent = createUnitType('%');
604
- var px = createUnitType('px');
605
- var vh = createUnitType('vh');
606
- var vw = createUnitType('vw');
607
- var progressPercentage = Object.assign(Object.assign({}, percent), { parse: (v) => percent.parse(v) / 100, transform: (v) => percent.transform(v * 100) });
608
706
  var validMotionProps = /* @__PURE__ */ new Set([
609
707
  'animate',
610
708
  'exit',
@@ -899,13 +997,6 @@ function isDragActive() {
899
997
  openGestureLock();
900
998
  return false;
901
999
  }
902
- var number = {
903
- test: (v) => typeof v === 'number',
904
- parse: parseFloat,
905
- transform: (v) => v,
906
- };
907
- var alpha = Object.assign(Object.assign({}, number), { transform: (v) => clamp(0, 1, v) });
908
- var scale = Object.assign(Object.assign({}, number), { default: 1 });
909
1000
  var isColorString = (type, testProp) => (v) => {
910
1001
  return Boolean(isString(v) && singleColorRegex.test(v) && v.startsWith(type) ||
911
1002
  testProp && !isNullish(v) && Object.prototype.hasOwnProperty.call(v, testProp));
@@ -1219,14 +1310,9 @@ function spring(_j) {
1219
1310
  next: (t) => {
1220
1311
  const current = resolveSpring(t);
1221
1312
  if (!isResolvedFromDuration) {
1222
- let currentVelocity = initialVelocity;
1223
- if (t !== 0) {
1224
- if (dampingRatio < 1) {
1225
- currentVelocity = calcGeneratorVelocity(resolveSpring, t, current);
1226
- }
1227
- else {
1228
- currentVelocity = 0;
1229
- }
1313
+ let currentVelocity = 0;
1314
+ if (dampingRatio < 1) {
1315
+ currentVelocity = t === 0 ? secondsToMilliseconds(initialVelocity) : calcGeneratorVelocity(resolveSpring, t, current);
1230
1316
  }
1231
1317
  const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
1232
1318
  const isBelowDisplacementThreshold = Math.abs(target - current) <= restDelta;
@@ -2288,75 +2374,6 @@ var filter = Object.assign(Object.assign({}, complex), { getAnimatableNone: (v)
2288
2374
  const functions = v.match(functionRegex);
2289
2375
  return functions ? functions.map(applyDefaultFilter).join(' ') : v;
2290
2376
  } });
2291
- var int = Object.assign(Object.assign({}, number), { transform: Math.round });
2292
- var numberValueTypes = {
2293
- // Border props
2294
- borderWidth: px,
2295
- borderTopWidth: px,
2296
- borderRightWidth: px,
2297
- borderBottomWidth: px,
2298
- borderLeftWidth: px,
2299
- borderRadius: px,
2300
- radius: px,
2301
- borderTopLeftRadius: px,
2302
- borderTopRightRadius: px,
2303
- borderBottomRightRadius: px,
2304
- borderBottomLeftRadius: px,
2305
- // Positioning props
2306
- width: px,
2307
- maxWidth: px,
2308
- height: px,
2309
- maxHeight: px,
2310
- size: px,
2311
- top: px,
2312
- right: px,
2313
- bottom: px,
2314
- left: px,
2315
- // Spacing props
2316
- padding: px,
2317
- paddingTop: px,
2318
- paddingRight: px,
2319
- paddingBottom: px,
2320
- paddingLeft: px,
2321
- margin: px,
2322
- marginTop: px,
2323
- marginRight: px,
2324
- marginBottom: px,
2325
- marginLeft: px,
2326
- // Transform props
2327
- rotate: degrees,
2328
- rotateX: degrees,
2329
- rotateY: degrees,
2330
- rotateZ: degrees,
2331
- scale,
2332
- scaleX: scale,
2333
- scaleY: scale,
2334
- scaleZ: scale,
2335
- skew: degrees,
2336
- skewX: degrees,
2337
- skewY: degrees,
2338
- distance: px,
2339
- translateX: px,
2340
- translateY: px,
2341
- translateZ: px,
2342
- x: px,
2343
- y: px,
2344
- z: px,
2345
- perspective: px,
2346
- transformPerspective: px,
2347
- opacity: alpha,
2348
- originX: progressPercentage,
2349
- originY: progressPercentage,
2350
- originZ: px,
2351
- // Misc
2352
- zIndex: int,
2353
- backgroundPositionX: px,
2354
- backgroundPositionY: px,
2355
- // SVG
2356
- fillOpacity: alpha,
2357
- strokeOpacity: alpha,
2358
- numOctaves: int,
2359
- };
2360
2377
  var defaultValueTypes = Object.assign(Object.assign({}, numberValueTypes), {
2361
2378
  // Color props
2362
2379
  color, backgroundColor: color, outlineColor: color, fill: color, stroke: color,
@@ -2698,6 +2715,8 @@ var AcceleratedAnimation = class extends BaseAnimation {
2698
2715
  this.isStopped = true;
2699
2716
  if (this.state === 'idle')
2700
2717
  return;
2718
+ this.resolveFinishedPromise();
2719
+ this.updateFinishedPromise();
2701
2720
  const { resolved, } = this;
2702
2721
  if (!resolved)
2703
2722
  return;
@@ -2785,7 +2804,7 @@ var MotionValue = class {
2785
2804
  * @internal
2786
2805
  */
2787
2806
  constructor(init, options = {}) {
2788
- this.version = '11.3.9';
2807
+ this.version = '11.3.23';
2789
2808
  this.canTrackVelocity = null;
2790
2809
  this.events = {};
2791
2810
  this.updateAndNotify = (v, render = true) => {
@@ -3041,42 +3060,6 @@ var MotionValue = class {
3041
3060
  function motionValue(init, options) {
3042
3061
  return new MotionValue(init, options);
3043
3062
  }
3044
- var WillChangeMotionValue = class extends MotionValue {
3045
- constructor() {
3046
- super(...arguments);
3047
- this.output = [];
3048
- this.counts = /* @__PURE__ */ new Map();
3049
- }
3050
- add(name) {
3051
- const styleName = getWillChangeName(name);
3052
- if (!styleName)
3053
- return;
3054
- const prevCount = this.counts.get(styleName) || 0;
3055
- this.counts.set(styleName, prevCount + 1);
3056
- if (prevCount === 0) {
3057
- this.output.push(styleName);
3058
- this.update();
3059
- }
3060
- let hasRemoved = false;
3061
- return () => {
3062
- if (hasRemoved)
3063
- return;
3064
- hasRemoved = true;
3065
- const newCount = this.counts.get(styleName) - 1;
3066
- this.counts.set(styleName, newCount);
3067
- if (newCount === 0) {
3068
- removeItem(this.output, styleName);
3069
- this.update();
3070
- }
3071
- };
3072
- }
3073
- update() {
3074
- this.set(this.output.length ? this.output.join(', ') : 'auto');
3075
- }
3076
- };
3077
- function useWillChange() {
3078
- return useConstant(() => new WillChangeMotionValue('auto'));
3079
- }
3080
3063
  function resolveVariant(visualElement, definition, custom) {
3081
3064
  const props = visualElement.getProps();
3082
3065
  return resolveVariantFromProps(props, definition, custom !== void 0 ? custom : props.custom, visualElement);
@@ -3281,6 +3264,39 @@ function setTarget(visualElement, definition) {
3281
3264
  function getOptimisedAppearId(visualElement) {
3282
3265
  return visualElement.getProps()[optimizedAppearDataAttribute];
3283
3266
  }
3267
+ var WillChangeMotionValue = class extends MotionValue {
3268
+ constructor() {
3269
+ super(...arguments);
3270
+ this.output = [];
3271
+ this.counts = /* @__PURE__ */ new Map();
3272
+ }
3273
+ add(name) {
3274
+ const styleName = getWillChangeName(name);
3275
+ if (!styleName)
3276
+ return;
3277
+ const prevCount = this.counts.get(styleName) || 0;
3278
+ this.counts.set(styleName, prevCount + 1);
3279
+ if (prevCount === 0) {
3280
+ this.output.push(styleName);
3281
+ this.update();
3282
+ }
3283
+ let hasRemoved = false;
3284
+ return () => {
3285
+ if (hasRemoved)
3286
+ return;
3287
+ hasRemoved = true;
3288
+ const newCount = this.counts.get(styleName) - 1;
3289
+ this.counts.set(styleName, newCount);
3290
+ if (newCount === 0) {
3291
+ removeItem(this.output, styleName);
3292
+ this.update();
3293
+ }
3294
+ };
3295
+ }
3296
+ update() {
3297
+ this.set(this.output.length ? this.output.join(', ') : 'auto');
3298
+ }
3299
+ };
3284
3300
  function isWillChangeMotionValue(value) {
3285
3301
  return Boolean(isMotionValue(value) && value.add);
3286
3302
  }
@@ -3317,10 +3333,10 @@ function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0,
3317
3333
  }
3318
3334
  const valueTransition = Object.assign({ delay: delay2, elapsed: 0 }, getValueTransition(transition || {}, key7));
3319
3335
  let isHandoff = false;
3320
- if (window.HandoffAppearAnimations) {
3336
+ if (window.MotionHandoffAnimation) {
3321
3337
  const appearId = getOptimisedAppearId(visualElement);
3322
3338
  if (appearId) {
3323
- const elapsed = window.HandoffAppearAnimations(appearId, key7, value, frame);
3339
+ const elapsed = window.MotionHandoffAnimation(appearId, key7, frame);
3324
3340
  if (elapsed !== null) {
3325
3341
  valueTransition.elapsed = elapsed;
3326
3342
  isHandoff = true;
@@ -3399,9 +3415,7 @@ function animateVisualElement(visualElement, definition, options = {}) {
3399
3415
  animation = Promise.all(animateTarget(visualElement, resolvedDefinition, options));
3400
3416
  }
3401
3417
  return animation.then(() => {
3402
- frame.postRender(() => {
3403
- visualElement.notify('AnimationComplete', definition);
3404
- });
3418
+ visualElement.notify('AnimationComplete', definition);
3405
3419
  });
3406
3420
  }
3407
3421
  function shallowCompare(next, prev) {
@@ -3760,7 +3774,7 @@ function usePresence() {
3760
3774
  const { isPresent: isPresent2, onExitComplete, register, } = context;
3761
3775
  const id4 = useId();
3762
3776
  useEffect(() => register(id4), []);
3763
- const safeToRemove = () => onExitComplete && onExitComplete(id4);
3777
+ const safeToRemove = useCallback(() => onExitComplete && onExitComplete(id4), [id4, onExitComplete,]);
3764
3778
  return !isPresent2 && onExitComplete ? [false, safeToRemove,] : [true,];
3765
3779
  }
3766
3780
  function useIsPresent() {
@@ -3829,7 +3843,7 @@ function updateMotionValuesFromProps(element, next, prev) {
3829
3843
  if (isMotionValue(nextValue)) {
3830
3844
  element.addValue(key7, nextValue);
3831
3845
  if (false) {
3832
- warnOnce(nextValue.version === '11.3.9', `Attempting to mix Framer Motion versions ${nextValue.version} with 11.3.9 may not work as expected.`);
3846
+ warnOnce(nextValue.version === '11.3.23', `Attempting to mix Framer Motion versions ${nextValue.version} with 11.3.23 may not work as expected.`);
3833
3847
  }
3834
3848
  }
3835
3849
  else if (isMotionValue(prevValue)) {
@@ -4319,41 +4333,34 @@ function isForcedMotionValue(key7, { layout: layout2, layoutId, }) {
4319
4333
  return transformProps.has(key7) || key7.startsWith('origin') ||
4320
4334
  (layout2 || layoutId !== void 0) && (!!scaleCorrectors[key7] || key7 === 'opacity');
4321
4335
  }
4322
- var getValueAsType = (value, type) => {
4323
- return type && typeof value === 'number' ? type.transform(value) : value;
4324
- };
4325
4336
  function buildHTMLStyles(state, latestValues, transformTemplate2) {
4326
- const { style, vars, transform: transform2, transformOrigin, } = state;
4337
+ const { style, vars, transformOrigin, } = state;
4327
4338
  let hasTransform2 = false;
4328
4339
  let hasTransformOrigin = false;
4329
- let transformIsNone = true;
4330
4340
  for (const key7 in latestValues) {
4331
4341
  const value = latestValues[key7];
4332
- if (isCSSVariableName(key7)) {
4333
- vars[key7] = value;
4334
- continue;
4335
- }
4336
- const valueType = numberValueTypes[key7];
4337
- const valueAsType = getValueAsType(value, valueType);
4338
4342
  if (transformProps.has(key7)) {
4339
4343
  hasTransform2 = true;
4340
- transform2[key7] = valueAsType;
4341
- if (!transformIsNone)
4342
- continue;
4343
- if (value !== (valueType.default || 0))
4344
- transformIsNone = false;
4344
+ continue;
4345
4345
  }
4346
- else if (key7.startsWith('origin')) {
4347
- hasTransformOrigin = true;
4348
- transformOrigin[key7] = valueAsType;
4346
+ else if (isCSSVariableName(key7)) {
4347
+ vars[key7] = value;
4348
+ continue;
4349
4349
  }
4350
4350
  else {
4351
- style[key7] = valueAsType;
4351
+ const valueAsType = getValueAsType(value, numberValueTypes[key7]);
4352
+ if (key7.startsWith('origin')) {
4353
+ hasTransformOrigin = true;
4354
+ transformOrigin[key7] = valueAsType;
4355
+ }
4356
+ else {
4357
+ style[key7] = valueAsType;
4358
+ }
4352
4359
  }
4353
4360
  }
4354
4361
  if (!latestValues.transform) {
4355
4362
  if (hasTransform2 || transformTemplate2) {
4356
- style.transform = buildTransform(state.transform, transformIsNone, transformTemplate2);
4363
+ style.transform = buildTransform(latestValues, state.transform, transformTemplate2);
4357
4364
  }
4358
4365
  else if (style.transform) {
4359
4366
  style.transform = 'none';
@@ -6068,7 +6075,7 @@ function resetDistortingTransform(key7, visualElement, values, sharedAnimationVa
6068
6075
  }
6069
6076
  }
6070
6077
  }
6071
- function isOptimisedAppearTree(projectionNode) {
6078
+ function isOptimisedTransformAnimationInTree(projectionNode) {
6072
6079
  projectionNode.hasCheckedOptimisedAppear = true;
6073
6080
  if (projectionNode.root === projectionNode)
6074
6081
  return false;
@@ -6076,11 +6083,11 @@ function isOptimisedAppearTree(projectionNode) {
6076
6083
  if (!visualElement) {
6077
6084
  return false;
6078
6085
  }
6079
- else if (getOptimisedAppearId(visualElement)) {
6086
+ else if (window.MotionHasOptimisedTransformAnimation(getOptimisedAppearId(visualElement))) {
6080
6087
  return true;
6081
6088
  }
6082
6089
  else if (projectionNode.parent && !projectionNode.parent.hasCheckedOptimisedAppear) {
6083
- return isOptimisedAppearTree(projectionNode.parent);
6090
+ return isOptimisedTransformAnimationInTree(projectionNode.parent);
6084
6091
  }
6085
6092
  else {
6086
6093
  return false;
@@ -6273,8 +6280,8 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
6273
6280
  this.options.onExitComplete && this.options.onExitComplete();
6274
6281
  return;
6275
6282
  }
6276
- if (window.HandoffCancelAllAnimations && isOptimisedAppearTree(this)) {
6277
- window.HandoffCancelAllAnimations();
6283
+ if (window.MotionHandoffCancelAll && isOptimisedTransformAnimationInTree(this)) {
6284
+ window.MotionHandoffCancelAll();
6278
6285
  }
6279
6286
  !this.root.isUpdating && this.root.startUpdate();
6280
6287
  if (this.isLayoutDirty)
@@ -6384,11 +6391,13 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
6384
6391
  needsMeasurement = false;
6385
6392
  }
6386
6393
  if (needsMeasurement) {
6394
+ const isRoot = checkIsScrollRoot(this.instance);
6387
6395
  this.scroll = {
6388
6396
  animationId: this.root.animationId,
6389
6397
  phase,
6390
- isRoot: checkIsScrollRoot(this.instance),
6398
+ isRoot,
6391
6399
  offset: measureScroll(this.instance),
6400
+ wasRoot: this.scroll ? this.scroll.isRoot : isRoot,
6392
6401
  };
6393
6402
  }
6394
6403
  }
@@ -6422,31 +6431,35 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
6422
6431
  };
6423
6432
  }
6424
6433
  measurePageBox() {
6434
+ var _a;
6425
6435
  const { visualElement, } = this.options;
6426
6436
  if (!visualElement)
6427
6437
  return createBox();
6428
6438
  const box = visualElement.measureViewportBox();
6429
- const { scroll: scroll2, } = this.root;
6430
- if (scroll2) {
6431
- translateAxis(box.x, scroll2.offset.x);
6432
- translateAxis(box.y, scroll2.offset.y);
6439
+ const wasInScrollRoot = ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) ||
6440
+ this.path.some(checkNodeWasScrollRoot);
6441
+ if (!wasInScrollRoot) {
6442
+ const { scroll: scroll2, } = this.root;
6443
+ if (scroll2) {
6444
+ translateAxis(box.x, scroll2.offset.x);
6445
+ translateAxis(box.y, scroll2.offset.y);
6446
+ }
6433
6447
  }
6434
6448
  return box;
6435
6449
  }
6436
6450
  removeElementScroll(box) {
6451
+ var _a;
6437
6452
  const boxWithoutScroll = createBox();
6438
6453
  copyBoxInto(boxWithoutScroll, box);
6454
+ if ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) {
6455
+ return boxWithoutScroll;
6456
+ }
6439
6457
  for (let i = 0; i < this.path.length; i++) {
6440
6458
  const node = this.path[i];
6441
6459
  const { scroll: scroll2, options, } = node;
6442
6460
  if (node !== this.root && scroll2 && options.layoutScroll) {
6443
- if (scroll2.isRoot) {
6461
+ if (scroll2.wasRoot) {
6444
6462
  copyBoxInto(boxWithoutScroll, box);
6445
- const { scroll: rootScroll, } = this.root;
6446
- if (rootScroll) {
6447
- translateAxis(boxWithoutScroll.x, -rootScroll.offset.x);
6448
- translateAxis(boxWithoutScroll.y, -rootScroll.offset.y);
6449
- }
6450
6463
  }
6451
6464
  translateAxis(boxWithoutScroll.x, scroll2.offset.x);
6452
6465
  translateAxis(boxWithoutScroll.y, scroll2.offset.y);
@@ -7122,6 +7135,10 @@ function shouldAnimatePositionOnly(animationType, snapshot, layout2) {
7122
7135
  return animationType === 'position' ||
7123
7136
  animationType === 'preserve-aspect' && !isNear(aspectRatio(snapshot), aspectRatio(layout2), 0.2);
7124
7137
  }
7138
+ function checkNodeWasScrollRoot(node) {
7139
+ var _a;
7140
+ return node !== node.root && ((_a = node.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot);
7141
+ }
7125
7142
  var DocumentProjectionNode = createProjectionNode2({
7126
7143
  attachResizeListener: (ref, notify2) => addDomEvent(ref, 'resize', notify2),
7127
7144
  measureScroll: () => ({
@@ -7275,28 +7292,6 @@ function createDomMotionComponent(key7) {
7275
7292
  }, preloadedFeatures, createDomVisualElement));
7276
7293
  }
7277
7294
  var m = createMotionProxy(createDomMotionConfig);
7278
- function useIsMounted() {
7279
- const isMounted = useRef(false);
7280
- useIsomorphicLayoutEffect(() => {
7281
- isMounted.current = true;
7282
- return () => {
7283
- isMounted.current = false;
7284
- };
7285
- }, []);
7286
- return isMounted;
7287
- }
7288
- function useForceUpdate() {
7289
- const isMounted = useIsMounted();
7290
- const [forcedRenderCount, setForcedRenderCount,] = useState(0);
7291
- const forceRender = useCallback(() => {
7292
- isMounted.current && setForcedRenderCount(forcedRenderCount + 1);
7293
- }, [forcedRenderCount,]);
7294
- const deferredForceRender = useCallback(() => frame.postRender(forceRender), [forceRender,]);
7295
- return [deferredForceRender, forcedRenderCount,];
7296
- }
7297
- function useUnmountEffect(callback) {
7298
- return useEffect(() => () => callback(), []);
7299
- }
7300
7295
  var PopChildMeasure = class extends React2.Component {
7301
7296
  getSnapshotBeforeUpdate(prevProps) {
7302
7297
  const element = this.props.childRef.current;
@@ -7408,12 +7403,6 @@ function newChildrenMap() {
7408
7403
  return /* @__PURE__ */ new Map();
7409
7404
  }
7410
7405
  var getChildKey = (child) => child.key || '';
7411
- function updateChildLookup(children, allChildren) {
7412
- children.forEach((child) => {
7413
- const key7 = getChildKey(child);
7414
- allChildren.set(key7, child);
7415
- });
7416
- }
7417
7406
  function onlyElements(children) {
7418
7407
  const filtered = [];
7419
7408
  Children.forEach(children, (child) => {
@@ -7422,104 +7411,84 @@ function onlyElements(children) {
7422
7411
  });
7423
7412
  return filtered;
7424
7413
  }
7425
- var AnimatePresence = ({ children, custom, initial = true, onExitComplete, exitBeforeEnter, presenceAffectsLayout = true, mode = 'sync', }) => {
7414
+ var AnimatePresence = ({ children, exitBeforeEnter, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = 'sync', }) => {
7426
7415
  invariant(!exitBeforeEnter, 'Replace exitBeforeEnter with mode=\'wait\'');
7427
- const forceRender = useContext3(LayoutGroupContext).forceRender || useForceUpdate()[0];
7428
- const isMounted = useIsMounted();
7429
- const filteredChildren = onlyElements(children);
7430
- let childrenToRender = filteredChildren;
7431
- const exitingChildren = useRef(/* @__PURE__ */ new Map()).current;
7432
- const presentChildren = useRef(childrenToRender);
7433
- const allChildren = useRef(/* @__PURE__ */ new Map()).current;
7416
+ const presentChildren = useMemo(() => onlyElements(children), [children,]);
7417
+ const presentKeys = presentChildren.map(getChildKey);
7434
7418
  const isInitialRender = useRef(true);
7419
+ const pendingPresentChildren = useRef(presentChildren);
7420
+ const exitComplete = useConstant(() => /* @__PURE__ */ new Map());
7421
+ const [diffedChildren, setDiffedChildren,] = useState(presentChildren);
7422
+ const [renderedChildren, setRenderedChildren,] = useState(presentChildren);
7435
7423
  useIsomorphicLayoutEffect(() => {
7436
7424
  isInitialRender.current = false;
7437
- updateChildLookup(filteredChildren, allChildren);
7438
- presentChildren.current = childrenToRender;
7439
- });
7440
- useUnmountEffect(() => {
7441
- isInitialRender.current = true;
7442
- allChildren.clear();
7443
- exitingChildren.clear();
7444
- });
7445
- if (isInitialRender.current) {
7446
- return jsx(Fragment, {
7447
- children: childrenToRender.map((child) => jsx(PresenceChild, {
7448
- isPresent: true,
7449
- initial: initial ? void 0 : false,
7450
- presenceAffectsLayout,
7451
- mode,
7452
- children: child,
7453
- }, getChildKey(child))),
7454
- });
7455
- }
7456
- childrenToRender = [...childrenToRender,];
7457
- const presentKeys = presentChildren.current.map(getChildKey);
7458
- const targetKeys = filteredChildren.map(getChildKey);
7459
- const numPresent = presentKeys.length;
7460
- for (let i = 0; i < numPresent; i++) {
7461
- const key7 = presentKeys[i];
7462
- if (targetKeys.indexOf(key7) === -1 && !exitingChildren.has(key7)) {
7463
- exitingChildren.set(key7, void 0);
7425
+ pendingPresentChildren.current = presentChildren;
7426
+ for (let i = 0; i < renderedChildren.length; i++) {
7427
+ const key7 = getChildKey(renderedChildren[i]);
7428
+ if (!presentKeys.includes(key7)) {
7429
+ if (exitComplete.get(key7) !== true) {
7430
+ exitComplete.set(key7, false);
7431
+ }
7432
+ }
7433
+ else {
7434
+ exitComplete.delete(key7);
7435
+ }
7436
+ }
7437
+ }, [renderedChildren, presentKeys.length, presentKeys.join('-'),]);
7438
+ const exitingChildren = [];
7439
+ if (presentChildren !== diffedChildren) {
7440
+ let nextChildren = [...presentChildren,];
7441
+ for (let i = 0; i < renderedChildren.length; i++) {
7442
+ const child = renderedChildren[i];
7443
+ const key7 = getChildKey(child);
7444
+ if (!presentKeys.includes(key7)) {
7445
+ nextChildren.splice(i, 0, child);
7446
+ exitingChildren.push(child);
7447
+ }
7448
+ }
7449
+ if (mode === 'wait' && exitingChildren.length) {
7450
+ nextChildren = exitingChildren;
7464
7451
  }
7452
+ setRenderedChildren(onlyElements(nextChildren));
7453
+ setDiffedChildren(presentChildren);
7454
+ return;
7465
7455
  }
7466
- if (mode === 'wait' && exitingChildren.size) {
7467
- childrenToRender = [];
7456
+ if (false) {
7457
+ console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
7468
7458
  }
7469
- exitingChildren.forEach((component, key7) => {
7470
- if (targetKeys.indexOf(key7) !== -1)
7471
- return;
7472
- const child = allChildren.get(key7);
7473
- if (!child)
7474
- return;
7475
- const insertionIndex = presentKeys.indexOf(key7);
7476
- let exitingComponent = component;
7477
- if (!exitingComponent) {
7459
+ const { forceRender, } = useContext3(LayoutGroupContext);
7460
+ return jsx(Fragment, {
7461
+ children: renderedChildren.map((child) => {
7462
+ const key7 = getChildKey(child);
7463
+ const isPresent2 = presentChildren === renderedChildren || presentKeys.includes(key7);
7478
7464
  const onExit = () => {
7479
- exitingChildren.delete(key7);
7480
- const leftOverKeys = Array.from(allChildren.keys()).filter((childKey) => !targetKeys.includes(childKey));
7481
- leftOverKeys.forEach((leftOverKey) => allChildren.delete(leftOverKey));
7482
- presentChildren.current = filteredChildren.filter((presentChild) => {
7483
- const presentChildKey = getChildKey(presentChild);
7484
- return (
7485
- // filter out the node exiting
7486
- presentChildKey === key7 ||
7487
- // filter out the leftover children
7488
- leftOverKeys.includes(presentChildKey));
7465
+ if (exitComplete.has(key7)) {
7466
+ exitComplete.set(key7, true);
7467
+ }
7468
+ else {
7469
+ return;
7470
+ }
7471
+ let isEveryExitComplete = true;
7472
+ exitComplete.forEach((isExitComplete) => {
7473
+ if (!isExitComplete)
7474
+ isEveryExitComplete = false;
7489
7475
  });
7490
- if (!exitingChildren.size) {
7491
- if (isMounted.current === false)
7492
- return;
7493
- forceRender();
7476
+ if (isEveryExitComplete) {
7477
+ forceRender === null || forceRender === void 0 ? void 0 : forceRender();
7478
+ setRenderedChildren(pendingPresentChildren.current);
7494
7479
  onExitComplete && onExitComplete();
7495
7480
  }
7496
7481
  };
7497
- exitingComponent = jsx(PresenceChild, {
7498
- isPresent: false,
7499
- onExitComplete: onExit,
7500
- custom,
7482
+ return jsx(PresenceChild, {
7483
+ isPresent: isPresent2,
7484
+ initial: !isInitialRender.current || initial ? void 0 : false,
7485
+ custom: isPresent2 ? void 0 : custom,
7501
7486
  presenceAffectsLayout,
7502
7487
  mode,
7488
+ onExitComplete: isPresent2 ? void 0 : onExit,
7503
7489
  children: child,
7504
- }, getChildKey(child));
7505
- exitingChildren.set(key7, exitingComponent);
7506
- }
7507
- childrenToRender.splice(insertionIndex, 0, exitingComponent);
7508
- });
7509
- childrenToRender = childrenToRender.map((child) => {
7510
- const key7 = child.key;
7511
- return exitingChildren.has(key7) ? child : jsx(PresenceChild, {
7512
- isPresent: true,
7513
- presenceAffectsLayout,
7514
- mode,
7515
- children: child,
7516
- }, getChildKey(child));
7517
- });
7518
- if (false) {
7519
- console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
7520
- }
7521
- return jsx(Fragment, {
7522
- children: exitingChildren.size ? childrenToRender : childrenToRender.map((child) => cloneElement2(child)),
7490
+ }, key7);
7491
+ }),
7523
7492
  });
7524
7493
  };
7525
7494
  function MotionConfig(_j) {
@@ -7563,6 +7532,25 @@ function isLazyBundle(features) {
7563
7532
  return typeof features === 'function';
7564
7533
  }
7565
7534
  var DeprecatedLayoutGroupContext = createContext(null);
7535
+ function useIsMounted() {
7536
+ const isMounted = useRef(false);
7537
+ useIsomorphicLayoutEffect(() => {
7538
+ isMounted.current = true;
7539
+ return () => {
7540
+ isMounted.current = false;
7541
+ };
7542
+ }, []);
7543
+ return isMounted;
7544
+ }
7545
+ function useForceUpdate() {
7546
+ const isMounted = useIsMounted();
7547
+ const [forcedRenderCount, setForcedRenderCount,] = useState(0);
7548
+ const forceRender = useCallback(() => {
7549
+ isMounted.current && setForcedRenderCount(forcedRenderCount + 1);
7550
+ }, [forcedRenderCount,]);
7551
+ const deferredForceRender = useCallback(() => frame.postRender(forceRender), [forceRender,]);
7552
+ return [deferredForceRender, forcedRenderCount,];
7553
+ }
7566
7554
  var notify = (node) => !node.isLayoutDirty && node.willUpdate(false);
7567
7555
  function nodeGroup() {
7568
7556
  const nodes = /* @__PURE__ */ new Set();
@@ -7762,6 +7750,7 @@ var Reorder = {
7762
7750
  Group,
7763
7751
  Item,
7764
7752
  };
7753
+ var domMin = Object.assign({ renderer: createDomVisualElement }, animations);
7765
7754
  var domAnimation = Object.assign(Object.assign({ renderer: createDomVisualElement }, animations), gestureAnimations);
7766
7755
  var domMax = Object.assign(Object.assign(Object.assign({}, domAnimation), drag), layout);
7767
7756
  function useMotionTemplate(fragments, ...values) {
@@ -7779,10 +7768,15 @@ function useMotionTemplate(fragments, ...values) {
7779
7768
  }
7780
7769
  return useCombineMotionValues(values.filter(isMotionValue), buildValue);
7781
7770
  }
7771
+ function toNumber(v) {
7772
+ if (typeof v === 'number')
7773
+ return v;
7774
+ return parseFloat(v);
7775
+ }
7782
7776
  function useSpring(source, config = {}) {
7783
7777
  const { isStatic, } = useContext3(MotionConfigContext);
7784
7778
  const activeSpringAnimation = useRef(null);
7785
- const value = useMotionValue(isMotionValue(source) ? source.get() : source);
7779
+ const value = useMotionValue(isMotionValue(source) ? toNumber(source.get()) : source);
7786
7780
  const latestValue = useRef(value.get());
7787
7781
  const latestSetter = useRef(() => { });
7788
7782
  const startAnimation2 = () => {
@@ -7810,7 +7804,7 @@ function useSpring(source, config = {}) {
7810
7804
  }, [JSON.stringify(config),]);
7811
7805
  useIsomorphicLayoutEffect(() => {
7812
7806
  if (isMotionValue(source)) {
7813
- return source.on('change', (v) => value.set(parseFloat(v)));
7807
+ return source.on('change', (v) => value.set(toNumber(v)));
7814
7808
  }
7815
7809
  }, [value,]);
7816
7810
  return value;
@@ -8288,6 +8282,9 @@ function useTime() {
8288
8282
  useAnimationFrame((t) => time2.set(t));
8289
8283
  return time2;
8290
8284
  }
8285
+ function useWillChange() {
8286
+ return useConstant(() => new WillChangeMotionValue('auto'));
8287
+ }
8291
8288
  function useReducedMotion() {
8292
8289
  !hasReducedMotionListener.current && initPrefersReducedMotion();
8293
8290
  const [shouldReduceMotion,] = useState(prefersReducedMotion.current);
@@ -8374,6 +8371,9 @@ function animationControls() {
8374
8371
  };
8375
8372
  return controls;
8376
8373
  }
8374
+ function useUnmountEffect(callback) {
8375
+ return useEffect(() => () => callback(), []);
8376
+ }
8377
8377
  var wrap = (min, max, v) => {
8378
8378
  const rangeSize = max - min;
8379
8379
  return ((v - min) % rangeSize + rangeSize) % rangeSize + min;
@@ -8827,8 +8827,9 @@ function useResetProjection() {
8827
8827
  }
8828
8828
  var appearStoreId = (id4, value) => `${id4}: ${value}`;
8829
8829
  var appearAnimationStore = /* @__PURE__ */ new Map();
8830
+ var elementsWithAppearAnimations = /* @__PURE__ */ new Set();
8830
8831
  var handoffFrameTime;
8831
- function handoffOptimizedAppearAnimation(elementId, valueName, _value, frame2) {
8832
+ function handoffOptimizedAppearAnimation(elementId, valueName, frame2) {
8832
8833
  const optimisedValueName = transformProps.has(valueName) ? 'transform' : valueName;
8833
8834
  const storeId = appearStoreId(elementId, optimisedValueName);
8834
8835
  const optimisedAnimation = appearAnimationStore.get(storeId);
@@ -8836,25 +8837,14 @@ function handoffOptimizedAppearAnimation(elementId, valueName, _value, frame2) {
8836
8837
  return null;
8837
8838
  }
8838
8839
  const { animation, startTime, } = optimisedAnimation;
8839
- const cancelAnimation = () => {
8840
+ if (startTime === null || window.MotionHandoffIsComplete) {
8840
8841
  appearAnimationStore.delete(storeId);
8841
- if (frame2) {
8842
- frame2.render(() => frame2.render(() => {
8843
- try {
8844
- animation.cancel();
8845
- }
8846
- catch (error) { }
8847
- }));
8848
- }
8849
- else {
8842
+ frame2.render(() => frame2.render(() => {
8850
8843
  try {
8851
8844
  animation.cancel();
8852
8845
  }
8853
8846
  catch (error) { }
8854
- }
8855
- };
8856
- if (startTime === null || window.HandoffComplete) {
8857
- cancelAnimation();
8847
+ }));
8858
8848
  return null;
8859
8849
  }
8860
8850
  else {
@@ -8867,14 +8857,14 @@ function handoffOptimizedAppearAnimation(elementId, valueName, _value, frame2) {
8867
8857
  var startFrameTime;
8868
8858
  var readyAnimation;
8869
8859
  function startOptimizedAppearAnimation(element, name, keyframes2, options, onReady) {
8870
- if (window.HandoffComplete) {
8871
- window.HandoffAppearAnimations = void 0;
8860
+ if (window.MotionHandoffIsComplete) {
8861
+ window.MotionHandoffAnimation = void 0;
8872
8862
  return;
8873
8863
  }
8874
8864
  const id4 = element.dataset[optimizedAppearDataId];
8875
8865
  if (!id4)
8876
8866
  return;
8877
- window.HandoffAppearAnimations = handoffOptimizedAppearAnimation;
8867
+ window.MotionHandoffAnimation = handoffOptimizedAppearAnimation;
8878
8868
  const storeId = appearStoreId(id4, name);
8879
8869
  if (!readyAnimation) {
8880
8870
  readyAnimation = animateStyle(element, name, [keyframes2[0], keyframes2[0],], /**
@@ -8888,15 +8878,18 @@ function startOptimizedAppearAnimation(element, name, keyframes2, options, onRea
8888
8878
  animation: readyAnimation,
8889
8879
  startTime: null,
8890
8880
  });
8891
- if (!window.HandoffCancelAllAnimations) {
8892
- window.HandoffCancelAllAnimations = () => {
8893
- appearAnimationStore.forEach(({ animation, }) => {
8881
+ window.MotionHandoffAnimation = handoffOptimizedAppearAnimation;
8882
+ window.MotionHandoffCancelAll = () => {
8883
+ appearAnimationStore.forEach(({ animation, }, animationId) => {
8884
+ if (animationId.endsWith('transform')) {
8894
8885
  animation.cancel();
8895
- });
8896
- appearAnimationStore.clear();
8897
- window.HandoffCancelAllAnimations = void 0;
8898
- };
8899
- }
8886
+ appearAnimationStore.delete(animationId);
8887
+ }
8888
+ });
8889
+ window.MotionHandoffCancelAll = void 0;
8890
+ };
8891
+ window.MotionHasOptimisedAnimation = (elementId) => Boolean(elementId && elementsWithAppearAnimations.has(elementId));
8892
+ window.MotionHasOptimisedTransformAnimation = (elementId) => Boolean(elementId && appearAnimationStore.has(appearStoreId(elementId, 'transform')));
8900
8893
  }
8901
8894
  const startAnimation2 = () => {
8902
8895
  readyAnimation.cancel();
@@ -8912,6 +8905,7 @@ function startOptimizedAppearAnimation(element, name, keyframes2, options, onRea
8912
8905
  if (onReady)
8913
8906
  onReady(appearAnimation);
8914
8907
  };
8908
+ elementsWithAppearAnimations.add(id4);
8915
8909
  if (readyAnimation.ready) {
8916
8910
  readyAnimation.ready.then(startAnimation2).catch(noop);
8917
8911
  }
@@ -9070,12 +9064,13 @@ var cancelSync = stepsOrder.reduce((acc, key7) => {
9070
9064
  acc[key7] = (process2) => cancelFrame(process2);
9071
9065
  return acc;
9072
9066
  }, {});
9073
- // https :https://app.framerstatic.com/framer.V4LTAYQT.js
9067
+ // https :https://app.framerstatic.com/framer.LMS2FZ32.js
9074
9068
  import React4 from 'react';
9075
9069
  import { startTransition as startTransition2, } from 'react';
9076
9070
  import { Suspense as Suspense2, } from 'react';
9077
9071
  import ReactDOM from 'react-dom';
9078
9072
  import { createRef, } from 'react';
9073
+ import { cloneElement as cloneElement32, } from 'react';
9079
9074
  var require_hsluv = __commonJS({
9080
9075
  '../../../node_modules/hsluv/dist/hsluv.cjs'(exports) {
9081
9076
  'use strict';
@@ -27963,9 +27958,9 @@ function runEffectAnimation(target, effect, shouldReduceMotion, ref, appearId, i
27963
27958
  const visualElement = visualElementStore.get(ref.current);
27964
27959
  if (visualElement)
27965
27960
  visualElement.setBaseTarget(key7, value);
27966
- const handoff = isString22(appearId) && !(motionValue2 == null ? void 0 : motionValue2.hasAnimated) && safeWindow.HandoffAppearAnimations
27961
+ const handoff = isString22(appearId) && !(motionValue2 == null ? void 0 : motionValue2.hasAnimated) && safeWindow.MotionHandoffAnimation
27967
27962
  ? {
27968
- elapsed: safeWindow.HandoffAppearAnimations(appearId, key7, motionValue2, frame),
27963
+ elapsed: safeWindow.MotionHandoffAnimation(appearId, key7, frame),
27969
27964
  }
27970
27965
  : void 0;
27971
27966
  if (instant) {
@@ -30467,15 +30462,23 @@ function stateCanSubmitForm(state) {
30467
30462
  function preventDefault(e) {
30468
30463
  e.preventDefault();
30469
30464
  }
30470
- function openExternalLink(link) {
30471
- if (!safeWindow)
30472
- return;
30465
+ function openExternalLinkInCurrentTab(link, formRef) {
30473
30466
  const href = isValidURL(link, false) ? link : `https://${link}`;
30474
- safeWindow.open(href, '_blank');
30467
+ const linkElement = document.createElement('a');
30468
+ linkElement.href = href;
30469
+ linkElement.target = '_self';
30470
+ linkElement.style.display = 'none';
30471
+ if (!('current' in formRef && formRef.current))
30472
+ return;
30473
+ formRef.current.appendChild(linkElement);
30474
+ linkElement.click();
30475
+ linkElement.remove();
30475
30476
  }
30476
30477
  var FormContext = React4.createContext(void 0);
30477
- var FormContainer = /* @__PURE__ */ React4.forwardRef((_j, ref) => {
30478
+ var FormContainer = /* @__PURE__ */ React4.forwardRef((_j, forwardedRef) => {
30478
30479
  var { action, children, redirectUrl, onSuccess, onError, onLoading } = _j, props = __rest(_j, ["action", "children", "redirectUrl", "onSuccess", "onError", "onLoading"]);
30480
+ const fallbackRef = React4.useRef(null);
30481
+ const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : fallbackRef;
30479
30482
  const router = useRouter();
30480
30483
  const currentRoute = useCurrentRoute();
30481
30484
  const implicitPathVariables = useImplicitPathVariables();
@@ -30500,7 +30503,7 @@ var FormContainer = /* @__PURE__ */ React4.forwardRef((_j, ref) => {
30500
30503
  if (isString22(link)) {
30501
30504
  const matchingRoute2 = findMatchingRouteAttributesForResolvedPath(router, link, implicitPathVariables);
30502
30505
  if (!matchingRoute2) {
30503
- openExternalLink(link);
30506
+ openExternalLinkInCurrentTab(link, ref);
30504
30507
  return;
30505
30508
  }
30506
30509
  const { routeId: routeId2, elementId: elementId2, pathVariables: pathVariables2, } = matchingRoute2;
@@ -37911,7 +37914,7 @@ function processRichTextChildren(element, stylesPresetsClassNames, plainText, an
37911
37914
  children = [anchorLink,];
37912
37915
  }
37913
37916
  }
37914
- return cloneElement2(element, props, ...children);
37917
+ return cloneElement32(element, props, ...children);
37915
37918
  }
37916
37919
  function generateHeadingSlug(children, slugCounters) {
37917
37920
  var _j;
@@ -40119,7 +40122,7 @@ var package_default = {
40119
40122
  yargs: '^17.6.2',
40120
40123
  },
40121
40124
  peerDependencies: {
40122
- 'framer-motion': '11.3.9',
40125
+ 'framer-motion': '11.3.23',
40123
40126
  react: '^18.2.0',
40124
40127
  'react-dom': '^18.2.0',
40125
40128
  },
@@ -40150,7 +40153,7 @@ MotionValue.prototype.addChild = function ({ transformer = (v) => v, }) {
40150
40153
  if (false) {
40151
40154
  MainLoop.start();
40152
40155
  }
40153
- export { _injectRuntime, AcceleratedAnimation, addActionControls, addFonts, addPointerEvent, addPointerInfo, addPropertyControls, addScaleCorrector, AnchorLinkTarget, Animatable, animate2 as animate, AnimatePresence, AnimateSharedLayout, animateValue, animateVisualElement, animationControls, animations, annotateTypeOnStringify, anticipate, AnyInterpolation, AutomaticLayoutIds, BackgroundImage, backgroundImageFromProps, backIn, backInOut, backOut, BezierAnimator, BoxShadow, buildTransform, calcLength, calculateRect, callEach, cancelFrame, cancelSync, ChildrenCanSuspend, circIn, circInOut, circOut, clamp, collectVisualStyleFromProps, Color, color, ColorFormat, ColorMixModelType, combinedCSSRulesForPreview, complex, ComponentContainerContext, ComponentPresetsConsumer, ComponentPresetsProvider, ComponentViewportProvider, ConstraintMask, constraintsEnabled, ConstraintValues, Container, ControlType, ConvertColor, convertPresentationTree, convertPropsToDeviceOptions, createBox, createData, createDomMotionComponent, createFramerPageLink, createMotionComponent, createScopedAnimate, cssBackgroundSize, cubicBezier, CustomCursorHost, CustomProperties, cx, CycleVariantState, Data, DataContext, DataObserver, DataObserverContext, debounce, defaultDeviceProps, degreesToRadians, delay, DeprecatedComponentContainer, DeprecatedFrameWithEvents, DeprecatedLayoutGroupContext, DeprecatedLayoutGroupContext as LayoutGroupContext, Device, DeviceCodeComponent, devicePresets, DimensionType, disableInstantTransitions, dispatchKeyDownEvent, distance, distance2D, DOM, domAnimation, domMax, DragControls, Draggable, easeIn, easeInOut, easeOut, EmptyState, environment, ErrorPlaceholder, executeInRenderEnvironment, Fetcher, filterProps, finiteNumber, FlatTree, Floating, FontSourceNames, fontStore, forceLayerBackingWithCSSProperties, FormBooleanInput, FormContainer, FormPlainTextInput2 as FormPlainTextInput, FormSelect, fraction, Frame, frame, frameData, frameFromElement, frameFromElements, FramerAnimation, framerAppearAnimationScriptKey, framerAppearEffects, framerAppearIdKey, framerAppearTransformTemplateToken, framerCSSMarker, FramerEvent, FramerEventListener, FramerEventSession, FrameWithMotion, GamepadContext, GeneratedComponentContext, getComponentSize, getDevicePreset, getFonts, getFontsFromComponentPreset, getFontsFromSharedStyle, getLoadingLazyAtYPosition, getMeasurableCodeComponentChildren, getMergedConstraintsProps, getPropertyControls, getWhereExpressionFromPathVariables, gradientForShape, Image2 as Image, imagePatternPropsForFill, imageUrlForAsset, inferInitialRouteFromPath, injectComponentCSSRules, installFlexboxGapWorkaroundIfNeeded, InternalID, interpolate, invariant, inView, isAnimatable2 as isAnimatable, isBrowser, isDesignDefinition, isDragActive, isEqual, isFiniteNumber, isFractionDimension, isFramerGamepadKeydownData, isFramerPageLink, isGapEnabled, isMotionComponent, isMotionValue2 as isMotionValue, isOfAnnotatedType, isOverride, isReactDefinition, isRelativeNumber, isShallowEqualArray, isStraightCurve, isValidMotionProp, Layer, LayoutGroup, LayoutIdContext, lazy, LazyMotion, LazyValue, LibraryFeaturesProvider, Line, LinearGradient, Link, loadFont, loadJSON, localPackageFallbackIdentifier, localShadowFrame, m, MainLoop, makePaddingString, makeUseVisualState, markHydrationStart, memoize2 as memoize, mirrorEasing, mix, modulate, motion, MotionConfig, MotionConfigContext, MotionContext, MotionGlobalConfig, MotionSetup, MotionValue, motionValue, NavigateTo, NavigationCallbackProvider, NavigationConsumer, NavigationTransitionType, NavigationWrapper as Navigation, NotFoundError, ObservableObject, optimizeAppear, optimizeAppearTransformTemplate, optimizedAppearDataAttribute, paddingFromProps, Page3 as Page, PageEffectsProvider, PageRoot, ParentSizeState, parseFramerPageLink, pathDefaults, PathSegment, PathVariablesContext, pipe, Point, Polygon, preloadImage, PresenceContext, print, progress, PropertyOverrides, PropertyStore, propsForLink, pushLoadMoreHistory, px, QueryEngine, RadialGradient, Rect, removeHiddenBreakpointLayers, removeHiddenBreakpointLayersV2, RenderTarget, Reorder, resolveLink, ResolveLinks, resolveMotionValue, resolvePageScope, reverseEasing, RichText, roundedNumber, roundedNumberString, roundWithOffset, Scroll, scroll, scrollInfo, setGlobalRenderEnvironment, setInitialHydrationState, Shadow, sharedSVGManager, shouldOpenLinkInNewTab, Size, spring, SpringAnimator, SSRVariants, Stack, stagger, startAnimation, startOptimizedAppearAnimation, steps, StyleSheetContext, SVG, SwitchLayoutGroupContext, sync, systemFontFamilyName, Text2 as Text, throttle, toFlexDirection, toJustifyOrAlignment, toSVGPath, transform, transformString2 as transformString, transformTemplate, turnOffReactEventHandling, unwrapMotionComponent, useActiveTargetCallback, useActiveVariantCallback, useAddVariantProps, useAnimate, useAnimatedState, useAnimatedState as useDeprecatedAnimatedState, useAnimation, useAnimationControls, useAnimationFrame, useBreakpointVariants, useComponentViewport, useConstant2 as useConstant, useCurrentPathVariables, useCurrentRouteId, useCustomCursors, useCycle, useDataRecord, useDomEvent, useDragControls, useDynamicRefs, useElementScroll, useForceUpdate, useGamepad, useHotkey, useHydratedBreakpointVariants, useInitialRouteComponent, useInstantLayoutTransition, useInstantTransition, useInvertedScale, useInvertedScale as useDeprecatedInvertedScale, useInView, useIsInCurrentNavigationTarget, useIsomorphicLayoutEffect, useIsOnFramerCanvas, useIsPresent, useLoadMorePaginatedQuery, useLocale, useLocaleCode, useLocaleInfo, useLocalizationInfo, useMeasureLayout, useMotionTemplate, useMotionValue, useMotionValueEvent, useNavigate, useNavigation, useObserveData, useOnAppear, useOnCurrentTargetChange, useOnVariantChange, useOverlayState, usePageEffects, usePrefetch, usePreloadQuery, usePresence, usePrototypeNavigate, useProvidedWindow, useQueryData, useReducedMotion, useReducedMotionConfig, useRenderEnvironment, useResetProjection, useRoute, useRouteAnchor, useRouteElementId, useRouteHandler, useRouter, useScroll, useSpring, useTime, useTransform, useUnmountEffect, useVariantState, useVelocity, useViewportScroll, useWillChange, ValueInterpolation, valueToDimensionType, VariantSelector, Vector, VectorGroup, version, VisualElement, visualElementStore, warning, WindowContext, withCSS, withFX, withGeneratedLayoutId, withInfiniteScroll, withMappedReactProps, withMeasuredSize, WithNavigator, withOpacity, withOptimizedAppearEffect, WithOverride, withParallaxTransform, withPath, withPerformanceMarks, withShape, withStyleAppearEffect, withVariantAppearEffect, withVariantFX, wrap, };
40156
+ export { _injectRuntime, AcceleratedAnimation, addActionControls, addFonts, addPointerEvent, addPointerInfo, addPropertyControls, addScaleCorrector, AnchorLinkTarget, Animatable, animate2 as animate, AnimatePresence, AnimateSharedLayout, animateValue, animateVisualElement, animationControls, animations, annotateTypeOnStringify, anticipate, AnyInterpolation, AutomaticLayoutIds, BackgroundImage, backgroundImageFromProps, backIn, backInOut, backOut, BezierAnimator, BoxShadow, buildTransform, calcLength, calculateRect, callEach, cancelFrame, cancelSync, ChildrenCanSuspend, circIn, circInOut, circOut, clamp, collectVisualStyleFromProps, Color, color, ColorFormat, ColorMixModelType, combinedCSSRulesForPreview, complex, ComponentContainerContext, ComponentPresetsConsumer, ComponentPresetsProvider, ComponentViewportProvider, ConstraintMask, constraintsEnabled, ConstraintValues, Container, ControlType, ConvertColor, convertPresentationTree, convertPropsToDeviceOptions, createBox, createData, createDomMotionComponent, createFramerPageLink, createMotionComponent, createScopedAnimate, cssBackgroundSize, cubicBezier, CustomCursorHost, CustomProperties, cx, CycleVariantState, Data, DataContext, DataObserver, DataObserverContext, debounce, defaultDeviceProps, degreesToRadians, delay, DeprecatedComponentContainer, DeprecatedFrameWithEvents, DeprecatedLayoutGroupContext, DeprecatedLayoutGroupContext as LayoutGroupContext, Device, DeviceCodeComponent, devicePresets, DimensionType, disableInstantTransitions, dispatchKeyDownEvent, distance, distance2D, DOM, domAnimation, domMax, domMin, DragControls, Draggable, easeIn, easeInOut, easeOut, EmptyState, environment, ErrorPlaceholder, executeInRenderEnvironment, Fetcher, filterProps, finiteNumber, FlatTree, Floating, FontSourceNames, fontStore, forceLayerBackingWithCSSProperties, FormBooleanInput, FormContainer, FormPlainTextInput2 as FormPlainTextInput, FormSelect, fraction, Frame, frame, frameData, frameFromElement, frameFromElements, FramerAnimation, framerAppearAnimationScriptKey, framerAppearEffects, framerAppearIdKey, framerAppearTransformTemplateToken, framerCSSMarker, FramerEvent, FramerEventListener, FramerEventSession, FrameWithMotion, GamepadContext, GeneratedComponentContext, getComponentSize, getDevicePreset, getFonts, getFontsFromComponentPreset, getFontsFromSharedStyle, getLoadingLazyAtYPosition, getMeasurableCodeComponentChildren, getMergedConstraintsProps, getPropertyControls, getWhereExpressionFromPathVariables, gradientForShape, Image2 as Image, imagePatternPropsForFill, imageUrlForAsset, inferInitialRouteFromPath, injectComponentCSSRules, installFlexboxGapWorkaroundIfNeeded, InternalID, interpolate, invariant, inView, isAnimatable2 as isAnimatable, isBrowser, isDesignDefinition, isDragActive, isEqual, isFiniteNumber, isFractionDimension, isFramerGamepadKeydownData, isFramerPageLink, isGapEnabled, isMotionComponent, isMotionValue2 as isMotionValue, isOfAnnotatedType, isOverride, isReactDefinition, isRelativeNumber, isShallowEqualArray, isStraightCurve, isValidMotionProp, Layer, LayoutGroup, LayoutIdContext, lazy, LazyMotion, LazyValue, LibraryFeaturesProvider, Line, LinearGradient, Link, loadFont, loadJSON, localPackageFallbackIdentifier, localShadowFrame, m, MainLoop, makePaddingString, makeUseVisualState, markHydrationStart, memoize2 as memoize, mirrorEasing, mix, modulate, motion, MotionConfig, MotionConfigContext, MotionContext, MotionGlobalConfig, MotionSetup, MotionValue, motionValue, NavigateTo, NavigationCallbackProvider, NavigationConsumer, NavigationTransitionType, NavigationWrapper as Navigation, NotFoundError, ObservableObject, optimizeAppear, optimizeAppearTransformTemplate, optimizedAppearDataAttribute, paddingFromProps, Page3 as Page, PageEffectsProvider, PageRoot, ParentSizeState, parseFramerPageLink, pathDefaults, PathSegment, PathVariablesContext, pipe, Point, Polygon, preloadImage, PresenceContext, print, progress, PropertyOverrides, PropertyStore, propsForLink, pushLoadMoreHistory, px, QueryEngine, RadialGradient, Rect, removeHiddenBreakpointLayers, removeHiddenBreakpointLayersV2, RenderTarget, Reorder, resolveLink, ResolveLinks, resolveMotionValue, resolvePageScope, reverseEasing, RichText, roundedNumber, roundedNumberString, roundWithOffset, Scroll, scroll, scrollInfo, setGlobalRenderEnvironment, setInitialHydrationState, Shadow, sharedSVGManager, shouldOpenLinkInNewTab, Size, spring, SpringAnimator, SSRVariants, Stack, stagger, startAnimation, startOptimizedAppearAnimation, steps, StyleSheetContext, SVG, SwitchLayoutGroupContext, sync, systemFontFamilyName, Text2 as Text, throttle, toFlexDirection, toJustifyOrAlignment, toSVGPath, transform, transformString2 as transformString, transformTemplate, turnOffReactEventHandling, unwrapMotionComponent, useActiveTargetCallback, useActiveVariantCallback, useAddVariantProps, useAnimate, useAnimatedState, useAnimatedState as useDeprecatedAnimatedState, useAnimation, useAnimationControls, useAnimationFrame, useBreakpointVariants, useComponentViewport, useConstant2 as useConstant, useCurrentPathVariables, useCurrentRouteId, useCustomCursors, useCycle, useDataRecord, useDomEvent, useDragControls, useDynamicRefs, useElementScroll, useForceUpdate, useGamepad, useHotkey, useHydratedBreakpointVariants, useInitialRouteComponent, useInstantLayoutTransition, useInstantTransition, useInvertedScale, useInvertedScale as useDeprecatedInvertedScale, useInView, useIsInCurrentNavigationTarget, useIsomorphicLayoutEffect, useIsOnFramerCanvas, useIsPresent, useLoadMorePaginatedQuery, useLocale, useLocaleCode, useLocaleInfo, useLocalizationInfo, useMeasureLayout, useMotionTemplate, useMotionValue, useMotionValueEvent, useNavigate, useNavigation, useObserveData, useOnAppear, useOnCurrentTargetChange, useOnVariantChange, useOverlayState, usePageEffects, usePrefetch, usePreloadQuery, usePresence, usePrototypeNavigate, useProvidedWindow, useQueryData, useReducedMotion, useReducedMotionConfig, useRenderEnvironment, useResetProjection, useRoute, useRouteAnchor, useRouteElementId, useRouteHandler, useRouter, useScroll, useSpring, useTime, useTransform, useUnmountEffect, useVariantState, useVelocity, useViewportScroll, useWillChange, ValueInterpolation, valueToDimensionType, VariantSelector, Vector, VectorGroup, version, VisualElement, visualElementStore, warning, WindowContext, withCSS, withFX, withGeneratedLayoutId, withInfiniteScroll, withMappedReactProps, withMeasuredSize, WithNavigator, withOpacity, withOptimizedAppearEffect, WithOverride, withParallaxTransform, withPath, withPerformanceMarks, withShape, withStyleAppearEffect, withVariantAppearEffect, withVariantFX, wrap, };
40154
40157
  /**
40155
40158
  * @license Emotion v11.0.0
40156
40159
  * MIT License