{"version":3,"names":["JSReanimated","isWeb","PropsAllowlists","createReactDOMStyle","createTransformValue","createTextShadowValue","require","default","e","reanimatedJS","global","_makeShareableClone","Error","_scheduleOnJS","_scheduleOnRuntime","_updatePropsJS","updates","viewRef","isAnimatedProps","_component","component","rawStyles","Object","keys","reduce","acc","key","value","index","setNativeProps","undefined","style","updatePropsDOM","props","length","forEach","dashedKey","replace","m","toLowerCase","_touchableNode","setAttribute","componentName","className","console","warn","newProps","_component$setNativeP2","_component$setNativeP","uiProps","isNativeProp","call","previousStyle","currentStyle","domStyle","Array","isArray","transform","textShadowColor","textShadowRadius","textShadowOffset","textShadow","propName","NATIVE_THREAD_PROPS_WHITELIST"],"sources":["index.ts"],"sourcesContent":["'use strict';\nimport JSReanimated from './JSReanimated';\nimport type { StyleProps } from '../commonTypes';\nimport type { AnimatedStyle } from '../helperTypes';\nimport { isWeb } from '../PlatformChecker';\nimport { PropsAllowlists } from '../../propsAllowlists';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet createReactDOMStyle: (style: any) => any;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet createTransformValue: (transform: any) => any;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet createTextShadowValue: (style: any) => void | string;\n\nif (isWeb()) {\n try {\n createReactDOMStyle =\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('react-native-web/dist/exports/StyleSheet/compiler/createReactDOMStyle').default;\n } catch (e) {}\n\n try {\n // React Native Web 0.19+\n createTransformValue =\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('react-native-web/dist/exports/StyleSheet/preprocess').createTransformValue;\n } catch (e) {}\n\n try {\n createTextShadowValue =\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('react-native-web/dist/exports/StyleSheet/preprocess').createTextShadowValue;\n } catch (e) {}\n}\n\nconst reanimatedJS = new JSReanimated();\n\nglobal._makeShareableClone = () => {\n throw new Error(\n '[Reanimated] _makeShareableClone should never be called in JSReanimated.'\n );\n};\n\nglobal._scheduleOnJS = () => {\n throw new Error(\n '[Reanimated] _scheduleOnJS should never be called in JSReanimated.'\n );\n};\n\nglobal._scheduleOnRuntime = () => {\n throw new Error(\n '[Reanimated] _scheduleOnRuntime should never be called in JSReanimated.'\n );\n};\n\ninterface JSReanimatedComponent {\n previousStyle: StyleProps;\n setNativeProps?: (style: StyleProps) => void;\n style?: StyleProps;\n props: Record;\n _touchableNode: {\n setAttribute: (key: string, props: unknown) => void;\n };\n}\n\nexport interface ReanimatedHTMLElement extends HTMLElement {\n previousStyle: StyleProps;\n setNativeProps?: (style: StyleProps) => void;\n props: Record;\n _touchableNode: {\n setAttribute: (key: string, props: unknown) => void;\n };\n reanimatedDummy?: boolean;\n removedAfterAnimation?: boolean;\n}\n\nexport const _updatePropsJS = (\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n updates: StyleProps | AnimatedStyle,\n viewRef: { _component?: JSReanimatedComponent | ReanimatedHTMLElement },\n isAnimatedProps?: boolean\n): void => {\n if (viewRef._component) {\n const component = viewRef._component;\n const [rawStyles] = Object.keys(updates).reduce(\n (acc: [StyleProps, AnimatedStyle], key) => {\n const value = updates[key];\n const index = typeof value === 'function' ? 1 : 0;\n acc[index][key] = value;\n return acc;\n },\n [{}, {}]\n );\n\n if (typeof component.setNativeProps === 'function') {\n // This is the legacy way to update props on React Native Web <= 0.18.\n // Also, some components (e.g. from react-native-svg) don't have styles\n // and always provide setNativeProps function instead (even on React Native Web 0.19+).\n setNativeProps(component, rawStyles, isAnimatedProps);\n } else if (\n createReactDOMStyle !== undefined &&\n component.style !== undefined\n ) {\n // React Native Web 0.19+ no longer provides setNativeProps function,\n // so we need to update DOM nodes directly.\n updatePropsDOM(component, rawStyles, isAnimatedProps);\n } else if (Object.keys(component.props).length > 0) {\n Object.keys(component.props).forEach((key) => {\n if (!rawStyles[key]) {\n return;\n }\n const dashedKey = key.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase());\n component._touchableNode.setAttribute(dashedKey, rawStyles[key]);\n });\n } else {\n const componentName =\n 'className' in component ? component?.className : '';\n console.warn(\n `[Reanimated] It's not possible to manipulate the component ${componentName}`\n );\n }\n }\n};\n\nconst setNativeProps = (\n component: JSReanimatedComponent | ReanimatedHTMLElement,\n newProps: StyleProps,\n isAnimatedProps?: boolean\n): void => {\n if (isAnimatedProps) {\n const uiProps: Record = {};\n for (const key in newProps) {\n if (isNativeProp(key)) {\n uiProps[key] = newProps[key];\n }\n }\n // Only update UI props directly on the component,\n // other props can be updated as standard style props.\n component.setNativeProps?.(uiProps);\n }\n\n const previousStyle = component.previousStyle ? component.previousStyle : {};\n const currentStyle = { ...previousStyle, ...newProps };\n component.previousStyle = currentStyle;\n\n component.setNativeProps?.({ style: currentStyle });\n};\n\nconst updatePropsDOM = (\n component: JSReanimatedComponent | HTMLElement,\n style: StyleProps,\n isAnimatedProps?: boolean\n): void => {\n const previousStyle = (component as JSReanimatedComponent).previousStyle\n ? (component as JSReanimatedComponent).previousStyle\n : {};\n const currentStyle = { ...previousStyle, ...style };\n (component as JSReanimatedComponent).previousStyle = currentStyle;\n\n const domStyle = createReactDOMStyle(currentStyle);\n if (Array.isArray(domStyle.transform) && createTransformValue !== undefined) {\n domStyle.transform = createTransformValue(domStyle.transform);\n }\n\n if (\n createTextShadowValue !== undefined &&\n (domStyle.textShadowColor ||\n domStyle.textShadowRadius ||\n domStyle.textShadowOffset)\n ) {\n domStyle.textShadow = createTextShadowValue({\n textShadowColor: domStyle.textShadowColor,\n textShadowOffset: domStyle.textShadowOffset,\n textShadowRadius: domStyle.textShadowRadius,\n });\n }\n\n for (const key in domStyle) {\n if (isAnimatedProps) {\n (component as HTMLElement).setAttribute(key, domStyle[key]);\n } else {\n (component.style as StyleProps)[key] = domStyle[key];\n }\n }\n};\n\nfunction isNativeProp(propName: string): boolean {\n return !!PropsAllowlists.NATIVE_THREAD_PROPS_WHITELIST[propName];\n}\n\nexport default reanimatedJS;\n"],"mappings":"AAAA,YAAY;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