text: "use strict";
  
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.default = exports.CHANNEL = void 0;
  
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
  
  var _propTypes = _interopRequireDefault(require("prop-types"));
  
  // Same value used by react-jss
  var CHANNEL = '__THEMING__';
  exports.CHANNEL = CHANNEL;
  var themeListener = {
    contextTypes: (0, _defineProperty2.default)({}, CHANNEL, _propTypes.default.object),
    initial: function initial(context) {
      if (!context[CHANNEL]) {
        return null;
      }
  
      return context[CHANNEL].getState();
    },
    subscribe: function subscribe(context, cb) {
      if (!context[CHANNEL]) {
        return null;
      }
  
      return context[CHANNEL].subscribe(cb);
    },
    unsubscribe: function unsubscribe(context, subscriptionId) {
      if (context[CHANNEL]) {
        context[CHANNEL].unsubscribe(subscriptionId);
      }
    }
  };
  var _default = themeListener;
  exports.default = _default;