{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/objectWithoutProperties\";\nvar _excluded = [\"style\", \"debug\"];\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) { _defineProperty(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; }\nimport { propConfig } from \"../theme/styled-system\";\nimport { useTheme } from \"./useTheme\";\nimport React from 'react';\nimport { useNativeBaseConfig } from \"../core/NativeBaseContext\";\nimport { useResponsiveQuery } from \"../utils/useResponsiveQuery\";\nimport stableHash from 'stable-hash';\nimport { resolvePropsToStyle } from \"./useThemeProps/resolvePropsToStyle\";\nimport Platform from \"react-native-web/dist/exports/Platform\";\nimport StyleSheet from \"react-native-web/dist/exports/StyleSheet\";\nimport { omitUndefined } from \"../theme/tools\";\nimport { isEmptyObj } from \"../utils/isEmptyObj\";\nvar getStyledSystemPropsAndRestProps = function getStyledSystemPropsAndRestProps(props) {\n  var styledSystemProps = {};\n  var restProps = {};\n  var incomingAndThemeProps = omitUndefined(props);\n  for (var key in incomingAndThemeProps) {\n    if (key in propConfig) {\n      styledSystemProps[key] = incomingAndThemeProps[key];\n    } else {\n      restProps[key] = incomingAndThemeProps[key];\n    }\n  }\n  return {\n    styledSystemProps: styledSystemProps,\n    restProps: restProps\n  };\n};\nexport var useStyledSystemPropsResolver = function useStyledSystemPropsResolver(_ref) {\n  var propStyle = _ref.style,\n    debug = _ref.debug,\n    props = _objectWithoutProperties(_ref, _excluded);\n  var theme = useTheme();\n  var _useNativeBaseConfig = useNativeBaseConfig('makeStyledComponent'),\n    currentBreakpoint = _useNativeBaseConfig.currentBreakpoint,\n    config = _useNativeBaseConfig.config;\n  var strictMode = config.strictMode;\n  var _useResponsiveQuery = useResponsiveQuery(),\n    getResponsiveStyles = _useResponsiveQuery.getResponsiveStyles;\n  var _getStyledSystemProps = getStyledSystemPropsAndRestProps(props),\n    styledSystemProps = _getStyledSystemProps.styledSystemProps,\n    restProps = _getStyledSystemProps.restProps;\n  var _React$useMemo = React.useMemo(function () {\n      var resolvedStyle = resolvePropsToStyle(styledSystemProps, theme, Platform.OS, debug, currentBreakpoint, strictMode, getResponsiveStyles, restProps.INTERNAL_themeStyle, restProps.stateProps, restProps.INTERNAL_inlineStyle);\n      return resolvedStyle;\n    }, [stableHash(styledSystemProps), theme, currentBreakpoint, debug, strictMode, stableHash(propStyle), getResponsiveStyles, stableHash(props), stableHash(restProps.stateProps), stableHash(restProps.INTERNAL_inlineStyle)]),\n    style = _React$useMemo.style,\n    dataSet = _React$useMemo.dataSet,\n    styleFromProps = _React$useMemo.styleFromProps;\n  delete restProps.INTERNAL_themeStyle;\n  delete restProps.stateProps;\n  restProps.dataSet = _objectSpread(_objectSpread({}, restProps.dataSet), dataSet);\n  var boxStyleSheet = StyleSheet.create({\n    box: style\n  });\n  var styleSheet;\n  if (!isEmptyObj(propStyle)) {\n    styleSheet = [boxStyleSheet.box, propStyle];\n  } else {\n    styleSheet = boxStyleSheet.box;\n  }\n  return [styleSheet, restProps, styleFromProps];\n};","map":{"version":3,"sources":["useStyledSystemPropsResolver.ts"],"names":["propConfig","useTheme","React","useNativeBaseConfig","useResponsiveQuery","stableHash","resolvePropsToStyle","omitUndefined","isEmptyObj","getStyledSystemPropsAndRestProps","props","styledSystemProps","restProps","incomingAndThemeProps","key","useStyledSystemPropsResolver","style","propStyle","debug","theme","currentBreakpoint","config","strictMode","getResponsiveStyles","dataSet","styleFromProps","useMemo","resolvedStyle","Platform","OS","INTERNAL_themeStyle","stateProps","INTERNAL_inlineStyle","boxStyleSheet","create","box","styleSheet"],"mappings":";;;;;AACA,SAASA,UAAT;AACA,SAASC,QAAT;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAASC,mBAAT;AACA,SAASC,kBAAT;AAEA,OAAOC,UAAP,MAAuB,aAAvB;AACA,SAASC,mBAAT;AAAA,OAAA,QAAA;AAAA,OAAA,UAAA;AAEA,SAASC,aAAT;AACA,SAASC,UAAT;AAEA,IAAMC,gCAAgC,GAAIC,SAApCD,gCAAgC,CAAIC,KAAD,EAAgB;EACvD,IAAMC,iBAAsB,GAAG,CAAA,CAA/B;EACA,IAAMC,SAAc,GAAG,CAAA,CAAvB;EAEA,IAAMC,qBAAqB,GAAGN,aAAa,CAACG,KAAD,CAA3C;EAEA,KAAK,IAAMI,GAAX,IAAkBD,qBAAlB,EAAyC;IACvC,IAAIC,GAAG,IAAId,UAAX,EAAuB;MACrBW,iBAAiB,CAACG,GAAD,CAAjBH,GAAyBE,qBAAqB,CAACC,GAAD,CAA9CH;IACD,CAFD,MAEO;MACLC,SAAS,CAACE,GAAD,CAATF,GAAiBC,qBAAqB,CAACC,GAAD,CAAtCF;IACD;EACF;EAED,OAAO;IAAED,iBAAF,EAAEA,iBAAF;IAAqBC,SAAAA,EAAAA;EAArB,CAAP;AACD,CAfD;AAiBA,OAAO,IAAMG,4BAA4B,GAAG,SAA/BA,4BAA4B,CAAA,IAAA,EAI9B;EAAA,IAHFE,SADoC,GAAA,IAAA,CAC3CD,KAAK;IACLE,KAF2C,GAAA,IAAA,CAE3CA,KAF2C;IAGxCR,KAAAA,GAAAA,wBAAAA,CAAAA,IAAAA,EAAAA,SAAAA;EAEH,IAAMS,KAAK,GAAGlB,QAAQ,CAAA,CAAtB;EAEA,IAAA,oBAAA,GAAsCE,mBAAmB,CACvD,qBADuD,CAAzD;IAAQ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AA,aAAAA,KAAyBA,SAAS,CAACY,OAAf,GAA2BA,OAAAA,CAA/CZ;EAEA,IAAMqB,aAAa,GAAG,UAAU,CAACC,MAAX,CAAkB;IAAEC,GAAG,EAAEnB;EAAP,CAAlB,CAtDb;EAuDT,IAAIoB,UAAJ;EAEA,IAAI,CAAC5B,UAAU,CAACS,SAAD,CAAf,EAA4B;IAC1BmB,UAAU,GAAG,CAACH,aAAa,CAACE,GAAf,EAAoBlB,SAApB,CAAbmB;EACD,CAFD,MAEO;IACLA,UAAU,GAAGH,aAAa,CAACE,GAA3BC;EACD;EAED,OAAO,CAACA,UAAD,EAAaxB,SAAb,EAAwBa,cAAxB,CAAP;AACD,CApEM","sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\nimport { propConfig } from '../theme/styled-system';\nimport { useTheme } from './useTheme';\nimport React from 'react';\nimport { useNativeBaseConfig } from '../core/NativeBaseContext';\nimport { useResponsiveQuery } from '../utils/useResponsiveQuery';\n//@ts-ignore\nimport stableHash from 'stable-hash';\nimport { resolvePropsToStyle } from './useThemeProps/resolvePropsToStyle';\nimport { Platform, StyleSheet } from 'react-native';\nimport { omitUndefined } from '../theme/tools';\nimport { isEmptyObj } from '../utils/isEmptyObj';\n\nconst getStyledSystemPropsAndRestProps = (props: any) => {\n  const styledSystemProps: any = {};\n  const restProps: any = {};\n\n  const incomingAndThemeProps = omitUndefined(props);\n\n  for (const key in incomingAndThemeProps) {\n    if (key in propConfig) {\n      styledSystemProps[key] = incomingAndThemeProps[key];\n    } else {\n      restProps[key] = incomingAndThemeProps[key];\n    }\n  }\n\n  return { styledSystemProps, restProps };\n};\n\nexport const useStyledSystemPropsResolver = ({\n  style: propStyle,\n  debug,\n  ...props\n}: any) => {\n  const theme = useTheme();\n\n  const { currentBreakpoint, config } = useNativeBaseConfig(\n    'makeStyledComponent'\n  );\n  const strictMode = config.strictMode;\n\n  const { getResponsiveStyles } = useResponsiveQuery();\n\n  const { styledSystemProps, restProps } = getStyledSystemPropsAndRestProps(\n    props\n  );\n\n  const { style, dataSet, styleFromProps } = React.useMemo(() => {\n    const resolvedStyle = resolvePropsToStyle(\n      styledSystemProps,\n      theme,\n      Platform.OS,\n      debug,\n      currentBreakpoint,\n      strictMode,\n      getResponsiveStyles,\n      restProps.INTERNAL_themeStyle,\n      restProps.stateProps,\n      restProps.INTERNAL_inlineStyle\n    );\n    return resolvedStyle;\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    stableHash(styledSystemProps),\n    theme,\n    currentBreakpoint,\n    debug,\n    strictMode,\n    stableHash(propStyle),\n    getResponsiveStyles,\n    stableHash(props),\n    stableHash(restProps.stateProps),\n    stableHash(restProps.INTERNAL_inlineStyle),\n  ]);\n\n  // if (process.env.NODE_ENV === \"development\" && debug) {\n  //   /* eslint-disable-next-line */\n  //   console.log(\"style,resprops\", currentBreakpoint);\n  // }\n  // console.log('** use prop resolution 2', restProps);\n\n  delete restProps.INTERNAL_themeStyle;\n  delete restProps.stateProps;\n\n  restProps.dataSet = { ...restProps.dataSet, ...dataSet };\n\n  const boxStyleSheet = StyleSheet.create({ box: style }); // StyleSheet.create(style);\n  let styleSheet;\n\n  if (!isEmptyObj(propStyle)) {\n    styleSheet = [boxStyleSheet.box, propStyle];\n  } else {\n    styleSheet = boxStyleSheet.box;\n  }\n\n  return [styleSheet, restProps, styleFromProps];\n};\n"]},"metadata":{},"sourceType":"module"}