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/src/framer.js CHANGED
@@ -1,4 +1,4 @@
1
- // https :https://app.framerstatic.com/chunk-HCJ5X5Q7.js
1
+ // https :https://app.framerstatic.com/chunk-VMMGJNOV.js
2
2
  import { createContext, } from 'react';
3
3
  import { useEffect, useLayoutEffect, } from 'react';
4
4
  import { jsx, jsxs, } from 'react/jsx-runtime';
@@ -10,8 +10,8 @@ import { useId, } from 'react';
10
10
  import { createElement, Fragment, } from 'react';
11
11
  import { Component, } from 'react';
12
12
  import { useState, } from 'react';
13
- import { Children, cloneElement as cloneElement2, isValidElement, } from 'react';
14
13
  import * as React2 from 'react';
14
+ import { Children, isValidElement, } from 'react';
15
15
  var __create = Object.create;
16
16
  var __defProp = Object.defineProperty;
17
17
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -132,7 +132,7 @@ var MotionConfigContext = createContext({
132
132
  },);
133
133
  var MotionContext = createContext({},);
134
134
  var PresenceContext = createContext(null,);
135
- var isBrowser = typeof document !== 'undefined';
135
+ var isBrowser = typeof window !== 'undefined';
136
136
  var useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
137
137
  var camelToDash = (str) => str.replace(/([a-z])([A-Z])/gu, '$1-$2',).toLowerCase();
138
138
  var optimizedAppearDataId = 'framerAppearId';
@@ -309,6 +309,7 @@ function isRefObject(ref,) {
309
309
  }
310
310
  var scheduleHandoffComplete = false;
311
311
  function useVisualElement(Component33, visualState, props, createVisualElement2, ProjectionNodeConstructor,) {
312
+ var _a;
312
313
  const {
313
314
  visualElement: parent,
314
315
  } = useContext3(MotionContext,);
@@ -338,7 +339,11 @@ function useVisualElement(Component33, visualState, props, createVisualElement2,
338
339
  useInsertionEffect(() => {
339
340
  visualElement && visualElement.update(props, presenceContext,);
340
341
  },);
341
- const wantsHandoff = useRef(Boolean(props[optimizedAppearDataAttribute] && !window.HandoffComplete,),);
342
+ const optimisedAppearId = props[optimizedAppearDataAttribute];
343
+ const wantsHandoff = useRef(
344
+ Boolean(optimisedAppearId,) && !window.MotionHandoffIsComplete &&
345
+ ((_a = window.MotionHasOptimisedAnimation) === null || _a === void 0 ? void 0 : _a.call(window, optimisedAppearId,)),
346
+ );
342
347
  useIsomorphicLayoutEffect(() => {
343
348
  if (!visualElement) return;
344
349
  visualElement.updateFeatures();
@@ -352,18 +357,16 @@ function useVisualElement(Component33, visualState, props, createVisualElement2,
352
357
  if (!wantsHandoff.current && visualElement.animationState) {
353
358
  visualElement.animationState.animateChanges();
354
359
  }
355
- if (wantsHandoff.current) {
356
- wantsHandoff.current = false;
357
- if (!scheduleHandoffComplete) {
358
- scheduleHandoffComplete = true;
359
- queueMicrotask(completeHandoff,);
360
- }
360
+ wantsHandoff.current = false;
361
+ if (!scheduleHandoffComplete) {
362
+ scheduleHandoffComplete = true;
363
+ queueMicrotask(completeHandoff,);
361
364
  }
362
365
  },);
363
366
  return visualElement;
364
367
  }
365
368
  function completeHandoff() {
366
- window.HandoffComplete = true;
369
+ window.MotionHandoffIsComplete = true;
367
370
  }
368
371
  function createProjectionNode(visualElement, props, ProjectionNodeConstructor, initialPromotionConfig,) {
369
372
  const {
@@ -583,6 +586,37 @@ function addScaleCorrector(correctors,) {
583
586
  Object.assign(scaleCorrectors, correctors,);
584
587
  }
585
588
  var isMotionValue = (value) => Boolean(value && value.getVelocity,);
589
+ var clamp = (min, max, v,) => {
590
+ if (v > max) return max;
591
+ if (v < min) return min;
592
+ return v;
593
+ };
594
+ var sanitize = (v) => Math.round(v * 1e5,) / 1e5;
595
+ var floatRegex = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
596
+ var colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
597
+ var singleColorRegex =
598
+ /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;
599
+ function isString(v,) {
600
+ return typeof v === 'string';
601
+ }
602
+ function isNullish(v,) {
603
+ return v == null;
604
+ }
605
+ var createUnitType = (unit) => ({
606
+ test: (v) => isString(v,) && v.endsWith(unit,) && v.split(' ',).length === 1,
607
+ parse: parseFloat,
608
+ transform: (v) => `${v}${unit}`,
609
+ });
610
+ var degrees = createUnitType('deg',);
611
+ var percent = createUnitType('%',);
612
+ var px = createUnitType('px',);
613
+ var vh = createUnitType('vh',);
614
+ var vw = createUnitType('vw',);
615
+ var progressPercentage = {
616
+ ...percent,
617
+ parse: (v) => percent.parse(v,) / 100,
618
+ transform: (v) => percent.transform(v * 100,),
619
+ };
586
620
  var transformPropOrder = [
587
621
  'transformPerspective',
588
622
  'x',
@@ -603,6 +637,94 @@ var transformPropOrder = [
603
637
  'skewY',
604
638
  ];
605
639
  var transformProps = new Set(transformPropOrder,);
640
+ var getValueAsType = (value, type,) => {
641
+ return type && typeof value === 'number' ? type.transform(value,) : value;
642
+ };
643
+ var number = {
644
+ test: (v) => typeof v === 'number',
645
+ parse: parseFloat,
646
+ transform: (v) => v,
647
+ };
648
+ var alpha = {
649
+ ...number,
650
+ transform: (v) => clamp(0, 1, v,),
651
+ };
652
+ var scale = {
653
+ ...number,
654
+ default: 1,
655
+ };
656
+ var int = {
657
+ ...number,
658
+ transform: Math.round,
659
+ };
660
+ var numberValueTypes = {
661
+ // Border props
662
+ borderWidth: px,
663
+ borderTopWidth: px,
664
+ borderRightWidth: px,
665
+ borderBottomWidth: px,
666
+ borderLeftWidth: px,
667
+ borderRadius: px,
668
+ radius: px,
669
+ borderTopLeftRadius: px,
670
+ borderTopRightRadius: px,
671
+ borderBottomRightRadius: px,
672
+ borderBottomLeftRadius: px,
673
+ // Positioning props
674
+ width: px,
675
+ maxWidth: px,
676
+ height: px,
677
+ maxHeight: px,
678
+ size: px,
679
+ top: px,
680
+ right: px,
681
+ bottom: px,
682
+ left: px,
683
+ // Spacing props
684
+ padding: px,
685
+ paddingTop: px,
686
+ paddingRight: px,
687
+ paddingBottom: px,
688
+ paddingLeft: px,
689
+ margin: px,
690
+ marginTop: px,
691
+ marginRight: px,
692
+ marginBottom: px,
693
+ marginLeft: px,
694
+ // Transform props
695
+ rotate: degrees,
696
+ rotateX: degrees,
697
+ rotateY: degrees,
698
+ rotateZ: degrees,
699
+ scale,
700
+ scaleX: scale,
701
+ scaleY: scale,
702
+ scaleZ: scale,
703
+ skew: degrees,
704
+ skewX: degrees,
705
+ skewY: degrees,
706
+ distance: px,
707
+ translateX: px,
708
+ translateY: px,
709
+ translateZ: px,
710
+ x: px,
711
+ y: px,
712
+ z: px,
713
+ perspective: px,
714
+ transformPerspective: px,
715
+ opacity: alpha,
716
+ originX: progressPercentage,
717
+ originY: progressPercentage,
718
+ originZ: px,
719
+ // Misc
720
+ zIndex: int,
721
+ backgroundPositionX: px,
722
+ backgroundPositionY: px,
723
+ // SVG
724
+ fillOpacity: alpha,
725
+ strokeOpacity: alpha,
726
+ numOctaves: int,
727
+ };
606
728
  var translateAlias = {
607
729
  x: 'translateX',
608
730
  y: 'translateY',
@@ -610,13 +732,29 @@ var translateAlias = {
610
732
  transformPerspective: 'perspective',
611
733
  };
612
734
  var numTransforms = transformPropOrder.length;
613
- function buildTransform(transform2, transformIsDefault, transformTemplate2,) {
735
+ function buildTransform(latestValues, transform2, transformTemplate2,) {
614
736
  let transformString3 = '';
737
+ let transformIsDefault = true;
615
738
  for (let i = 0; i < numTransforms; i++) {
616
739
  const key7 = transformPropOrder[i];
617
- if (transform2[key7] !== void 0) {
618
- const transformName = translateAlias[key7] || key7;
619
- transformString3 += `${transformName}(${transform2[key7]}) `;
740
+ const value = latestValues[key7];
741
+ if (value === void 0) continue;
742
+ let valueIsDefault = true;
743
+ if (typeof value === 'number') {
744
+ valueIsDefault = value === (key7.startsWith('scale',) ? 1 : 0);
745
+ } else {
746
+ valueIsDefault = parseFloat(value,) === 0;
747
+ }
748
+ if (!valueIsDefault || transformTemplate2) {
749
+ const valueAsType = getValueAsType(value, numberValueTypes[key7],);
750
+ if (!valueIsDefault) {
751
+ transformIsDefault = false;
752
+ const transformName = translateAlias[key7] || key7;
753
+ transformString3 += `${transformName}(${valueAsType}) `;
754
+ }
755
+ if (transformTemplate2) {
756
+ transform2[key7] = valueAsType;
757
+ }
620
758
  }
621
759
  }
622
760
  transformString3 = transformString3.trim();
@@ -627,37 +765,6 @@ function buildTransform(transform2, transformIsDefault, transformTemplate2,) {
627
765
  }
628
766
  return transformString3;
629
767
  }
630
- var clamp = (min, max, v,) => {
631
- if (v > max) return max;
632
- if (v < min) return min;
633
- return v;
634
- };
635
- var sanitize = (v) => Math.round(v * 1e5,) / 1e5;
636
- var floatRegex = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
637
- var colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
638
- var singleColorRegex =
639
- /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;
640
- function isString(v,) {
641
- return typeof v === 'string';
642
- }
643
- function isNullish(v,) {
644
- return v == null;
645
- }
646
- var createUnitType = (unit) => ({
647
- test: (v) => isString(v,) && v.endsWith(unit,) && v.split(' ',).length === 1,
648
- parse: parseFloat,
649
- transform: (v) => `${v}${unit}`,
650
- });
651
- var degrees = createUnitType('deg',);
652
- var percent = createUnitType('%',);
653
- var px = createUnitType('px',);
654
- var vh = createUnitType('vh',);
655
- var vw = createUnitType('vw',);
656
- var progressPercentage = {
657
- ...percent,
658
- parse: (v) => percent.parse(v,) / 100,
659
- transform: (v) => percent.transform(v * 100,),
660
- };
661
768
  var validMotionProps = /* @__PURE__ */ new Set([
662
769
  'animate',
663
770
  'exit',
@@ -962,19 +1069,6 @@ function isDragActive() {
962
1069
  openGestureLock();
963
1070
  return false;
964
1071
  }
965
- var number = {
966
- test: (v) => typeof v === 'number',
967
- parse: parseFloat,
968
- transform: (v) => v,
969
- };
970
- var alpha = {
971
- ...number,
972
- transform: (v) => clamp(0, 1, v,),
973
- };
974
- var scale = {
975
- ...number,
976
- default: 1,
977
- };
978
1072
  var isColorString = (type, testProp,) => (v) => {
979
1073
  return Boolean(
980
1074
  isString(v,) && singleColorRegex.test(v,) && v.startsWith(type,) ||
@@ -1327,13 +1421,9 @@ function spring({
1327
1421
  next: (t) => {
1328
1422
  const current = resolveSpring(t,);
1329
1423
  if (!isResolvedFromDuration) {
1330
- let currentVelocity = initialVelocity;
1331
- if (t !== 0) {
1332
- if (dampingRatio < 1) {
1333
- currentVelocity = calcGeneratorVelocity(resolveSpring, t, current,);
1334
- } else {
1335
- currentVelocity = 0;
1336
- }
1424
+ let currentVelocity = 0;
1425
+ if (dampingRatio < 1) {
1426
+ currentVelocity = t === 0 ? secondsToMilliseconds(initialVelocity,) : calcGeneratorVelocity(resolveSpring, t, current,);
1337
1427
  }
1338
1428
  const isBelowVelocityThreshold = Math.abs(currentVelocity,) <= restSpeed;
1339
1429
  const isBelowDisplacementThreshold = Math.abs(target - current,) <= restDelta;
@@ -2498,78 +2588,6 @@ var filter = {
2498
2588
  return functions ? functions.map(applyDefaultFilter,).join(' ',) : v;
2499
2589
  },
2500
2590
  };
2501
- var int = {
2502
- ...number,
2503
- transform: Math.round,
2504
- };
2505
- var numberValueTypes = {
2506
- // Border props
2507
- borderWidth: px,
2508
- borderTopWidth: px,
2509
- borderRightWidth: px,
2510
- borderBottomWidth: px,
2511
- borderLeftWidth: px,
2512
- borderRadius: px,
2513
- radius: px,
2514
- borderTopLeftRadius: px,
2515
- borderTopRightRadius: px,
2516
- borderBottomRightRadius: px,
2517
- borderBottomLeftRadius: px,
2518
- // Positioning props
2519
- width: px,
2520
- maxWidth: px,
2521
- height: px,
2522
- maxHeight: px,
2523
- size: px,
2524
- top: px,
2525
- right: px,
2526
- bottom: px,
2527
- left: px,
2528
- // Spacing props
2529
- padding: px,
2530
- paddingTop: px,
2531
- paddingRight: px,
2532
- paddingBottom: px,
2533
- paddingLeft: px,
2534
- margin: px,
2535
- marginTop: px,
2536
- marginRight: px,
2537
- marginBottom: px,
2538
- marginLeft: px,
2539
- // Transform props
2540
- rotate: degrees,
2541
- rotateX: degrees,
2542
- rotateY: degrees,
2543
- rotateZ: degrees,
2544
- scale,
2545
- scaleX: scale,
2546
- scaleY: scale,
2547
- scaleZ: scale,
2548
- skew: degrees,
2549
- skewX: degrees,
2550
- skewY: degrees,
2551
- distance: px,
2552
- translateX: px,
2553
- translateY: px,
2554
- translateZ: px,
2555
- x: px,
2556
- y: px,
2557
- z: px,
2558
- perspective: px,
2559
- transformPerspective: px,
2560
- opacity: alpha,
2561
- originX: progressPercentage,
2562
- originY: progressPercentage,
2563
- originZ: px,
2564
- // Misc
2565
- zIndex: int,
2566
- backgroundPositionX: px,
2567
- backgroundPositionY: px,
2568
- // SVG
2569
- fillOpacity: alpha,
2570
- strokeOpacity: alpha,
2571
- numOctaves: int,
2572
- };
2573
2591
  var defaultValueTypes = {
2574
2592
  ...numberValueTypes,
2575
2593
  // Color props
@@ -3001,6 +3019,8 @@ var AcceleratedAnimation = class extends BaseAnimation {
3001
3019
  this.resolver.cancel();
3002
3020
  this.isStopped = true;
3003
3021
  if (this.state === 'idle') return;
3022
+ this.resolveFinishedPromise();
3023
+ this.updateFinishedPromise();
3004
3024
  const {
3005
3025
  resolved,
3006
3026
  } = this;
@@ -3121,7 +3141,7 @@ var MotionValue = class {
3121
3141
  * @internal
3122
3142
  */
3123
3143
  constructor(init, options = {},) {
3124
- this.version = '11.3.9';
3144
+ this.version = '11.3.23';
3125
3145
  this.canTrackVelocity = null;
3126
3146
  this.events = {};
3127
3147
  this.updateAndNotify = (v, render = true,) => {
@@ -3375,40 +3395,6 @@ var MotionValue = class {
3375
3395
  function motionValue(init, options,) {
3376
3396
  return new MotionValue(init, options,);
3377
3397
  }
3378
- var WillChangeMotionValue = class extends MotionValue {
3379
- constructor() {
3380
- super(...arguments,);
3381
- this.output = [];
3382
- this.counts = /* @__PURE__ */ new Map();
3383
- }
3384
- add(name,) {
3385
- const styleName = getWillChangeName(name,);
3386
- if (!styleName) return;
3387
- const prevCount = this.counts.get(styleName,) || 0;
3388
- this.counts.set(styleName, prevCount + 1,);
3389
- if (prevCount === 0) {
3390
- this.output.push(styleName,);
3391
- this.update();
3392
- }
3393
- let hasRemoved = false;
3394
- return () => {
3395
- if (hasRemoved) return;
3396
- hasRemoved = true;
3397
- const newCount = this.counts.get(styleName,) - 1;
3398
- this.counts.set(styleName, newCount,);
3399
- if (newCount === 0) {
3400
- removeItem(this.output, styleName,);
3401
- this.update();
3402
- }
3403
- };
3404
- }
3405
- update() {
3406
- this.set(this.output.length ? this.output.join(', ',) : 'auto',);
3407
- }
3408
- };
3409
- function useWillChange() {
3410
- return useConstant(() => new WillChangeMotionValue('auto',));
3411
- }
3412
3398
  function resolveVariant(visualElement, definition, custom,) {
3413
3399
  const props = visualElement.getProps();
3414
3400
  return resolveVariantFromProps(props, definition, custom !== void 0 ? custom : props.custom, visualElement,);
@@ -3647,6 +3633,37 @@ function setTarget(visualElement, definition,) {
3647
3633
  function getOptimisedAppearId(visualElement,) {
3648
3634
  return visualElement.getProps()[optimizedAppearDataAttribute];
3649
3635
  }
3636
+ var WillChangeMotionValue = class extends MotionValue {
3637
+ constructor() {
3638
+ super(...arguments,);
3639
+ this.output = [];
3640
+ this.counts = /* @__PURE__ */ new Map();
3641
+ }
3642
+ add(name,) {
3643
+ const styleName = getWillChangeName(name,);
3644
+ if (!styleName) return;
3645
+ const prevCount = this.counts.get(styleName,) || 0;
3646
+ this.counts.set(styleName, prevCount + 1,);
3647
+ if (prevCount === 0) {
3648
+ this.output.push(styleName,);
3649
+ this.update();
3650
+ }
3651
+ let hasRemoved = false;
3652
+ return () => {
3653
+ if (hasRemoved) return;
3654
+ hasRemoved = true;
3655
+ const newCount = this.counts.get(styleName,) - 1;
3656
+ this.counts.set(styleName, newCount,);
3657
+ if (newCount === 0) {
3658
+ removeItem(this.output, styleName,);
3659
+ this.update();
3660
+ }
3661
+ };
3662
+ }
3663
+ update() {
3664
+ this.set(this.output.length ? this.output.join(', ',) : 'auto',);
3665
+ }
3666
+ };
3650
3667
  function isWillChangeMotionValue(value,) {
3651
3668
  return Boolean(isMotionValue(value,) && value.add,);
3652
3669
  }
@@ -3696,10 +3713,10 @@ function animateTarget(visualElement, targetAndTransition, {
3696
3713
  ...getValueTransition(transition || {}, key7,),
3697
3714
  };
3698
3715
  let isHandoff = false;
3699
- if (window.HandoffAppearAnimations) {
3716
+ if (window.MotionHandoffAnimation) {
3700
3717
  const appearId = getOptimisedAppearId(visualElement,);
3701
3718
  if (appearId) {
3702
- const elapsed = window.HandoffAppearAnimations(appearId, key7, value, frame,);
3719
+ const elapsed = window.MotionHandoffAnimation(appearId, key7, frame,);
3703
3720
  if (elapsed !== null) {
3704
3721
  valueTransition.elapsed = elapsed;
3705
3722
  isHandoff = true;
@@ -3800,9 +3817,7 @@ function animateVisualElement(visualElement, definition, options = {},) {
3800
3817
  animation = Promise.all(animateTarget(visualElement, resolvedDefinition, options,),);
3801
3818
  }
3802
3819
  return animation.then(() => {
3803
- frame.postRender(() => {
3804
- visualElement.notify('AnimationComplete', definition,);
3805
- },);
3820
+ visualElement.notify('AnimationComplete', definition,);
3806
3821
  },);
3807
3822
  }
3808
3823
  function shallowCompare(next, prev,) {
@@ -4189,7 +4204,7 @@ function usePresence() {
4189
4204
  } = context;
4190
4205
  const id4 = useId();
4191
4206
  useEffect(() => register(id4,), [],);
4192
- const safeToRemove = () => onExitComplete && onExitComplete(id4,);
4207
+ const safeToRemove = useCallback(() => onExitComplete && onExitComplete(id4,), [id4, onExitComplete,],);
4193
4208
  return !isPresent2 && onExitComplete ? [false, safeToRemove,] : [true,];
4194
4209
  }
4195
4210
  function useIsPresent() {
@@ -4259,8 +4274,8 @@ function updateMotionValuesFromProps(element, next, prev,) {
4259
4274
  element.addValue(key7, nextValue,);
4260
4275
  if (false) {
4261
4276
  warnOnce(
4262
- nextValue.version === '11.3.9',
4263
- `Attempting to mix Framer Motion versions ${nextValue.version} with 11.3.9 may not work as expected.`,
4277
+ nextValue.version === '11.3.23',
4278
+ `Attempting to mix Framer Motion versions ${nextValue.version} with 11.3.23 may not work as expected.`,
4264
4279
  );
4265
4280
  }
4266
4281
  } else if (isMotionValue(prevValue,)) {
@@ -4779,42 +4794,35 @@ function isForcedMotionValue(key7, {
4779
4794
  return transformProps.has(key7,) || key7.startsWith('origin',) ||
4780
4795
  (layout2 || layoutId !== void 0) && (!!scaleCorrectors[key7] || key7 === 'opacity');
4781
4796
  }
4782
- var getValueAsType = (value, type,) => {
4783
- return type && typeof value === 'number' ? type.transform(value,) : value;
4784
- };
4785
4797
  function buildHTMLStyles(state, latestValues, transformTemplate2,) {
4786
4798
  const {
4787
4799
  style,
4788
4800
  vars,
4789
- transform: transform2,
4790
4801
  transformOrigin,
4791
4802
  } = state;
4792
4803
  let hasTransform2 = false;
4793
4804
  let hasTransformOrigin = false;
4794
- let transformIsNone = true;
4795
4805
  for (const key7 in latestValues) {
4796
4806
  const value = latestValues[key7];
4797
- if (isCSSVariableName(key7,)) {
4798
- vars[key7] = value;
4799
- continue;
4800
- }
4801
- const valueType = numberValueTypes[key7];
4802
- const valueAsType = getValueAsType(value, valueType,);
4803
4807
  if (transformProps.has(key7,)) {
4804
4808
  hasTransform2 = true;
4805
- transform2[key7] = valueAsType;
4806
- if (!transformIsNone) continue;
4807
- if (value !== (valueType.default || 0)) transformIsNone = false;
4808
- } else if (key7.startsWith('origin',)) {
4809
- hasTransformOrigin = true;
4810
- transformOrigin[key7] = valueAsType;
4809
+ continue;
4810
+ } else if (isCSSVariableName(key7,)) {
4811
+ vars[key7] = value;
4812
+ continue;
4811
4813
  } else {
4812
- style[key7] = valueAsType;
4814
+ const valueAsType = getValueAsType(value, numberValueTypes[key7],);
4815
+ if (key7.startsWith('origin',)) {
4816
+ hasTransformOrigin = true;
4817
+ transformOrigin[key7] = valueAsType;
4818
+ } else {
4819
+ style[key7] = valueAsType;
4820
+ }
4813
4821
  }
4814
4822
  }
4815
4823
  if (!latestValues.transform) {
4816
4824
  if (hasTransform2 || transformTemplate2) {
4817
- style.transform = buildTransform(state.transform, transformIsNone, transformTemplate2,);
4825
+ style.transform = buildTransform(latestValues, state.transform, transformTemplate2,);
4818
4826
  } else if (style.transform) {
4819
4827
  style.transform = 'none';
4820
4828
  }
@@ -6802,7 +6810,7 @@ function resetDistortingTransform(key7, visualElement, values, sharedAnimationVa
6802
6810
  }
6803
6811
  }
6804
6812
  }
6805
- function isOptimisedAppearTree(projectionNode,) {
6813
+ function isOptimisedTransformAnimationInTree(projectionNode,) {
6806
6814
  projectionNode.hasCheckedOptimisedAppear = true;
6807
6815
  if (projectionNode.root === projectionNode) return false;
6808
6816
  const {
@@ -6810,10 +6818,10 @@ function isOptimisedAppearTree(projectionNode,) {
6810
6818
  } = projectionNode.options;
6811
6819
  if (!visualElement) {
6812
6820
  return false;
6813
- } else if (getOptimisedAppearId(visualElement,)) {
6821
+ } else if (window.MotionHasOptimisedTransformAnimation(getOptimisedAppearId(visualElement,),)) {
6814
6822
  return true;
6815
6823
  } else if (projectionNode.parent && !projectionNode.parent.hasCheckedOptimisedAppear) {
6816
- return isOptimisedAppearTree(projectionNode.parent,);
6824
+ return isOptimisedTransformAnimationInTree(projectionNode.parent,);
6817
6825
  } else {
6818
6826
  return false;
6819
6827
  }
@@ -7027,8 +7035,8 @@ function createProjectionNode2({
7027
7035
  this.options.onExitComplete && this.options.onExitComplete();
7028
7036
  return;
7029
7037
  }
7030
- if (window.HandoffCancelAllAnimations && isOptimisedAppearTree(this,)) {
7031
- window.HandoffCancelAllAnimations();
7038
+ if (window.MotionHandoffCancelAll && isOptimisedTransformAnimationInTree(this,)) {
7039
+ window.MotionHandoffCancelAll();
7032
7040
  }
7033
7041
  !this.root.isUpdating && this.root.startUpdate();
7034
7042
  if (this.isLayoutDirty) return;
@@ -7138,11 +7146,13 @@ function createProjectionNode2({
7138
7146
  needsMeasurement = false;
7139
7147
  }
7140
7148
  if (needsMeasurement) {
7149
+ const isRoot = checkIsScrollRoot(this.instance,);
7141
7150
  this.scroll = {
7142
7151
  animationId: this.root.animationId,
7143
7152
  phase,
7144
- isRoot: checkIsScrollRoot(this.instance,),
7153
+ isRoot,
7145
7154
  offset: measureScroll(this.instance,),
7155
+ wasRoot: this.scroll ? this.scroll.isRoot : isRoot,
7146
7156
  };
7147
7157
  }
7148
7158
  }
@@ -7175,23 +7185,32 @@ function createProjectionNode2({
7175
7185
  };
7176
7186
  }
7177
7187
  measurePageBox() {
7188
+ var _a;
7178
7189
  const {
7179
7190
  visualElement,
7180
7191
  } = this.options;
7181
7192
  if (!visualElement) return createBox();
7182
7193
  const box = visualElement.measureViewportBox();
7183
- const {
7184
- scroll: scroll2,
7185
- } = this.root;
7186
- if (scroll2) {
7187
- translateAxis(box.x, scroll2.offset.x,);
7188
- translateAxis(box.y, scroll2.offset.y,);
7194
+ const wasInScrollRoot = ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) ||
7195
+ this.path.some(checkNodeWasScrollRoot,);
7196
+ if (!wasInScrollRoot) {
7197
+ const {
7198
+ scroll: scroll2,
7199
+ } = this.root;
7200
+ if (scroll2) {
7201
+ translateAxis(box.x, scroll2.offset.x,);
7202
+ translateAxis(box.y, scroll2.offset.y,);
7203
+ }
7189
7204
  }
7190
7205
  return box;
7191
7206
  }
7192
7207
  removeElementScroll(box,) {
7208
+ var _a;
7193
7209
  const boxWithoutScroll = createBox();
7194
7210
  copyBoxInto(boxWithoutScroll, box,);
7211
+ if ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) {
7212
+ return boxWithoutScroll;
7213
+ }
7195
7214
  for (let i = 0; i < this.path.length; i++) {
7196
7215
  const node = this.path[i];
7197
7216
  const {
@@ -7199,15 +7218,8 @@ function createProjectionNode2({
7199
7218
  options,
7200
7219
  } = node;
7201
7220
  if (node !== this.root && scroll2 && options.layoutScroll) {
7202
- if (scroll2.isRoot) {
7221
+ if (scroll2.wasRoot) {
7203
7222
  copyBoxInto(boxWithoutScroll, box,);
7204
- const {
7205
- scroll: rootScroll,
7206
- } = this.root;
7207
- if (rootScroll) {
7208
- translateAxis(boxWithoutScroll.x, -rootScroll.offset.x,);
7209
- translateAxis(boxWithoutScroll.y, -rootScroll.offset.y,);
7210
- }
7211
7223
  }
7212
7224
  translateAxis(boxWithoutScroll.x, scroll2.offset.x,);
7213
7225
  translateAxis(boxWithoutScroll.y, scroll2.offset.y,);
@@ -7921,6 +7933,10 @@ function shouldAnimatePositionOnly(animationType, snapshot, layout2,) {
7921
7933
  return animationType === 'position' ||
7922
7934
  animationType === 'preserve-aspect' && !isNear(aspectRatio(snapshot,), aspectRatio(layout2,), 0.2,);
7923
7935
  }
7936
+ function checkNodeWasScrollRoot(node,) {
7937
+ var _a;
7938
+ return node !== node.root && ((_a = node.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot);
7939
+ }
7924
7940
  var DocumentProjectionNode = createProjectionNode2({
7925
7941
  attachResizeListener: (ref, notify2,) => addDomEvent(ref, 'resize', notify2,),
7926
7942
  measureScroll: () => ({
@@ -8091,28 +8107,6 @@ function createDomMotionComponent(key7,) {
8091
8107
  ),);
8092
8108
  }
8093
8109
  var m = createMotionProxy(createDomMotionConfig,);
8094
- function useIsMounted() {
8095
- const isMounted = useRef(false,);
8096
- useIsomorphicLayoutEffect(() => {
8097
- isMounted.current = true;
8098
- return () => {
8099
- isMounted.current = false;
8100
- };
8101
- }, [],);
8102
- return isMounted;
8103
- }
8104
- function useForceUpdate() {
8105
- const isMounted = useIsMounted();
8106
- const [forcedRenderCount, setForcedRenderCount,] = useState(0,);
8107
- const forceRender = useCallback(() => {
8108
- isMounted.current && setForcedRenderCount(forcedRenderCount + 1,);
8109
- }, [forcedRenderCount,],);
8110
- const deferredForceRender = useCallback(() => frame.postRender(forceRender,), [forceRender,],);
8111
- return [deferredForceRender, forcedRenderCount,];
8112
- }
8113
- function useUnmountEffect(callback,) {
8114
- return useEffect(() => () => callback(), [],);
8115
- }
8116
8110
  var PopChildMeasure = class extends React2.Component {
8117
8111
  getSnapshotBeforeUpdate(prevProps,) {
8118
8112
  const element = this.props.childRef.current;
@@ -8241,12 +8235,6 @@ function newChildrenMap() {
8241
8235
  return /* @__PURE__ */ new Map();
8242
8236
  }
8243
8237
  var getChildKey = (child) => child.key || '';
8244
- function updateChildLookup(children, allChildren,) {
8245
- children.forEach((child) => {
8246
- const key7 = getChildKey(child,);
8247
- allChildren.set(key7, child,);
8248
- },);
8249
- }
8250
8238
  function onlyElements(children,) {
8251
8239
  const filtered = [];
8252
8240
  Children.forEach(children, (child) => {
@@ -8256,112 +8244,91 @@ function onlyElements(children,) {
8256
8244
  }
8257
8245
  var AnimatePresence = ({
8258
8246
  children,
8247
+ exitBeforeEnter,
8259
8248
  custom,
8260
8249
  initial = true,
8261
8250
  onExitComplete,
8262
- exitBeforeEnter,
8263
8251
  presenceAffectsLayout = true,
8264
8252
  mode = 'sync',
8265
8253
  },) => {
8266
8254
  invariant(!exitBeforeEnter, 'Replace exitBeforeEnter with mode=\'wait\'',);
8267
- const forceRender = useContext3(LayoutGroupContext,).forceRender || useForceUpdate()[0];
8268
- const isMounted = useIsMounted();
8269
- const filteredChildren = onlyElements(children,);
8270
- let childrenToRender = filteredChildren;
8271
- const exitingChildren = useRef(/* @__PURE__ */ new Map(),).current;
8272
- const presentChildren = useRef(childrenToRender,);
8273
- const allChildren = useRef(/* @__PURE__ */ new Map(),).current;
8255
+ const presentChildren = useMemo(() => onlyElements(children,), [children,],);
8256
+ const presentKeys = presentChildren.map(getChildKey,);
8274
8257
  const isInitialRender = useRef(true,);
8258
+ const pendingPresentChildren = useRef(presentChildren,);
8259
+ const exitComplete = useConstant(() => /* @__PURE__ */ new Map());
8260
+ const [diffedChildren, setDiffedChildren,] = useState(presentChildren,);
8261
+ const [renderedChildren, setRenderedChildren,] = useState(presentChildren,);
8275
8262
  useIsomorphicLayoutEffect(() => {
8276
8263
  isInitialRender.current = false;
8277
- updateChildLookup(filteredChildren, allChildren,);
8278
- presentChildren.current = childrenToRender;
8279
- },);
8280
- useUnmountEffect(() => {
8281
- isInitialRender.current = true;
8282
- allChildren.clear();
8283
- exitingChildren.clear();
8284
- },);
8285
- if (isInitialRender.current) {
8286
- return jsx(Fragment, {
8287
- children: childrenToRender.map((child) =>
8288
- jsx(PresenceChild, {
8289
- isPresent: true,
8290
- initial: initial ? void 0 : false,
8291
- presenceAffectsLayout,
8292
- mode,
8293
- children: child,
8294
- }, getChildKey(child,),)
8295
- ),
8296
- },);
8264
+ pendingPresentChildren.current = presentChildren;
8265
+ for (let i = 0; i < renderedChildren.length; i++) {
8266
+ const key7 = getChildKey(renderedChildren[i],);
8267
+ if (!presentKeys.includes(key7,)) {
8268
+ if (exitComplete.get(key7,) !== true) {
8269
+ exitComplete.set(key7, false,);
8270
+ }
8271
+ } else {
8272
+ exitComplete.delete(key7,);
8273
+ }
8274
+ }
8275
+ }, [renderedChildren, presentKeys.length, presentKeys.join('-',),],);
8276
+ const exitingChildren = [];
8277
+ if (presentChildren !== diffedChildren) {
8278
+ let nextChildren = [...presentChildren,];
8279
+ for (let i = 0; i < renderedChildren.length; i++) {
8280
+ const child = renderedChildren[i];
8281
+ const key7 = getChildKey(child,);
8282
+ if (!presentKeys.includes(key7,)) {
8283
+ nextChildren.splice(i, 0, child,);
8284
+ exitingChildren.push(child,);
8285
+ }
8286
+ }
8287
+ if (mode === 'wait' && exitingChildren.length) {
8288
+ nextChildren = exitingChildren;
8289
+ }
8290
+ setRenderedChildren(onlyElements(nextChildren,),);
8291
+ setDiffedChildren(presentChildren,);
8292
+ return;
8297
8293
  }
8298
- childrenToRender = [...childrenToRender,];
8299
- const presentKeys = presentChildren.current.map(getChildKey,);
8300
- const targetKeys = filteredChildren.map(getChildKey,);
8301
- const numPresent = presentKeys.length;
8302
- for (let i = 0; i < numPresent; i++) {
8303
- const key7 = presentKeys[i];
8304
- if (targetKeys.indexOf(key7,) === -1 && !exitingChildren.has(key7,)) {
8305
- exitingChildren.set(key7, void 0,);
8306
- }
8307
- }
8308
- if (mode === 'wait' && exitingChildren.size) {
8309
- childrenToRender = [];
8310
- }
8311
- exitingChildren.forEach((component, key7,) => {
8312
- if (targetKeys.indexOf(key7,) !== -1) return;
8313
- const child = allChildren.get(key7,);
8314
- if (!child) return;
8315
- const insertionIndex = presentKeys.indexOf(key7,);
8316
- let exitingComponent = component;
8317
- if (!exitingComponent) {
8294
+ if (false) {
8295
+ console.warn(
8296
+ `You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`,
8297
+ );
8298
+ }
8299
+ const {
8300
+ forceRender,
8301
+ } = useContext3(LayoutGroupContext,);
8302
+ return jsx(Fragment, {
8303
+ children: renderedChildren.map((child) => {
8304
+ const key7 = getChildKey(child,);
8305
+ const isPresent2 = presentChildren === renderedChildren || presentKeys.includes(key7,);
8318
8306
  const onExit = () => {
8319
- exitingChildren.delete(key7,);
8320
- const leftOverKeys = Array.from(allChildren.keys(),).filter((childKey) => !targetKeys.includes(childKey,));
8321
- leftOverKeys.forEach((leftOverKey) => allChildren.delete(leftOverKey,));
8322
- presentChildren.current = filteredChildren.filter((presentChild) => {
8323
- const presentChildKey = getChildKey(presentChild,);
8324
- return (
8325
- // filter out the node exiting
8326
- presentChildKey === key7 ||
8327
- // filter out the leftover children
8328
- leftOverKeys.includes(presentChildKey,)
8329
- );
8307
+ if (exitComplete.has(key7,)) {
8308
+ exitComplete.set(key7, true,);
8309
+ } else {
8310
+ return;
8311
+ }
8312
+ let isEveryExitComplete = true;
8313
+ exitComplete.forEach((isExitComplete) => {
8314
+ if (!isExitComplete) isEveryExitComplete = false;
8330
8315
  },);
8331
- if (!exitingChildren.size) {
8332
- if (isMounted.current === false) return;
8333
- forceRender();
8316
+ if (isEveryExitComplete) {
8317
+ forceRender === null || forceRender === void 0 ? void 0 : forceRender();
8318
+ setRenderedChildren(pendingPresentChildren.current,);
8334
8319
  onExitComplete && onExitComplete();
8335
8320
  }
8336
8321
  };
8337
- exitingComponent = jsx(PresenceChild, {
8338
- isPresent: false,
8339
- onExitComplete: onExit,
8340
- custom,
8322
+ return jsx(PresenceChild, {
8323
+ isPresent: isPresent2,
8324
+ initial: !isInitialRender.current || initial ? void 0 : false,
8325
+ custom: isPresent2 ? void 0 : custom,
8341
8326
  presenceAffectsLayout,
8342
8327
  mode,
8328
+ onExitComplete: isPresent2 ? void 0 : onExit,
8343
8329
  children: child,
8344
- }, getChildKey(child,),);
8345
- exitingChildren.set(key7, exitingComponent,);
8346
- }
8347
- childrenToRender.splice(insertionIndex, 0, exitingComponent,);
8348
- },);
8349
- childrenToRender = childrenToRender.map((child) => {
8350
- const key7 = child.key;
8351
- return exitingChildren.has(key7,) ? child : jsx(PresenceChild, {
8352
- isPresent: true,
8353
- presenceAffectsLayout,
8354
- mode,
8355
- children: child,
8356
- }, getChildKey(child,),);
8357
- },);
8358
- if (false) {
8359
- console.warn(
8360
- `You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`,
8361
- );
8362
- }
8363
- return jsx(Fragment, {
8364
- children: exitingChildren.size ? childrenToRender : childrenToRender.map((child) => cloneElement2(child,)),
8330
+ }, key7,);
8331
+ },),
8365
8332
  },);
8366
8333
  };
8367
8334
  function MotionConfig({
@@ -8420,6 +8387,25 @@ function isLazyBundle(features,) {
8420
8387
  return typeof features === 'function';
8421
8388
  }
8422
8389
  var DeprecatedLayoutGroupContext = createContext(null,);
8390
+ function useIsMounted() {
8391
+ const isMounted = useRef(false,);
8392
+ useIsomorphicLayoutEffect(() => {
8393
+ isMounted.current = true;
8394
+ return () => {
8395
+ isMounted.current = false;
8396
+ };
8397
+ }, [],);
8398
+ return isMounted;
8399
+ }
8400
+ function useForceUpdate() {
8401
+ const isMounted = useIsMounted();
8402
+ const [forcedRenderCount, setForcedRenderCount,] = useState(0,);
8403
+ const forceRender = useCallback(() => {
8404
+ isMounted.current && setForcedRenderCount(forcedRenderCount + 1,);
8405
+ }, [forcedRenderCount,],);
8406
+ const deferredForceRender = useCallback(() => frame.postRender(forceRender,), [forceRender,],);
8407
+ return [deferredForceRender, forcedRenderCount,];
8408
+ }
8423
8409
  var notify = (node) => !node.isLayoutDirty && node.willUpdate(false,);
8424
8410
  function nodeGroup() {
8425
8411
  const nodes = /* @__PURE__ */ new Set();
@@ -8666,6 +8652,10 @@ var Reorder = {
8666
8652
  Group,
8667
8653
  Item,
8668
8654
  };
8655
+ var domMin = {
8656
+ renderer: createDomVisualElement,
8657
+ ...animations,
8658
+ };
8669
8659
  var domAnimation = {
8670
8660
  renderer: createDomVisualElement,
8671
8661
  ...animations,
@@ -8691,12 +8681,16 @@ function useMotionTemplate(fragments, ...values) {
8691
8681
  }
8692
8682
  return useCombineMotionValues(values.filter(isMotionValue,), buildValue,);
8693
8683
  }
8684
+ function toNumber(v,) {
8685
+ if (typeof v === 'number') return v;
8686
+ return parseFloat(v,);
8687
+ }
8694
8688
  function useSpring(source, config = {},) {
8695
8689
  const {
8696
8690
  isStatic,
8697
8691
  } = useContext3(MotionConfigContext,);
8698
8692
  const activeSpringAnimation = useRef(null,);
8699
- const value = useMotionValue(isMotionValue(source,) ? source.get() : source,);
8693
+ const value = useMotionValue(isMotionValue(source,) ? toNumber(source.get(),) : source,);
8700
8694
  const latestValue = useRef(value.get(),);
8701
8695
  const latestSetter = useRef(() => {},);
8702
8696
  const startAnimation2 = () => {
@@ -8731,7 +8725,7 @@ function useSpring(source, config = {},) {
8731
8725
  }, [JSON.stringify(config,),],);
8732
8726
  useIsomorphicLayoutEffect(() => {
8733
8727
  if (isMotionValue(source,)) {
8734
- return source.on('change', (v) => value.set(parseFloat(v,),),);
8728
+ return source.on('change', (v) => value.set(toNumber(v,),),);
8735
8729
  }
8736
8730
  }, [value,],);
8737
8731
  return value;
@@ -9228,6 +9222,9 @@ function useTime() {
9228
9222
  useAnimationFrame((t) => time2.set(t,));
9229
9223
  return time2;
9230
9224
  }
9225
+ function useWillChange() {
9226
+ return useConstant(() => new WillChangeMotionValue('auto',));
9227
+ }
9231
9228
  function useReducedMotion() {
9232
9229
  !hasReducedMotionListener.current && initPrefersReducedMotion();
9233
9230
  const [shouldReduceMotion,] = useState(prefersReducedMotion.current,);
@@ -9318,6 +9315,9 @@ function animationControls() {
9318
9315
  };
9319
9316
  return controls;
9320
9317
  }
9318
+ function useUnmountEffect(callback,) {
9319
+ return useEffect(() => () => callback(), [],);
9320
+ }
9321
9321
  var wrap = (min, max, v,) => {
9322
9322
  const rangeSize = max - min;
9323
9323
  return ((v - min) % rangeSize + rangeSize) % rangeSize + min;
@@ -9808,8 +9808,9 @@ function useResetProjection() {
9808
9808
  }
9809
9809
  var appearStoreId = (id4, value,) => `${id4}: ${value}`;
9810
9810
  var appearAnimationStore = /* @__PURE__ */ new Map();
9811
+ var elementsWithAppearAnimations = /* @__PURE__ */ new Set();
9811
9812
  var handoffFrameTime;
9812
- function handoffOptimizedAppearAnimation(elementId, valueName, _value, frame2,) {
9813
+ function handoffOptimizedAppearAnimation(elementId, valueName, frame2,) {
9813
9814
  const optimisedValueName = transformProps.has(valueName,) ? 'transform' : valueName;
9814
9815
  const storeId = appearStoreId(elementId, optimisedValueName,);
9815
9816
  const optimisedAnimation = appearAnimationStore.get(storeId,);
@@ -9820,24 +9821,15 @@ function handoffOptimizedAppearAnimation(elementId, valueName, _value, frame2,)
9820
9821
  animation,
9821
9822
  startTime,
9822
9823
  } = optimisedAnimation;
9823
- const cancelAnimation = () => {
9824
+ if (startTime === null || window.MotionHandoffIsComplete) {
9824
9825
  appearAnimationStore.delete(storeId,);
9825
- if (frame2) {
9826
- frame2.render(() =>
9827
- frame2.render(() => {
9828
- try {
9829
- animation.cancel();
9830
- } catch (error) {}
9831
- },)
9832
- );
9833
- } else {
9834
- try {
9835
- animation.cancel();
9836
- } catch (error) {}
9837
- }
9838
- };
9839
- if (startTime === null || window.HandoffComplete) {
9840
- cancelAnimation();
9826
+ frame2.render(() =>
9827
+ frame2.render(() => {
9828
+ try {
9829
+ animation.cancel();
9830
+ } catch (error) {}
9831
+ },)
9832
+ );
9841
9833
  return null;
9842
9834
  } else {
9843
9835
  if (handoffFrameTime === void 0) {
@@ -9849,13 +9841,13 @@ function handoffOptimizedAppearAnimation(elementId, valueName, _value, frame2,)
9849
9841
  var startFrameTime;
9850
9842
  var readyAnimation;
9851
9843
  function startOptimizedAppearAnimation(element, name, keyframes2, options, onReady,) {
9852
- if (window.HandoffComplete) {
9853
- window.HandoffAppearAnimations = void 0;
9844
+ if (window.MotionHandoffIsComplete) {
9845
+ window.MotionHandoffAnimation = void 0;
9854
9846
  return;
9855
9847
  }
9856
9848
  const id4 = element.dataset[optimizedAppearDataId];
9857
9849
  if (!id4) return;
9858
- window.HandoffAppearAnimations = handoffOptimizedAppearAnimation;
9850
+ window.MotionHandoffAnimation = handoffOptimizedAppearAnimation;
9859
9851
  const storeId = appearStoreId(id4, name,);
9860
9852
  if (!readyAnimation) {
9861
9853
  readyAnimation = animateStyle(element, name, [keyframes2[0], keyframes2[0],], /**
@@ -9870,17 +9862,21 @@ function startOptimizedAppearAnimation(element, name, keyframes2, options, onRea
9870
9862
  animation: readyAnimation,
9871
9863
  startTime: null,
9872
9864
  },);
9873
- if (!window.HandoffCancelAllAnimations) {
9874
- window.HandoffCancelAllAnimations = () => {
9875
- appearAnimationStore.forEach(({
9876
- animation,
9877
- },) => {
9865
+ window.MotionHandoffAnimation = handoffOptimizedAppearAnimation;
9866
+ window.MotionHandoffCancelAll = () => {
9867
+ appearAnimationStore.forEach(({
9868
+ animation,
9869
+ }, animationId,) => {
9870
+ if (animationId.endsWith('transform',)) {
9878
9871
  animation.cancel();
9879
- },);
9880
- appearAnimationStore.clear();
9881
- window.HandoffCancelAllAnimations = void 0;
9882
- };
9883
- }
9872
+ appearAnimationStore.delete(animationId,);
9873
+ }
9874
+ },);
9875
+ window.MotionHandoffCancelAll = void 0;
9876
+ };
9877
+ window.MotionHasOptimisedAnimation = (elementId) => Boolean(elementId && elementsWithAppearAnimations.has(elementId,),);
9878
+ window.MotionHasOptimisedTransformAnimation = (elementId) =>
9879
+ Boolean(elementId && appearAnimationStore.has(appearStoreId(elementId, 'transform',),),);
9884
9880
  }
9885
9881
  const startAnimation2 = () => {
9886
9882
  readyAnimation.cancel();
@@ -9895,6 +9891,7 @@ function startOptimizedAppearAnimation(element, name, keyframes2, options, onRea
9895
9891
  },);
9896
9892
  if (onReady) onReady(appearAnimation,);
9897
9893
  };
9894
+ elementsWithAppearAnimations.add(id4,);
9898
9895
  if (readyAnimation.ready) {
9899
9896
  readyAnimation.ready.then(startAnimation2,).catch(noop,);
9900
9897
  } else {
@@ -10067,13 +10064,14 @@ var cancelSync = stepsOrder.reduce((acc, key7,) => {
10067
10064
  return acc;
10068
10065
  }, {},);
10069
10066
 
10070
- // https :https://app.framerstatic.com/framer.V4LTAYQT.js
10067
+ // https :https://app.framerstatic.com/framer.LMS2FZ32.js
10071
10068
 
10072
10069
  import React4 from 'react';
10073
10070
  import { startTransition as startTransition2, } from 'react';
10074
10071
  import { Suspense as Suspense2, } from 'react';
10075
10072
  import ReactDOM from 'react-dom';
10076
10073
  import { createRef, } from 'react';
10074
+ import { cloneElement as cloneElement32, } from 'react';
10077
10075
  var require_hsluv = __commonJS({
10078
10076
  '../../../node_modules/hsluv/dist/hsluv.cjs'(exports,) {
10079
10077
  'use strict';
@@ -29986,9 +29984,9 @@ async function runEffectAnimation(target, effect, shouldReduceMotion, ref, appea
29986
29984
  const visualElement = visualElementStore.get(ref.current,);
29987
29985
  if (visualElement) visualElement.setBaseTarget(key7, value,);
29988
29986
  const handoff =
29989
- isString22(appearId,) && !(motionValue2 == null ? void 0 : motionValue2.hasAnimated) && safeWindow.HandoffAppearAnimations
29987
+ isString22(appearId,) && !(motionValue2 == null ? void 0 : motionValue2.hasAnimated) && safeWindow.MotionHandoffAnimation
29990
29988
  ? {
29991
- elapsed: safeWindow.HandoffAppearAnimations(appearId, key7, motionValue2, frame,),
29989
+ elapsed: safeWindow.MotionHandoffAnimation(appearId, key7, frame,),
29992
29990
  }
29993
29991
  : void 0;
29994
29992
  if (instant) {
@@ -32672,10 +32670,16 @@ function stateCanSubmitForm(state,) {
32672
32670
  function preventDefault(e,) {
32673
32671
  e.preventDefault();
32674
32672
  }
32675
- function openExternalLink(link,) {
32676
- if (!safeWindow) return;
32673
+ function openExternalLinkInCurrentTab(link, formRef,) {
32677
32674
  const href = isValidURL(link, false,) ? link : `https://${link}`;
32678
- safeWindow.open(href, '_blank',);
32675
+ const linkElement = document.createElement('a',);
32676
+ linkElement.href = href;
32677
+ linkElement.target = '_self';
32678
+ linkElement.style.display = 'none';
32679
+ if (!('current' in formRef && formRef.current)) return;
32680
+ formRef.current.appendChild(linkElement,);
32681
+ linkElement.click();
32682
+ linkElement.remove();
32679
32683
  }
32680
32684
  var FormContext = React4.createContext(void 0,);
32681
32685
  var FormContainer = /* @__PURE__ */ React4.forwardRef(({
@@ -32686,7 +32690,9 @@ var FormContainer = /* @__PURE__ */ React4.forwardRef(({
32686
32690
  onError,
32687
32691
  onLoading,
32688
32692
  ...props
32689
- }, ref,) => {
32693
+ }, forwardedRef,) => {
32694
+ const fallbackRef = React4.useRef(null,);
32695
+ const ref = forwardedRef ?? fallbackRef;
32690
32696
  const router = useRouter();
32691
32697
  const currentRoute = useCurrentRoute();
32692
32698
  const implicitPathVariables = useImplicitPathVariables();
@@ -32712,7 +32718,7 @@ var FormContainer = /* @__PURE__ */ React4.forwardRef(({
32712
32718
  if (isString22(link,)) {
32713
32719
  const matchingRoute2 = findMatchingRouteAttributesForResolvedPath(router, link, implicitPathVariables,);
32714
32720
  if (!matchingRoute2) {
32715
- openExternalLink(link,);
32721
+ openExternalLinkInCurrentTab(link, ref,);
32716
32722
  return;
32717
32723
  }
32718
32724
  const {
@@ -40605,7 +40611,7 @@ function processRichTextChildren(
40605
40611
  children = [anchorLink,];
40606
40612
  }
40607
40613
  }
40608
- return cloneElement2(element, props, ...children,);
40614
+ return cloneElement32(element, props, ...children,);
40609
40615
  }
40610
40616
  function generateHeadingSlug(children, slugCounters,) {
40611
40617
  const headingText = children.map(extractTextFromReactNode,).join('',);
@@ -43083,7 +43089,7 @@ var package_default = {
43083
43089
  yargs: '^17.6.2',
43084
43090
  },
43085
43091
  peerDependencies: {
43086
- 'framer-motion': '11.3.9',
43092
+ 'framer-motion': '11.3.23',
43087
43093
  react: '^18.2.0',
43088
43094
  'react-dom': '^18.2.0',
43089
43095
  },
@@ -43210,6 +43216,7 @@ export {
43210
43216
  DOM,
43211
43217
  domAnimation,
43212
43218
  domMax,
43219
+ domMin,
43213
43220
  DragControls,
43214
43221
  Draggable,
43215
43222
  easeIn,