{"ast":null,"code":"import _objectWithoutProperties from \"@babel/runtime/helpers/objectWithoutProperties\";\nimport _defineProperty2 from \"@babel/runtime/helpers/defineProperty\";\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/inherits\";\nimport _possibleConstructorReturn from \"@babel/runtime/helpers/possibleConstructorReturn\";\nimport _getPrototypeOf from \"@babel/runtime/helpers/getPrototypeOf\";\nvar _excluded = [\"styleInterpolator\", \"interpolationIndex\", \"current\", \"gesture\", \"next\", \"layout\", \"insets\", \"overlay\", \"overlayEnabled\", \"shadowEnabled\", \"gestureEnabled\", \"gestureDirection\", \"pageOverflowEnabled\", \"headerDarkContent\", \"children\", \"containerStyle\", \"contentStyle\"];\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\nfunction _defineProperty(obj, key, value) {\n key = _toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\nfunction _toPropertyKey(arg) {\n var key = _toPrimitive(arg, \"string\");\n return typeof key === \"symbol\" ? key : String(key);\n}\nfunction _toPrimitive(input, hint) {\n if (typeof input !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (typeof res !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}\nimport Color from 'color';\nimport * as React from 'react';\nimport Animated from \"react-native-web/dist/exports/Animated\";\nimport InteractionManager from \"react-native-web/dist/exports/InteractionManager\";\nimport Platform from \"react-native-web/dist/exports/Platform\";\nimport StyleSheet from \"react-native-web/dist/exports/StyleSheet\";\nimport View from \"react-native-web/dist/exports/View\";\nimport { forModalPresentationIOS } from \"../../TransitionConfigs/CardStyleInterpolators\";\nimport CardAnimationContext from \"../../utils/CardAnimationContext\";\nimport getDistanceForDirection from \"../../utils/getDistanceForDirection\";\nimport getInvertedMultiplier from \"../../utils/getInvertedMultiplier\";\nimport memoize from \"../../utils/memoize\";\nimport { GestureState, PanGestureHandler } from \"../GestureHandler\";\nimport ModalStatusBarManager from \"../ModalStatusBarManager\";\nimport CardSheet from \"./CardSheet\";\nvar GESTURE_VELOCITY_IMPACT = 0.3;\nvar TRUE = 1;\nvar FALSE = 0;\nvar GESTURE_RESPONSE_DISTANCE_HORIZONTAL = 50;\nvar GESTURE_RESPONSE_DISTANCE_VERTICAL = 135;\nvar useNativeDriver = Platform.OS !== 'web';\nvar hasOpacityStyle = function hasOpacityStyle(style) {\n if (style) {\n var flattenedStyle = StyleSheet.flatten(style);\n return flattenedStyle.opacity != null;\n }\n return false;\n};\nvar Card = function (_React$Component) {\n _inherits(Card, _React$Component);\n var _super = _createSuper(Card);\n function Card() {\n var _this;\n _classCallCheck(this, Card);\n _this = _super.apply(this, arguments);\n _defineProperty(_assertThisInitialized(_this), \"isCurrentlyMounted\", false);\n _defineProperty(_assertThisInitialized(_this), \"isClosing\", new Animated.Value(FALSE));\n _defineProperty(_assertThisInitialized(_this), \"inverted\", new Animated.Value(getInvertedMultiplier(_this.props.gestureDirection)));\n _defineProperty(_assertThisInitialized(_this), \"layout\", {\n width: new Animated.Value(_this.props.layout.width),\n height: new Animated.Value(_this.props.layout.height)\n });\n _defineProperty(_assertThisInitialized(_this), \"isSwiping\", new Animated.Value(FALSE));\n _defineProperty(_assertThisInitialized(_this), \"interactionHandle\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"pendingGestureCallback\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"lastToValue\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"animate\", function (_ref) {\n var closing = _ref.closing,\n velocity = _ref.velocity;\n var _this$props = _this.props,\n gesture = _this$props.gesture,\n transitionSpec = _this$props.transitionSpec,\n onOpen = _this$props.onOpen,\n onClose = _this$props.onClose,\n onTransition = _this$props.onTransition;\n var toValue = _this.getAnimateToValue(_objectSpread(_objectSpread({}, _this.props), {}, {\n closing: closing\n }));\n _this.lastToValue = toValue;\n _this.isClosing.setValue(closing ? TRUE : FALSE);\n var spec = closing ? transitionSpec.close : transitionSpec.open;\n var animation = spec.animation === 'spring' ? Animated.spring : Animated.timing;\n _this.setPointerEventsEnabled(!closing);\n _this.handleStartInteraction();\n clearTimeout(_this.pendingGestureCallback);\n onTransition === null || onTransition === void 0 ? void 0 : onTransition({\n closing: closing,\n gesture: velocity !== undefined\n });\n animation(gesture, _objectSpread(_objectSpread({}, spec.config), {}, {\n velocity: velocity,\n toValue: toValue,\n useNativeDriver: useNativeDriver,\n isInteraction: false\n })).start(function (_ref2) {\n var finished = _ref2.finished;\n _this.handleEndInteraction();\n clearTimeout(_this.pendingGestureCallback);\n if (finished) {\n if (closing) {\n onClose();\n } else {\n onOpen();\n }\n if (_this.isCurrentlyMounted) {\n _this.forceUpdate();\n }\n }\n });\n });\n _defineProperty(_assertThisInitialized(_this), \"getAnimateToValue\", function (_ref3) {\n var closing = _ref3.closing,\n layout = _ref3.layout,\n gestureDirection = _ref3.gestureDirection;\n if (!closing) {\n return 0;\n }\n return getDistanceForDirection(layout, gestureDirection);\n });\n _defineProperty(_assertThisInitialized(_this), \"setPointerEventsEnabled\", function (enabled) {\n var _this$ref$current;\n var pointerEvents = enabled ? 'box-none' : 'none';\n (_this$ref$current = _this.ref.current) === null || _this$ref$current === void 0 ? void 0 : _this$ref$current.setPointerEvents(pointerEvents);\n });\n _defineProperty(_assertThisInitialized(_this), \"handleStartInteraction\", function () {\n if (_this.interactionHandle === undefined) {\n _this.interactionHandle = InteractionManager.createInteractionHandle();\n }\n });\n _defineProperty(_assertThisInitialized(_this), \"handleEndInteraction\", function () {\n if (_this.interactionHandle !== undefined) {\n InteractionManager.clearInteractionHandle(_this.interactionHandle);\n _this.interactionHandle = undefined;\n }\n });\n _defineProperty(_assertThisInitialized(_this), \"handleGestureStateChange\", function (_ref4) {\n var nativeEvent = _ref4.nativeEvent;\n var _this$props2 = _this.props,\n layout = _this$props2.layout,\n onClose = _this$props2.onClose,\n onGestureBegin = _this$props2.onGestureBegin,\n onGestureCanceled = _this$props2.onGestureCanceled,\n onGestureEnd = _this$props2.onGestureEnd,\n gestureDirection = _this$props2.gestureDirection,\n gestureVelocityImpact = _this$props2.gestureVelocityImpact;\n switch (nativeEvent.state) {\n case GestureState.ACTIVE:\n _this.isSwiping.setValue(TRUE);\n _this.handleStartInteraction();\n onGestureBegin === null || onGestureBegin === void 0 ? void 0 : onGestureBegin();\n break;\n case GestureState.CANCELLED:\n {\n _this.isSwiping.setValue(FALSE);\n _this.handleEndInteraction();\n var velocity = gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? nativeEvent.velocityY : nativeEvent.velocityX;\n _this.animate({\n closing: _this.props.closing,\n velocity: velocity\n });\n onGestureCanceled === null || onGestureCanceled === void 0 ? void 0 : onGestureCanceled();\n break;\n }\n case GestureState.END:\n {\n _this.isSwiping.setValue(FALSE);\n var distance;\n var translation;\n var _velocity;\n if (gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted') {\n distance = layout.height;\n translation = nativeEvent.translationY;\n _velocity = nativeEvent.velocityY;\n } else {\n distance = layout.width;\n translation = nativeEvent.translationX;\n _velocity = nativeEvent.velocityX;\n }\n var closing = (translation + _velocity * gestureVelocityImpact) * getInvertedMultiplier(gestureDirection) > distance / 2 ? _velocity !== 0 || translation !== 0 : _this.props.closing;\n _this.animate({\n closing: closing,\n velocity: _velocity\n });\n if (closing) {\n _this.pendingGestureCallback = setTimeout(function () {\n onClose();\n _this.forceUpdate();\n }, 32);\n }\n onGestureEnd === null || onGestureEnd === void 0 ? void 0 : onGestureEnd();\n break;\n }\n }\n });\n _defineProperty(_assertThisInitialized(_this), \"getInterpolatedStyle\", memoize(function (styleInterpolator, animation) {\n return styleInterpolator(animation);\n }));\n _defineProperty(_assertThisInitialized(_this), \"getCardAnimation\", memoize(function (interpolationIndex, current, next, layout, insetTop, insetRight, insetBottom, insetLeft) {\n return {\n index: interpolationIndex,\n current: {\n progress: current\n },\n next: next && {\n progress: next\n },\n closing: _this.isClosing,\n swiping: _this.isSwiping,\n inverted: _this.inverted,\n layouts: {\n screen: layout\n },\n insets: {\n top: insetTop,\n right: insetRight,\n bottom: insetBottom,\n left: insetLeft\n }\n };\n }));\n _defineProperty(_assertThisInitialized(_this), \"ref\", React.createRef());\n return _this;\n }\n _createClass(Card, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.animate({\n closing: this.props.closing\n });\n this.isCurrentlyMounted = true;\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n var _this$props3 = this.props,\n layout = _this$props3.layout,\n gestureDirection = _this$props3.gestureDirection,\n closing = _this$props3.closing;\n var width = layout.width,\n height = layout.height;\n if (width !== prevProps.layout.width) {\n this.layout.width.setValue(width);\n }\n if (height !== prevProps.layout.height) {\n this.layout.height.setValue(height);\n }\n if (gestureDirection !== prevProps.gestureDirection) {\n this.inverted.setValue(getInvertedMultiplier(gestureDirection));\n }\n var toValue = this.getAnimateToValue(this.props);\n if (this.getAnimateToValue(prevProps) !== toValue || this.lastToValue !== toValue) {\n this.animate({\n closing: closing\n });\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.props.gesture.stopAnimation();\n this.isCurrentlyMounted = false;\n this.handleEndInteraction();\n }\n }, {\n key: \"gestureActivationCriteria\",\n value: function gestureActivationCriteria() {\n var _this$props4 = this.props,\n layout = _this$props4.layout,\n gestureDirection = _this$props4.gestureDirection,\n gestureResponseDistance = _this$props4.gestureResponseDistance;\n var enableTrackpadTwoFingerGesture = true;\n var distance = gestureResponseDistance !== undefined ? gestureResponseDistance : gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? GESTURE_RESPONSE_DISTANCE_VERTICAL : GESTURE_RESPONSE_DISTANCE_HORIZONTAL;\n if (gestureDirection === 'vertical') {\n return {\n maxDeltaX: 15,\n minOffsetY: 5,\n hitSlop: {\n bottom: -layout.height + distance\n },\n enableTrackpadTwoFingerGesture: enableTrackpadTwoFingerGesture\n };\n } else if (gestureDirection === 'vertical-inverted') {\n return {\n maxDeltaX: 15,\n minOffsetY: -5,\n hitSlop: {\n top: -layout.height + distance\n },\n enableTrackpadTwoFingerGesture: enableTrackpadTwoFingerGesture\n };\n } else {\n var hitSlop = -layout.width + distance;\n var invertedMultiplier = getInvertedMultiplier(gestureDirection);\n if (invertedMultiplier === 1) {\n return {\n minOffsetX: 5,\n maxDeltaY: 20,\n hitSlop: {\n right: hitSlop\n },\n enableTrackpadTwoFingerGesture: enableTrackpadTwoFingerGesture\n };\n } else {\n return {\n minOffsetX: -5,\n maxDeltaY: 20,\n hitSlop: {\n left: hitSlop\n },\n enableTrackpadTwoFingerGesture: enableTrackpadTwoFingerGesture\n };\n }\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$props5 = this.props,\n styleInterpolator = _this$props5.styleInterpolator,\n interpolationIndex = _this$props5.interpolationIndex,\n current = _this$props5.current,\n gesture = _this$props5.gesture,\n next = _this$props5.next,\n layout = _this$props5.layout,\n insets = _this$props5.insets,\n overlay = _this$props5.overlay,\n overlayEnabled = _this$props5.overlayEnabled,\n shadowEnabled = _this$props5.shadowEnabled,\n gestureEnabled = _this$props5.gestureEnabled,\n gestureDirection = _this$props5.gestureDirection,\n pageOverflowEnabled = _this$props5.pageOverflowEnabled,\n headerDarkContent = _this$props5.headerDarkContent,\n children = _this$props5.children,\n customContainerStyle = _this$props5.containerStyle,\n contentStyle = _this$props5.contentStyle,\n rest = _objectWithoutProperties(_this$props5, _excluded);\n var interpolationProps = this.getCardAnimation(interpolationIndex, current, next, layout, insets.top, insets.right, insets.bottom, insets.left);\n var interpolatedStyle = this.getInterpolatedStyle(styleInterpolator, interpolationProps);\n var containerStyle = interpolatedStyle.containerStyle,\n cardStyle = interpolatedStyle.cardStyle,\n overlayStyle = interpolatedStyle.overlayStyle,\n shadowStyle = interpolatedStyle.shadowStyle;\n var handleGestureEvent = gestureEnabled ? Animated.event([{\n nativeEvent: gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? {\n translationY: gesture\n } : {\n translationX: gesture\n }\n }], {\n useNativeDriver: useNativeDriver\n }) : undefined;\n var _StyleSheet$flatten = StyleSheet.flatten(contentStyle || {}),\n backgroundColor = _StyleSheet$flatten.backgroundColor;\n var isTransparent = typeof backgroundColor === 'string' ? Color(backgroundColor).alpha() === 0 : false;\n return React.createElement(CardAnimationContext.Provider, {\n value: interpolationProps\n }, Platform.OS === 'ios' && overlayEnabled && next && getIsModalPresentation(styleInterpolator) ? React.createElement(ModalStatusBarManager, {\n dark: headerDarkContent,\n layout: layout,\n insets: insets,\n style: cardStyle\n }) : null, React.createElement(Animated.View, {\n style: {\n opacity: current\n },\n collapsable: false\n }), React.createElement(View, _extends({\n pointerEvents: \"box-none\"\n }, rest), overlayEnabled ? React.createElement(View, {\n pointerEvents: \"box-none\",\n style: StyleSheet.absoluteFill\n }, overlay({\n style: overlayStyle\n })) : null, React.createElement(Animated.View, {\n style: [styles.container, containerStyle, customContainerStyle],\n pointerEvents: \"box-none\"\n }, React.createElement(PanGestureHandler, _extends({\n enabled: layout.width !== 0 && gestureEnabled,\n onGestureEvent: handleGestureEvent,\n onHandlerStateChange: this.handleGestureStateChange\n }, this.gestureActivationCriteria()), React.createElement(Animated.View, {\n needsOffscreenAlphaCompositing: hasOpacityStyle(cardStyle),\n style: [styles.container, cardStyle]\n }, shadowEnabled && shadowStyle && !isTransparent ? React.createElement(Animated.View, {\n style: [styles.shadow, gestureDirection === 'horizontal' ? [styles.shadowHorizontal, styles.shadowLeft] : gestureDirection === 'horizontal-inverted' ? [styles.shadowHorizontal, styles.shadowRight] : gestureDirection === 'vertical' ? [styles.shadowVertical, styles.shadowTop] : [styles.shadowVertical, styles.shadowBottom], {\n backgroundColor: backgroundColor\n }, shadowStyle],\n pointerEvents: \"none\"\n }) : null, React.createElement(CardSheet, {\n ref: this.ref,\n enabled: pageOverflowEnabled,\n layout: layout,\n style: contentStyle\n }, children))))));\n }\n }]);\n return Card;\n}(React.Component);\nexport { Card as default };\n_defineProperty(Card, \"defaultProps\", {\n shadowEnabled: false,\n gestureEnabled: true,\n gestureVelocityImpact: GESTURE_VELOCITY_IMPACT,\n overlay: function overlay(_ref5) {\n var style = _ref5.style;\n return style ? React.createElement(Animated.View, {\n pointerEvents: \"none\",\n style: [styles.overlay, style]\n }) : null;\n }\n});\nexport var getIsModalPresentation = function getIsModalPresentation(cardStyleInterpolator) {\n return cardStyleInterpolator === forModalPresentationIOS || cardStyleInterpolator.name === 'forModalPresentationIOS';\n};\nvar styles = StyleSheet.create({\n container: {\n flex: 1\n },\n overlay: {\n flex: 1,\n backgroundColor: '#000'\n },\n shadow: {\n position: 'absolute',\n shadowRadius: 5,\n shadowColor: '#000',\n shadowOpacity: 0.3\n },\n shadowHorizontal: {\n top: 0,\n bottom: 0,\n width: 3,\n shadowOffset: {\n width: -1,\n height: 1\n }\n },\n shadowLeft: {\n left: 0\n },\n shadowRight: {\n right: 0\n },\n shadowVertical: {\n left: 0,\n right: 0,\n height: 3,\n shadowOffset: {\n width: 1,\n height: -1\n }\n },\n shadowTop: {\n top: 0\n },\n shadowBottom: {\n bottom: 0\n }\n});","map":{"version":3,"sources":["Card.tsx"],"names":["Color","React","forModalPresentationIOS","CardAnimationContext","getDistanceForDirection","getInvertedMultiplier","memoize","GestureState","PanGestureHandler","ModalStatusBarManager","CardSheet","GESTURE_VELOCITY_IMPACT","TRUE","FALSE","GESTURE_RESPONSE_DISTANCE_HORIZONTAL","GESTURE_RESPONSE_DISTANCE_VERTICAL","useNativeDriver","Platform","OS","hasOpacityStyle","style","flattenedStyle","StyleSheet","flatten","opacity","Card","Component","shadowEnabled","gestureEnabled","gestureVelocityImpact","overlay","styles","componentDidMount","animate","closing","props","isCurrentlyMounted","componentDidUpdate","prevProps","layout","gestureDirection","width","height","setValue","inverted","toValue","getAnimateToValue","lastToValue","componentWillUnmount","gesture","stopAnimation","handleEndInteraction","Animated","Value","velocity","transitionSpec","onOpen","onClose","onTransition","isClosing","spec","close","open","animation","spring","timing","setPointerEventsEnabled","handleStartInteraction","clearTimeout","pendingGestureCallback","undefined","config","isInteraction","start","finished","forceUpdate","enabled","pointerEvents","ref","current","setPointerEvents","interactionHandle","InteractionManager","createInteractionHandle","clearInteractionHandle","nativeEvent","onGestureBegin","onGestureCanceled","onGestureEnd","state","ACTIVE","isSwiping","CANCELLED","velocityY","velocityX","END","distance","translation","translationY","translationX","setTimeout","styleInterpolator","interpolationIndex","next","insetTop","insetRight","insetBottom","insetLeft","index","progress","swiping","layouts","screen","insets","top","right","bottom","left","gestureActivationCriteria","gestureResponseDistance","enableTrackpadTwoFingerGesture","maxDeltaX","minOffsetY","hitSlop","invertedMultiplier","minOffsetX","maxDeltaY","createRef","render","overlayEnabled","pageOverflowEnabled","headerDarkContent","children","containerStyle","customContainerStyle","contentStyle","rest","interpolationProps","getCardAnimation","interpolatedStyle","getInterpolatedStyle","cardStyle","overlayStyle","shadowStyle","handleGestureEvent","event","backgroundColor","isTransparent","alpha","getIsModalPresentation","absoluteFill","container","handleGestureStateChange","shadow","shadowHorizontal","shadowLeft","shadowRight","shadowVertical","shadowTop","shadowBottom","cardStyleInterpolator","name","create","flex","position","shadowRadius","shadowColor","shadowOpacity","shadowOffset"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAO,KAAKC,KAAK,MAAM,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAa9B,SAASC,uBAAuB;AAQhC,OAAOC,oBAAoB;AAC3B,OAAOC,uBAAuB;AAC9B,OAAOC,qBAAqB;AAC5B,OAAOC,OAAO;AACd,SACEC,YAAY,EACZC,iBAAiB;AAGnB,OAAOC,qBAAqB;AAC5B,OAAOC,SAAS;AAqChB,IAAMC,uBAAuB,GAAG,GAAG;AAEnC,IAAMC,IAAI,GAAG,CAAC;AACd,IAAMC,KAAK,GAAG,CAAC;AAKf,IAAMC,oCAAoC,GAAG,EAAE;AAC/C,IAAMC,kCAAkC,GAAG,GAAG;AAE9C,IAAMC,eAAe,GAAGC,QAAQ,CAACC,EAA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G,GACpE,IAAI;EAAA;AACZ,CAAC,CAAA;AAqdH,OAAO,IAAMiI,sBAAsB,GACjCW,SADWX,sBAAsB,CACjCW,qBAAiD,EAC9C;EACH,OACEA,qBAAqB,KAAK9J,uBAAuB,IAEjD8J,qBAAqB,CAACC,IAAI,KAAK,yBAAyB;AAE5D,CAAC;AAED,IAAMlI,MAAM,GAAGT,UAAU,CAAC4I,MAAM,CAAC;EAC/BX,SAAS,EAAE;IACTY,IAAI,EAAE;EACR,CAAC;EACDrI,OAAO,EAAE;IACPqI,IAAI,EAAE,CAAC;IACPjB,eAAe,EAAE;EACnB,CAAC;EACDO,MAAM,EAAE;IACNW,QAAQ,EAAE,UAAU;IACpBC,YAAY,EAAE,CAAC;IACfC,WAAW,EAAE,MAAM;IACnBC,aAAa,EAAE;EACjB,CAAC;EACDb,gBAAgB,EAAE;IAChBxC,GAAG,EAAE,CAAC;IACNE,MAAM,EAAE,CAAC;IACT3E,KAAK,EAAE,CAAC;IACR+H,YAAY,EAAE;MAAE/H,KAAK,EAAE,CAAC,CAAC;MAAEC,MAAM,EAAE;IAAE;EACvC,CAAC;EACDiH,UAAU,EAAE;IACVtC,IAAI,EAAE;EACR,CAAC;EACDuC,WAAW,EAAE;IACXzC,KAAK,EAAE;EACT,CAAC;EACD0C,cAAc,EAAE;IACdxC,IAAI,EAAE,CAAC;IACPF,KAAK,EAAE,CAAC;IACRzE,MAAM,EAAE,CAAC;IACT8H,YAAY,EAAE;MAAE/H,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE,CAAC;IAAE;EACvC,CAAC;EACDoH,SAAS,EAAE;IACT5C,GAAG,EAAE;EACP,CAAC;EACD6C,YAAY,EAAE;IACZ3C,MAAM,EAAE;EACV;AACF,CAAC,CAAC","sourceRoot":"../../src","sourcesContent":["function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport Color from 'color';\nimport * as React from 'react';\nimport { Animated, InteractionManager, Platform, StyleSheet, View } from 'react-native';\nimport { forModalPresentationIOS } from '../../TransitionConfigs/CardStyleInterpolators';\nimport CardAnimationContext from '../../utils/CardAnimationContext';\nimport getDistanceForDirection from '../../utils/getDistanceForDirection';\nimport getInvertedMultiplier from '../../utils/getInvertedMultiplier';\nimport memoize from '../../utils/memoize';\nimport { GestureState, PanGestureHandler } from '../GestureHandler';\nimport ModalStatusBarManager from '../ModalStatusBarManager';\nimport CardSheet from './CardSheet';\nconst GESTURE_VELOCITY_IMPACT = 0.3;\nconst TRUE = 1;\nconst FALSE = 0;\n\n/**\n * The distance of touch start from the edge of the screen where the gesture will be recognized\n */\nconst GESTURE_RESPONSE_DISTANCE_HORIZONTAL = 50;\nconst GESTURE_RESPONSE_DISTANCE_VERTICAL = 135;\nconst useNativeDriver = Platform.OS !== 'web';\nconst hasOpacityStyle = style => {\n if (style) {\n const flattenedStyle = StyleSheet.flatten(style);\n return flattenedStyle.opacity != null;\n }\n return false;\n};\nexport default class Card extends React.Component {\n constructor() {\n super(...arguments);\n _defineProperty(this, \"isCurrentlyMounted\", false);\n _defineProperty(this, \"isClosing\", new Animated.Value(FALSE));\n _defineProperty(this, \"inverted\", new Animated.Value(getInvertedMultiplier(this.props.gestureDirection)));\n _defineProperty(this, \"layout\", {\n width: new Animated.Value(this.props.layout.width),\n height: new Animated.Value(this.props.layout.height)\n });\n _defineProperty(this, \"isSwiping\", new Animated.Value(FALSE));\n _defineProperty(this, \"interactionHandle\", void 0);\n _defineProperty(this, \"pendingGestureCallback\", void 0);\n _defineProperty(this, \"lastToValue\", void 0);\n _defineProperty(this, \"animate\", _ref => {\n let {\n closing,\n velocity\n } = _ref;\n const {\n gesture,\n transitionSpec,\n onOpen,\n onClose,\n onTransition\n } = this.props;\n const toValue = this.getAnimateToValue({\n ...this.props,\n closing\n });\n this.lastToValue = toValue;\n this.isClosing.setValue(closing ? TRUE : FALSE);\n const spec = closing ? transitionSpec.close : transitionSpec.open;\n const animation = spec.animation === 'spring' ? Animated.spring : Animated.timing;\n this.setPointerEventsEnabled(!closing);\n this.handleStartInteraction();\n clearTimeout(this.pendingGestureCallback);\n onTransition === null || onTransition === void 0 ? void 0 : onTransition({\n closing,\n gesture: velocity !== undefined\n });\n animation(gesture, {\n ...spec.config,\n velocity,\n toValue,\n useNativeDriver,\n isInteraction: false\n }).start(_ref2 => {\n let {\n finished\n } = _ref2;\n this.handleEndInteraction();\n clearTimeout(this.pendingGestureCallback);\n if (finished) {\n if (closing) {\n onClose();\n } else {\n onOpen();\n }\n if (this.isCurrentlyMounted) {\n // Make sure to re-open screen if it wasn't removed\n this.forceUpdate();\n }\n }\n });\n });\n _defineProperty(this, \"getAnimateToValue\", _ref3 => {\n let {\n closing,\n layout,\n gestureDirection\n } = _ref3;\n if (!closing) {\n return 0;\n }\n return getDistanceForDirection(layout, gestureDirection);\n });\n _defineProperty(this, \"setPointerEventsEnabled\", enabled => {\n var _this$ref$current;\n const pointerEvents = enabled ? 'box-none' : 'none';\n (_this$ref$current = this.ref.current) === null || _this$ref$current === void 0 ? void 0 : _this$ref$current.setPointerEvents(pointerEvents);\n });\n _defineProperty(this, \"handleStartInteraction\", () => {\n if (this.interactionHandle === undefined) {\n this.interactionHandle = InteractionManager.createInteractionHandle();\n }\n });\n _defineProperty(this, \"handleEndInteraction\", () => {\n if (this.interactionHandle !== undefined) {\n InteractionManager.clearInteractionHandle(this.interactionHandle);\n this.interactionHandle = undefined;\n }\n });\n _defineProperty(this, \"handleGestureStateChange\", _ref4 => {\n let {\n nativeEvent\n } = _ref4;\n const {\n layout,\n onClose,\n onGestureBegin,\n onGestureCanceled,\n onGestureEnd,\n gestureDirection,\n gestureVelocityImpact\n } = this.props;\n switch (nativeEvent.state) {\n case GestureState.ACTIVE:\n this.isSwiping.setValue(TRUE);\n this.handleStartInteraction();\n onGestureBegin === null || onGestureBegin === void 0 ? void 0 : onGestureBegin();\n break;\n case GestureState.CANCELLED:\n {\n this.isSwiping.setValue(FALSE);\n this.handleEndInteraction();\n const velocity = gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? nativeEvent.velocityY : nativeEvent.velocityX;\n this.animate({\n closing: this.props.closing,\n velocity\n });\n onGestureCanceled === null || onGestureCanceled === void 0 ? void 0 : onGestureCanceled();\n break;\n }\n case GestureState.END:\n {\n this.isSwiping.setValue(FALSE);\n let distance;\n let translation;\n let velocity;\n if (gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted') {\n distance = layout.height;\n translation = nativeEvent.translationY;\n velocity = nativeEvent.velocityY;\n } else {\n distance = layout.width;\n translation = nativeEvent.translationX;\n velocity = nativeEvent.velocityX;\n }\n const closing = (translation + velocity * gestureVelocityImpact) * getInvertedMultiplier(gestureDirection) > distance / 2 ? velocity !== 0 || translation !== 0 : this.props.closing;\n this.animate({\n closing,\n velocity\n });\n if (closing) {\n // We call onClose with a delay to make sure that the animation has already started\n // This will make sure that the state update caused by this doesn't affect start of animation\n this.pendingGestureCallback = setTimeout(() => {\n onClose();\n\n // Trigger an update after we dispatch the action to remove the screen\n // This will make sure that we check if the screen didn't get removed so we can cancel the animation\n this.forceUpdate();\n }, 32);\n }\n onGestureEnd === null || onGestureEnd === void 0 ? void 0 : onGestureEnd();\n break;\n }\n }\n });\n _defineProperty(this, \"getInterpolatedStyle\", memoize((styleInterpolator, animation) => styleInterpolator(animation)));\n _defineProperty(this, \"getCardAnimation\", memoize((interpolationIndex, current, next, layout, insetTop, insetRight, insetBottom, insetLeft) => ({\n index: interpolationIndex,\n current: {\n progress: current\n },\n next: next && {\n progress: next\n },\n closing: this.isClosing,\n swiping: this.isSwiping,\n inverted: this.inverted,\n layouts: {\n screen: layout\n },\n insets: {\n top: insetTop,\n right: insetRight,\n bottom: insetBottom,\n left: insetLeft\n }\n })));\n _defineProperty(this, \"ref\", /*#__PURE__*/React.createRef());\n }\n componentDidMount() {\n this.animate({\n closing: this.props.closing\n });\n this.isCurrentlyMounted = true;\n }\n componentDidUpdate(prevProps) {\n const {\n layout,\n gestureDirection,\n closing\n } = this.props;\n const {\n width,\n height\n } = layout;\n if (width !== prevProps.layout.width) {\n this.layout.width.setValue(width);\n }\n if (height !== prevProps.layout.height) {\n this.layout.height.setValue(height);\n }\n if (gestureDirection !== prevProps.gestureDirection) {\n this.inverted.setValue(getInvertedMultiplier(gestureDirection));\n }\n const toValue = this.getAnimateToValue(this.props);\n if (this.getAnimateToValue(prevProps) !== toValue || this.lastToValue !== toValue) {\n // We need to trigger the animation when route was closed\n // Thr route might have been closed by a `POP` action or by a gesture\n // When route was closed due to a gesture, the animation would've happened already\n // It's still important to trigger the animation so that `onClose` is called\n // If `onClose` is not called, cleanup step won't be performed for gestures\n this.animate({\n closing\n });\n }\n }\n componentWillUnmount() {\n this.props.gesture.stopAnimation();\n this.isCurrentlyMounted = false;\n this.handleEndInteraction();\n }\n gestureActivationCriteria() {\n const {\n layout,\n gestureDirection,\n gestureResponseDistance\n } = this.props;\n const enableTrackpadTwoFingerGesture = true;\n const distance = gestureResponseDistance !== undefined ? gestureResponseDistance : gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? GESTURE_RESPONSE_DISTANCE_VERTICAL : GESTURE_RESPONSE_DISTANCE_HORIZONTAL;\n if (gestureDirection === 'vertical') {\n return {\n maxDeltaX: 15,\n minOffsetY: 5,\n hitSlop: {\n bottom: -layout.height + distance\n },\n enableTrackpadTwoFingerGesture\n };\n } else if (gestureDirection === 'vertical-inverted') {\n return {\n maxDeltaX: 15,\n minOffsetY: -5,\n hitSlop: {\n top: -layout.height + distance\n },\n enableTrackpadTwoFingerGesture\n };\n } else {\n const hitSlop = -layout.width + distance;\n const invertedMultiplier = getInvertedMultiplier(gestureDirection);\n if (invertedMultiplier === 1) {\n return {\n minOffsetX: 5,\n maxDeltaY: 20,\n hitSlop: {\n right: hitSlop\n },\n enableTrackpadTwoFingerGesture\n };\n } else {\n return {\n minOffsetX: -5,\n maxDeltaY: 20,\n hitSlop: {\n left: hitSlop\n },\n enableTrackpadTwoFingerGesture\n };\n }\n }\n }\n render() {\n const {\n styleInterpolator,\n interpolationIndex,\n current,\n gesture,\n next,\n layout,\n insets,\n overlay,\n overlayEnabled,\n shadowEnabled,\n gestureEnabled,\n gestureDirection,\n pageOverflowEnabled,\n headerDarkContent,\n children,\n containerStyle: customContainerStyle,\n contentStyle,\n ...rest\n } = this.props;\n const interpolationProps = this.getCardAnimation(interpolationIndex, current, next, layout, insets.top, insets.right, insets.bottom, insets.left);\n const interpolatedStyle = this.getInterpolatedStyle(styleInterpolator, interpolationProps);\n const {\n containerStyle,\n cardStyle,\n overlayStyle,\n shadowStyle\n } = interpolatedStyle;\n const handleGestureEvent = gestureEnabled ? Animated.event([{\n nativeEvent: gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? {\n translationY: gesture\n } : {\n translationX: gesture\n }\n }], {\n useNativeDriver\n }) : undefined;\n const {\n backgroundColor\n } = StyleSheet.flatten(contentStyle || {});\n const isTransparent = typeof backgroundColor === 'string' ? Color(backgroundColor).alpha() === 0 : false;\n return /*#__PURE__*/React.createElement(CardAnimationContext.Provider, {\n value: interpolationProps\n },\n // StatusBar messes with translucent status bar on Android\n // So we should only enable it on iOS\n Platform.OS === 'ios' && overlayEnabled && next && getIsModalPresentation(styleInterpolator) ? /*#__PURE__*/React.createElement(ModalStatusBarManager, {\n dark: headerDarkContent,\n layout: layout,\n insets: insets,\n style: cardStyle\n }) : null, /*#__PURE__*/React.createElement(Animated.View, {\n style: {\n // This is a dummy style that doesn't actually change anything visually.\n // Animated needs the animated value to be used somewhere, otherwise things don't update properly.\n // If we disable animations and hide header, it could end up making the value unused.\n // So we have this dummy style that will always be used regardless of what else changed.\n opacity: current\n }\n // Make sure that this view isn't removed. If this view is removed, our style with animated value won't apply\n ,\n collapsable: false\n }), /*#__PURE__*/React.createElement(View, _extends({\n pointerEvents: \"box-none\"\n }, rest), overlayEnabled ? /*#__PURE__*/React.createElement(View, {\n pointerEvents: \"box-none\",\n style: StyleSheet.absoluteFill\n }, overlay({\n style: overlayStyle\n })) : null, /*#__PURE__*/React.createElement(Animated.View, {\n style: [styles.container, containerStyle, customContainerStyle],\n pointerEvents: \"box-none\"\n }, /*#__PURE__*/React.createElement(PanGestureHandler, _extends({\n enabled: layout.width !== 0 && gestureEnabled,\n onGestureEvent: handleGestureEvent,\n onHandlerStateChange: this.handleGestureStateChange\n }, this.gestureActivationCriteria()), /*#__PURE__*/React.createElement(Animated.View, {\n needsOffscreenAlphaCompositing: hasOpacityStyle(cardStyle),\n style: [styles.container, cardStyle]\n }, shadowEnabled && shadowStyle && !isTransparent ? /*#__PURE__*/React.createElement(Animated.View, {\n style: [styles.shadow, gestureDirection === 'horizontal' ? [styles.shadowHorizontal, styles.shadowLeft] : gestureDirection === 'horizontal-inverted' ? [styles.shadowHorizontal, styles.shadowRight] : gestureDirection === 'vertical' ? [styles.shadowVertical, styles.shadowTop] : [styles.shadowVertical, styles.shadowBottom], {\n backgroundColor\n }, shadowStyle],\n pointerEvents: \"none\"\n }) : null, /*#__PURE__*/React.createElement(CardSheet, {\n ref: this.ref,\n enabled: pageOverflowEnabled,\n layout: layout,\n style: contentStyle\n }, children))))));\n }\n}\n_defineProperty(Card, \"defaultProps\", {\n shadowEnabled: false,\n gestureEnabled: true,\n gestureVelocityImpact: GESTURE_VELOCITY_IMPACT,\n overlay: _ref5 => {\n let {\n style\n } = _ref5;\n return style ? /*#__PURE__*/React.createElement(Animated.View, {\n pointerEvents: \"none\",\n style: [styles.overlay, style]\n }) : null;\n }\n});\nexport const getIsModalPresentation = cardStyleInterpolator => {\n return cardStyleInterpolator === forModalPresentationIOS ||\n // Handle custom modal presentation interpolators as well\n cardStyleInterpolator.name === 'forModalPresentationIOS';\n};\nconst styles = StyleSheet.create({\n container: {\n flex: 1\n },\n overlay: {\n flex: 1,\n backgroundColor: '#000'\n },\n shadow: {\n position: 'absolute',\n shadowRadius: 5,\n shadowColor: '#000',\n shadowOpacity: 0.3\n },\n shadowHorizontal: {\n top: 0,\n bottom: 0,\n width: 3,\n shadowOffset: {\n width: -1,\n height: 1\n }\n },\n shadowLeft: {\n left: 0\n },\n shadowRight: {\n right: 0\n },\n shadowVertical: {\n left: 0,\n right: 0,\n height: 3,\n shadowOffset: {\n width: 1,\n height: -1\n }\n },\n shadowTop: {\n top: 0\n },\n shadowBottom: {\n bottom: 0\n }\n});\n//# sourceMappingURL=Card.js.map"]},"metadata":{},"sourceType":"module"}