"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.CairoProvider = CairoProvider;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = require("@wix/bex-core/react");
var _reactDom = require("@wix/bex-utils/react-dom");
var _react2 = _interopRequireWildcard(require("react"));
var _version = require("../version");
require("../styles.global.css");
var wixDesignSystemVersion = _interopRequireWildcard(require("../wix-design-system-version"));
var _minimalRequiredWdsRuntimeCheck = require("../minimalRequiredWdsRuntimeCheck");
var _PatternsThemeProvider = require("../themes/PatternsThemeProvider");
var _panelTheme = require("../themes/panel-theme");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/providers/CairoProvider.tsx";
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
(0, _reactDom.configure)();
if (process.env.NODE_ENV !== 'production') {
  (0, _minimalRequiredWdsRuntimeCheck.minimalRequiredWdsRuntimeCheck)({
    required: wixDesignSystemVersion.required
  });
}
function CairoProvider(props) {
  const {
    value: valueProp,
    children,
    layoutType,
    ...rest
  } = props;
  const [value] = (0, _react2.useState)(() => ({
    ...valueProp,
    environment: {
      ...valueProp.environment,
      uiLibVersion: _version.version
    }
  }));
  let child = children;
  if (layoutType === 'panel') {
    child = /*#__PURE__*/_react2.default.createElement(_PatternsThemeProvider.PatternsThemeProvider, {
      value: _panelTheme.panelTheme,
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 41,
        columnNumber: 7
      }
    }, children);
  }
  return /*#__PURE__*/_react2.default.createElement(_react.CairoProvider, (0, _extends2.default)({}, rest, {
    value: value,
    layoutType: layoutType,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 47,
      columnNumber: 5
    }
  }), child);
}
//# sourceMappingURL=CairoProvider.js.map