@nethesis/phone-island 1.1.5 → 1.1.6

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.
Files changed (321) hide show
  1. package/dist/App.js.map +1 -1
  2. package/dist/components/AlertView/index.js.map +1 -1
  3. package/dist/components/AudioBars.js.map +1 -1
  4. package/dist/components/AudioPlayerView/PlayerFooterActions.js +1 -1
  5. package/dist/components/AudioPlayerView/PlayerFooterActions.js.map +1 -1
  6. package/dist/components/AudioPlayerView/Progress.js.map +1 -1
  7. package/dist/components/AudioPlayerView/index.js +1 -1
  8. package/dist/components/AudioPlayerView/index.js.map +1 -1
  9. package/dist/components/CallView/Actions.js +1 -1
  10. package/dist/components/CallView/Actions.js.map +1 -1
  11. package/dist/components/CallView/BackCall.js +1 -1
  12. package/dist/components/CallView/BackCall.js.map +1 -1
  13. package/dist/components/CallView/DeviceIcon.js +1 -1
  14. package/dist/components/CallView/DeviceIcon.js.map +1 -1
  15. package/dist/components/CallView/DisplayName.js +1 -1
  16. package/dist/components/CallView/DisplayName.js.map +1 -1
  17. package/dist/components/CallView/DisplayNameUtils.js.map +1 -1
  18. package/dist/components/CallView/Number.js +1 -1
  19. package/dist/components/CallView/Number.js.map +1 -1
  20. package/dist/components/CallView/NumberPopover.js +1 -1
  21. package/dist/components/CallView/NumberPopover.js.map +1 -1
  22. package/dist/components/CallView/index.js +1 -1
  23. package/dist/components/CallView/index.js.map +1 -1
  24. package/dist/components/ConferenceView/ConferenceUsersList.js +1 -1
  25. package/dist/components/ConferenceView/ConferenceUsersList.js.map +1 -1
  26. package/dist/components/ConferenceView/index.js +1 -1
  27. package/dist/components/ConferenceView/index.js.map +1 -1
  28. package/dist/components/ContactView/ContactListView.js +1 -1
  29. package/dist/components/ContactView/ContactListView.js.map +1 -1
  30. package/dist/components/ContactView/SelectContactNumberView.js +1 -1
  31. package/dist/components/ContactView/SelectContactNumberView.js.map +1 -1
  32. package/dist/components/ContactView/TransferActions.js +1 -1
  33. package/dist/components/ContactView/TransferActions.js.map +1 -1
  34. package/dist/components/Hangup.js +1 -1
  35. package/dist/components/Hangup.js.map +1 -1
  36. package/dist/components/KeypadView/index.js +1 -1
  37. package/dist/components/KeypadView/index.js.map +1 -1
  38. package/dist/components/OperatorBusyView/index.js +1 -1
  39. package/dist/components/OperatorBusyView/index.js.map +1 -1
  40. package/dist/components/PhysicalRecorderView/index.js +1 -1
  41. package/dist/components/PhysicalRecorderView/index.js.map +1 -1
  42. package/dist/components/RecorderView/Actions.js +1 -1
  43. package/dist/components/RecorderView/Actions.js.map +1 -1
  44. package/dist/components/RecorderView/BarsGroup.js.map +1 -1
  45. package/dist/components/RecorderView/index.js +1 -1
  46. package/dist/components/RecorderView/index.js.map +1 -1
  47. package/dist/components/SettingsView/AudioView.js +1 -1
  48. package/dist/components/SettingsView/AudioView.js.map +1 -1
  49. package/dist/components/SettingsView/MicrophoneView.js +1 -1
  50. package/dist/components/SettingsView/MicrophoneView.js.map +1 -1
  51. package/dist/components/SettingsView/SettingsHeader.js +1 -1
  52. package/dist/components/SettingsView/SettingsHeader.js.map +1 -1
  53. package/dist/components/SettingsView/ThemeView.js +1 -1
  54. package/dist/components/SettingsView/ThemeView.js.map +1 -1
  55. package/dist/components/SettingsView/index.js +1 -1
  56. package/dist/components/SettingsView/index.js.map +1 -1
  57. package/dist/components/SideView/SideView.js +1 -1
  58. package/dist/components/SideView/SideView.js.map +1 -1
  59. package/dist/components/SideView/hooks/useSideViewLogic.js.map +1 -1
  60. package/dist/components/Socket.js.map +1 -1
  61. package/dist/components/SwitchDeviceView/index.js +1 -1
  62. package/dist/components/SwitchDeviceView/index.js.map +1 -1
  63. package/dist/components/SwitchInputView/DropdownContent.js +1 -1
  64. package/dist/components/SwitchInputView/DropdownContent.js.map +1 -1
  65. package/dist/components/SwitchInputView/Index.js +1 -1
  66. package/dist/components/TextScroll.js +1 -1
  67. package/dist/components/TextScroll.js.map +1 -1
  68. package/dist/components/TranscriptionView/TranscriptionView.js +1 -1
  69. package/dist/components/TranscriptionView/TranscriptionView.js.map +1 -1
  70. package/dist/components/VideoStreamingEmptyState/index.js +1 -1
  71. package/dist/components/VideoStreamingEmptyState/index.js.map +1 -1
  72. package/dist/components/VideoStreamingSkeleton/index.js +1 -1
  73. package/dist/components/VideoStreamingSkeleton/index.js.map +1 -1
  74. package/dist/components/VideoView/index.js.map +1 -1
  75. package/dist/components/WebRTC.js.map +1 -1
  76. package/dist/events/SocketEvents.js.map +1 -1
  77. package/dist/lib/i18n.js +1 -1
  78. package/dist/lib/i18n.js.map +1 -1
  79. package/dist/lib/phone/call.js +1 -1
  80. package/dist/lib/phone/call.js.map +1 -1
  81. package/dist/lib/phone/counterpartDevice.js.map +1 -1
  82. package/dist/lib/phone/video.js.map +1 -1
  83. package/dist/lib/player/audio.js.map +1 -1
  84. package/dist/lib/user/default_device.js.map +1 -1
  85. package/dist/lib/user/extensions.js.map +1 -1
  86. package/dist/models/currentCall.js.map +1 -1
  87. package/dist/models/island.js.map +1 -1
  88. package/dist/models/player.js +1 -1
  89. package/dist/models/player.js.map +1 -1
  90. package/dist/node_modules/framer-motion/dist/es/animation/hooks/animation-controls.mjs.js +1 -1
  91. package/dist/node_modules/framer-motion/dist/es/animation/hooks/animation-controls.mjs.js.map +1 -1
  92. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs.js +1 -1
  93. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs.js.map +1 -1
  94. package/dist/node_modules/framer-motion/dist/es/gestures/hover.mjs.js +1 -1
  95. package/dist/node_modules/framer-motion/dist/es/gestures/hover.mjs.js.map +1 -1
  96. package/dist/node_modules/framer-motion/dist/es/gestures/pan/index.mjs.js +1 -1
  97. package/dist/node_modules/framer-motion/dist/es/gestures/pan/index.mjs.js.map +1 -1
  98. package/dist/node_modules/framer-motion/dist/es/gestures/press.mjs.js +1 -1
  99. package/dist/node_modules/framer-motion/dist/es/gestures/press.mjs.js.map +1 -1
  100. package/dist/node_modules/framer-motion/dist/es/motion/features/animation/exit.mjs.js +1 -1
  101. package/dist/node_modules/framer-motion/dist/es/motion/features/animation/exit.mjs.js.map +1 -1
  102. package/dist/node_modules/framer-motion/dist/es/motion/features/animation/index.mjs.js +1 -1
  103. package/dist/node_modules/framer-motion/dist/es/motion/features/animation/index.mjs.js.map +1 -1
  104. package/dist/node_modules/framer-motion/dist/es/motion/features/definitions.mjs.js +1 -1
  105. package/dist/node_modules/framer-motion/dist/es/motion/features/definitions.mjs.js.map +1 -1
  106. package/dist/node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs.js +1 -1
  107. package/dist/node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs.js.map +1 -1
  108. package/dist/node_modules/framer-motion/dist/es/motion/index.mjs.js +1 -1
  109. package/dist/node_modules/framer-motion/dist/es/motion/index.mjs.js.map +1 -1
  110. package/dist/node_modules/framer-motion/dist/es/motion/utils/use-visual-element.mjs.js +1 -1
  111. package/dist/node_modules/framer-motion/dist/es/motion/utils/use-visual-element.mjs.js.map +1 -1
  112. package/dist/node_modules/framer-motion/dist/es/motion/utils/valid-prop.mjs.js +1 -1
  113. package/dist/node_modules/framer-motion/dist/es/motion/utils/valid-prop.mjs.js.map +1 -1
  114. package/dist/node_modules/i18next/dist/esm/i18next.js +1 -1
  115. package/dist/node_modules/i18next/dist/esm/i18next.js.map +1 -1
  116. package/dist/node_modules/js-base64/base64.mjs.js +1 -1
  117. package/dist/node_modules/js-base64/base64.mjs.js.map +1 -1
  118. package/dist/node_modules/motion-dom/dist/es/animation/AsyncMotionValueAnimation.mjs.js +1 -1
  119. package/dist/node_modules/motion-dom/dist/es/animation/AsyncMotionValueAnimation.mjs.js.map +1 -1
  120. package/dist/node_modules/motion-dom/dist/es/animation/JSAnimation.mjs.js +1 -1
  121. package/dist/node_modules/motion-dom/dist/es/animation/JSAnimation.mjs.js.map +1 -1
  122. package/dist/node_modules/motion-dom/dist/es/animation/NativeAnimation.mjs.js +1 -1
  123. package/dist/node_modules/motion-dom/dist/es/animation/NativeAnimation.mjs.js.map +1 -1
  124. package/dist/node_modules/motion-dom/dist/es/animation/animate/single-value.mjs.js +1 -1
  125. package/dist/node_modules/motion-dom/dist/es/animation/animate/single-value.mjs.js.map +1 -1
  126. package/dist/node_modules/motion-dom/dist/es/animation/generators/inertia.mjs.js +1 -1
  127. package/dist/node_modules/motion-dom/dist/es/animation/generators/inertia.mjs.js.map +1 -1
  128. package/dist/node_modules/motion-dom/dist/es/animation/generators/keyframes.mjs.js +1 -1
  129. package/dist/node_modules/motion-dom/dist/es/animation/generators/keyframes.mjs.js.map +1 -1
  130. package/dist/node_modules/motion-dom/dist/es/animation/generators/spring.mjs.js +1 -1
  131. package/dist/node_modules/motion-dom/dist/es/animation/generators/spring.mjs.js.map +1 -1
  132. package/dist/node_modules/motion-dom/dist/es/animation/interfaces/visual-element-target.mjs.js +1 -1
  133. package/dist/node_modules/motion-dom/dist/es/animation/interfaces/visual-element-target.mjs.js.map +1 -1
  134. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.mjs.js +1 -1
  135. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.mjs.js.map +1 -1
  136. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/KeyframesResolver.mjs.js.map +1 -1
  137. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/get-final.mjs.js +1 -1
  138. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/get-final.mjs.js.map +1 -1
  139. package/dist/node_modules/motion-dom/dist/es/animation/utils/can-animate.mjs.js +1 -1
  140. package/dist/node_modules/motion-dom/dist/es/animation/utils/can-animate.mjs.js.map +1 -1
  141. package/dist/node_modules/motion-dom/dist/es/animation/utils/css-variables-conversion.mjs.js +1 -1
  142. package/dist/node_modules/motion-dom/dist/es/animation/utils/css-variables-conversion.mjs.js.map +1 -1
  143. package/dist/node_modules/motion-dom/dist/es/animation/utils/is-transition-defined.mjs.js +1 -1
  144. package/dist/node_modules/motion-dom/dist/es/animation/utils/is-transition-defined.mjs.js.map +1 -1
  145. package/dist/node_modules/motion-dom/dist/es/animation/waapi/supports/waapi.mjs.js +1 -1
  146. package/dist/node_modules/motion-dom/dist/es/animation/waapi/supports/waapi.mjs.js.map +1 -1
  147. package/dist/node_modules/motion-dom/dist/es/animation/waapi/transforms/TransformAnimation.mjs.js +1 -1
  148. package/dist/node_modules/motion-dom/dist/es/animation/waapi/transforms/TransformAnimation.mjs.js.map +1 -1
  149. package/dist/node_modules/motion-dom/dist/es/animation/waapi/transforms/groups.mjs.js.map +1 -1
  150. package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/accelerated-values.mjs.js +1 -1
  151. package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/accelerated-values.mjs.js.map +1 -1
  152. package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/needs-mixer.mjs.js +2 -0
  153. package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/needs-mixer.mjs.js.map +1 -0
  154. package/dist/node_modules/motion-dom/dist/es/gestures/drag/VisualElementDragControls.mjs.js +1 -1
  155. package/dist/node_modules/motion-dom/dist/es/gestures/drag/VisualElementDragControls.mjs.js.map +1 -1
  156. package/dist/node_modules/motion-dom/dist/es/gestures/pan/PanSession.mjs.js +1 -1
  157. package/dist/node_modules/motion-dom/dist/es/gestures/pan/PanSession.mjs.js.map +1 -1
  158. package/dist/node_modules/motion-dom/dist/es/gestures/press/index.mjs.js +1 -1
  159. package/dist/node_modules/motion-dom/dist/es/gestures/press/index.mjs.js.map +1 -1
  160. package/dist/node_modules/motion-dom/dist/es/gestures/press/utils/keyboard.mjs.js +1 -1
  161. package/dist/node_modules/motion-dom/dist/es/gestures/press/utils/keyboard.mjs.js.map +1 -1
  162. package/dist/node_modules/motion-dom/dist/es/projection/animation/mix-values.mjs.js +1 -1
  163. package/dist/node_modules/motion-dom/dist/es/projection/animation/mix-values.mjs.js.map +1 -1
  164. package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-apply.mjs.js +1 -1
  165. package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-apply.mjs.js.map +1 -1
  166. package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-calc.mjs.js +1 -1
  167. package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-calc.mjs.js.map +1 -1
  168. package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-remove.mjs.js +1 -1
  169. package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-remove.mjs.js.map +1 -1
  170. package/dist/node_modules/motion-dom/dist/es/projection/geometry/round.mjs.js +2 -0
  171. package/dist/node_modules/motion-dom/dist/es/projection/geometry/round.mjs.js.map +1 -0
  172. package/dist/node_modules/motion-dom/dist/es/projection/node/DocumentProjectionNode.mjs.js +1 -1
  173. package/dist/node_modules/motion-dom/dist/es/projection/node/DocumentProjectionNode.mjs.js.map +1 -1
  174. package/dist/node_modules/motion-dom/dist/es/projection/node/HTMLProjectionNode.mjs.js +1 -1
  175. package/dist/node_modules/motion-dom/dist/es/projection/node/HTMLProjectionNode.mjs.js.map +1 -1
  176. package/dist/node_modules/motion-dom/dist/es/projection/node/create-projection-node.mjs.js +1 -1
  177. package/dist/node_modules/motion-dom/dist/es/projection/node/create-projection-node.mjs.js.map +1 -1
  178. package/dist/node_modules/motion-dom/dist/es/projection/styles/transform.mjs.js +1 -1
  179. package/dist/node_modules/motion-dom/dist/es/projection/styles/transform.mjs.js.map +1 -1
  180. package/dist/node_modules/motion-dom/dist/es/projection/utils/has-transform.mjs.js +1 -1
  181. package/dist/node_modules/motion-dom/dist/es/projection/utils/has-transform.mjs.js.map +1 -1
  182. package/dist/node_modules/motion-dom/dist/es/projection/utils/measure.mjs.js +1 -1
  183. package/dist/node_modules/motion-dom/dist/es/projection/utils/measure.mjs.js.map +1 -1
  184. package/dist/node_modules/motion-dom/dist/es/render/VisualElement.mjs.js +1 -1
  185. package/dist/node_modules/motion-dom/dist/es/render/VisualElement.mjs.js.map +1 -1
  186. package/dist/node_modules/motion-dom/dist/es/render/dom/parse-transform.mjs.js +1 -1
  187. package/dist/node_modules/motion-dom/dist/es/render/dom/parse-transform.mjs.js.map +1 -1
  188. package/dist/node_modules/motion-dom/dist/es/render/html/HTMLVisualElement.mjs.js +1 -1
  189. package/dist/node_modules/motion-dom/dist/es/render/html/HTMLVisualElement.mjs.js.map +1 -1
  190. package/dist/node_modules/motion-dom/dist/es/render/html/utils/build-transform.mjs.js +1 -1
  191. package/dist/node_modules/motion-dom/dist/es/render/html/utils/build-transform.mjs.js.map +1 -1
  192. package/dist/node_modules/motion-dom/dist/es/render/utils/animation-state.mjs.js +1 -1
  193. package/dist/node_modules/motion-dom/dist/es/render/utils/animation-state.mjs.js.map +1 -1
  194. package/dist/node_modules/motion-dom/dist/es/stats/buffer.mjs.js +2 -0
  195. package/dist/node_modules/motion-dom/dist/es/stats/buffer.mjs.js.map +1 -0
  196. package/dist/node_modules/motion-dom/dist/es/utils/interpolate.mjs.js +1 -1
  197. package/dist/node_modules/motion-dom/dist/es/utils/interpolate.mjs.js.map +1 -1
  198. package/dist/node_modules/motion-dom/dist/es/utils/is-ref-object.mjs.js.map +1 -0
  199. package/dist/node_modules/motion-dom/dist/es/utils/mix/color.mjs.js +1 -1
  200. package/dist/node_modules/motion-dom/dist/es/utils/mix/color.mjs.js.map +1 -1
  201. package/dist/node_modules/motion-dom/dist/es/utils/mix/complex.mjs.js +1 -1
  202. package/dist/node_modules/motion-dom/dist/es/utils/mix/complex.mjs.js.map +1 -1
  203. package/dist/node_modules/motion-dom/dist/es/utils/resolve-elements.mjs.js.map +1 -1
  204. package/dist/node_modules/motion-dom/dist/es/value/index.mjs.js +1 -1
  205. package/dist/node_modules/motion-dom/dist/es/value/index.mjs.js.map +1 -1
  206. package/dist/node_modules/motion-dom/dist/es/value/types/color/hex.mjs.js +1 -1
  207. package/dist/node_modules/motion-dom/dist/es/value/types/color/hex.mjs.js.map +1 -1
  208. package/dist/node_modules/motion-dom/dist/es/value/types/complex/index.mjs.js +1 -1
  209. package/dist/node_modules/motion-dom/dist/es/value/types/complex/index.mjs.js.map +1 -1
  210. package/dist/node_modules/motion-dom/dist/es/value/types/utils/animatable-none.mjs.js +1 -1
  211. package/dist/node_modules/motion-dom/dist/es/value/types/utils/animatable-none.mjs.js.map +1 -1
  212. package/dist/node_modules/motion-utils/dist/es/easing/utils/map.mjs.js +1 -1
  213. package/dist/node_modules/motion-utils/dist/es/easing/utils/map.mjs.js.map +1 -1
  214. package/dist/node_modules/react-i18next/dist/es/context.js +1 -1
  215. package/dist/node_modules/react-i18next/dist/es/context.js.map +1 -1
  216. package/dist/node_modules/react-i18next/dist/es/defaults.js +1 -1
  217. package/dist/node_modules/react-i18next/dist/es/defaults.js.map +1 -1
  218. package/dist/node_modules/react-i18next/dist/es/i18nInstance.js +1 -1
  219. package/dist/node_modules/react-i18next/dist/es/i18nInstance.js.map +1 -1
  220. package/dist/node_modules/react-i18next/dist/es/initReactI18next.js +1 -1
  221. package/dist/node_modules/react-i18next/dist/es/initReactI18next.js.map +1 -1
  222. package/dist/node_modules/react-i18next/dist/es/unescape.js +1 -1
  223. package/dist/node_modules/react-i18next/dist/es/unescape.js.map +1 -1
  224. package/dist/node_modules/react-i18next/dist/es/useTranslation.js +1 -1
  225. package/dist/node_modules/react-i18next/dist/es/useTranslation.js.map +1 -1
  226. package/dist/node_modules/react-i18next/dist/es/utils.js +1 -1
  227. package/dist/node_modules/react-i18next/dist/es/utils.js.map +1 -1
  228. package/dist/package.json.js +1 -1
  229. package/dist/services/astproxy.js +1 -1
  230. package/dist/services/astproxy.js.map +1 -1
  231. package/dist/services/phonebook.js +1 -1
  232. package/dist/services/phonebook.js.map +1 -1
  233. package/dist/utils/customHooks/useLocalStorage.js.map +1 -1
  234. package/dist/utils/deviceUtils.js.map +1 -1
  235. package/package.json +10 -5
  236. package/dist/_virtual/arrayLikeToArray.js +0 -2
  237. package/dist/_virtual/arrayLikeToArray.js.map +0 -1
  238. package/dist/_virtual/arrayWithHoles.js +0 -2
  239. package/dist/_virtual/arrayWithHoles.js.map +0 -1
  240. package/dist/_virtual/classCallCheck.js +0 -2
  241. package/dist/_virtual/classCallCheck.js.map +0 -1
  242. package/dist/_virtual/createClass.js +0 -2
  243. package/dist/_virtual/createClass.js.map +0 -1
  244. package/dist/_virtual/defineProperty.js +0 -2
  245. package/dist/_virtual/defineProperty.js.map +0 -1
  246. package/dist/_virtual/iterableToArrayLimit.js +0 -2
  247. package/dist/_virtual/iterableToArrayLimit.js.map +0 -1
  248. package/dist/_virtual/nonIterableRest.js +0 -2
  249. package/dist/_virtual/nonIterableRest.js.map +0 -1
  250. package/dist/_virtual/objectWithoutProperties.js +0 -2
  251. package/dist/_virtual/objectWithoutProperties.js.map +0 -1
  252. package/dist/_virtual/objectWithoutPropertiesLoose.js +0 -2
  253. package/dist/_virtual/objectWithoutPropertiesLoose.js.map +0 -1
  254. package/dist/_virtual/slicedToArray.js +0 -2
  255. package/dist/_virtual/slicedToArray.js.map +0 -1
  256. package/dist/_virtual/toPrimitive.js +0 -2
  257. package/dist/_virtual/toPrimitive.js.map +0 -1
  258. package/dist/_virtual/toPropertyKey.js +0 -2
  259. package/dist/_virtual/toPropertyKey.js.map +0 -1
  260. package/dist/_virtual/typeof.js +0 -2
  261. package/dist/_virtual/typeof.js.map +0 -1
  262. package/dist/_virtual/unsupportedIterableToArray.js +0 -2
  263. package/dist/_virtual/unsupportedIterableToArray.js.map +0 -1
  264. package/dist/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +0 -2
  265. package/dist/node_modules/@babel/runtime/helpers/arrayLikeToArray.js.map +0 -1
  266. package/dist/node_modules/@babel/runtime/helpers/arrayWithHoles.js +0 -2
  267. package/dist/node_modules/@babel/runtime/helpers/arrayWithHoles.js.map +0 -1
  268. package/dist/node_modules/@babel/runtime/helpers/classCallCheck.js +0 -2
  269. package/dist/node_modules/@babel/runtime/helpers/classCallCheck.js.map +0 -1
  270. package/dist/node_modules/@babel/runtime/helpers/createClass.js +0 -2
  271. package/dist/node_modules/@babel/runtime/helpers/createClass.js.map +0 -1
  272. package/dist/node_modules/@babel/runtime/helpers/defineProperty.js +0 -2
  273. package/dist/node_modules/@babel/runtime/helpers/defineProperty.js.map +0 -1
  274. package/dist/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +0 -2
  275. package/dist/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js.map +0 -1
  276. package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +0 -2
  277. package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js.map +0 -1
  278. package/dist/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +0 -2
  279. package/dist/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js.map +0 -1
  280. package/dist/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +0 -2
  281. package/dist/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js.map +0 -1
  282. package/dist/node_modules/@babel/runtime/helpers/esm/inherits.js +0 -2
  283. package/dist/node_modules/@babel/runtime/helpers/esm/inherits.js.map +0 -1
  284. package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +0 -2
  285. package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArray.js.map +0 -1
  286. package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +0 -2
  287. package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js.map +0 -1
  288. package/dist/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +0 -2
  289. package/dist/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js.map +0 -1
  290. package/dist/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +0 -2
  291. package/dist/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js.map +0 -1
  292. package/dist/node_modules/@babel/runtime/helpers/esm/toArray.js +0 -2
  293. package/dist/node_modules/@babel/runtime/helpers/esm/toArray.js.map +0 -1
  294. package/dist/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +0 -2
  295. package/dist/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js.map +0 -1
  296. package/dist/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js +0 -2
  297. package/dist/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js.map +0 -1
  298. package/dist/node_modules/@babel/runtime/helpers/nonIterableRest.js +0 -2
  299. package/dist/node_modules/@babel/runtime/helpers/nonIterableRest.js.map +0 -1
  300. package/dist/node_modules/@babel/runtime/helpers/objectWithoutProperties.js +0 -2
  301. package/dist/node_modules/@babel/runtime/helpers/objectWithoutProperties.js.map +0 -1
  302. package/dist/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +0 -2
  303. package/dist/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js.map +0 -1
  304. package/dist/node_modules/@babel/runtime/helpers/slicedToArray.js +0 -2
  305. package/dist/node_modules/@babel/runtime/helpers/slicedToArray.js.map +0 -1
  306. package/dist/node_modules/@babel/runtime/helpers/toPrimitive.js +0 -2
  307. package/dist/node_modules/@babel/runtime/helpers/toPrimitive.js.map +0 -1
  308. package/dist/node_modules/@babel/runtime/helpers/toPropertyKey.js +0 -2
  309. package/dist/node_modules/@babel/runtime/helpers/toPropertyKey.js.map +0 -1
  310. package/dist/node_modules/@babel/runtime/helpers/typeof.js +0 -2
  311. package/dist/node_modules/@babel/runtime/helpers/typeof.js.map +0 -1
  312. package/dist/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js +0 -2
  313. package/dist/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js.map +0 -1
  314. package/dist/node_modules/framer-motion/dist/es/utils/get-context-window.mjs.js +0 -2
  315. package/dist/node_modules/framer-motion/dist/es/utils/get-context-window.mjs.js.map +0 -1
  316. package/dist/node_modules/framer-motion/dist/es/utils/is-ref-object.mjs.js.map +0 -1
  317. package/dist/node_modules/html-parse-stringify/dist/html-parse-stringify.js +0 -2
  318. package/dist/node_modules/html-parse-stringify/dist/html-parse-stringify.js.map +0 -1
  319. package/dist/node_modules/void-elements/index.js +0 -2
  320. package/dist/node_modules/void-elements/index.js.map +0 -1
  321. /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/utils/is-ref-object.mjs.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"TransformAnimation.mjs.js","sources":["../../../../../../../../node_modules/motion-dom/dist/es/animation/waapi/transforms/TransformAnimation.mjs"],"sourcesContent":["import { isBezierDefinition, millisecondsToSeconds, clamp, progress } from 'motion-utils';\nimport { frame } from '../../../frameloop/frame.mjs';\nimport { frameData } from '../../../frameloop/frame-data.mjs';\nimport { time } from '../../../frameloop/sync-time.mjs';\nimport { buildTransform, translateAlias } from '../../../render/html/utils/build-transform.mjs';\nimport { transformPropOrder } from '../../../render/utils/keys-transform.mjs';\nimport { mixNumber } from '../../../utils/mix/number.mjs';\nimport { numberValueTypes } from '../../../value/types/maps/number.mjs';\nimport { getValueAsType } from '../../../value/types/utils/get-as-type.mjs';\nimport { frameloopDriver } from '../../drivers/frame.mjs';\nimport { keyframes } from '../../generators/keyframes.mjs';\nimport { defaultOffset } from '../../keyframes/offsets/default.mjs';\nimport { JSAnimation, round } from '../../JSAnimation.mjs';\nimport { sampleDelta } from '../../NativeAnimationExtended.mjs';\nimport { cubicBezierAsString } from '../easing/cubic-bezier.mjs';\nimport { supportedWaapiEasing } from '../easing/supported.mjs';\nimport { supportsWaapi } from '../supports/waapi.mjs';\nimport { supportsLinearEasing } from '../../../utils/supports/linear-easing.mjs';\nimport { transformGroups } from './groups.mjs';\n\n/**\n * Sample at the interruption sampling rate, up to a cap for long\n * animations.\n */\nconst maxSamples = 200;\n/**\n * How far values may stray from the WAAPI animation: as a fraction of\n * each value's change when they share an easing, otherwise in px or deg,\n * or for scale.\n */\nconst easingTolerance = 0.001;\nconst sampleTolerance = 0.1;\nconst scaleTolerance = 0.001;\n/**\n * If an outside write, or a seek the WAAPI animation can't follow,\n * happens again within this window, the group is being driven every\n * frame (scrubbing, drag), which is cheaper on the main thread than\n * rebuilding the WAAPI animation every frame.\n */\nconst churnWindow = 100;\n/**\n * Named easings that are the same cubic-bezier in JS and CSS.\n */\nconst isNativeEasing = (ease) => /^(linear|ease(In|Out|InOut))$/.test(ease);\nconst byTime = (a, b) => a - b;\n/**\n * n + 1 evenly spaced timestamps, from one timestamp to another.\n */\nconst spread = (from, to, n) => {\n const result = [];\n for (let i = 0; i <= n; i++)\n result.push(mixNumber(from, to, i / n));\n return result;\n};\nconst getOwner = (options) => options.motionValue.owner;\nconst getGroup = (element) => transformGroups.get(element);\nconst read = (owner, key) => owner.latestValues ? owner.latestValues[key] : owner.getValue(key)?.get();\n/**\n * Whether this animation should join its element's transform group.\n * Animations that can't be accelerated still join, so the group knows\n * to stay on the main thread while they run. Browsers without linear()\n * easing stay on the main thread.\n */\nconst canGroupTransform = ({ name, motionValue, }) => name &&\n transformPropOrder.includes(name) &&\n motionValue?.owner?.current instanceof HTMLElement &&\n supportsWaapi() &&\n supportsLinearEasing();\nfunction canAccelerateTransform(options) {\n const owner = getOwner(options);\n const { onUpdate, transformTemplate } = owner.getProps();\n return (\n /**\n * A handoff from an optimised appear animation is already running\n * on its own WAAPI animation. onUpdate needs every value, every\n * frame.\n */\n !options.isHandoff &&\n !onUpdate &&\n !options.hasOnUpdate &&\n /**\n * transformTemplate could output anything.\n */\n !transformTemplate &&\n options.type !== \"inertia\" &&\n /**\n * A literal transform, or pathRotation, replaces or adds to the\n * transform we'd build. styleEffect builds its own as \"none\".\n */\n (read(owner, \"transform\") || \"none\") === \"none\" &&\n !read(owner, \"pathRotation\") &&\n /**\n * Layout animations write transform every frame.\n */\n !owner.projection?.isProjecting());\n}\nclass TransformAnimation extends JSAnimation {\n constructor(options) {\n const element = getOwner(options).current;\n const { driver = frameloopDriver } = options;\n let animation;\n /**\n * Before JSAnimation replaces the type with its generator.\n */\n const canAccelerate = canAccelerateTransform(options);\n /**\n * The driver ticks on the main thread only once the group has\n * moved there. Until then, starting or stopping tells the group to\n * update its WAAPI animation.\n */\n options.driver = (update) => {\n const js = driver(update);\n return {\n js,\n now: js.now,\n start: (keepAlive = true) => {\n const group = getGroup(element);\n const isJS = !group || group.isJS;\n /**\n * keepAlive is false when seeking. Seeking the WAAPI\n * animation is free, but if a seek needs a rebuild and\n * keeps happening, the group moves to the main thread.\n */\n isJS\n ? js.start(keepAlive)\n : group.schedule(false, !keepAlive);\n },\n stop: () => {\n js.stop();\n const group = getGroup(element);\n group && !group.isFinishing && group.release(animation);\n },\n };\n };\n super(options);\n animation = this;\n this.canAccelerate = canAccelerate;\n /**\n * stop is bound in JSAnimation, so wrap it rather than override.\n * Before stopping, set the motion value to where the WAAPI\n * animation is now, with velocity, for the next animation to\n * start from.\n */\n const { stop } = this;\n this.stop = () => {\n this.isAccelerated() && this.sync();\n stop();\n };\n }\n get group() {\n return getGroup(getOwner(this.options).current);\n }\n get js() {\n return this.driver?.js;\n }\n get name() {\n return this.options.name;\n }\n /**\n * When this stops moving, or, if it repeats forever, when it starts\n * repeating, and how long each repeat takes. Held (paused, or at\n * speed 0) animations never stop moving.\n */\n timing() {\n const { startTime, speed, totalDuration } = this;\n const { delay = 0, repeatType } = this.options;\n return this.holdTime !== null\n ? [Infinity, 0]\n : totalDuration === Infinity\n ? [\n startTime + delay / speed,\n (this.resolvedDuration * (repeatType === \"loop\" ? 1 : 2)) /\n speed || 1,\n ]\n : [startTime + (delay + totalDuration) / speed, 0];\n }\n /**\n * Whether this is running, or paused, on the compositor.\n */\n isAccelerated() {\n const { group, state } = this;\n return (group?.tracks.has(this) &&\n !group.isJS &&\n this.canAccelerate &&\n (state === \"running\" || state === \"paused\"));\n }\n /**\n * The value now, while this runs on the compositor and so doesn't\n * set its motion value every frame.\n */\n liveValue() {\n return this.isAccelerated() ? this.sampleAt(time.now()) : undefined;\n }\n /**\n * If this is a two-keyframe tween whose easing WAAPI runs exactly,\n * when it starts and stops moving, and that easing.\n */\n tween() {\n const { keyframes: keyframes$1, type, ease, times, repeat, delay = 0 } = this.options;\n const easing = isBezierDefinition(ease)\n ? cubicBezierAsString(ease)\n : isNativeEasing(ease) && supportedWaapiEasing[ease];\n if (easing &&\n !repeat &&\n !times &&\n keyframes$1.length === 2 &&\n type === keyframes &&\n this.holdTime === null) {\n const start = this.startTime + delay / this.speed;\n return [start, start + this.resolvedDuration / this.speed, easing];\n }\n }\n /**\n * The timestamps between two timestamps where this reaches a\n * keyframe or starts a repeat, where it can turn or jump.\n */\n boundaries(from, to) {\n const { startTime, speed, resolvedDuration, options } = this;\n const { delay = 0, repeat = 0, repeatDelay = 0, repeatType, times, keyframes: keyframes$1, type, } = options;\n const offsets = (type || keyframes) === keyframes\n ? times || defaultOffset(keyframes$1)\n : [0, 1];\n const start = startTime + delay / speed;\n const result = [];\n if (this.holdTime !== null || !(resolvedDuration > 0))\n return result;\n for (let i = Math.max(0, Math.floor(((from - start) * speed) / resolvedDuration)); i <= repeat; i++) {\n const iterationStart = start + (i * resolvedDuration) / speed;\n if (iterationStart > to)\n break;\n for (const offset of offsets) {\n const t = iterationStart +\n ((i % 2 && repeatType && repeatType !== \"loop\"\n ? 1 - offset\n : offset) *\n (resolvedDuration - repeatDelay)) /\n speed;\n t > from && t < to && result.push(t);\n }\n }\n return result;\n }\n /**\n * The value at a timestamp, as a number.\n */\n numberAt(timestamp) {\n return parseFloat(this.sampleAt(timestamp, true));\n }\n /**\n * Write the current value, and velocity, to the motion value.\n */\n sync() {\n const now = time.now();\n this.options.motionValue.setWithVelocity(this.sampleAt(now - sampleDelta, true), this.sampleAt(now, true), sampleDelta);\n }\n play() {\n /**\n * A stopped animation (one that was interrupted) can't play again,\n * so it mustn't join the group.\n */\n if (this.isStopped)\n return;\n (this.group || createGroup(getOwner(this.options))).tracks.add(this);\n super.play();\n }\n pause() {\n super.pause();\n if (this.isAccelerated()) {\n this.sync();\n this.group.schedule(false);\n }\n }\n /**\n * JSAnimation finishes on its next tick, which only happens on the\n * main thread, so finish now.\n */\n complete() {\n super.complete();\n const { group } = this;\n group && !group.isJS && this.canAccelerate && this.tick(time.now());\n }\n /**\n * Without a tick to rebase it, a held time still includes the delay,\n * so take it off here, as a JS animation does on its next tick.\n */\n get time() {\n if (this.isAccelerated()) {\n return millisecondsToSeconds(clamp(0, this.totalDuration, this.at(time.now()) - (this.options.delay || 0)));\n }\n return super.time;\n }\n /**\n * A JS animation sets its motion value from a seek on its next tick.\n * This doesn't tick, so set it now, rather than leave it to be set\n * when this next stops.\n */\n set time(newTime) {\n super.time = newTime;\n this.isAccelerated() && this.sync();\n }\n /**\n * Scroll timelines set time every frame, so run these on the main\n * thread.\n */\n attachTimeline(timeline) {\n this.canAccelerate = false;\n this.group?.demote(true);\n return super.attachTimeline(timeline);\n }\n}\nfunction createGroup(owner) {\n const element = owner.current;\n const tracks = new Set();\n const byKey = new Map();\n /**\n * Transforms that aren't animating, as built into the WAAPI animation.\n */\n let statics = {};\n /**\n * The transforms in the WAAPI animation, in order.\n */\n let keys = [];\n let built = new Map();\n let segments = [];\n let needsBuild = false;\n let isScheduled = false;\n let isEnded = false;\n let hasChurned = false;\n let lastChurn = -Infinity;\n const has = (key) => {\n for (const track of tracks)\n if (track.name === key)\n return true;\n };\n /**\n * The transform values at a timestamp or, without one, from the\n * motion values. Animations that don't repeat forever are sampled no\n * earlier than settled, so a loop that starts from an earlier cycle\n * boundary holds them at their end.\n */\n const valuesAt = (timestamp, settled) => {\n const values = {};\n for (const key of timestamp === undefined ? transformPropOrder : keys) {\n const track = byKey.get(key);\n const value = timestamp === undefined\n ? read(owner, key)\n : track\n ? track.sampleAt(settled > timestamp && !track.timing()[1]\n ? settled\n : timestamp)\n : statics[key];\n if (value !== undefined)\n values[key] = value;\n }\n return values;\n };\n /**\n * Build the transform at a timestamp. Unlike buildTransform, every key\n * is written, even at its default, so each keyframe has the same list\n * of functions and the browser interpolates them one by one.\n */\n const compose = (timestamp, settled) => {\n let transform = \"\";\n const values = valuesAt(timestamp, settled);\n for (const key in values) {\n transform +=\n (translateAlias[key] || key) +\n \"(\" +\n getValueAsType(values[key], numberValueTypes[key]) +\n \") \";\n }\n return transform || \"none\";\n };\n /**\n * Write the transform as an inline style, as the renderer would.\n */\n const commit = (values = valuesAt()) => {\n element.style.transform = buildTransform(values, {});\n };\n /**\n * Cancel the WAAPI animations, by default first committing the\n * transform. The renderer writes its own version on its next render.\n */\n const stop = (shouldCommit = true) => {\n shouldCommit && commit();\n segments.forEach(({ animation }) => animation.cancel());\n segments = [];\n };\n const add = (animation, offset, end = Infinity) => {\n const segment = { animation, offset, end };\n animation.startTime = time.now() + offset;\n /**\n * Animations finish when the WAAPI animation reaches their end.\n * Once a loop has taken over, the finished animation isn't needed.\n */\n if (end < Infinity) {\n animation.onfinish = () => {\n segment.isDone = true;\n if (segments.some((s) => s.end === Infinity)) {\n animation.cancel();\n segments = segments.filter((s) => s !== segment);\n }\n group.schedule(false);\n };\n }\n /**\n * Something else cancelled it, so carry on on the main thread.\n */\n animation.oncancel = () => segments.includes(segment) && group.demote();\n segments.push(segment);\n };\n /**\n * Where a value jumps between two timestamps, as when a repeat starts\n * again: the timestamps either side of the jump, or none if it moves\n * there continuously.\n */\n const jumpAt = (value, a, b) => {\n const change = (x, y) => Math.abs(value(y) - value(x));\n const size = change(a, b);\n while (b - a > 0.01) {\n const mid = (a + b) / 2;\n change(a, mid) > change(mid, b) ? (b = mid) : (a = mid);\n }\n return change(a, b) > size / 2 ? [a, b] : [];\n };\n /**\n * If every moving animation follows the same eased progress between\n * two timestamps, the easing that describes it.\n */\n const getEasing = (moving, from, to, bounds) => {\n const samples = Math.min(maxSamples, Math.max(2, Math.ceil((to - from) / sampleDelta)));\n /**\n * Too many keyframes or repeats to follow with this many samples.\n */\n if (bounds.length * 4 > samples)\n return;\n const at = spread(from, to, samples).concat(bounds).sort(byTime);\n const position = (t) => progress(from, to, t);\n let shared;\n let progressAt;\n for (const track of moving) {\n const values = at.map((t) => track.numberAt(t));\n const [first] = values;\n const changes = values.map((value) => value - first);\n const end = changes[changes.length - 1];\n /**\n * A value that ends only a tiny way from where it started, as\n * a round trip does if it's built just after it starts, or\n * from a float residue, ends where it started. Dividing by\n * that tiny range would stretch the easing to values the\n * compositor can't render.\n */\n const range = changes.some((change) => Math.abs(change) * easingTolerance > Math.abs(end))\n ? 0\n : end;\n const progress = changes.map((change) => range ? change / range : change);\n /**\n * A value that doesn't change, like one still in its delay,\n * fits any easing. One that changes but ends where it started\n * fits none.\n */\n if (!range) {\n if (progress.some((p) => !(Math.abs(p) <= easingTolerance))) {\n return;\n }\n }\n else if (!shared) {\n shared = progress;\n progressAt = (t) => (track.numberAt(t) - first) / range;\n }\n else if (progress.some((p, i) => !(Math.abs(p - shared[i]) <= easingTolerance))) {\n return;\n }\n }\n if (!shared ||\n shared.every((p, i) => Math.abs(p - position(at[i])) <= easingTolerance)) {\n return \"linear\";\n }\n /**\n * A repeat that starts again jumps back, which takes two points at\n * the same position.\n */\n const points = [];\n const point = (t, p = progressAt(t)) => points.push(round(p) + \" \" + round(position(t) * 100) + \"%\");\n shared.forEach((p, i) => {\n i &&\n Math.abs(p - shared[i - 1]) > 0.2 &&\n jumpAt(progressAt, at[i - 1], at[i]).forEach((t) => point(t));\n point(at[i], p);\n });\n return \"linear(\" + points + \")\";\n };\n /**\n * Sample timestamps between two timestamps, closer together where the\n * moving animations curve.\n */\n const sample = (moving, from, to, bounds) => {\n const times = [from];\n /**\n * Values that aren't numbers, like calc(), are left to the\n * browser to interpolate.\n */\n const isStraight = (a, b) => moving.every((track) => !(Math.abs(track.numberAt((a + b) / 2) -\n (track.numberAt(a) + track.numberAt(b)) / 2) >\n (track.name.startsWith(\"scale\")\n ? scaleTolerance\n : sampleTolerance)));\n const split = (a, b, depth) => {\n if (b - a < 1 || isStraight(a, b)) {\n times.push(b);\n }\n else if (depth < 4) {\n split(a, (a + b) / 2, depth + 1);\n split((a + b) / 2, b, depth + 1);\n }\n else {\n /**\n * Keyframes either side of a jump, like a repeat starting\n * again, so it doesn't play as a quick sweep.\n */\n for (const track of moving) {\n times.push(...jumpAt((t) => track.numberAt(t), a, b));\n }\n times.push(b);\n }\n };\n /**\n * Split at least every 100ms, and at every keyframe and repeat,\n * either side of where a value can jump.\n */\n const ends = spread(from, to, Math.ceil((to - from) / 100));\n for (const t of bounds)\n ends.push(t, Math.min(t + 0.01, to));\n let start = from;\n for (const end of ends.sort(byTime)) {\n end > start && split(start, end, 0);\n start = end;\n }\n return times.sort(byTime);\n };\n /**\n * If every moving animation is the same tween, started together, as\n * happens for the values of one animate() call or transition, when\n * they move and their native easing.\n */\n const getTween = (moving) => {\n let shared;\n for (const track of moving) {\n const tween = track.tween();\n if (!tween ||\n shared?.some((v, i) => i < 2\n ? Math.abs(tween[i] - v) > 1\n : tween[i] !== v)) {\n return;\n }\n shared = tween;\n }\n return shared;\n };\n /**\n * A WAAPI animation of the composed transform between two timestamps.\n */\n const run = (moving, from, to, options = { fill: \"both\" }, settled, nativeEasing) => {\n const bounds = moving.flatMap((track) => track.boundaries(from, to));\n const easing = nativeEasing || getEasing(moving, from, to, bounds);\n const times = easing ? [from, to] : sample(moving, from, to, bounds);\n const transform = times.map((t) => compose(t, settled));\n let keyframes = { transform };\n if (!easing) {\n keyframes.offset = times.map((t) => progress(from, to, t));\n }\n /**\n * If nothing moves, don't hold a transform, which, even at its\n * default, would make the element a containing block. The empty\n * animation still finishes the animations.\n */\n if (transform.every((t) => t === transform[0])) {\n commit(valuesAt(from, settled));\n keyframes = null;\n }\n return element.animate(keyframes, {\n ...options,\n duration: to - from,\n easing: easing || \"linear\",\n });\n };\n /**\n * Replace the WAAPI animations with ones built from now. Returns\n * undefined if the animations can't be composed.\n */\n const animate = (now) => {\n /**\n * The finite part runs until the last finite animation (or the\n * last delay) ends. Infinitely repeating animations then continue\n * as one looping WAAPI animation, which needs them to share a\n * cycle.\n */\n let end = now;\n let cycle = 0;\n let cycleStart = 0;\n const moving = [];\n const looping = [];\n const ends = new Set();\n byKey.clear();\n built = new Map();\n for (const track of tracks) {\n byKey.set(track.name, track);\n const [trackEnd, trackCycle] = track.timing();\n const isHeld = trackEnd === Infinity;\n built.set(track, [track.at(now), track.speed, isHeld]);\n /**\n * Held animations don't move, so keep their motion values up\n * to date, as a JSAnimation would on a seek.\n */\n if (isHeld) {\n track.sync();\n continue;\n }\n if (track.speed < 0)\n return;\n if (trackCycle) {\n if (cycle) {\n const phase = (trackEnd - cycleStart) / trackCycle;\n if (Math.abs(trackCycle - cycle) > 1 ||\n Math.abs(phase - Math.round(phase)) * cycle > 1) {\n return;\n }\n }\n else {\n cycle = trackCycle;\n cycleStart = trackEnd;\n }\n looping.push(track);\n }\n else {\n ends.add(trackEnd);\n }\n moving.push(track);\n end = Math.max(end, trackEnd);\n }\n statics = {};\n /**\n * Transforms that aren't animating are left out at their default.\n */\n keys = transformPropOrder.filter((key) => {\n if (byKey.has(key))\n return true;\n const value = (statics[key] = read(owner, key));\n return (value !== undefined &&\n parseFloat(value) !==\n (key.startsWith(\"scale\") ? 1 : 0));\n });\n stop(false);\n /**\n * Values that share one tween are one WAAPI animation of it, with\n * two keyframes and its own easing, from when they started.\n */\n const tween = !cycle && getTween(moving);\n try {\n if (tween && tween[1] > now) {\n const [from, to, easing] = tween;\n add(run(moving, from, to, undefined, undefined, easing), from - now, to - from);\n }\n else if (end > now) {\n add(run(moving, now, end), 0, end - now);\n /**\n * Animations that end sooner finish on the events of\n * empty animations that end with them.\n */\n ends.forEach((trackEnd) => trackEnd < end - 1 &&\n add(element.animate(null, {\n duration: trackEnd - now,\n }), 0, trackEnd - now));\n }\n if (cycle) {\n /**\n * Build one cycle from a cycle boundary, so it repeats\n * seamlessly, and start it part way through.\n */\n const from = cycleStart + Math.floor((end - cycleStart) / cycle) * cycle;\n add(run(looping, from, from + cycle, {\n iterations: Infinity,\n iterationStart: (end - from) / cycle,\n /**\n * It must not fill backwards over the finite part\n * that runs before it.\n */\n fill: \"forwards\",\n }, end), end - now);\n }\n }\n catch {\n return;\n }\n /**\n * Everything is held, so hold it with an inline style instead.\n */\n segments.length || stop();\n return true;\n };\n /**\n * If every animation has been paused, played, seeked or sped up\n * together since the WAAPI animation was built, do the same to it.\n * Returns false if it needs rebuilding instead.\n */\n const retime = (now) => {\n let elapsed;\n let rate = 0;\n for (const track of tracks) {\n const state = built.get(track);\n if (!state)\n return false;\n const [builtTime, builtSpeed, wasHeld] = state;\n const trackTime = track.at(now);\n const isHeld = track.timing()[0] === Infinity;\n if (wasHeld) {\n if (isHeld && trackTime === builtTime)\n continue;\n return false;\n }\n const trackElapsed = (trackTime - builtTime) / builtSpeed;\n const trackRate = isHeld ? 0 : track.speed / builtSpeed;\n if (elapsed === undefined) {\n elapsed = trackElapsed;\n rate = trackRate;\n }\n else if (Math.abs(trackElapsed - elapsed) > 1 ||\n trackRate !== rate) {\n return false;\n }\n }\n if (elapsed === undefined)\n return true;\n if (!segments.length)\n return false;\n for (const { offset, end, isDone } of segments) {\n const local = elapsed - offset;\n if (end < Infinity &&\n (isDone ? local < end - 1 : local < 0 || local >= end)) {\n return false;\n }\n }\n for (const { animation, offset, isDone } of segments) {\n if (isDone)\n continue;\n const local = elapsed - offset;\n if (rate) {\n animation.playbackRate = rate;\n animation.startTime = now - local / rate;\n }\n else {\n animation.pause();\n animation.currentTime = local;\n }\n }\n return true;\n };\n /**\n * If no animations are left, write where they got to and cancel the\n * WAAPI animations. Returns whether the group ended.\n */\n const end = () => {\n if (tracks.size)\n return false;\n isEnded = true;\n /**\n * The element may have a newer group if this one was detached\n * (see handOffElementState).\n */\n getGroup(element) === group && transformGroups.delete(element);\n group.isJS || stop();\n return true;\n };\n const build = () => {\n const now = time.now();\n /**\n * Finish the animations that have reached their end, which the\n * WAAPI animation has already rendered.\n */\n if (!group.isJS) {\n group.isFinishing = true;\n tracks.forEach((track) => {\n const [trackEnd, trackCycle] = track.timing();\n if (track.state === \"running\" &&\n track.speed > 0 &&\n !trackCycle &&\n trackEnd <= now + 1) {\n track.complete();\n /**\n * From now it's checked for outside writes like any\n * other static transform. If the WAAPI animation never\n * rendered it (it was instant), rebuild with its value.\n */\n statics[track.name] = read(owner, track.name);\n built.has(track) || (needsBuild = true);\n }\n });\n group.isFinishing = false;\n }\n isScheduled = false;\n if (isEnded)\n return;\n tracks.forEach(({ state }, track) => {\n if (state === \"idle\" || state === \"finished\")\n tracks.delete(track);\n });\n if (end())\n return;\n for (const track of tracks) {\n if (!track.canAccelerate)\n return group.demote(true);\n }\n /**\n * Everything that kept the group on the main thread has finished,\n * so move the remaining animations back to the compositor.\n */\n if (group.isJS) {\n group.isJS = false;\n needsBuild = true;\n tracks.forEach((track) => track.js?.stop());\n }\n const shouldBuild = needsBuild;\n const churned = hasChurned;\n needsBuild = hasChurned = false;\n if (shouldBuild || !retime(now)) {\n if (churned) {\n if (now - lastChurn < churnWindow)\n return group.demote();\n lastChurn = now;\n }\n if (!animate(now))\n return group.demote();\n }\n };\n const group = {\n tracks,\n isJS: false,\n isFinishing: false,\n schedule(build_, isChurn) {\n if (isEnded)\n return;\n needsBuild || (needsBuild = build_);\n hasChurned || (hasChurned = !!isChurn);\n /**\n * Build in this frame's render step, so it's in place before\n * anything reads the DOM in postRender, or straight after the\n * current task outside of a frame.\n */\n if (!isScheduled) {\n isScheduled = true;\n frameData.isProcessing\n ? frame.render(build, false, true)\n : queueMicrotask(build);\n }\n },\n /**\n * End the group now, rather than when it next builds, so the\n * element's transform is the caller's again as soon as its last\n * animation is stopped.\n */\n release(track) {\n /**\n * Only drop the stopped animation. Others can be idle because\n * they're part way through play(), and are about to run.\n */\n const { state } = track;\n if (state === \"idle\" || state === \"finished\")\n tracks.delete(track);\n end() || group.schedule(true);\n },\n /**\n * An outside write. Rebuild once, but if it keeps happening, move\n * to the main thread.\n */\n check() {\n if (group.isJS)\n return;\n for (const key in statics) {\n if (read(owner, key) !== statics[key] && !has(key)) {\n return group.schedule(true, true);\n }\n }\n },\n demote(canReturn) {\n if (group.isJS || isEnded)\n return;\n /**\n * Unless only another animation is holding the group on the\n * main thread, these animations stay there until they end.\n */\n tracks.forEach((track) => {\n track.isAccelerated() && track.sync();\n canReturn || (track.canAccelerate = false);\n });\n group.isJS = true;\n built = new Map();\n stop();\n tracks.forEach((track) => track.state === \"running\" && track.js?.start());\n },\n };\n transformGroups.set(element, group);\n return group;\n}\n\nexport { TransformAnimation, canGroupTransform };\n//# sourceMappingURL=TransformAnimation.mjs.map\n"],"names":["easingTolerance","byTime","a","b","spread","from","to","n","result","i","push","mixNumber","getOwner","options","motionValue","owner","getGroup","element","transformGroups","get","read","key","latestValues","getValue","TransformAnimation","JSAnimation","constructor","current","driver","frameloopDriver","animation","canAccelerate","onUpdate","transformTemplate","getProps","isHandoff","hasOnUpdate","type","projection","isProjecting","canAccelerateTransform","update","js","now","start","keepAlive","group","isJS","schedule","stop","isFinishing","release","super","this","isAccelerated","sync","name","timing","startTime","speed","totalDuration","delay","repeatType","holdTime","Infinity","resolvedDuration","state","tracks","has","liveValue","sampleAt","time","undefined","tween","keyframes","keyframes$1","ease","times","repeat","easing","isBezierDefinition","cubicBezierAsString","test","isNativeEasing","supportedWaapiEasing","length","keyframesGenerator","boundaries","repeatDelay","offsets","defaultOffset","Math","max","floor","iterationStart","offset","t","numberAt","timestamp","parseFloat","setWithVelocity","sampleDelta","play","isStopped","Set","byKey","Map","statics","keys","built","segments","needsBuild","isScheduled","isEnded","hasChurned","lastChurn","track","valuesAt","settled","values","transformPropOrder","value","compose","transform","translateAlias","getValueAsType","numberValueTypes","commit","style","buildTransform","shouldCommit","forEach","cancel","add","end","segment","onfinish","isDone","some","s","filter","oncancel","includes","demote","jumpAt","change","x","y","abs","size","mid","getEasing","moving","bounds","samples","min","ceil","at","concat","sort","position","progress","shared","progressAt","map","first","changes","range","p","every","points","point","round","sample","isStraight","startsWith","split","depth","ends","getTween","v","run","fill","nativeEasing","flatMap","animate","duration","cycle","cycleStart","looping","clear","set","trackEnd","trackCycle","isHeld","phase","iterations","retime","elapsed","rate","builtTime","builtSpeed","wasHeld","trackTime","trackElapsed","trackRate","local","playbackRate","pause","currentTime","delete","build","complete","shouldBuild","churned","build_","isChurn","frameData","isProcessing","frame","render","queueMicrotask","check","canReturn","createGroup","tick","millisecondsToSeconds","clamp","newTime","attachTimeline","timeline","canGroupTransform","HTMLElement","supportsWaapi","supportsLinearEasing"],"mappings":"8sCAqHA,MAOMA,EAAkB,KAkBlBC,EAASA,CAACC,EAAWC,IAAcD,EAAIC,EAKvCC,EAASA,CAACC,EAAcC,EAAYC,KACtC,MAAMC,EAAmB,GACzB,IAAK,IAAIC,EAAI,EAAGA,GAAKF,EAAGE,IAAKD,EAAOE,KAAKC,EAAAA,UAAUN,EAAMC,EAAIG,EAAIF,IACjE,OAAOC,GAGLI,EAAYC,GACdA,EAAQC,YAAaC,MAEnBC,EAAYC,GACdC,EAAAA,gBAAgBC,IAAIF,GAElBG,EAAOA,CAACL,EAAuBM,IACjCN,EAAMO,aAAeP,EAAMO,aAAaD,GAAON,EAAMQ,SAASF,IAAMF,MAiDlE,MAAOK,UAEHC,EAAAA,YAGNC,WAAAA,CAAYb,GACR,MAAMI,EAAUL,EAASC,GAASc,SAC5BC,OAAEA,EAASC,EAAAA,iBAAoBhB,EACrC,IAAIiB,EAKJ,MAAMC,EA5Cd,SAAgClB,GAC5B,MAAME,EAAQH,EAASC,IACjBmB,SAAEA,EAAQC,kBAAEA,GAAsBlB,EAAMmB,WAE9C,QAMKrB,EAAQsB,WACRH,GACAnB,EAAQuB,aAIRH,GACgB,YAAjBpB,EAAQwB,MAKiC,UAAxCjB,EAAKL,EAAO,cAAgB,SAC5BK,EAAKL,EAAO,iBAIZA,EAAMuB,YAAYC,eAE3B,CAe8BC,CAAuB3B,GAO7CA,EAAQe,OAAUa,IACd,MAAMC,EAAKd,EAAOa,GAElB,MAAO,CACHC,KACAC,IAAKD,EAAGC,IACRC,MAAOA,CAACC,GAAY,KAChB,MAAMC,EAAQ9B,EAASC,IACT6B,GAASA,EAAMC,KAQvBL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,GAAaC,OAAOY,mBAAmB6M,aACvCC,EAAaA,iBACbC,EAAAA"}
1
+ {"version":3,"file":"TransformAnimation.mjs.js","sources":["../../../../../../../../node_modules/motion-dom/dist/es/animation/waapi/transforms/TransformAnimation.mjs"],"sourcesContent":["import { isEasingArray, isBezierDefinition, easingDefinitionToFunction, millisecondsToSeconds, clamp, progress } from 'motion-utils';\nimport { frame } from '../../../frameloop/frame.mjs';\nimport { frameData } from '../../../frameloop/frame-data.mjs';\nimport { time } from '../../../frameloop/sync-time.mjs';\nimport { isDefaultTransform, transformFunction } from '../../../render/html/utils/build-transform.mjs';\nimport { transformPropOrder } from '../../../render/utils/keys-transform.mjs';\nimport { mixNumber } from '../../../utils/mix/number.mjs';\nimport { frameloopDriver } from '../../drivers/frame.mjs';\nimport { keyframes } from '../../generators/keyframes.mjs';\nimport { defaultOffset } from '../../keyframes/offsets/default.mjs';\nimport { JSAnimation, round } from '../../JSAnimation.mjs';\nimport { sampleDelta } from '../../NativeAnimationExtended.mjs';\nimport { cubicBezierAsString } from '../easing/cubic-bezier.mjs';\nimport { supportedWaapiEasing } from '../easing/supported.mjs';\nimport { supportsWaapi } from '../supports/waapi.mjs';\nimport { needsMixer } from '../utils/needs-mixer.mjs';\nimport { supportsLinearEasing } from '../../../utils/supports/linear-easing.mjs';\nimport { transformGroups } from './groups.mjs';\n\n/**\n * Sample at the interruption sampling rate, up to a cap for long\n * animations.\n */\nconst maxSamples = 200;\n/**\n * How far values may stray from the WAAPI animation: as a fraction of\n * each value's change when they share an easing, otherwise in px or deg,\n * or for scale.\n */\nconst easingTolerance = 0.001;\nconst sampleTolerance = 0.1;\nconst scaleTolerance = 0.001;\n/**\n * If an outside write, or a seek the WAAPI animation can't follow,\n * happens again within this window, the group is being driven every\n * frame (scrubbing, drag), which is cheaper on the main thread than\n * rebuilding the WAAPI animation every frame.\n */\nconst churnWindow = 100;\n/**\n * A WAAPI animation that starts moving later than this, as most segments\n * of a long sequence do, is built this long before it starts, rather than\n * all at once at the start.\n */\nconst buildAhead = 100;\n/**\n * Named easings that are the same cubic-bezier in JS and CSS.\n */\nconst nativeEasings = new Set([\"linear\", \"easeIn\", \"easeOut\", \"easeInOut\"]);\nconst isNativeEasing = (ease) => nativeEasings.has(ease);\n/**\n * The last trace of each easing WAAPI can't run into linear(), with its\n * number of samples, so the elements of a sequence that share an easing\n * and duration trace it once.\n */\nconst traced = new WeakMap();\nconst trace = (ease, samples) => {\n let last = traced.get(ease);\n if (last?.[0] !== samples) {\n last = [\n samples,\n \"linear(\" +\n defaultOffset(Array(samples + 1)).map((p) => round(ease(p)) + \" \" + round(p * 100) + \"%\") +\n \")\",\n ];\n traced.set(ease, last);\n }\n return last[1];\n};\n/**\n * How many samples trace an easing between two timestamps.\n */\nconst countSamples = (from, to) => Math.min(maxSamples, Math.max(2, Math.ceil((to - from) / sampleDelta)));\n/**\n * Whether two eased progresses match. False if either is NaN.\n */\nconst isNear = (a, b) => Math.abs(a - b) <= easingTolerance;\nconst byTime = (a, b) => a - b;\n/**\n * n + 1 evenly spaced timestamps, from one timestamp to another.\n */\nconst spread = (from, to, n) => defaultOffset(Array(n + 1)).map((p) => mixNumber(from, to, p));\nconst getOwner = (options) => options.motionValue.owner;\nconst getGroup = (element) => transformGroups.get(element);\n/**\n * Whether an animation has ended, so can leave its group.\n */\nconst hasEnded = ({ state }) => state === \"idle\" || state === \"finished\";\nconst read = (owner, key) => owner.latestValues ? owner.latestValues[key] : owner.getValue(key)?.get();\n/**\n * Whether this animation should join its element's transform group.\n * Animations that can't be accelerated still join, so the group knows\n * to stay on the main thread while they run. Browsers without linear()\n * easing stay on the main thread.\n */\nconst canGroupTransform = ({ name, motionValue, }) => name &&\n transformPropOrder.includes(name) &&\n motionValue?.owner?.current instanceof HTMLElement &&\n supportsWaapi() &&\n supportsLinearEasing();\nfunction canAccelerateTransform(options) {\n const owner = getOwner(options);\n const { onUpdate, transformTemplate } = owner.getProps();\n return (\n /**\n * A handoff from an optimised appear animation is already running\n * on its own WAAPI animation. onUpdate needs every value, every\n * frame.\n */\n !options.isHandoff &&\n !onUpdate &&\n !options.hasOnUpdate &&\n /**\n * transformTemplate could output anything.\n */\n !transformTemplate &&\n options.type !== \"inertia\" &&\n /**\n * A literal transform, or pathRotation, replaces or adds to the\n * transform we'd build. styleEffect builds its own as \"none\".\n */\n (read(owner, \"transform\") || \"none\") === \"none\" &&\n !read(owner, \"pathRotation\") &&\n /**\n * Layout animations write transform every frame.\n */\n !owner.projection?.isProjecting() &&\n /**\n * A mixer that blends these values makes them every frame. It's\n * asked last, as it's user code.\n */\n !needsMixer(options));\n}\n/**\n * Starting or stopping tells the group to update its WAAPI animation.\n * The frame loop driver is only made once the group is on the main\n * thread, as accelerated animations never tick.\n */\nclass TransformDriver {\n constructor(element, update, makeDriver, animation) {\n this.element = element;\n this.update = update;\n this.makeDriver = makeDriver;\n this.animation = animation;\n }\n get js() {\n return (this.driver || (this.driver = this.makeDriver(this.update)));\n }\n now() {\n return this.driver || this.makeDriver !== frameloopDriver\n ? this.js.now()\n : frameData.isProcessing\n ? frameData.timestamp\n : time.now();\n }\n /**\n * keepAlive is false when seeking. Seeking the WAAPI animation is\n * free, but if a seek needs a rebuild and keeps happening, the group\n * moves to the main thread.\n */\n start(keepAlive = true) {\n const group = getGroup(this.element);\n !group || group.isJS\n ? this.js.start(keepAlive)\n : group.schedule(false, !keepAlive);\n }\n stopJS() {\n this.driver?.stop();\n }\n stop() {\n this.stopJS();\n const group = getGroup(this.element);\n group && !group.isFinishing && group.release(this.animation);\n }\n}\n/**\n * JSAnimation's time setter, looked up on first use rather than at module\n * load, so the module has no top-level side effects and stays\n * tree-shakeable in flattened bundles.\n */\nlet setTime;\nclass TransformAnimation extends JSAnimation {\n constructor(options) {\n const element = getOwner(options).current;\n const { driver = frameloopDriver } = options;\n let animation;\n /**\n * Before JSAnimation replaces the type with its generator.\n */\n const canAccelerate = canAccelerateTransform(options);\n /**\n * The driver ticks on the main thread only once the group has\n * moved there, so its frame loop driver is made then.\n */\n options.driver = (update) => new TransformDriver(element, update, driver, animation);\n super(options);\n animation = this;\n /**\n * The first driver is made in super(), before this was assigned.\n */\n const firstDriver = this.driver;\n firstDriver && (firstDriver.animation = this);\n this.canAccelerate = canAccelerate;\n /**\n * stop is bound in JSAnimation, so wrap it rather than override.\n * Before stopping, set the motion value to where the WAAPI\n * animation is now, with velocity, for the next animation to\n * start from.\n */\n const { stop } = this;\n this.stop = () => {\n this.isAccelerated() && this.sync();\n stop();\n };\n }\n /**\n * Each keyframe's offset, made once for the keyframes rather than on\n * every build.\n */\n offsets() {\n const { keyframes, times } = this.options;\n if (times)\n return times;\n if (this.offsetsOf !== keyframes) {\n this.offsetsOf = keyframes;\n this.cachedOffsets = defaultOffset(keyframes);\n }\n return this.cachedOffsets;\n }\n get group() {\n return getGroup(getOwner(this.options).current);\n }\n get js() {\n return this.driver?.js;\n }\n stopJS() {\n this.driver?.stopJS();\n }\n get name() {\n return this.options.name;\n }\n /**\n * When this stops moving, or, if it repeats forever, when it starts\n * repeating, and how long each repeat takes. Held (paused, or at\n * speed 0) animations never stop moving.\n */\n timing() {\n const { startTime, speed, totalDuration } = this;\n const { delay = 0, repeatType } = this.options;\n return this.holdTime !== null\n ? [Infinity, 0]\n : totalDuration === Infinity\n ? [\n startTime + delay / speed,\n (this.resolvedDuration * (repeatType === \"loop\" ? 1 : 2)) /\n speed || 1,\n ]\n : [startTime + (delay + totalDuration) / speed, 0];\n }\n /**\n * Whether this is running, or paused, on the compositor.\n */\n isAccelerated() {\n const { group, state } = this;\n return (group?.tracks.has(this) &&\n !group.isJS &&\n this.canAccelerate &&\n (state === \"running\" || state === \"paused\"));\n }\n /**\n * The value now, while this runs on the compositor and so doesn't\n * set its motion value every frame.\n */\n liveValue() {\n return this.isAccelerated() ? this.sampleAt(time.now()) : undefined;\n }\n /**\n * If this moves between two keyframes only, holding still either side\n * of them, as each value of a sequence segment does, when it starts\n * and stops moving, and its easing: as a string if WAAPI runs it\n * exactly, otherwise its function, to trace.\n */\n tween() {\n const { keyframes: keyframes$1, type, repeat, delay = 0 } = this.options;\n let span = -1;\n if (repeat || type !== keyframes || this.holdTime !== null) {\n return;\n }\n for (let i = 1; i < keyframes$1.length; i++) {\n if (keyframes$1[i] !== keyframes$1[i - 1]) {\n if (span >= 0)\n return;\n span = i - 1;\n }\n }\n let { ease } = this.options;\n if (isEasingArray(ease))\n ease = ease[span];\n const offsets = this.offsets();\n const at = (i) => this.startTime +\n (delay + offsets[i] * this.totalDuration) / this.speed;\n if (span >= 0) {\n const easing = isBezierDefinition(ease)\n ? cubicBezierAsString(ease)\n : isNativeEasing(ease)\n ? supportedWaapiEasing[ease]\n : easingDefinitionToFunction(ease);\n /**\n * An easing that doesn't run from 0 to 1 doesn't move between\n * the keyframes, so is traced from the values it gives instead.\n */\n return [\n at(span),\n at(span + 1),\n typeof easing === \"string\" ||\n (isNear(easing(0), 0) && isNear(easing(1), 1))\n ? easing\n : undefined,\n ];\n }\n }\n /**\n * The timestamps between two timestamps where this reaches a\n * keyframe or starts a repeat, where it can turn or jump.\n */\n boundaries(from, to) {\n const { startTime, speed, resolvedDuration, options } = this;\n const { delay = 0, repeat = 0, repeatDelay = 0, repeatType, type, } = options;\n const offsets = (type || keyframes) === keyframes\n ? this.offsets()\n : [0, 1];\n const start = startTime + delay / speed;\n const result = [];\n if (this.holdTime !== null || !(resolvedDuration > 0))\n return result;\n for (let i = Math.max(0, Math.floor(((from - start) * speed) / resolvedDuration)); i <= repeat; i++) {\n const iterationStart = start + (i * resolvedDuration) / speed;\n if (iterationStart > to)\n break;\n for (const offset of offsets) {\n const t = iterationStart +\n ((i % 2 && repeatType && repeatType !== \"loop\"\n ? 1 - offset\n : offset) *\n (resolvedDuration - repeatDelay)) /\n speed;\n t > from && t < to && result.push(t);\n }\n }\n return result;\n }\n /**\n * The value at a timestamp, as a number.\n */\n numberAt(timestamp) {\n return parseFloat(this.sampleAt(timestamp, true));\n }\n /**\n * Write the current value, and velocity, to the motion value.\n */\n sync() {\n const now = time.now();\n const value = this.sampleAt(now, true);\n /**\n * A held value doesn't move, so there's no need to sample it\n * twice.\n */\n this.options.motionValue.setWithVelocity(this.holdTime === null\n ? this.sampleAt(now - sampleDelta, true)\n : value, value, sampleDelta);\n }\n play() {\n /**\n * A stopped animation (one that was interrupted) can't play again,\n * so it mustn't join the group.\n */\n if (this.isStopped)\n return;\n (this.group || createGroup(getOwner(this.options))).tracks.add(this);\n super.play();\n }\n pause() {\n super.pause();\n this.isAccelerated() && this.group.schedule(false);\n }\n /**\n * JSAnimation finishes on its next tick, which only happens once the\n * group is on the main thread, so finish now. That includes an\n * animation that can't be accelerated but reached its end before the\n * group could move there.\n */\n complete() {\n super.complete();\n const { group } = this;\n group && !group.isJS && this.tick(time.now());\n }\n /**\n * Without a tick to rebase it, a held time still includes the delay,\n * so take it off here, as a JS animation does on its next tick.\n */\n get time() {\n if (this.isAccelerated()) {\n return millisecondsToSeconds(clamp(0, this.totalDuration, this.at(time.now()) - (this.options.delay || 0)));\n }\n return super.time;\n }\n /**\n * Calls JSAnimation's setter directly, as `super.time =` is a slow\n * path in V8 and this runs for every animation of a seeked sequence.\n */\n set time(newTime) {\n (setTime ?? (setTime = Object.getOwnPropertyDescriptor(JSAnimation.prototype, \"time\").set)).call(this, newTime);\n }\n /**\n * Scroll timelines set time every frame, so run these on the main\n * thread.\n */\n attachTimeline(timeline) {\n this.canAccelerate = false;\n this.group?.demote(true);\n return super.attachTimeline(timeline);\n }\n}\n/**\n * Groups that build straight after the current task build in one\n * microtask, rather than one each.\n */\nlet builds;\nconst buildSoon = (build) => {\n builds ||\n queueMicrotask(() => {\n const queue = builds;\n builds = undefined;\n queue.forEach((build) => build());\n });\n (builds || (builds = [])).push(build);\n};\nfunction createGroup(owner) {\n const element = owner.current;\n const tracks = new Set();\n const byKey = new Map();\n /**\n * Transforms that aren't animating, as built into the WAAPI animation.\n */\n let statics = {};\n /**\n * The transforms in the WAAPI animation, in order.\n */\n let keys = [];\n let built = new Map();\n let segments = [];\n let needsBuild = false;\n let isScheduled = false;\n let isEnded = false;\n let hasChurned = false;\n let lastChurn = -Infinity;\n let wake;\n let wakeAt = Infinity;\n /**\n * While waiting to build a tween that starts later, how long after\n * the last build to build it.\n */\n let buildAt;\n const has = (key) => {\n for (const track of tracks)\n if (track.name === key)\n return true;\n };\n /**\n * The transform values at a timestamp or, without one, from the\n * motion values. Animations that don't repeat forever are sampled no\n * earlier than settled, so a loop that starts from an earlier cycle\n * boundary holds them at their end.\n */\n const valuesAt = (timestamp, settled) => {\n const values = {};\n for (const key of timestamp === undefined ? transformPropOrder : keys) {\n const track = byKey.get(key);\n const value = timestamp === undefined\n ? read(owner, key)\n : track\n ? track.sampleAt(settled > timestamp && !track.timing()[1]\n ? settled\n : timestamp)\n : statics[key];\n if (value !== undefined)\n values[key] = value;\n }\n return values;\n };\n /**\n * Build a transform from values in transformPropOrder. For a keyframe,\n * every key is written, even at its default, so each keyframe has the\n * same list of functions and the browser interpolates them one by one.\n * As an inline style, defaults are left out, as buildTransform does.\n */\n const toTransform = (values, isStyle) => {\n let transform = \"\";\n for (const key in values) {\n const value = values[key];\n if (!isStyle || !isDefaultTransform(key, value)) {\n transform += transformFunction(key, value) + \" \";\n }\n }\n return (isStyle ? transform.trim() : transform) || \"none\";\n };\n /**\n * Build the transform at a timestamp.\n */\n const compose = (timestamp, settled) => toTransform(valuesAt(timestamp, settled));\n /**\n * Write the transform as an inline style, as the renderer would.\n */\n const commit = (values = valuesAt()) => {\n element.style.transform = toTransform(values, true);\n };\n /**\n * Cancel a WAAPI animation and remove its handlers, as WebKit never\n * collects an animation once it has run, nor anything its handlers\n * reference (#4034).\n */\n const cancel = (animation) => {\n animation.onfinish = animation.oncancel = null;\n animation.cancel();\n };\n /**\n * Cancel the WAAPI animations, by default first committing the\n * transform. The renderer writes its own version on its next render.\n */\n const stop = (shouldCommit = true) => {\n clearTimeout(wake);\n wakeAt = Infinity;\n buildAt = undefined;\n shouldCommit && commit();\n segments.forEach(({ animation }) => cancel(animation));\n segments = [];\n };\n /**\n * A WAAPI animation that add() starts by setting its startTime. Playing\n * it first, as element.animate() does, would leave WebKit holding that\n * play's ready time once startTime ends the play, and it uses that for\n * the next updatePlaybackRate(), so the animation would jump.\n */\n const create = (keyframes, options) => new Animation(new KeyframeEffect(element, keyframes, options));\n const add = (animation, offset, end = Infinity) => {\n const segment = { animation, offset, end };\n animation.startTime = time.now() + offset;\n /**\n * Animations finish when the WAAPI animation reaches their end.\n * Once a loop has taken over, the finished animation isn't needed.\n */\n if (end < Infinity) {\n animation.onfinish = () => {\n segment.isDone = true;\n if (segments.some((s) => s.end === Infinity)) {\n cancel(animation);\n segments = segments.filter((s) => s !== segment);\n }\n group.schedule(false);\n };\n }\n /**\n * Something else cancelled it, so carry on on the main thread.\n */\n animation.oncancel = () => segments.includes(segment) && group.demote();\n segments.push(segment);\n };\n /**\n * Where a value jumps between two timestamps, as when a repeat starts\n * again: the timestamps either side of the jump, or none if it moves\n * there continuously.\n */\n const jumpAt = (value, a, b) => {\n const change = (x, y) => Math.abs(value(y) - value(x));\n const size = change(a, b);\n while (b - a > 0.01) {\n const mid = (a + b) / 2;\n change(a, mid) > change(mid, b) ? (b = mid) : (a = mid);\n }\n return change(a, b) > size / 2 ? [a, b] : [];\n };\n /**\n * If every moving animation follows the same eased progress between\n * two timestamps, the easing that describes it.\n */\n const getEasing = (moving, from, to, bounds) => {\n const samples = countSamples(from, to);\n /**\n * Too many keyframes or repeats to follow with this many samples.\n */\n if (bounds.length * 4 > samples)\n return;\n /**\n * First check half way, where values with different easings\n * usually differ, before sampling every value many times.\n */\n let quick;\n for (const track of moving) {\n const first = track.numberAt(from);\n const p = (track.numberAt((from + to) / 2) - first) /\n (track.numberAt(to) - first);\n /**\n * NaN if it doesn't move.\n */\n if (p !== p)\n continue;\n if (quick === undefined)\n quick = p;\n else if (!isNear(p, quick))\n return;\n }\n const at = spread(from, to, samples).concat(bounds).sort(byTime);\n const position = (t) => progress(from, to, t);\n let shared;\n let progressAt;\n for (const track of moving) {\n const first = track.numberAt(from);\n const changes = at.map((t) => track.numberAt(t) - first);\n const end = changes[changes.length - 1];\n /**\n * A value that ends only a tiny way from where it started, as\n * a round trip does if it's built just after it starts, or\n * from a float residue, ends where it started. Dividing by\n * that tiny range would stretch the easing to values the\n * compositor can't render.\n */\n const range = changes.some((change) => Math.abs(change) * easingTolerance > Math.abs(end))\n ? 0\n : end;\n const progress = changes.map((change) => range ? change / range : change);\n /**\n * The first value that moves sets the easing, and every other\n * one must follow it. A value that doesn't change, like one\n * still in its delay, fits any easing. One that changes but\n * ends where it started fits none.\n */\n if (range && !shared) {\n shared = progress;\n progressAt = (t) => (track.numberAt(t) - first) / range;\n }\n else if (progress.some((p, i) => !isNear(p, range && shared[i]))) {\n return;\n }\n }\n if (!shared || shared.every((p, i) => isNear(p, position(at[i])))) {\n return \"linear\";\n }\n /**\n * A repeat that starts again jumps back, which takes two points at\n * the same position.\n */\n const points = [];\n const point = (t, p = progressAt(t)) => points.push(round(p) + \" \" + round(position(t) * 100) + \"%\");\n shared.forEach((p, i) => {\n i &&\n Math.abs(p - shared[i - 1]) > 0.2 &&\n jumpAt(progressAt, at[i - 1], at[i]).forEach((t) => point(t));\n point(at[i], p);\n });\n return \"linear(\" + points + \")\";\n };\n /**\n * Sample timestamps between two timestamps, closer together where the\n * moving animations curve.\n */\n const sample = (moving, from, to, bounds) => {\n const times = [from];\n /**\n * A linear tween is straight between its keyframes, so only the\n * other values can curve, and a tween only while it moves.\n */\n const curved = [];\n let curveFrom = to;\n let curveTo = from;\n for (const track of moving) {\n const tween = track.tween();\n if (tween?.[2] !== \"linear\") {\n const [trackEnd, cycle] = track.timing();\n const [a, b] = tween || [from, cycle ? to : trackEnd];\n curveFrom = Math.min(curveFrom, a);\n curveTo = Math.max(curveTo, b);\n curved.push(track);\n }\n }\n curveFrom = Math.max(from, curveFrom);\n curveTo = Math.min(to, curveTo);\n /**\n * Values that aren't numbers, like calc(), are left to the\n * browser to interpolate.\n */\n const isStraight = (a, b) => curved.every((track) => !(Math.abs(track.numberAt((a + b) / 2) -\n (track.numberAt(a) + track.numberAt(b)) / 2) >\n (track.name.startsWith(\"scale\")\n ? scaleTolerance\n : sampleTolerance)));\n const split = (a, b, depth) => {\n if (b - a < 1 || isStraight(a, b)) {\n times.push(b);\n }\n else if (depth < 4) {\n split(a, (a + b) / 2, depth + 1);\n split((a + b) / 2, b, depth + 1);\n }\n else {\n /**\n * Keyframes either side of a jump, like a repeat starting\n * again, so it doesn't play as a quick sweep.\n */\n for (const track of moving) {\n times.push(...jumpAt((t) => track.numberAt(t), a, b));\n }\n times.push(b);\n }\n };\n /**\n * Split at least every 100ms where a value can curve, and at every\n * keyframe and repeat, either side of where a value can jump.\n */\n const ends = curveTo > curveFrom\n ? spread(curveFrom, curveTo, Math.ceil((curveTo - curveFrom) / 100))\n : [];\n ends.push(to);\n for (const t of bounds)\n ends.push(t, Math.min(t + 0.01, to));\n let start = from;\n for (const end of ends.sort(byTime)) {\n end > start && split(start, end, 0);\n start = end;\n }\n return times.sort(byTime);\n };\n /**\n * If every moving animation is the same tween, started together, as\n * happens for the values of one animate() call or transition, when\n * they move and their native easing.\n */\n const getTween = (moving) => {\n let shared;\n for (const track of moving) {\n const tween = track.tween();\n if (!tween ||\n (shared &&\n (Math.abs(tween[0] - shared[0]) > 1 ||\n Math.abs(tween[1] - shared[1]) > 1))) {\n return;\n }\n /**\n * Easings that differ, like the springs a sequence makes for\n * each value, can still be the same curve.\n */\n shared = [\n tween[0],\n tween[1],\n !shared || tween[2] === shared[2] ? tween[2] : undefined,\n ];\n }\n return shared;\n };\n /**\n * A WAAPI animation of the composed transform between two timestamps.\n */\n const run = (moving, from, to, nativeEasing, options = { fill: \"both\" }, settled) => {\n /**\n * With an easing given, there's nothing to sample, so no need\n * for the boundaries.\n */\n const bounds = nativeEasing\n ? []\n : moving.flatMap((track) => track.boundaries(from, to));\n const easing = nativeEasing || getEasing(moving, from, to, bounds);\n const times = easing ? [from, to] : sample(moving, from, to, bounds);\n const transform = times.map((t) => compose(t, settled));\n let keyframes = { transform };\n if (!easing) {\n keyframes.offset = times.map((t) => progress(from, to, t));\n }\n /**\n * If nothing moves, don't hold a transform, which, even at its\n * default, would make the element a containing block. The empty\n * animation still finishes the animations.\n */\n if (transform.every((t) => t === transform[0])) {\n commit(valuesAt(from, settled));\n keyframes = null;\n }\n return create(keyframes, {\n ...options,\n duration: to - from,\n easing: easing || \"linear\",\n });\n };\n /**\n * Check whether it's time to build in this long. A check that's due\n * sooner is kept, and checks again if it's early, so pausing and\n * playing don't each replace a timer. One due later, after a seek or\n * speed change while held, is replaced.\n */\n const wakeIn = (delay) => {\n const at = time.now() + delay;\n if (at < wakeAt) {\n clearTimeout(wake);\n wakeAt = at;\n wake = setTimeout(() => {\n wakeAt = Infinity;\n group.schedule(false);\n }, delay);\n }\n };\n /**\n * Replace the WAAPI animations with ones built from now. Returns\n * undefined if the animations can't be composed.\n */\n const animate = (now) => {\n /**\n * The finite part runs until the last finite animation (or the\n * last delay) ends. Infinitely repeating animations then continue\n * as one looping WAAPI animation, which needs them to share a\n * cycle.\n */\n let end = now;\n let cycle = 0;\n let cycleStart = 0;\n const moving = [];\n const looping = [];\n const ends = new Set();\n byKey.clear();\n built = new Map();\n for (const track of tracks) {\n byKey.set(track.name, track);\n const [trackEnd, trackCycle] = track.timing();\n const isHeld = trackEnd === Infinity;\n built.set(track, [track.at(now), track.speed, isHeld]);\n if (isHeld)\n continue;\n if (track.speed < 0)\n return;\n if (trackCycle) {\n if (cycle) {\n const phase = (trackEnd - cycleStart) / trackCycle;\n if (Math.abs(trackCycle - cycle) > 1 ||\n Math.abs(phase - Math.round(phase)) * cycle > 1) {\n return;\n }\n }\n else {\n cycle = trackCycle;\n cycleStart = trackEnd;\n }\n looping.push(track);\n }\n else {\n ends.add(trackEnd);\n }\n moving.push(track);\n end = Math.max(end, trackEnd);\n }\n statics = {};\n /**\n * Transforms that aren't animating are left out at their default.\n */\n keys = transformPropOrder.filter((key) => {\n if (byKey.has(key))\n return true;\n const value = (statics[key] = read(owner, key));\n return value !== undefined && !isDefaultTransform(key, value);\n });\n stop(false);\n /**\n * Values that share one tween are one WAAPI animation of it, with\n * two keyframes and its own easing, from when they started.\n */\n const tween = !cycle && getTween(moving);\n try {\n if (end > now) {\n let easing;\n if (tween && tween[1] > now) {\n const [from, to, ease] = tween;\n /**\n * Until it's built, the motion values hold where it\n * starts, for the renderer to write.\n */\n if (from - now > buildAhead) {\n moving.forEach((track) => track.sync());\n wakeIn((buildAt = from - now - buildAhead));\n return true;\n }\n easing =\n typeof ease === \"string\"\n ? ease\n : ease\n ? trace(ease, countSamples(from, to))\n : getEasing(moving, from, to, []);\n /**\n * It holds its last keyframe until the animations end.\n */\n easing &&\n add(run(moving, from, to, easing, {\n fill: \"both\",\n endDelay: end - to,\n }), from - now, end - from);\n }\n easing || add(run(moving, now, end), 0, end - now);\n /**\n * Animations that end sooner finish on the events of\n * empty animations that end with them.\n */\n ends.forEach((trackEnd) => trackEnd < end - 1 &&\n add(create(null, { duration: trackEnd - now }), 0, trackEnd - now));\n }\n if (cycle) {\n /**\n * Build one cycle from a cycle boundary, so it repeats\n * seamlessly, and start it part way through.\n */\n const from = cycleStart + Math.floor((end - cycleStart) / cycle) * cycle;\n add(run(looping, from, from + cycle, undefined, {\n iterations: Infinity,\n iterationStart: (end - from) / cycle,\n /**\n * It must not fill backwards over the finite part\n * that runs before it.\n */\n fill: \"forwards\",\n }, end), end - now);\n }\n }\n catch {\n return;\n }\n /**\n * Everything is held, so hold it with an inline style instead.\n */\n segments.length || stop();\n return true;\n };\n /**\n * If every animation has been paused, played, seeked or sped up\n * together since the WAAPI animation was built, do the same to it.\n * Returns false if it needs rebuilding instead. Seeking to before a\n * tween starts rebuilds, so a running group seeked every frame still\n * moves to the main thread.\n */\n const retime = (now, isSeek) => {\n let elapsed;\n let rate = 0;\n for (const track of tracks) {\n const state = built.get(track);\n if (!state)\n return false;\n const [builtTime, builtSpeed, wasHeld] = state;\n const trackTime = track.at(now);\n const isHeld = track.timing()[0] === Infinity;\n /**\n * With nothing on the compositor, a held animation is set\n * where it's held, so it can be seeked as often as needed.\n */\n if (wasHeld) {\n if (isHeld && (trackTime === builtTime || !segments.length)) {\n continue;\n }\n return false;\n }\n const trackElapsed = (trackTime - builtTime) / builtSpeed;\n const trackRate = isHeld ? 0 : track.speed / builtSpeed;\n if (elapsed === undefined) {\n elapsed = trackElapsed;\n rate = trackRate;\n }\n else if (Math.abs(trackElapsed - elapsed) > 1 ||\n trackRate !== rate) {\n return false;\n }\n }\n if (elapsed === undefined)\n return true;\n /**\n * Waiting to build a tween that starts later. Until then the\n * values hold where they start, so only when to build changes.\n * Held, it has nothing on the compositor, so it can be seeked.\n */\n if (!segments.length) {\n if (buildAt === undefined || (isSeek && rate))\n return false;\n if (rate) {\n const delay = (buildAt - elapsed) / rate;\n if (delay < 1)\n return false;\n wakeIn(delay);\n }\n return true;\n }\n /**\n * Only a tween is built to start later, and it holds its first\n * keyframe until then, so it can be paused and played before it\n * starts.\n */\n for (const { offset, end, isDone } of segments) {\n const local = elapsed - offset;\n if (end < Infinity &&\n (isDone\n ? local < end - 1\n : (local < 0 && (isSeek || offset <= 0)) || local >= end)) {\n return false;\n }\n }\n for (const { animation, offset, isDone } of segments) {\n if (isDone)\n continue;\n const local = elapsed - offset;\n if (rate &&\n animation.updatePlaybackRate &&\n animation.playState === \"running\" &&\n Math.abs(Number(animation.currentTime) - local) < 20) {\n /**\n * Only the speed changed. Setting playbackRate and\n * startTime restarts a running compositor animation, which\n * can render the underlying value for a frame.\n */\n animation.playbackRate !== rate &&\n animation.updatePlaybackRate(rate);\n }\n else if (rate) {\n animation.playbackRate !== rate &&\n (animation.playbackRate = rate);\n animation.startTime = now - local / rate;\n }\n else {\n /**\n * Hold it without pause(), whose pending pause setting\n * currentTime would end at once, leaving WebKit holding its\n * ready time (see create()).\n */\n animation.startTime = null;\n animation.currentTime = local;\n }\n }\n return true;\n };\n /**\n * If no animations are left, write where they got to and cancel the\n * WAAPI animations. Returns whether the group ended.\n */\n const end = () => {\n if (tracks.size)\n return false;\n isEnded = true;\n /**\n * The element may have a newer group if this one was detached\n * (see handOffElementState).\n */\n getGroup(element) === group && transformGroups.delete(element);\n group.isJS || stop();\n return true;\n };\n const build = () => {\n const now = time.now();\n /**\n * Finish the animations that have reached their end, which the\n * WAAPI animation has already rendered.\n */\n if (!group.isJS) {\n group.isFinishing = true;\n tracks.forEach((track) => {\n const [trackEnd, trackCycle] = track.timing();\n if (track.state === \"running\" &&\n track.speed > 0 &&\n !trackCycle &&\n trackEnd <= now + 1) {\n track.complete();\n /**\n * From now it's checked for outside writes like any\n * other static transform. If the WAAPI animation never\n * rendered it (it was instant), rebuild with its value.\n */\n statics[track.name] = read(owner, track.name);\n built.has(track) || (needsBuild = true);\n }\n });\n group.isFinishing = false;\n }\n isScheduled = false;\n if (isEnded)\n return;\n tracks.forEach((track) => hasEnded(track) && tracks.delete(track));\n if (end())\n return;\n for (const track of tracks) {\n if (!track.canAccelerate)\n return group.demote(true);\n }\n /**\n * Everything that kept the group on the main thread has finished,\n * so move the remaining animations back to the compositor.\n */\n if (group.isJS) {\n group.isJS = false;\n needsBuild = true;\n tracks.forEach((track) => track.stopJS());\n }\n const shouldBuild = needsBuild;\n const churned = hasChurned;\n needsBuild = hasChurned = false;\n if (shouldBuild || !retime(now, churned)) {\n if (churned) {\n if (now - lastChurn < churnWindow)\n return group.demote();\n lastChurn = now;\n }\n if (!animate(now))\n return group.demote();\n }\n else if (buildAt !== undefined && !churned) {\n /**\n * Still waiting to build, so the values still hold where\n * they start.\n */\n return;\n }\n /**\n * Held animations don't move, so set their motion values to where\n * they're held, as a JSAnimation would on its next tick. Pausing\n * and seeking schedule this, so it's once however many there are.\n */\n tracks.forEach((track) => track.timing()[0] === Infinity && track.sync());\n };\n const group = {\n tracks,\n isJS: false,\n isFinishing: false,\n schedule(build_, isChurn) {\n if (isEnded)\n return;\n needsBuild || (needsBuild = build_);\n hasChurned || (hasChurned = !!isChurn);\n /**\n * Build in this frame's render step, so it's in place before\n * anything reads the DOM in postRender, or straight after the\n * current task outside of a frame.\n */\n if (!isScheduled) {\n isScheduled = true;\n frameData.isProcessing\n ? frame.render(build, false, true)\n : buildSoon(build);\n }\n },\n /**\n * End the group now, rather than when it next builds, so the\n * element's transform is the caller's again as soon as its last\n * animation is stopped.\n */\n release(track) {\n /**\n * Only drop the stopped animation. Others can be idle because\n * they're part way through play(), and are about to run.\n */\n hasEnded(track) && tracks.delete(track);\n end() || group.schedule(true);\n },\n /**\n * An outside write. Rebuild once, but if it keeps happening, move\n * to the main thread.\n */\n check() {\n if (group.isJS)\n return;\n for (const key in statics) {\n if (read(owner, key) !== statics[key] && !has(key)) {\n return group.schedule(true, true);\n }\n }\n },\n demote(canReturn) {\n if (group.isJS || isEnded)\n return;\n /**\n * Unless only another animation is holding the group on the\n * main thread, these animations stay there until they end.\n */\n tracks.forEach((track) => {\n track.isAccelerated() && track.sync();\n canReturn || (track.canAccelerate = false);\n });\n group.isJS = true;\n built = new Map();\n stop();\n tracks.forEach((track) => track.state === \"running\" && track.js?.start());\n return true;\n },\n };\n transformGroups.set(element, group);\n return group;\n}\n\nexport { TransformAnimation, canGroupTransform };\n//# sourceMappingURL=TransformAnimation.mjs.map\n"],"names":["easingTolerance","buildAhead","nativeEasings","Set","traced","WeakMap","countSamples","from","to","Math","min","max","ceil","sampleDelta","isNear","a","b","abs","byTime","spread","n","defaultOffset","Array","map","p","mixNumber","getOwner","options","motionValue","owner","getGroup","element","transformGroups","get","hasEnded","state","read","key","latestValues","getValue","TransformDriver","constructor","update","makeDriver","animation","this","js","driver","now","frameloopDriver","frameData","isProcessing","timestamp","time","start","keepAlive","group","isJS","schedule","stopJS","stop","isFinishing","release","setTime","builds","TransformAnimation","JSAnimation","current","canAccelerate","onUpdate","transformTemplate","getProps","isHandoff","hasOnUpdate","type","projection","isProjecting","needsMixer","canAccelerateTransform","super","firstDriver","isAccelerated","sync","offsets","keyframes","times","offsetsOf","cachedOffsets","name","timing","startTime","speed","totalDuration","delay","repeatType","holdTime","Infinity","resolvedDuration","tracks","has","liveValue","sampleAt","undefined","tween","keyframes$1","repeat","span","keyframesGenerator","i","length","ease","isEasingArray","at","easing","isBezierDefinition","cubicBezierAsString","isNativeEasing","supportedWaapiEasing","easingDefinitionToFunction","boundaries","repeatDelay","result","floor","iterationStart","offset","t","push","numberAt","parseFloat","value","setWithVelocity","play","isStopped","byKey","Map","wake","buildAt","statics","keys","built","segments","needsBuild","isScheduled","isEnded","hasChurned","lastChurn","wakeAt","track","valuesAt","settled","values","transformPropOrder","toTransform","isStyle","transform","isDefaultTransform","transformFunction","trim","compose","commit","style","cancel","onfinish","oncancel","shouldCommit","clearTimeout","forEach","create","Animation","KeyframeEffect","add","end","segment","isDone","some","s","filter","includes","demote","jumpAt","change","x","y","size","mid","getEasing","moving","bounds","samples","quick","first","concat","sort","position","progress","shared","progressAt","changes","range","every","points","point","round","sample","curved","curveFrom","curveTo","trackEnd","cycle","isStraight","startsWith","split","depth","ends","getTween","run","nativeEasing","fill","flatMap","duration","wakeIn","setTimeout","animate","cycleStart","looping","clear","set","trackCycle","isHeld","phase","trace","last","endDelay","iterations","retime","isSeek","elapsed","rate","builtTime","builtSpeed","wasHeld","trackTime","trackElapsed","trackRate","local","updatePlaybackRate","playState","Number","currentTime","playbackRate","delete","build","complete","shouldBuild","churned","build_","isChurn","frame","render","buildSoon","check","canReturn","createGroup","pause","tick","millisecondsToSeconds","clamp","newTime","Object","getOwnPropertyDescriptor","prototype","call","attachTimeline","timeline","queueMicrotask","queue","canGroupTransform","HTMLElement","supportsWaapi","supportsLinearEasing"],"mappings":"2yCAuHA,MAOMA,EAAkB,KAiBlBC,EAAa,IAKbC,EAAgB,IAAIC,IAAI,CAAC,SAAU,SAAU,UAAW,cASxDC,EAAS,IAAIC,QAqBbC,EAAeA,CAACC,EAAcC,IAChCC,KAAKC,IA5DU,IA4DMD,KAA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BAAgBkM,IAAInM,EAASyB,IAEtBA,EACX,CAj+BwB8M,CAAY5O,EAASmB,KAAKlB,WAAWuE,OAAOwE,IAAI7H,MAEhEkC,MAAMoD,OACV,CAEAoI,KAAAA,GACIxL,MAAMwL,QAEN1N,KAAKoC,iBAAmBpC,KAAKW,MAAOE,UAAS,EACjD,CAQAkM,QAAAA,GACI7K,MAAM6K,WACN,MAAMpM,MAAEA,GAAUX,KAClBW,IAAUA,EAAMC,MAAQZ,KAAK2N,KAAKnN,EAAIA,KAACL,MAC3C,CAMA,QAAIK,GACA,OAAIR,KAAKoC,gBACEwL,EAAAA,sBACHC,EAAAA,MACI,EACA7N,KAAK+C,cACL/C,KAAKmE,GAAG3D,EAAIA,KAACL,QAAUH,KAAKlB,QAAQkE,OAAS,KAKlDd,MAAM1B,IACjB,CAMA,QAAIA,CAAKsN,IACH5M,IAAAA,EAAY6M,OAAOC,yBACjB3M,EAAAA,YAAY4M,UACZ,QACD5C,MAAM6C,KAAKlO,KAAM8N,EACxB,CAMAK,cAAAA,CAAeC,GAGX,OAFApO,KAAKuB,eAAgB,EACrBvB,KAAKW,OAAO0H,QAAO,GACZnG,MAAMiM,eAAeC,EAChC,EASJ,MAAMd,EAAaR,IACf3L,GACIkN,eAAe,KACX,MAAMC,EAAQnN,EACdA,OAASsC,EACT6K,EAAM7G,QAASqF,GAAUA,QAE/B3L,IAAAA,EAAW,KAAI8D,KAAK6H,2DA9aOyB,EAC7B5L,OACA5D,iBAEA4D,GACA+D,EAAAA,mBAAmB0B,SAASzF,IAC5B5D,GAAaC,OAAOsC,mBAAmBkN,aACvCC,EAAaA,iBACbC,EAAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"groups.mjs.js","sources":["../../../../../../../../node_modules/motion-dom/dist/es/animation/waapi/transforms/groups.mjs"],"sourcesContent":["const transformGroups = new WeakMap();\n\nexport { transformGroups };\n//# sourceMappingURL=groups.mjs.map\n"],"names":["transformGroups","WeakMap"],"mappings":"oEAqBaA,MAAAA,EAAkB,IAAIC"}
1
+ {"version":3,"file":"groups.mjs.js","sources":["../../../../../../../../node_modules/motion-dom/dist/es/animation/waapi/transforms/groups.mjs"],"sourcesContent":["const transformGroups = new WeakMap();\n\nexport { transformGroups };\n//# sourceMappingURL=groups.mjs.map\n"],"names":["transformGroups","WeakMap"],"mappings":"oEAsBaA,MAAAA,EAAkB,IAAIC"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=new Set(["opacity","clipPath","filter","transform","backgroundColor"]);exports.acceleratedValues=e;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=new Set(["opacity","clipPath","filter","transform"]);exports.acceleratedValues=e;
2
2
  //# sourceMappingURL=accelerated-values.mjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"accelerated-values.mjs.js","sources":["../../../../../../../../node_modules/motion-dom/dist/es/animation/waapi/utils/accelerated-values.mjs"],"sourcesContent":["/**\n * A list of values that can be hardware-accelerated.\n */\nconst acceleratedValues = new Set([\n \"opacity\",\n \"clipPath\",\n \"filter\",\n \"transform\",\n \"backgroundColor\",\n]);\n\nexport { acceleratedValues };\n//# sourceMappingURL=accelerated-values.mjs.map\n"],"names":["acceleratedValues","Set"],"mappings":"oEAGO,MAAMA,EAAoB,IAAIC,IAAY,CAC7C,UACA,WACA,SACA,YACA"}
1
+ {"version":3,"file":"accelerated-values.mjs.js","sources":["../../../../../../../../node_modules/motion-dom/dist/es/animation/waapi/utils/accelerated-values.mjs"],"sourcesContent":["/**\n * A list of values that can be hardware-accelerated.\n *\n * Colors aren't included: WAAPI mixes them in sRGB, but JS animations\n * (and the sampler that estimates a WAAPI value on interrupt) mix them\n * in linear color space, so interrupting one would visibly jump.\n */\nconst acceleratedValues = new Set([\n \"opacity\",\n \"clipPath\",\n \"filter\",\n \"transform\",\n]);\n\nexport { acceleratedValues };\n//# sourceMappingURL=accelerated-values.mjs.map\n"],"names":["acceleratedValues","Set"],"mappings":"oEAOO,MAAMA,EAAoB,IAAIC,IAAY,CAC7C,UACA,WACA,SACA"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.needsMixer=({mixer:e,keyframes:r})=>e&&"number"!=typeof r[0]&&r.some((s,t)=>t&&e(r[t-1],s));
2
+ //# sourceMappingURL=needs-mixer.mjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"needs-mixer.mjs.js","sources":["../../../../../../../../node_modules/motion-dom/dist/es/animation/waapi/utils/needs-mixer.mjs"],"sourcesContent":["/**\n * Whether an animation needs its mixer, which WAAPI can't call. Numbers\n * blend as usual, and an animation whose mixer declines every pair runs\n * as it would without one.\n */\nconst needsMixer = ({ mixer, keyframes }) => mixer &&\n typeof keyframes[0] !== \"number\" &&\n keyframes.some((keyframe, i) => i && mixer(keyframes[i - 1], keyframe));\n\nexport { needsMixer };\n//# sourceMappingURL=needs-mixer.mjs.map\n"],"names":["needsMixer","mixer","keyframes","some","keyframe","i"],"mappings":"uFAO0BA,EAAGC,QAAOC,eAChCD,GACwB,iBAAjBC,EAAU,IACjBA,EAAUC,KAAK,CAACC,EAAUC,IAAMA,GAAKJ,EAAMC,EAAUG,EAAI,GAAID"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../animation/interfaces/motion-value.mjs.js"),s=require("../../animation/utils/css-variables-conversion.mjs.js"),e=require("../../animation/utils/is-css-variable.mjs.js"),i=require("../../events/add-dom-event.mjs.js"),n=require("../../events/add-pointer-event.mjs.js"),r=require("../../frameloop/frame.mjs.js"),o=require("../../projection/geometry/conversion.mjs.js"),a=require("../../projection/geometry/delta-calc.mjs.js"),l=require("../../projection/geometry/models.mjs.js"),c=require("../../projection/utils/each-axis.mjs.js"),u=require("../../projection/utils/measure.mjs.js"),h=require("../../resize/index.mjs.js"),g=require("../../utils/mix/number.mjs.js"),m=require("../../value/types/numbers/units.mjs.js"),d=require("../../value/will-change/add-will-change.mjs.js"),p=require("../pan/PanSession.mjs.js"),v=require("../press/utils/is-keyboard-accessible.mjs.js"),f=require("./state/set-active.mjs.js"),P=require("./utils/constraints.mjs.js"),j=require("../../../../../motion-utils/dist/es/errors.mjs.js");const x=new WeakMap;function E(t){return!!t&&"object"==typeof t&&("current"in t||"nodeType"in t)}const D=t=>"current"in t?t.current:t;function A(t){let s=!0;return()=>{s?s=!1:t()}}function C(t,s,e){return!(!0!==s&&s!==t||null!==e&&e!==t)}exports.VisualElementDragControls=class{constructor(t,s=()=>t.getProps()){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=l.createBox(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t,this.readProps=s}start(t,{snapToCursor:i=!1,distanceThreshold:n}={}){const{presenceContext:o}=this.visualElement;if(o&&!1===o.isPresent)return;const{dragSnapToOrigin:l}=this.getProps();this.panSession=new p.PanSession(t,{onSessionStart:t=>{i&&this.snapToCursor(t),this.stopAnimation()},onStart:(t,i)=>{const{drag:n,dragPropagation:o,onDragStart:l}=this.getProps();if(n&&!o&&(this.openDragLock&&this.openDragLock(),this.openDragLock=f.setDragLock(n),!this.openDragLock))return;this.latestPointerEvent=t,this.latestPanInfo=i,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),c.eachAxis(t=>{let i=this.getAxisMotionValue(t).get()||0;if(e.isCSSVariableToken(i)&&(i=s.getVariableValue(i,this.visualElement.current)||0),m.px.test(i))i=parseFloat(i);else if(m.percent.test(i)){const{projection:s}=this.visualElement;if(s&&s.layout){const e=s.layout.layoutBox[t];if(e){i=a.calcLength(e)*(parseFloat(i)/100)}}}this.originPoint[t]=i}),l&&r.frame.update(()=>l(t,i),!1,!0),d.addValueToWillChange(this.visualElement,"transform");const{animationState:u}=this.visualElement;u&&u.setActive("whileDrag",!0)},onMove:(t,s)=>{this.latestPointerEvent=t,this.latestPanInfo=s;const{dragPropagation:e,dragDirectionLock:i,onDirectionLock:n,onDrag:o}=this.getProps();if(!e&&!this.openDragLock)return;const{offset:a}=s;if(i&&null===this.currentDirection){if(this.currentDirection=function(t,s=10){let e=null;Math.abs(t.y)>s?e="y":Math.abs(t.x)>s&&(e="x");return e}(a),null===this.currentDirection)return;n&&n(this.currentDirection)}this.updateAxis("x",s.point,a),this.updateAxis("y",s.point,a),this.visualElement.render(),o&&r.frame.update(()=>o(t,s),!1,!0)},onSessionEnd:(t,s)=>{this.latestPointerEvent=t,this.latestPanInfo=s,this.stop(t,s),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation:()=>{const{dragSnapToOrigin:t}=this.getProps();(t||this.constraints)&&this.startAnimation({x:0,y:0})}},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:this.visualElement.current?.ownerDocument.defaultView,element:this.visualElement.current})}stop(t,s,e){const i=t||this.latestPointerEvent,n=s||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!n||!i)return;const{velocity:a}=n;this.startAnimation(a,e);const{onDragEnd:l}=this.getProps();l&&r.frame.postRender(()=>l(i,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:s}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:e}=this.getProps();!e&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,s,e){const{drag:i}=this.getProps();if(!e||!C(t,i,this.currentDirection))return;const n=this.getAxisMotionValue(t);let r=this.originPoint[t]+e[t];this.constraints&&this.constraints[t]&&(r=P.applyConstraints(r,this.constraints[t],this.elastic[t])),n.set(r)}resolveConstraints(){const{dragConstraints:t,dragElastic:s}=this.getProps(),e=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;E(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!e)&&P.calcRelativeConstraints(e.layoutBox,t),this.elastic=P.resolveDragElastic(s),i!==this.constraints&&!E(t)&&e&&this.constraints&&!this.hasMutatedConstraints&&c.eachAxis(t=>{!1!==this.constraints&&this.getAxisMotionValue(t)&&(this.constraints[t]=P.rebaseAxisConstraints(e.layoutBox[t],this.constraints[t]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!E(t))return!1;const e=D(t);j.invariant(!!e,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;i.root&&(i.root.scroll=void 0,i.root.updateScroll());const n=u.measurePageBox(e,i.root,this.visualElement.getTransformPagePoint());let r=P.calcViewportConstraints(i.layout.layoutBox,n);if(s){const t=s(o.convertBoxToBoundingBox(r));this.hasMutatedConstraints=!!t,t&&(r=o.convertBoundingBoxToBox(t))}return r}startAnimation(t,s){const{drag:e,dragMomentum:i,dragElastic:n,dragTransition:r,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=c.eachAxis(a=>{if(!C(a,s||e,this.currentDirection))return;let c=l&&l[a]||{};!0!==o&&o!==a||(c={min:0,max:0});const u=n?200:1e6,h=n?40:1e7,g={type:"inertia",velocity:i?t[a]:0,bounceStiffness:u,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...r,...c};return this.startAxisValueAnimation(a,g)});return Promise.all(u).then(a)}startAxisValueAnimation(s,e){const i=this.getAxisMotionValue(s);return d.addValueToWillChange(this.visualElement,s),i.start(t.animateMotionValue(s,i,0,e,this.visualElement,!1))}stopAnimation(){c.eachAxis(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const s=`_drag${t.toUpperCase()}`,e=this.readProps()[s];return e||this.visualElement.getValue(t,this.visualElement.latestValues[t]??0)}snapToCursor({clientX:t,clientY:s}){const{drag:e}=this.getProps(),i={x:t,y:s},n=this.visualElement.getTransformPagePoint()?.(i)||i,r=this.visualElement.measureViewportBox();c.eachAxis(t=>{if(!C(t,e,this.currentDirection))return;const s=this.getAxisMotionValue(t),{min:i,max:o}=r[t];s.set((s.get()||0)+n[t]-g.mixNumber(i,o,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:s}=this.getProps(),{projection:e}=this.visualElement;if(!E(s)||!e||!this.constraints)return;this.stopAnimation();const i=this.constraints,n={x:0,y:0};c.eachAxis(t=>{const s=this.getAxisMotionValue(t).get();n[t]=P.calcOrigin({min:s,max:s},i[t])});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",e.root&&e.root.updateScroll(),e.updateLayout(),this.constraints=!1,this.resolveConstraints(),c.eachAxis(s=>{const e=this.getAxisMotionValue(s);if(!C(s,t,null)||!e.get())return;const{min:i,max:r}=this.constraints[s];e.set(g.mixNumber(i,r,n[s]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;x.set(this.visualElement,this);const t=this.visualElement.current,s=n.addPointerEvent(t,"pointerdown",s=>{const{drag:e,dragListener:i=!0}=this.getProps(),n=s.target,r=n!==t&&v.isElementTextInput(n);e&&i&&!r&&this.start(s)});let e;const o=()=>{const{dragConstraints:s}=this.getProps(),i=E(s)&&D(s);i&&(this.constraints=this.resolveRefConstraints(),e||(e=function(t,s,e){const i=h.resize(t,A(e)),n=h.resize(s,A(e));return()=>{i(),n()}}(t,i,()=>this.scalePositionWithinConstraints())))},{projection:a}=this.visualElement,l=a.addEventListener("measure",o);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),r.frame.read(o);const u=i.addDomEvent(window,"resize",()=>this.scalePositionWithinConstraints()),g=a.addEventListener("didUpdate",({delta:t,hasLayoutChanged:s})=>{this.isDragging&&s&&(c.eachAxis(s=>{if(!C(s,this.getProps().drag,this.currentDirection))return;const e=this.getAxisMotionValue(s);this.originPoint[s]+=t[s].translate,e.set(e.get()+t[s].translate)}),this.visualElement.render())});return()=>{u(),s(),l(),g&&g(),e&&e()}}getProps(){const t=this.readProps(),{drag:s=!1,dragDirectionLock:e=!1,dragPropagation:i=!1,dragConstraints:n=!1,dragElastic:r=P.defaultElastic,dragMomentum:o=!0}=t;return{...t,drag:s,dragDirectionLock:e,dragPropagation:i,dragConstraints:n,dragElastic:r,dragMomentum:o}}},exports.elementDragControls=x;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../animation/interfaces/motion-value.mjs.js"),s=require("../../animation/utils/css-variables-conversion.mjs.js"),e=require("../../animation/utils/is-css-variable.mjs.js"),i=require("../../events/add-dom-event.mjs.js"),n=require("../../events/add-pointer-event.mjs.js"),r=require("../../frameloop/frame.mjs.js"),o=require("../../projection/geometry/conversion.mjs.js"),a=require("../../projection/geometry/delta-calc.mjs.js"),l=require("../../projection/geometry/models.mjs.js"),c=require("../../projection/utils/each-axis.mjs.js"),u=require("../../projection/utils/measure.mjs.js"),h=require("../../resize/index.mjs.js"),g=require("../../utils/mix/number.mjs.js"),m=require("../../value/types/numbers/units.mjs.js"),p=require("../../value/will-change/add-will-change.mjs.js"),d=require("../pan/PanSession.mjs.js"),v=require("../press/utils/is-keyboard-accessible.mjs.js"),f=require("./state/set-active.mjs.js"),x=require("./utils/constraints.mjs.js"),P=require("../../../../../motion-utils/dist/es/errors.mjs.js");function j(t){let s="";for(const e of t.path){e.scroll=void 0,e.updateScroll();const{scroll:i}=e;e!==t.root&&i&&(s+=i.offset.x+","+i.offset.y+",")}return s}const E=new WeakMap;function D(t){return!!t&&"object"==typeof t&&("current"in t||"nodeType"in t)}const y=t=>"current"in t?t.current:t;function A(t){let s=!0;return()=>{s?s=!1:t()}}function C(t,s,e){return!(!0!==s&&s!==t||null!==e&&e!==t)}exports.VisualElementDragControls=class{constructor(t,s=()=>t.getProps()){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=l.createBox(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t,this.readProps=s}start(t,i={}){if(!1===this.visualElement.presenceContext?.isPresent)return;const{dragSnapToOrigin:n}=this.getProps();this.panSession=new d.PanSession(t,{onSessionStart:t=>{i.snapToCursor&&this.snapToCursor(t),this.stopAnimation()},onStart:(t,i)=>{const{drag:n,dragConstraints:o,dragPropagation:l,onDragStart:u}=this.getProps();if(n&&!l&&(this.openDragLock?.(),this.openDragLock=f.setDragLock(n),!this.openDragLock))return;this.latestPointerEvent=t,this.latestPanInfo=i,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints();const{projection:h}=this.visualElement;h&&(h.isAnimationBlocked=!0,h.target=void 0),c.eachAxis(t=>{let i=this.getAxisMotionValue(t).get()||0;if(e.isCSSVariableToken(i)&&(i=s.getVariableValue(i,this.visualElement.current)||0),m.px.test(i))i=parseFloat(i);else if(m.percent.test(i)){const s=h?.layout?.layoutBox[t];s&&(i=a.calcLength(s)*(parseFloat(i)/100))}this.originPoint[t]=i}),this.point="function"==typeof o&&o(this),u&&r.frame.update(()=>u(t,i),!1,!0),p.addValueToWillChange(this.visualElement,"transform"),this.visualElement.animationState?.setActive("whileDrag",!0)},onMove:(t,s)=>{this.latestPointerEvent=t,this.latestPanInfo=s;const{dragPropagation:e,dragDirectionLock:i,onDirectionLock:n,onDrag:o}=this.getProps();if(!e&&!this.openDragLock)return;const{offset:a}=s;if(i&&null===this.currentDirection){if(this.currentDirection=function(t,s=10){let e=null;Math.abs(t.y)>s?e="y":Math.abs(t.x)>s&&(e="x");return e}(a),null===this.currentDirection)return;n&&n(this.currentDirection)}this.updateAxis("x",a),this.updateAxis("y",a),this.point&&this.point.move(),this.visualElement.render(),o&&r.frame.update(()=>o(t,s),!1,!0)},onSessionEnd:(t,s)=>{this.latestPointerEvent=t,this.latestPanInfo=s,this.stop(t,s),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation:()=>{const{dragSnapToOrigin:t}=this.getProps();(t||this.constraints||this.point)&&this.startAnimation({x:0,y:0})}},{...i,transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:n,contextWindow:this.visualElement.current?.ownerDocument.defaultView,element:this.visualElement.current})}stop(t,s,e){const i=t||this.latestPointerEvent,n=s||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!n||!i)return;const{velocity:a}=n;this.startAnimation(a,e);const{onDragEnd:l}=this.getProps();l&&r.frame.postRender(()=>l(i,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:s}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession(),!this.getProps().dragPropagation&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s?.setActive("whileDrag",!1)}endPanSession(){this.panSession?.end(),this.panSession=void 0}updateAxis(t,s){const{drag:e}=this.readProps();if(!s||!C(t,e,this.currentDirection))return;const i=this.getAxisMotionValue(t);let n=this.originPoint[t]+s[t];const r=this.constraints&&this.constraints[t];r&&(n=x.applyConstraints(n,r,this.elastic[t])),this.point?this.point[t]=n:i.set(n)}resolveConstraints(){const{dragConstraints:t,dragElastic:s}=this.getProps(),{projection:e}=this.visualElement,i=e&&(e.layout||e.measure(!1)),n=this.constraints;D(t)?this.constraints&&this.scroll===j(e)||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!i||"object"!=typeof t)&&x.calcRelativeConstraints(i.layoutBox,t),this.elastic=x.resolveDragElastic(s),n!==this.constraints&&!D(t)&&i&&this.constraints&&!this.hasMutatedConstraints&&c.eachAxis(t=>{!1!==this.constraints&&this.getAxisMotionValue(t)&&(this.constraints[t]=x.rebaseAxisConstraints(i.layoutBox[t],this.constraints[t]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!D(t))return!1;const e=y(t);"production"!==process.env.NODE_ENV&&P.invariant(!!e,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;this.scroll=j(i);const n=u.measurePageBox(e,i.root,this.visualElement.getTransformPagePoint());let r=x.calcViewportConstraints(i.layout.layoutBox,i.removeElementScroll(n));if(s){const t=s(o.convertBoxToBoundingBox(r));this.hasMutatedConstraints=!!t,t&&(r=o.convertBoundingBoxToBox(t))}return r}startAnimation(t,s){const{drag:e,dragMomentum:i,dragElastic:n,dragTransition:r,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l={bounceStiffness:n?200:1e6,bounceDamping:n?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...r},u=n=>!i||this.point&&o||!C(n,s||e,this.currentDirection)?0:t[n];if(this.point&&!o)return this.point.release({x:u("x"),y:u("y")},l).then(a);const h=this.constraints||{},g=c.eachAxis(t=>{if(!C(t,s||e,this.currentDirection))return;let i=h[t]||{};!0!==o&&o!==t||(i={min:0,max:0});const n={type:"inertia",velocity:u(t),...l,...i};return this.startAxisValueAnimation(t,n)});return Promise.all(g).then(a)}startAxisValueAnimation(s,e){const i=this.getAxisMotionValue(s);return p.addValueToWillChange(this.visualElement,s),i.start(t.animateMotionValue(s,i,0,e,this.visualElement,!1))}stopAnimation(){c.eachAxis(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const s=`_drag${t.toUpperCase()}`,e=this.readProps()[s];return e||this.visualElement.getValue(t,this.visualElement.latestValues[t]??0)}snapToCursor({clientX:t,clientY:s}){const{drag:e}=this.getProps(),i={x:t,y:s},n=this.visualElement.getTransformPagePoint()?.(i)||i,r=this.visualElement.measureViewportBox();c.eachAxis(t=>{if(!C(t,e,this.currentDirection))return;const s=this.getAxisMotionValue(t),{min:i,max:o}=r[t];s.set((s.get()||0)+n[t]-g.mixNumber(i,o,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:s}=this.getProps(),{projection:e}=this.visualElement;if(!D(s)||!e||!this.constraints)return;this.stopAnimation();const i=this.constraints,n={x:0,y:0};c.eachAxis(t=>{const s=this.getAxisMotionValue(t).get();n[t]=x.calcOrigin({min:s,max:s},i[t])});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",e.root?.updateScroll(),e.updateLayout(),this.constraints=!1,this.resolveConstraints(),c.eachAxis(s=>{const e=this.getAxisMotionValue(s);if(!C(s,t,null)||!e.get())return;const{min:i,max:r}=this.constraints[s];e.set(g.mixNumber(i,r,n[s]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;E.set(this.visualElement,this);const t=this.visualElement.current,s=n.addPointerEvent(t,"pointerdown",s=>{const{drag:e,dragListener:i=!0}=this.getProps(),n=s.target,r=n!==t&&v.isElementTextInput(n);e&&i&&!r&&this.start(s)});let e;const o=()=>{const{dragConstraints:s}=this.getProps(),i=D(s)&&y(s);i&&(this.constraints=this.resolveRefConstraints(),e||(e=function(t,s,e){const i=h.resize(t,A(e)),n=h.resize(s,A(e));return()=>{i(),n()}}(t,i,()=>this.scalePositionWithinConstraints())))},{projection:a}=this.visualElement,l=a.addEventListener("measure",o);a.layout||(a.root?.updateScroll(),a.updateLayout()),r.frame.read(o);const u=i.addDomEvent(window,"resize",()=>this.scalePositionWithinConstraints()),g=a.addEventListener("didUpdate",({delta:t,hasLayoutChanged:s})=>{this.isDragging&&s&&(c.eachAxis(s=>{if(!C(s,this.getProps().drag,this.currentDirection))return;const e=this.getAxisMotionValue(s);this.originPoint[s]+=t[s].translate,e.set(e.get()+t[s].translate)}),this.visualElement.render())});return()=>{u(),s(),l(),g(),e?.()}}getProps(){const t=this.readProps(),{dragElastic:s=x.defaultElastic,dragMomentum:e=!0}=t;return{...t,dragElastic:s,dragMomentum:e}}},exports.elementDragControls=E;
2
2
  //# sourceMappingURL=VisualElementDragControls.mjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VisualElementDragControls.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/gestures/drag/VisualElementDragControls.mjs"],"sourcesContent":["import { invariant } from 'motion-utils';\nimport { animateMotionValue } from '../../animation/interfaces/motion-value.mjs';\nimport { getVariableValue } from '../../animation/utils/css-variables-conversion.mjs';\nimport { isCSSVariableToken } from '../../animation/utils/is-css-variable.mjs';\nimport { addDomEvent } from '../../events/add-dom-event.mjs';\nimport { addPointerEvent } from '../../events/add-pointer-event.mjs';\nimport { frame } from '../../frameloop/frame.mjs';\nimport { convertBoxToBoundingBox, convertBoundingBoxToBox } from '../../projection/geometry/conversion.mjs';\nimport { calcLength } from '../../projection/geometry/delta-calc.mjs';\nimport { createBox } from '../../projection/geometry/models.mjs';\nimport { eachAxis } from '../../projection/utils/each-axis.mjs';\nimport { measurePageBox } from '../../projection/utils/measure.mjs';\nimport { resize } from '../../resize/index.mjs';\nimport { mixNumber } from '../../utils/mix/number.mjs';\nimport { px, percent } from '../../value/types/numbers/units.mjs';\nimport { addValueToWillChange } from '../../value/will-change/add-will-change.mjs';\nimport { PanSession } from '../pan/PanSession.mjs';\nimport { isElementTextInput } from '../press/utils/is-keyboard-accessible.mjs';\nimport { setDragLock } from './state/set-active.mjs';\nimport { applyConstraints, calcRelativeConstraints, resolveDragElastic, calcViewportConstraints, defaultElastic, rebaseAxisConstraints, calcOrigin } from './utils/constraints.mjs';\n\nconst elementDragControls = new WeakMap();\nclass VisualElementDragControls {\n constructor(visualElement, readProps = () => visualElement.getProps()) {\n this.openDragLock = null;\n this.isDragging = false;\n this.currentDirection = null;\n this.originPoint = { x: 0, y: 0 };\n /**\n * The permitted boundaries of travel, in pixels.\n */\n this.constraints = false;\n this.hasMutatedConstraints = false;\n /**\n * The per-axis resolved elastic values.\n */\n this.elastic = createBox();\n /**\n * The latest pointer event. Used as fallback when the `cancel` and `stop` functions are called without arguments.\n */\n this.latestPointerEvent = null;\n /**\n * The latest pan info. Used as fallback when the `cancel` and `stop` functions are called without arguments.\n */\n this.latestPanInfo = null;\n this.visualElement = visualElement;\n this.readProps = readProps;\n }\n start(originEvent, { snapToCursor = false, distanceThreshold } = {}) {\n /**\n * Don't start dragging if this component is exiting\n */\n const { presenceContext } = this.visualElement;\n if (presenceContext && presenceContext.isPresent === false)\n return;\n const onSessionStart = (event) => {\n if (snapToCursor)\n this.snapToCursor(event);\n this.stopAnimation();\n };\n const onStart = (event, info) => {\n // Attempt to grab the global drag gesture lock - maybe make this part of PanSession\n const { drag, dragPropagation, onDragStart } = this.getProps();\n if (drag && !dragPropagation) {\n if (this.openDragLock)\n this.openDragLock();\n this.openDragLock = setDragLock(drag);\n // If we don 't have the lock, don't start dragging\n if (!this.openDragLock)\n return;\n }\n this.latestPointerEvent = event;\n this.latestPanInfo = info;\n this.isDragging = true;\n this.currentDirection = null;\n this.resolveConstraints();\n if (this.visualElement.projection) {\n this.visualElement.projection.isAnimationBlocked = true;\n this.visualElement.projection.target = undefined;\n }\n /**\n * Record gesture origin and pointer offset\n */\n eachAxis((axis) => {\n let current = this.getAxisMotionValue(axis).get() || 0;\n /**\n * If the MotionValue is a CSS variable, like \"var(--y)\",\n * resolve it so it can be converted to px below.\n */\n if (isCSSVariableToken(current)) {\n current =\n getVariableValue(current, this.visualElement.current) || 0;\n }\n /**\n * If the MotionValue is a px or percentage value convert to px\n */\n if (px.test(current)) {\n current = parseFloat(current);\n }\n else if (percent.test(current)) {\n const { projection } = this.visualElement;\n if (projection && projection.layout) {\n const measuredAxis = projection.layout.layoutBox[axis];\n if (measuredAxis) {\n const length = calcLength(measuredAxis);\n current = length * (parseFloat(current) / 100);\n }\n }\n }\n this.originPoint[axis] = current;\n });\n // Fire onDragStart event\n if (onDragStart) {\n frame.update(() => onDragStart(event, info), false, true);\n }\n addValueToWillChange(this.visualElement, \"transform\");\n const { animationState } = this.visualElement;\n animationState && animationState.setActive(\"whileDrag\", true);\n };\n const onMove = (event, info) => {\n this.latestPointerEvent = event;\n this.latestPanInfo = info;\n const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag, } = this.getProps();\n // If we didn't successfully receive the gesture lock, early return.\n if (!dragPropagation && !this.openDragLock)\n return;\n const { offset } = info;\n // Attempt to detect drag direction if directionLock is true\n if (dragDirectionLock && this.currentDirection === null) {\n this.currentDirection = getCurrentDirection(offset);\n /**\n * Wait for more movement until a direction is set. Once\n * it is, apply this move too: it can be the last before\n * release when the browser coalesces a fast gesture.\n */\n if (this.currentDirection === null)\n return;\n onDirectionLock && onDirectionLock(this.currentDirection);\n }\n // Update each point with the latest position\n this.updateAxis(\"x\", info.point, offset);\n this.updateAxis(\"y\", info.point, offset);\n /**\n * Ideally we would leave the renderer to fire naturally at the end of\n * this frame but if the element is about to change layout as the result\n * of a re-render we want to ensure the browser can read the latest\n * bounding box to ensure the pointer and element don't fall out of sync.\n */\n this.visualElement.render();\n /**\n * This must fire after the render call as it might trigger a state\n * change which itself might trigger a layout update.\n */\n if (onDrag) {\n frame.update(() => onDrag(event, info), false, true);\n }\n };\n const onSessionEnd = (event, info) => {\n this.latestPointerEvent = event;\n this.latestPanInfo = info;\n this.stop(event, info);\n this.latestPointerEvent = null;\n this.latestPanInfo = null;\n };\n const resumeAnimation = () => {\n const { dragSnapToOrigin: snap } = this.getProps();\n if (snap || this.constraints) {\n this.startAnimation({ x: 0, y: 0 });\n }\n };\n const { dragSnapToOrigin } = this.getProps();\n this.panSession = new PanSession(originEvent, {\n onSessionStart,\n onStart,\n onMove,\n onSessionEnd,\n resumeAnimation,\n }, {\n transformPagePoint: this.visualElement.getTransformPagePoint(),\n dragSnapToOrigin,\n distanceThreshold,\n contextWindow: this.visualElement.current?.ownerDocument.defaultView,\n element: this.visualElement.current,\n });\n }\n /**\n * @param dragAxes - The axes to animate on release, if not the `drag`\n * prop's, e.g. when drag was disabled mid-gesture.\n */\n stop(event, panInfo, dragAxes) {\n const finalEvent = event || this.latestPointerEvent;\n const finalPanInfo = panInfo || this.latestPanInfo;\n const isDragging = this.isDragging;\n this.cancel();\n if (!isDragging || !finalPanInfo || !finalEvent)\n return;\n const { velocity } = finalPanInfo;\n this.startAnimation(velocity, dragAxes);\n const { onDragEnd } = this.getProps();\n if (onDragEnd) {\n frame.postRender(() => onDragEnd(finalEvent, finalPanInfo));\n }\n }\n cancel() {\n this.isDragging = false;\n const { projection, animationState } = this.visualElement;\n if (projection) {\n projection.isAnimationBlocked = false;\n }\n this.endPanSession();\n const { dragPropagation } = this.getProps();\n if (!dragPropagation && this.openDragLock) {\n this.openDragLock();\n this.openDragLock = null;\n }\n animationState && animationState.setActive(\"whileDrag\", false);\n }\n /**\n * Clean up the pan session without modifying other drag state.\n * This is used during unmount to ensure event listeners are removed\n * without affecting projection animations or drag locks.\n */\n endPanSession() {\n this.panSession && this.panSession.end();\n this.panSession = undefined;\n }\n updateAxis(axis, _point, offset) {\n const { drag } = this.getProps();\n // If we're not dragging this axis, do an early return.\n if (!offset || !shouldDrag(axis, drag, this.currentDirection))\n return;\n const axisValue = this.getAxisMotionValue(axis);\n let next = this.originPoint[axis] + offset[axis];\n // Apply constraints\n if (this.constraints && this.constraints[axis]) {\n next = applyConstraints(next, this.constraints[axis], this.elastic[axis]);\n }\n axisValue.set(next);\n }\n resolveConstraints() {\n const { dragConstraints, dragElastic } = this.getProps();\n const layout = this.visualElement.projection &&\n !this.visualElement.projection.layout\n ? this.visualElement.projection.measure(false)\n : this.visualElement.projection?.layout;\n const prevConstraints = this.constraints;\n if (isElementConstraints(dragConstraints)) {\n if (!this.constraints) {\n this.constraints = this.resolveRefConstraints();\n }\n }\n else {\n if (dragConstraints && layout) {\n this.constraints = calcRelativeConstraints(layout.layoutBox, dragConstraints);\n }\n else {\n this.constraints = false;\n }\n }\n this.elastic = resolveDragElastic(dragElastic);\n /**\n * If we're outputting to external MotionValues, we want to rebase the measured constraints\n * from viewport-relative to component-relative. This only applies to relative (non-ref)\n * constraints, as ref-based constraints from calcViewportConstraints are already in the\n * correct coordinate space for the motion value transform offset.\n */\n if (prevConstraints !== this.constraints &&\n !isElementConstraints(dragConstraints) &&\n layout &&\n this.constraints &&\n !this.hasMutatedConstraints) {\n eachAxis((axis) => {\n if (this.constraints !== false &&\n this.getAxisMotionValue(axis)) {\n this.constraints[axis] = rebaseAxisConstraints(layout.layoutBox[axis], this.constraints[axis]);\n }\n });\n }\n }\n resolveRefConstraints() {\n const { dragConstraints: constraints, onMeasureDragConstraints } = this.getProps();\n if (!isElementConstraints(constraints))\n return false;\n const constraintsElement = resolveConstraintsElement(constraints);\n invariant(!!constraintsElement, \"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.\", \"drag-constraints-ref\");\n const { projection } = this.visualElement;\n // TODO\n if (!projection || !projection.layout)\n return false;\n /**\n * Refresh the root scroll offset so the constraint's viewport box\n * translates to correct page coordinates. The scroll captured at\n * drag mount can be stale if the document was scrolled afterwards —\n * e.g. via the browser restoring scroll on refresh, or an ancestor\n * layout effect running after this element's mount (#2829).\n *\n * Clear the cached scroll first so `updateScroll` bypasses its\n * per-animationId cache and re-reads the live value.\n */\n if (projection.root) {\n projection.root.scroll = undefined;\n projection.root.updateScroll();\n }\n const constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint());\n let measuredConstraints = calcViewportConstraints(projection.layout.layoutBox, constraintsBox);\n /**\n * If there's an onMeasureDragConstraints listener we call it and\n * if different constraints are returned, set constraints to that\n */\n if (onMeasureDragConstraints) {\n const userConstraints = onMeasureDragConstraints(convertBoxToBoundingBox(measuredConstraints));\n this.hasMutatedConstraints = !!userConstraints;\n if (userConstraints) {\n measuredConstraints = convertBoundingBoxToBox(userConstraints);\n }\n }\n return measuredConstraints;\n }\n startAnimation(velocity, dragAxes) {\n const { drag, dragMomentum, dragElastic, dragTransition, dragSnapToOrigin, onDragTransitionEnd, } = this.getProps();\n const constraints = this.constraints || {};\n const momentumAnimations = eachAxis((axis) => {\n if (!shouldDrag(axis, dragAxes || drag, this.currentDirection)) {\n return;\n }\n let transition = (constraints && constraints[axis]) || {};\n if (dragSnapToOrigin === true ||\n dragSnapToOrigin === axis)\n transition = { min: 0, max: 0 };\n /**\n * Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame\n * of spring animations so we should look into adding a disable spring option to `inertia`.\n * We could do something here where we affect the `bounceStiffness` and `bounceDamping`\n * using the value of `dragElastic`.\n */\n const bounceStiffness = dragElastic ? 200 : 1000000;\n const bounceDamping = dragElastic ? 40 : 10000000;\n const inertia = {\n type: \"inertia\",\n velocity: dragMomentum ? velocity[axis] : 0,\n bounceStiffness,\n bounceDamping,\n timeConstant: 750,\n restDelta: 1,\n restSpeed: 10,\n ...dragTransition,\n ...transition,\n };\n // If we're not animating on an externally-provided `MotionValue` we can use the\n // component's animation controls which will handle interactions with whileHover (etc),\n // otherwise we just have to animate the `MotionValue` itself.\n return this.startAxisValueAnimation(axis, inertia);\n });\n // Run all animations and then resolve the new drag constraints.\n return Promise.all(momentumAnimations).then(onDragTransitionEnd);\n }\n startAxisValueAnimation(axis, transition) {\n const axisValue = this.getAxisMotionValue(axis);\n addValueToWillChange(this.visualElement, axis);\n return axisValue.start(animateMotionValue(axis, axisValue, 0, transition, this.visualElement, false));\n }\n stopAnimation() {\n eachAxis((axis) => this.getAxisMotionValue(axis).stop());\n }\n /**\n * Drag works differently depending on which props are provided.\n *\n * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.\n * - Otherwise, we apply the delta to the x/y motion values.\n */\n getAxisMotionValue(axis) {\n const dragKey = `_drag${axis.toUpperCase()}`;\n const props = this.readProps();\n const externalMotionValue = props[dragKey];\n return externalMotionValue\n ? externalMotionValue\n : this.visualElement.getValue(axis, this.visualElement.latestValues[axis] ?? 0);\n }\n /**\n * Measure the live box - projection.layout may or may not include the\n * drag transform, depending on when it was measured.\n */\n snapToCursor({ clientX, clientY }) {\n const { drag } = this.getProps();\n const point = { x: clientX, y: clientY };\n const cursor = this.visualElement.getTransformPagePoint()?.(point) || point;\n const box = this.visualElement.measureViewportBox();\n eachAxis((axis) => {\n if (!shouldDrag(axis, drag, this.currentDirection))\n return;\n const axisValue = this.getAxisMotionValue(axis);\n const { min, max } = box[axis];\n axisValue.set((axisValue.get() || 0) + cursor[axis] - mixNumber(min, max, 0.5));\n });\n }\n /**\n * When the viewport resizes we want to check if the measured constraints\n * have changed and, if so, reposition the element within those new constraints\n * relative to where it was before the resize.\n */\n scalePositionWithinConstraints() {\n if (!this.visualElement.current)\n return;\n const { drag, dragConstraints } = this.getProps();\n const { projection } = this.visualElement;\n if (!isElementConstraints(dragConstraints) ||\n !projection ||\n !this.constraints)\n return;\n /**\n * Stop current animations as there can be visual glitching if we try to do\n * this mid-animation\n */\n this.stopAnimation();\n /**\n * Record the relative position of the dragged element relative to the\n * constraints box and save as a progress value.\n */\n const constraints = this.constraints;\n const boxProgress = { x: 0, y: 0 };\n eachAxis((axis) => {\n const latest = this.getAxisMotionValue(axis).get();\n boxProgress[axis] = calcOrigin({ min: latest, max: latest }, constraints[axis]);\n });\n /**\n * Update the layout of this element and resolve the latest drag constraints\n */\n const { transformTemplate } = this.visualElement.getProps();\n this.visualElement.current.style.transform = transformTemplate\n ? transformTemplate({}, \"\")\n : \"none\";\n projection.root && projection.root.updateScroll();\n projection.updateLayout();\n /**\n * Reset constraints so resolveConstraints() will recalculate them\n * with the freshly measured layout rather than returning the cached value.\n */\n this.constraints = false;\n this.resolveConstraints();\n /**\n * For each axis, calculate the current progress of the layout axis\n * within the new constraints.\n */\n eachAxis((axis) => {\n const axisValue = this.getAxisMotionValue(axis);\n /**\n * An element resting at its origin has no offset to preserve,\n * and re-projecting 0 into the new constraints would move it.\n */\n if (!shouldDrag(axis, drag, null) || !axisValue.get())\n return;\n /**\n * Calculate a new transform based on the previous box progress\n */\n const { min, max } = this.constraints[axis];\n axisValue.set(mixNumber(min, max, boxProgress[axis]));\n });\n /**\n * Flush the updated transform to the DOM synchronously to prevent\n * a visual flash at the element's CSS layout position (0,0) when\n * the transform was stripped for measurement.\n */\n this.visualElement.render();\n }\n addListeners() {\n if (!this.visualElement.current)\n return;\n elementDragControls.set(this.visualElement, this);\n const element = this.visualElement.current;\n /**\n * Attach a pointerdown event listener on this DOM element to initiate drag tracking.\n */\n const stopPointerListener = addPointerEvent(element, \"pointerdown\", (event) => {\n const { drag, dragListener = true } = this.getProps();\n const target = event.target;\n /**\n * Only block drag if clicking on a text input child element\n * (input, textarea, select, contenteditable) where users might\n * want to select text or interact with the control.\n *\n * Buttons and links don't block drag since they don't have\n * click-and-move actions of their own.\n */\n const isClickingTextInputChild = target !== element && isElementTextInput(target);\n if (drag && dragListener && !isClickingTextInputChild) {\n this.start(event);\n }\n });\n /**\n * If using ref-based constraints, observe both the draggable element\n * and the constraint container for size changes via ResizeObserver.\n * Setup is deferred because dragConstraints.current is null when\n * addListeners first runs (React hasn't committed the ref yet).\n */\n let stopResizeObservers;\n const measureDragConstraints = () => {\n const { dragConstraints } = this.getProps();\n const constraintsElement = isElementConstraints(dragConstraints) &&\n resolveConstraintsElement(dragConstraints);\n if (constraintsElement) {\n this.constraints = this.resolveRefConstraints();\n if (!stopResizeObservers) {\n stopResizeObservers = startResizeObservers(element, constraintsElement, () => this.scalePositionWithinConstraints());\n }\n }\n };\n const { projection } = this.visualElement;\n const stopMeasureLayoutListener = projection.addEventListener(\"measure\", measureDragConstraints);\n if (projection && !projection.layout) {\n projection.root && projection.root.updateScroll();\n projection.updateLayout();\n }\n frame.read(measureDragConstraints);\n /**\n * Attach a window resize listener to scale the draggable target within its defined\n * constraints as the window resizes.\n */\n const stopResizeListener = addDomEvent(window, \"resize\", () => this.scalePositionWithinConstraints());\n /**\n * If the element's layout changes, calculate the delta and apply that to\n * the drag gesture's origin point.\n */\n const stopLayoutUpdateListener = projection.addEventListener(\"didUpdate\", (({ delta, hasLayoutChanged }) => {\n if (this.isDragging && hasLayoutChanged) {\n eachAxis((axis) => {\n /**\n * Only compensate axes this gesture drags. A\n * non-drag axis follows its layout instead, as\n * nothing would ever move it back (e.g. snapping\n * to origin only animates drag axes).\n */\n if (!shouldDrag(axis, this.getProps().drag, this.currentDirection))\n return;\n const motionValue = this.getAxisMotionValue(axis);\n this.originPoint[axis] += delta[axis].translate;\n motionValue.set(motionValue.get() + delta[axis].translate);\n });\n this.visualElement.render();\n }\n }));\n return () => {\n stopResizeListener();\n stopPointerListener();\n stopMeasureLayoutListener();\n stopLayoutUpdateListener && stopLayoutUpdateListener();\n stopResizeObservers && stopResizeObservers();\n };\n }\n getProps() {\n const props = this.readProps();\n const { drag = false, dragDirectionLock = false, dragPropagation = false, dragConstraints = false, dragElastic = defaultElastic, dragMomentum = true, } = props;\n return {\n ...props,\n drag,\n dragDirectionLock,\n dragPropagation,\n dragConstraints,\n dragElastic,\n dragMomentum,\n };\n }\n}\n/**\n * `dragConstraints` can be an element, or a ref (`{ current }`) to one.\n */\nfunction isElementConstraints(constraints) {\n return (!!constraints &&\n typeof constraints === \"object\" &&\n (\"current\" in constraints || \"nodeType\" in constraints));\n}\nconst resolveConstraintsElement = (constraints) => \"current\" in constraints ? constraints.current : constraints;\nfunction skipFirstCall(callback) {\n let isFirst = true;\n return () => {\n if (isFirst) {\n isFirst = false;\n return;\n }\n callback();\n };\n}\nfunction startResizeObservers(element, constraintsElement, onResize) {\n const stopElement = resize(element, skipFirstCall(onResize));\n const stopContainer = resize(constraintsElement, skipFirstCall(onResize));\n return () => {\n stopElement();\n stopContainer();\n };\n}\nfunction shouldDrag(direction, drag, currentDirection) {\n return ((drag === true || drag === direction) &&\n (currentDirection === null || currentDirection === direction));\n}\n/**\n * Based on an x/y offset determine the current drag direction. If both axis' offsets are lower\n * than the provided threshold, return `null`.\n *\n * @param offset - The x/y offset from origin.\n * @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction.\n */\nfunction getCurrentDirection(offset, lockThreshold = 10) {\n let direction = null;\n if (Math.abs(offset.y) > lockThreshold) {\n direction = \"y\";\n }\n else if (Math.abs(offset.x) > lockThreshold) {\n direction = \"x\";\n }\n return direction;\n}\nfunction expectsResolvedDragConstraints({ dragConstraints, onMeasureDragConstraints, }) {\n return isElementConstraints(dragConstraints) && !!onMeasureDragConstraints;\n}\n\nexport { VisualElementDragControls, elementDragControls, expectsResolvedDragConstraints };\n//# sourceMappingURL=VisualElementDragControls.mjs.map\n"],"names":["elementDragControls","WeakMap","isElementConstraints","constraints","resolveConstraintsElement","current","skipFirstCall","callback","isFirst","shouldDrag","direction","drag","currentDirection","constructor","visualElement","readProps","getProps","this","openDragLock","isDragging","originPoint","x","y","hasMutatedConstraints","elastic","createBox","latestPointerEvent","latestPanInfo","start","originEvent","snapToCursor","distanceThreshold","presenceContext","isPresent","dragSnapToOrigin","panSession","PanSession","onSessionStart","event","stopAnimation","onStart","info","dragPropagation","onDragStart","setDragLock","resolveConstraints","projection","isAnimationBlocked","target","undefined","eachAxis","axis","getAxisMotionValue","get","isCSSVariableToken","getVariableValue","px","test","parseFloat","percent","layout","measuredAxis","layoutBox","calcLength","frame","update","addValueToWillChange","animationState","setActive","onMove","dragDirectionLock","onDirectionLock","onDrag","offset","lockThreshold","Math","abs","getCurrentDirection","updateAxis","point","render","onSessionEnd","stop","resumeAnimation","snap","startAnimation","transformPagePoint","getTransformPagePoint","contextWindow","ownerDocument","defaultView","element","panInfo","dragAxes","finalEvent","finalPanInfo","cancel","velocity","onDragEnd","postRender","endPanSession","end","_point","axisValue","next","applyConstraints","set","dragConstraints","dragElastic","measure","prevConstraints","resolveRefConstraints","calcRelativeConstraints","resolveDragElastic","rebaseAxisConstraints","onMeasureDragConstraints","constraintsElement","invariant","root","scroll","updateScroll","constraintsBox","measurePageBox","measuredConstraints","calcViewportConstraints","userConstraints","convertBoxToBoundingBox","convertBoundingBoxToBox","dragMomentum","dragTransition","onDragTransitionEnd","momentumAnimations","transition","min","max","bounceStiffness","bounceDamping","inertia","type","timeConstant","restDelta","restSpeed","startAxisValueAnimation","Promise","all","then","animateMotionValue","dragKey","toUpperCase","externalMotionValue","getValue","latestValues","clientX","clientY","cursor","box","measureViewportBox","mixNumber","scalePositionWithinConstraints","boxProgress","latest","calcOrigin","transformTemplate","style","transform","updateLayout","addListeners","stopPointerListener","addPointerEvent","dragListener","isClickingTextInputChild","isElementTextInput","stopResizeObservers","measureDragConstraints","onResize","stopElement","resize","stopContainer","startResizeObservers","stopMeasureLayoutListener","addEventListener","read","stopResizeListener","addDomEvent","window","stopLayoutUpdateListener","delta","hasLayoutChanged","motionValue","translate","props","defaultElastic"],"mappings":"4kCAsCaA,MAAAA,EAAsB,IAAIC,QAyyBvC,SAASC,EACLC,GAEA,QACMA,GACqB,iBAAhBA,IACN,YAAaA,GAAe,aAAcA,EAEnD,CAEA,MAAMC,EAA6BD,GAC/B,YAAaA,EAAcA,EAAYE,QAAUF,EAErD,SAASG,EAAcC,GACnB,IAAIC,GAAU,EACd,MAAO,KACCA,EACAA,GAAU,EAGdD,IAER,CAeA,SAASE,EACLC,EACAC,EACAC,GAEA,SACc,IAATD,GAAiBA,IAASD,GACL,OAArBE,GAA6BA,IAAqBF,EAE3D,yCAvxBIG,WAAAA,CACIC,EACAC,EAAqCA,IAAMD,EAAcE,YAtCrDC,KAAAC,aAAoC,KAE5CD,KAAAE,YAAa,EACLF,KAAAL,iBAAyC,KAEzCK,KAAAG,YAAqB,CAAEC,EAAG,EAAGC,EAAG,GAKhCL,KAAAd,aAA2C,EAE3Cc,KAAAM,uBAAwB,EAKxBN,KAAAO,QAAUC,EAAAA,YAKVR,KAAAS,mBAA0C,KAK1CT,KAAAU,cAAgC,KAapCV,KAAKH,cAAgBA,EACrBG,KAAKF,UAAYA,CACrB,CAEAa,KAAAA,CACIC,GACAC,aAAEA,GAAe,EAAKC,kBAAEA,GAA0C,IAKlE,MAAMC,gBAAEA,GAAoBf,KAAKH,cACjC,GAAIkB,IAAiD,IAA9BA,EAAgBC,UAAqB,OAE5D,MAoJMC,iBAAEA,GAAqBjB,KAAKD,WAClCC,KAAKkB,WAAa,IAAIC,EAAUA,WAC5BP,EACA,CACIQ,eAxJgBC,IAChBR,GAAcb,KAAKa,aAAaQ,GACpCrB,KAAKsB,iBAuJDC,QApJQA,CAACF,E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M8K,EAAQ7K,KAAKF,aACbJ,KACFA,GAAO,EAAK2D,kBACZA,GAAoB,EAAK5B,gBACzBA,GAAkB,EAAKiE,gBACvBA,GAAkB,EAAKC,YACvBA,EAAcmF,EAAcA,eAAA/D,aAC5BA,GAAe,GACf8D,EACJ,MAAO,IACAA,EACHnL,OACA2D,oBACA5B,kBACAiE,kBACAC,cACAoB,eAER"}
1
+ {"version":3,"file":"VisualElementDragControls.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/gestures/drag/VisualElementDragControls.mjs"],"sourcesContent":["import { invariant } from 'motion-utils';\nimport { animateMotionValue } from '../../animation/interfaces/motion-value.mjs';\nimport { getVariableValue } from '../../animation/utils/css-variables-conversion.mjs';\nimport { isCSSVariableToken } from '../../animation/utils/is-css-variable.mjs';\nimport { addDomEvent } from '../../events/add-dom-event.mjs';\nimport { addPointerEvent } from '../../events/add-pointer-event.mjs';\nimport { frame } from '../../frameloop/frame.mjs';\nimport { convertBoxToBoundingBox, convertBoundingBoxToBox } from '../../projection/geometry/conversion.mjs';\nimport { calcLength } from '../../projection/geometry/delta-calc.mjs';\nimport { createBox } from '../../projection/geometry/models.mjs';\nimport { eachAxis } from '../../projection/utils/each-axis.mjs';\nimport { measurePageBox } from '../../projection/utils/measure.mjs';\nimport { resize } from '../../resize/index.mjs';\nimport { mixNumber } from '../../utils/mix/number.mjs';\nimport { px, percent } from '../../value/types/numbers/units.mjs';\nimport { addValueToWillChange } from '../../value/will-change/add-will-change.mjs';\nimport { PanSession } from '../pan/PanSession.mjs';\nimport { isElementTextInput } from '../press/utils/is-keyboard-accessible.mjs';\nimport { setDragLock } from './state/set-active.mjs';\nimport { applyConstraints, calcRelativeConstraints, resolveDragElastic, calcViewportConstraints, defaultElastic, rebaseAxisConstraints, calcOrigin } from './utils/constraints.mjs';\n\n/**\n * Re-read the scroll of the projection's ancestors, and return that of the\n * `layoutScroll` ones as a key that changes when any of them scroll.\n *\n * Clear the cached scroll first so `updateScroll` bypasses its\n * per-animationId cache and re-reads the live value.\n */\nfunction measureScroll(projection) {\n let key = \"\";\n for (const node of projection.path) {\n node.scroll = undefined;\n node.updateScroll();\n const { scroll } = node;\n if (node !== projection.root && scroll) {\n key += scroll.offset.x + \",\" + scroll.offset.y + \",\";\n }\n }\n return key;\n}\nconst elementDragControls = new WeakMap();\nclass VisualElementDragControls {\n constructor(visualElement, readProps = () => visualElement.getProps()) {\n this.openDragLock = null;\n this.isDragging = false;\n this.currentDirection = null;\n this.originPoint = { x: 0, y: 0 };\n /**\n * The permitted boundaries of travel, in pixels.\n */\n this.constraints = false;\n this.hasMutatedConstraints = false;\n /**\n * The per-axis resolved elastic values.\n */\n this.elastic = createBox();\n /**\n * The latest pointer event. Used as fallback when the `cancel` and `stop` functions are called without arguments.\n */\n this.latestPointerEvent = null;\n /**\n * The latest pan info. Used as fallback when the `cancel` and `stop` functions are called without arguments.\n */\n this.latestPanInfo = null;\n this.visualElement = visualElement;\n this.readProps = readProps;\n }\n start(originEvent, options = {}) {\n /**\n * Don't start dragging if this component is exiting\n */\n if (this.visualElement.presenceContext?.isPresent === false)\n return;\n const onSessionStart = (event) => {\n if (options.snapToCursor)\n this.snapToCursor(event);\n this.stopAnimation();\n };\n const onStart = (event, info) => {\n // Attempt to grab the global drag gesture lock - maybe make this part of PanSession\n const { drag, dragConstraints, dragPropagation, onDragStart } = this.getProps();\n if (drag && !dragPropagation) {\n this.openDragLock?.();\n this.openDragLock = setDragLock(drag);\n // If we don 't have the lock, don't start dragging\n if (!this.openDragLock)\n return;\n }\n this.latestPointerEvent = event;\n this.latestPanInfo = info;\n this.isDragging = true;\n this.currentDirection = null;\n this.resolveConstraints();\n const { projection } = this.visualElement;\n if (projection) {\n projection.isAnimationBlocked = true;\n projection.target = undefined;\n }\n /**\n * Record gesture origin and pointer offset\n */\n eachAxis((axis) => {\n let current = this.getAxisMotionValue(axis).get() || 0;\n /**\n * If the MotionValue is a CSS variable, like \"var(--y)\",\n * resolve it so it can be converted to px below.\n */\n if (isCSSVariableToken(current)) {\n current =\n getVariableValue(current, this.visualElement.current) || 0;\n }\n /**\n * If the MotionValue is a px or percentage value convert to px\n */\n if (px.test(current)) {\n current = parseFloat(current);\n }\n else if (percent.test(current)) {\n const measuredAxis = projection?.layout?.layoutBox[axis];\n if (measuredAxis) {\n current =\n calcLength(measuredAxis) *\n (parseFloat(current) / 100);\n }\n }\n this.originPoint[axis] = current;\n });\n this.point =\n typeof dragConstraints === \"function\" && dragConstraints(this);\n // Fire onDragStart event\n if (onDragStart) {\n frame.update(() => onDragStart(event, info), false, true);\n }\n addValueToWillChange(this.visualElement, \"transform\");\n this.visualElement.animationState?.setActive(\"whileDrag\", true);\n };\n const onMove = (event, info) => {\n this.latestPointerEvent = event;\n this.latestPanInfo = info;\n const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag, } = this.getProps();\n // If we didn't successfully receive the gesture lock, early return.\n if (!dragPropagation && !this.openDragLock)\n return;\n const { offset } = info;\n // Attempt to detect drag direction if directionLock is true\n if (dragDirectionLock && this.currentDirection === null) {\n this.currentDirection = getCurrentDirection(offset);\n /**\n * Wait for more movement until a direction is set. Once\n * it is, apply this move too: it can be the last before\n * release when the browser coalesces a fast gesture.\n */\n if (this.currentDirection === null)\n return;\n onDirectionLock && onDirectionLock(this.currentDirection);\n }\n // Update each point with the latest position\n this.updateAxis(\"x\", offset);\n this.updateAxis(\"y\", offset);\n this.point && this.point.move();\n /**\n * Ideally we would leave the renderer to fire naturally at the end of\n * this frame but if the element is about to change layout as the result\n * of a re-render we want to ensure the browser can read the latest\n * bounding box to ensure the pointer and element don't fall out of sync.\n */\n this.visualElement.render();\n /**\n * This must fire after the render call as it might trigger a state\n * change which itself might trigger a layout update.\n */\n if (onDrag) {\n frame.update(() => onDrag(event, info), false, true);\n }\n };\n const onSessionEnd = (event, info) => {\n this.latestPointerEvent = event;\n this.latestPanInfo = info;\n this.stop(event, info);\n this.latestPointerEvent = null;\n this.latestPanInfo = null;\n };\n const resumeAnimation = () => {\n const { dragSnapToOrigin: snap } = this.getProps();\n if (snap || this.constraints || this.point) {\n this.startAnimation({ x: 0, y: 0 });\n }\n };\n const { dragSnapToOrigin } = this.getProps();\n this.panSession = new PanSession(originEvent, {\n onSessionStart,\n onStart,\n onMove,\n onSessionEnd,\n resumeAnimation,\n }, {\n ...options,\n transformPagePoint: this.visualElement.getTransformPagePoint(),\n dragSnapToOrigin,\n contextWindow: this.visualElement.current?.ownerDocument.defaultView,\n element: this.visualElement.current,\n });\n }\n /**\n * @param dragAxes - The axes to animate on release, if not the `drag`\n * prop's, e.g. when drag was disabled mid-gesture.\n */\n stop(event, panInfo, dragAxes) {\n const finalEvent = event || this.latestPointerEvent;\n const finalPanInfo = panInfo || this.latestPanInfo;\n const isDragging = this.isDragging;\n this.cancel();\n if (!isDragging || !finalPanInfo || !finalEvent)\n return;\n const { velocity } = finalPanInfo;\n this.startAnimation(velocity, dragAxes);\n const { onDragEnd } = this.getProps();\n if (onDragEnd) {\n frame.postRender(() => onDragEnd(finalEvent, finalPanInfo));\n }\n }\n cancel() {\n this.isDragging = false;\n const { projection, animationState } = this.visualElement;\n if (projection) {\n projection.isAnimationBlocked = false;\n }\n this.endPanSession();\n if (!this.getProps().dragPropagation && this.openDragLock) {\n this.openDragLock();\n this.openDragLock = null;\n }\n animationState?.setActive(\"whileDrag\", false);\n }\n /**\n * Clean up the pan session without modifying other drag state.\n * This is used during unmount to ensure event listeners are removed\n * without affecting projection animations or drag locks.\n */\n endPanSession() {\n this.panSession?.end();\n this.panSession = undefined;\n }\n updateAxis(axis, offset) {\n /**\n * Read drag per axis: a callback fired while updating the x axis\n * can synchronously re-render with new props.\n */\n const { drag } = this.readProps();\n // If we're not dragging this axis, do an early return.\n if (!offset || !shouldDrag(axis, drag, this.currentDirection))\n return;\n const axisValue = this.getAxisMotionValue(axis);\n let next = this.originPoint[axis] + offset[axis];\n // Apply constraints\n const constraints = this.constraints && this.constraints[axis];\n if (constraints) {\n next = applyConstraints(next, constraints, this.elastic[axis]);\n }\n this.point ? (this.point[axis] = next) : axisValue.set(next);\n }\n resolveConstraints() {\n const { dragConstraints, dragElastic } = this.getProps();\n const { projection } = this.visualElement;\n const layout = projection && (projection.layout || projection.measure(false));\n const prevConstraints = this.constraints;\n if (isElementConstraints(dragConstraints)) {\n /**\n * Ref constraints are measured with the layout. Scrolling a\n * `layoutScroll` ancestor since can move the element relative\n * to them without a layout measurement, so measure them again\n * (#2024). Otherwise keep them: they and the layout can both\n * have moved on the page since, e.g. when content above grows.\n */\n if (!this.constraints ||\n this.scroll !== measureScroll(projection)) {\n this.constraints = this.resolveRefConstraints();\n }\n }\n else {\n if (dragConstraints &&\n layout &&\n typeof dragConstraints === \"object\") {\n this.constraints = calcRelativeConstraints(layout.layoutBox, dragConstraints);\n }\n else {\n this.constraints = false;\n }\n }\n this.elastic = resolveDragElastic(dragElastic);\n /**\n * If we're outputting to external MotionValues, we want to rebase the measured constraints\n * from viewport-relative to component-relative. This only applies to relative (non-ref)\n * constraints, as ref-based constraints from calcViewportConstraints are already in the\n * correct coordinate space for the motion value transform offset.\n */\n if (prevConstraints !== this.constraints &&\n !isElementConstraints(dragConstraints) &&\n layout &&\n this.constraints &&\n !this.hasMutatedConstraints) {\n eachAxis((axis) => {\n if (this.constraints !== false &&\n this.getAxisMotionValue(axis)) {\n this.constraints[axis] = rebaseAxisConstraints(layout.layoutBox[axis], this.constraints[axis]);\n }\n });\n }\n }\n resolveRefConstraints() {\n const { dragConstraints: constraints, onMeasureDragConstraints } = this.getProps();\n if (!isElementConstraints(constraints))\n return false;\n const constraintsElement = resolveConstraintsElement(constraints);\n process.env.NODE_ENV !== \"production\" &&\n invariant(!!constraintsElement, \"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.\", \"drag-constraints-ref\");\n const { projection } = this.visualElement;\n // TODO\n if (!projection || !projection.layout)\n return false;\n /**\n * Refresh the scroll offsets of the root and `layoutScroll`\n * ancestors so the constraint's viewport box translates to the\n * layout's coordinates. The scroll captured when the layout was\n * measured can be stale if they've scrolled since — e.g. via the\n * browser restoring scroll on refresh, or an ancestor layout effect\n * running after this element's mount (#2829).\n */\n this.scroll = measureScroll(projection);\n const constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint());\n /**\n * layoutBox removes the scroll of `layoutScroll` ancestors, so\n * remove it from the constraints box too.\n */\n let measuredConstraints = calcViewportConstraints(projection.layout.layoutBox, projection.removeElementScroll(constraintsBox));\n /**\n * If there's an onMeasureDragConstraints listener we call it and\n * if different constraints are returned, set constraints to that\n */\n if (onMeasureDragConstraints) {\n const userConstraints = onMeasureDragConstraints(convertBoxToBoundingBox(measuredConstraints));\n this.hasMutatedConstraints = !!userConstraints;\n if (userConstraints) {\n measuredConstraints = convertBoundingBoxToBox(userConstraints);\n }\n }\n return measuredConstraints;\n }\n startAnimation(velocity, dragAxes) {\n const { drag, dragMomentum, dragElastic, dragTransition, dragSnapToOrigin, onDragTransitionEnd, } = this.getProps();\n /**\n * Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame\n * of spring animations so we should look into adding a disable spring option to `inertia`.\n * We could do something here where we affect the `bounceStiffness` and `bounceDamping`\n * using the value of `dragElastic`.\n */\n const options = {\n bounceStiffness: dragElastic ? 200 : 1000000,\n bounceDamping: dragElastic ? 40 : 10000000,\n timeConstant: 750,\n restDelta: 1,\n restSpeed: 10,\n ...dragTransition,\n };\n const axisVelocity = (axis) => dragMomentum &&\n !(this.point && dragSnapToOrigin) &&\n shouldDrag(axis, dragAxes || drag, this.currentDirection)\n ? velocity[axis]\n : 0;\n if (this.point && !dragSnapToOrigin) {\n return this.point\n .release({ x: axisVelocity(\"x\"), y: axisVelocity(\"y\") }, options)\n .then(onDragTransitionEnd);\n }\n const constraints = this.constraints || {};\n const momentumAnimations = eachAxis((axis) => {\n if (!shouldDrag(axis, dragAxes || drag, this.currentDirection)) {\n return;\n }\n let transition = constraints[axis] || {};\n if (dragSnapToOrigin === true ||\n dragSnapToOrigin === axis)\n transition = { min: 0, max: 0 };\n const inertia = {\n type: \"inertia\",\n velocity: axisVelocity(axis),\n ...options,\n ...transition,\n };\n // If we're not animating on an externally-provided `MotionValue` we can use the\n // component's animation controls which will handle interactions with whileHover (etc),\n // otherwise we just have to animate the `MotionValue` itself.\n return this.startAxisValueAnimation(axis, inertia);\n });\n // Run all animations and then resolve the new drag constraints.\n return Promise.all(momentumAnimations).then(onDragTransitionEnd);\n }\n startAxisValueAnimation(axis, transition) {\n const axisValue = this.getAxisMotionValue(axis);\n addValueToWillChange(this.visualElement, axis);\n return axisValue.start(animateMotionValue(axis, axisValue, 0, transition, this.visualElement, false));\n }\n stopAnimation() {\n eachAxis((axis) => this.getAxisMotionValue(axis).stop());\n }\n /**\n * Drag works differently depending on which props are provided.\n *\n * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.\n * - Otherwise, we apply the delta to the x/y motion values.\n */\n getAxisMotionValue(axis) {\n const dragKey = `_drag${axis.toUpperCase()}`;\n const props = this.readProps();\n const externalMotionValue = props[dragKey];\n return externalMotionValue\n ? externalMotionValue\n : this.visualElement.getValue(axis, this.visualElement.latestValues[axis] ?? 0);\n }\n /**\n * Measure the live box - projection.layout may or may not include the\n * drag transform, depending on when it was measured.\n */\n snapToCursor({ clientX, clientY }) {\n const { drag } = this.getProps();\n const point = { x: clientX, y: clientY };\n const cursor = this.visualElement.getTransformPagePoint()?.(point) || point;\n const box = this.visualElement.measureViewportBox();\n eachAxis((axis) => {\n if (!shouldDrag(axis, drag, this.currentDirection))\n return;\n const axisValue = this.getAxisMotionValue(axis);\n const { min, max } = box[axis];\n axisValue.set((axisValue.get() || 0) + cursor[axis] - mixNumber(min, max, 0.5));\n });\n }\n /**\n * When the viewport resizes we want to check if the measured constraints\n * have changed and, if so, reposition the element within those new constraints\n * relative to where it was before the resize.\n */\n scalePositionWithinConstraints() {\n if (!this.visualElement.current)\n return;\n const { drag, dragConstraints } = this.getProps();\n const { projection } = this.visualElement;\n if (!isElementConstraints(dragConstraints) ||\n !projection ||\n !this.constraints)\n return;\n /**\n * Stop current animations as there can be visual glitching if we try to do\n * this mid-animation\n */\n this.stopAnimation();\n /**\n * Record the relative position of the dragged element relative to the\n * constraints box and save as a progress value.\n */\n const constraints = this.constraints;\n const boxProgress = { x: 0, y: 0 };\n eachAxis((axis) => {\n const latest = this.getAxisMotionValue(axis).get();\n boxProgress[axis] = calcOrigin({ min: latest, max: latest }, constraints[axis]);\n });\n /**\n * Update the layout of this element and resolve the latest drag constraints\n */\n const { transformTemplate } = this.visualElement.getProps();\n this.visualElement.current.style.transform = transformTemplate\n ? transformTemplate({}, \"\")\n : \"none\";\n projection.root?.updateScroll();\n projection.updateLayout();\n /**\n * Reset constraints so resolveConstraints() will recalculate them\n * with the freshly measured layout rather than returning the cached value.\n */\n this.constraints = false;\n this.resolveConstraints();\n /**\n * For each axis, calculate the current progress of the layout axis\n * within the new constraints.\n */\n eachAxis((axis) => {\n const axisValue = this.getAxisMotionValue(axis);\n /**\n * An element resting at its origin has no offset to preserve,\n * and re-projecting 0 into the new constraints would move it.\n */\n if (!shouldDrag(axis, drag, null) || !axisValue.get())\n return;\n /**\n * Calculate a new transform based on the previous box progress\n */\n const { min, max } = this.constraints[axis];\n axisValue.set(mixNumber(min, max, boxProgress[axis]));\n });\n /**\n * Flush the updated transform to the DOM synchronously to prevent\n * a visual flash at the element's CSS layout position (0,0) when\n * the transform was stripped for measurement.\n */\n this.visualElement.render();\n }\n addListeners() {\n if (!this.visualElement.current)\n return;\n elementDragControls.set(this.visualElement, this);\n const element = this.visualElement.current;\n /**\n * Attach a pointerdown event listener on this DOM element to initiate drag tracking.\n */\n const stopPointerListener = addPointerEvent(element, \"pointerdown\", (event) => {\n const { drag, dragListener = true } = this.getProps();\n const target = event.target;\n /**\n * Only block drag if clicking on a text input child element\n * (input, textarea, select, contenteditable) where users might\n * want to select text or interact with the control.\n *\n * Buttons and links don't block drag since they don't have\n * click-and-move actions of their own.\n */\n const isClickingTextInputChild = target !== element && isElementTextInput(target);\n if (drag && dragListener && !isClickingTextInputChild) {\n this.start(event);\n }\n });\n /**\n * If using ref-based constraints, observe both the draggable element\n * and the constraint container for size changes via ResizeObserver.\n * Setup is deferred because dragConstraints.current is null when\n * addListeners first runs (React hasn't committed the ref yet).\n */\n let stopResizeObservers;\n const measureDragConstraints = () => {\n const { dragConstraints } = this.getProps();\n const constraintsElement = isElementConstraints(dragConstraints) &&\n resolveConstraintsElement(dragConstraints);\n if (constraintsElement) {\n this.constraints = this.resolveRefConstraints();\n if (!stopResizeObservers) {\n stopResizeObservers = startResizeObservers(element, constraintsElement, () => this.scalePositionWithinConstraints());\n }\n }\n };\n const { projection } = this.visualElement;\n const stopMeasureLayoutListener = projection.addEventListener(\"measure\", measureDragConstraints);\n if (!projection.layout) {\n projection.root?.updateScroll();\n projection.updateLayout();\n }\n frame.read(measureDragConstraints);\n /**\n * Attach a window resize listener to scale the draggable target within its defined\n * constraints as the window resizes.\n */\n const stopResizeListener = addDomEvent(window, \"resize\", () => this.scalePositionWithinConstraints());\n /**\n * If the element's layout changes, calculate the delta and apply that to\n * the drag gesture's origin point.\n */\n const stopLayoutUpdateListener = projection.addEventListener(\"didUpdate\", (({ delta, hasLayoutChanged }) => {\n if (this.isDragging && hasLayoutChanged) {\n eachAxis((axis) => {\n /**\n * Only compensate axes this gesture drags. A\n * non-drag axis follows its layout instead, as\n * nothing would ever move it back (e.g. snapping\n * to origin only animates drag axes).\n */\n if (!shouldDrag(axis, this.getProps().drag, this.currentDirection))\n return;\n const motionValue = this.getAxisMotionValue(axis);\n this.originPoint[axis] += delta[axis].translate;\n motionValue.set(motionValue.get() + delta[axis].translate);\n });\n this.visualElement.render();\n }\n }));\n return () => {\n stopResizeListener();\n stopPointerListener();\n stopMeasureLayoutListener();\n stopLayoutUpdateListener();\n stopResizeObservers?.();\n };\n }\n getProps() {\n const props = this.readProps();\n const { dragElastic = defaultElastic, dragMomentum = true } = props;\n return { ...props, dragElastic, dragMomentum };\n }\n}\n/**\n * `dragConstraints` can be an element, or a ref (`{ current }`) to one.\n */\nfunction isElementConstraints(constraints) {\n return (!!constraints &&\n typeof constraints === \"object\" &&\n (\"current\" in constraints || \"nodeType\" in constraints));\n}\nconst resolveConstraintsElement = (constraints) => \"current\" in constraints ? constraints.current : constraints;\nfunction skipFirstCall(callback) {\n let isFirst = true;\n return () => {\n if (isFirst) {\n isFirst = false;\n return;\n }\n callback();\n };\n}\nfunction startResizeObservers(element, constraintsElement, onResize) {\n const stopElement = resize(element, skipFirstCall(onResize));\n const stopContainer = resize(constraintsElement, skipFirstCall(onResize));\n return () => {\n stopElement();\n stopContainer();\n };\n}\nfunction shouldDrag(direction, drag, currentDirection) {\n return ((drag === true || drag === direction) &&\n (currentDirection === null || currentDirection === direction));\n}\n/**\n * Based on an x/y offset determine the current drag direction. If both axis' offsets are lower\n * than the provided threshold, return `null`.\n *\n * @param offset - The x/y offset from origin.\n * @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction.\n */\nfunction getCurrentDirection(offset, lockThreshold = 10) {\n let direction = null;\n if (Math.abs(offset.y) > lockThreshold) {\n direction = \"y\";\n }\n else if (Math.abs(offset.x) > lockThreshold) {\n direction = \"x\";\n }\n return direction;\n}\nfunction expectsResolvedDragConstraints({ dragConstraints, onMeasureDragConstraints, }) {\n return isElementConstraints(dragConstraints) && !!onMeasureDragConstraints;\n}\n\nexport { VisualElementDragControls, elementDragControls, expectsResolvedDragConstraints };\n//# sourceMappingURL=VisualElementDragControls.mjs.map\n"],"names":["measureScroll","projection","key","node","path","scroll","undefined","updateScroll","root","offset","x","y","elementDragControls","WeakMap","isElementConstraints","constraints","resolveConstraintsElement","current","skipFirstCall","callback","isFirst","shouldDrag","direction","drag","currentDirection","constructor","visualElement","readProps","getProps","this","openDragLock","isDragging","originPoint","hasMutatedConstraints","elastic","createBox","latestPointerEvent","latestPanInfo","start","originEvent","options","presenceContext","isPresent","dragSnapToOrigin","panSession","PanSession","onSessionStart","event","snapToCursor","stopAnimation","onStart","info","dragConstraints","dragPropagation","onDragStart","setDragLock","resolveConstraints","isAnimationBlocked","target","eachAxis","axis","getAxisMotionValue","get","isCSSVariableToken","getVariableValue","px","test","parseFloat","percent","measuredAxis","layout","layoutBox","calcLength","point","frame","update","addValueToWillChange","animationState","setActive","onMove","dragDirectionLock","onDirectionLock","onDrag","lockThreshold","Math","abs","getCurrentDirection","updateAxis","move","render","onSessionEnd","stop","resumeAnimation","snap","startAnimation","transformPagePoint","getTransformPagePoint","contextWindow","ownerDocument","defaultView","element","panInfo","dragAxes","finalEvent","finalPanInfo","cancel","velocity","onDragEnd","postRender","endPanSession","end","axisValue","next","applyConstraints","set","dragElastic","measure","prevConstraints","resolveRefConstraints","calcRelativeConstraints","resolveDragElastic","rebaseAxisConstraints","onMeasureDragConstraints","constraintsElement","process","env","NODE_ENV","invariant","constraintsBox","measurePageBox","measuredConstraints","calcViewportConstraints","removeElementScroll","userConstraints","convertBoxToBoundingBox","convertBoundingBoxToBox","dragMomentum","dragTransition","onDragTransitionEnd","bounceStiffness","bounceDamping","timeConstant","restDelta","restSpeed","axisVelocity","release","then","momentumAnimations","transition","min","max","inertia","type","startAxisValueAnimation","Promise","all","animateMotionValue","dragKey","toUpperCase","externalMotionValue","getValue","latestValues","clientX","clientY","cursor","box","measureViewportBox","mixNumber","scalePositionWithinConstraints","boxProgress","latest","calcOrigin","transformTemplate","style","transform","updateLayout","addListeners","stopPointerListener","addPointerEvent","dragListener","isClickingTextInputChild","isElementTextInput","stopResizeObservers","measureDragConstraints","onResize","stopElement","resize","stopContainer","startResizeObservers","stopMeasureLayoutListener","addEventListener","read","stopResizeListener","addDomEvent","window","stopLayoutUpdateListener","delta","hasLayoutChanged","motionValue","translate","props","defaultElastic"],"mappings":"4kCAgDA,SAASA,EAAcC,GACnB,IAAIC,EAAM,GAEV,IAAK,MAAMC,KAAQF,EAAWG,KAAM,CAChCD,EAAKE,YAASC,EACdH,EAAKI,eAEL,MAAMF,OAAEA,GAA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