mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-22 16:35:14 +00:00
1 line
22 KiB
JSON
1 line
22 KiB
JSON
{"ast":null,"code":"'use strict';\n\nexports.__esModule = true;\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _propTypes = require('prop-types');\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _gud = require('gud');\n\nvar _gud2 = _interopRequireDefault(_gud);\n\nvar _warning = require('warning');\n\nvar _warning2 = _interopRequireDefault(_warning);\n\nfunction _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (!self) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n}\n\nvar MAX_SIGNED_31_BIT_INT = 1073741823; // Inlined Object.is polyfill.\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n\nfunction objectIs(x, y) {\n if (x === y) {\n return x !== 0 || 1 / x === 1 / y;\n } else {\n return x !== x && y !== y;\n }\n}\n\nfunction createEventEmitter(value) {\n var handlers = [];\n return {\n on: function on(handler) {\n handlers.push(handler);\n },\n off: function off(handler) {\n handlers = handlers.filter(function (h) {\n return h !== handler;\n });\n },\n get: function get() {\n return value;\n },\n set: function set(newValue, changedBits) {\n value = newValue;\n handlers.forEach(function (handler) {\n return handler(value, changedBits);\n });\n }\n };\n}\n\nfunction onlyChild(children) {\n return Array.isArray(children) ? children[0] : children;\n}\n\nfunction createReactContext(defaultValue, calculateChangedBits) {\n var _Provider$childContex, _Consumer$contextType;\n\n var contextProp = '__create-react-context-' + (0, _gud2.default)() + '__';\n\n var Provider = function (_Component) {\n _inherits(Provider, _Component);\n\n function Provider() {\n var _temp, _this, _ret;\n\n _classCallCheck(this, Provider);\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.emitter = createEventEmitter(_this.props.value), _temp), _possibleConstructorReturn(_this, _ret);\n }\n\n Provider.prototype.getChildContext = function getChildContext() {\n var _ref;\n\n return _ref = {}, _ref[contextProp] = this.emitter, _ref;\n };\n\n Provider.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {\n if (this.props.value !== nextProps.value) {\n var oldValue = this.props.value;\n var newValue = nextProps.value;\n var changedBits = void 0;\n\n if (objectIs(oldValue, newValue)) {\n changedBits = 0; // No change\n } else {\n changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;\n\n if (process.env.NODE_ENV !== 'production') {\n (0, _warning2.default)((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits);\n }\n\n changedBits |= 0;\n\n if (changedBits !== 0) {\n this.emitter.set(nextProps.value, changedBits);\n }\n }\n }\n };\n\n Provider.prototype.render = function render() {\n return this.props.children;\n };\n\n return Provider;\n }(_react.Component);\n\n Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = _propTypes2.default.object.isRequired, _Provider$childContex);\n\n var Consumer = function (_Component2) {\n _inherits(Consumer, _Component2);\n\n function Consumer() {\n var _temp2, _this2, _ret2;\n\n _classCallCheck(this, Consumer);\n\n for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return _ret2 = (_temp2 = (_this2 = _possibleConstructorReturn(this, _Component2.call.apply(_Component2, [this].concat(args))), _this2), _this2.state = {\n value: _this2.getValue()\n }, _this2.onUpdate = function (newValue, changedBits) {\n var observedBits = _this2.observedBits | 0;\n\n if ((observedBits & changedBits) !== 0) {\n _this2.setState({\n value: _this2.getValue()\n });\n }\n }, _temp2), _possibleConstructorReturn(_this2, _ret2);\n }\n\n Consumer.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {\n var observedBits = nextProps.observedBits;\n this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT // Subscribe to all changes by default\n : observedBits;\n };\n\n Consumer.prototype.componentDidMount = function componentDidMount() {\n if (this.context[contextProp]) {\n this.context[contextProp].on(this.onUpdate);\n }\n\n var observedBits = this.props.observedBits;\n this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT // Subscribe to all changes by default\n : observedBits;\n };\n\n Consumer.prototype.componentWillUnmount = function componentWillUnmount() {\n if (this.context[contextProp]) {\n this.context[contextProp].off(this.onUpdate);\n }\n };\n\n Consumer.prototype.getValue = function getValue() {\n if (this.context[contextProp]) {\n return this.context[contextProp].get();\n } else {\n return defaultValue;\n }\n };\n\n Consumer.prototype.render = function render() {\n return onlyChild(this.props.children)(this.state.value);\n };\n\n return Consumer;\n }(_react.Component);\n\n Consumer.contextTypes = (_Consumer$contextType = {}, _Consumer$contextType[contextProp] = _propTypes2.default.object, _Consumer$contextType);\n return {\n Provider: Provider,\n Consumer: Consumer\n };\n}\n\nexports.default = createReactContext;\nmodule.exports = exports['default'];","map":{"version":3,"sources":["/app/node_modules/@hypnosphi/create-react-context/lib/implementation.js"],"names":["exports","__esModule","_react","require","_react2","_interopRequireDefault","_propTypes","_propTypes2","_gud","_gud2","_warning","_warning2","obj","default","_classCallCheck","instance","Constructor","TypeError","_possibleConstructorReturn","self","call","ReferenceError","_inherits","subClass","superClass","prototype","Object","create","constructor","value","enumerable","writable","configurable","setPrototypeOf","__proto__","MAX_SIGNED_31_BIT_INT","objectIs","x","y","createEventEmitter","handlers","on","handler","push","off","filter","h","get","set","newValue","changedBits","forEach","onlyChild","children","Array","isArray","createReactContext","defaultValue","calculateChangedBits","_Provider$childContex","_Consumer$contextType","contextProp","Provider","_Component","_temp","_this","_ret","_len","arguments","length","args","_key","apply","concat","emitter","props","getChildContext","_ref","componentWillReceiveProps","nextProps","oldValue","process","env","NODE_ENV","render","Component","childContextTypes","object","isRequired","Consumer","_Component2","_temp2","_this2","_ret2","_len2","_key2","state","getValue","onUpdate","observedBits","setState","undefined","componentDidMount","context","componentWillUnmount","contextTypes","module"],"mappings":"AAAA;;AAEAA,OAAO,CAACC,UAAR,GAAqB,IAArB;;AAEA,IAAIC,MAAM,GAAGC,OAAO,CAAC,OAAD,CAApB;;AAEA,IAAIC,OAAO,GAAGC,sBAAsB,CAACH,MAAD,CAApC;;AAEA,IAAII,UAAU,GAAGH,OAAO,CAAC,YAAD,CAAxB;;AAEA,IAAII,WAAW,GAAGF,sBAAsB,CAACC,UAAD,CAAxC;;AAEA,IAAIE,IAAI,GAAGL,OAAO,CAAC,KAAD,CAAlB;;AAEA,IAAIM,KAAK,GAAGJ,sBAAsB,CAACG,IAAD,CAAlC;;AAEA,IAAIE,QAAQ,GAAGP,OAAO,CAAC,SAAD,CAAtB;;AAEA,IAAIQ,SAAS,GAAGN,sBAAsB,CAACK,QAAD,CAAtC;;AAEA,SAASL,sBAAT,CAAgCO,GAAhC,EAAqC;AAAE,SAAOA,GAAG,IAAIA,GAAG,CAACX,UAAX,GAAwBW,GAAxB,GAA8B;AAAEC,IAAAA,OAAO,EAAED;AAAX,GAArC;AAAwD;;AAE/F,SAASE,eAAT,CAAyBC,QAAzB,EAAmCC,WAAnC,EAAgD;AA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AAWnE,KAA1C,CAAP;AACD,KAFD;;AAIA,WAAO4D,QAAP;AACD,GA1Dc,CA0DbvF,MAAM,CAACmF,SA1DM,CAAf;;AA4DAI,EAAAA,QAAQ,CAACgB,YAAT,IAAyB7C,qBAAqB,GAAG,EAAxB,EAA4BA,qBAAqB,CAACC,WAAD,CAArB,GAAqCtD,WAAW,CAACM,OAAZ,CAAoB0E,MAArF,EAA6F3B,qBAAtH;AAGA,SAAO;AACLE,IAAAA,QAAQ,EAAEA,QADL;AAEL2B,IAAAA,QAAQ,EAAEA;AAFL,GAAP;AAID;;AAEDzF,OAAO,CAACa,OAAR,GAAkB2C,kBAAlB;AACAkD,MAAM,CAAC1G,OAAP,GAAiBA,OAAO,CAAC,SAAD,CAAxB","sourcesContent":["'use strict';\n\nexports.__esModule = true;\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _propTypes = require('prop-types');\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _gud = require('gud');\n\nvar _gud2 = _interopRequireDefault(_gud);\n\nvar _warning = require('warning');\n\nvar _warning2 = _interopRequireDefault(_warning);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar MAX_SIGNED_31_BIT_INT = 1073741823;\n\n// Inlined Object.is polyfill.\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\nfunction objectIs(x, y) {\n if (x === y) {\n return x !== 0 || 1 / x === 1 / y;\n } else {\n return x !== x && y !== y;\n }\n}\n\nfunction createEventEmitter(value) {\n var handlers = [];\n return {\n on: function on(handler) {\n handlers.push(handler);\n },\n off: function off(handler) {\n handlers = handlers.filter(function (h) {\n return h !== handler;\n });\n },\n get: function get() {\n return value;\n },\n set: function set(newValue, changedBits) {\n value = newValue;\n handlers.forEach(function (handler) {\n return handler(value, changedBits);\n });\n }\n };\n}\n\nfunction onlyChild(children) {\n return Array.isArray(children) ? children[0] : children;\n}\n\nfunction createReactContext(defaultValue, calculateChangedBits) {\n var _Provider$childContex, _Consumer$contextType;\n\n var contextProp = '__create-react-context-' + (0, _gud2.default)() + '__';\n\n var Provider = function (_Component) {\n _inherits(Provider, _Component);\n\n function Provider() {\n var _temp, _this, _ret;\n\n _classCallCheck(this, Provider);\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.emitter = createEventEmitter(_this.props.value), _temp), _possibleConstructorReturn(_this, _ret);\n }\n\n Provider.prototype.getChildContext = function getChildContext() {\n var _ref;\n\n return _ref = {}, _ref[contextProp] = this.emitter, _ref;\n };\n\n Provider.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {\n if (this.props.value !== nextProps.value) {\n var oldValue = this.props.value;\n var newValue = nextProps.value;\n var changedBits = void 0;\n\n if (objectIs(oldValue, newValue)) {\n changedBits = 0; // No change\n } else {\n changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;\n if (process.env.NODE_ENV !== 'production') {\n (0, _warning2.default)((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits);\n }\n\n changedBits |= 0;\n\n if (changedBits !== 0) {\n this.emitter.set(nextProps.value, changedBits);\n }\n }\n }\n };\n\n Provider.prototype.render = function render() {\n return this.props.children;\n };\n\n return Provider;\n }(_react.Component);\n\n Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = _propTypes2.default.object.isRequired, _Provider$childContex);\n\n var Consumer = function (_Component2) {\n _inherits(Consumer, _Component2);\n\n function Consumer() {\n var _temp2, _this2, _ret2;\n\n _classCallCheck(this, Consumer);\n\n for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return _ret2 = (_temp2 = (_this2 = _possibleConstructorReturn(this, _Component2.call.apply(_Component2, [this].concat(args))), _this2), _this2.state = {\n value: _this2.getValue()\n }, _this2.onUpdate = function (newValue, changedBits) {\n var observedBits = _this2.observedBits | 0;\n if ((observedBits & changedBits) !== 0) {\n _this2.setState({ value: _this2.getValue() });\n }\n }, _temp2), _possibleConstructorReturn(_this2, _ret2);\n }\n\n Consumer.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {\n var observedBits = nextProps.observedBits;\n\n this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT // Subscribe to all changes by default\n : observedBits;\n };\n\n Consumer.prototype.componentDidMount = function componentDidMount() {\n if (this.context[contextProp]) {\n this.context[contextProp].on(this.onUpdate);\n }\n var observedBits = this.props.observedBits;\n\n this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT // Subscribe to all changes by default\n : observedBits;\n };\n\n Consumer.prototype.componentWillUnmount = function componentWillUnmount() {\n if (this.context[contextProp]) {\n this.context[contextProp].off(this.onUpdate);\n }\n };\n\n Consumer.prototype.getValue = function getValue() {\n if (this.context[contextProp]) {\n return this.context[contextProp].get();\n } else {\n return defaultValue;\n }\n };\n\n Consumer.prototype.render = function render() {\n return onlyChild(this.props.children)(this.state.value);\n };\n\n return Consumer;\n }(_react.Component);\n\n Consumer.contextTypes = (_Consumer$contextType = {}, _Consumer$contextType[contextProp] = _propTypes2.default.object, _Consumer$contextType);\n\n\n return {\n Provider: Provider,\n Consumer: Consumer\n };\n}\n\nexports.default = createReactContext;\nmodule.exports = exports['default'];"]},"metadata":{},"sourceType":"script"} |