UNPKG

reactotron-react-native

Version:

A development tool to explore, inspect, and diagnose your React Native apps.

2 lines (1 loc) 31.8 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var reactNative=require("react-native"),reactotronCoreClient=require("reactotron-core-client"),NativeSourceCode=require("react-native/Libraries/NativeModules/specs/NativeSourceCode"),React=require("react"),_LogBox=require("react-native/Libraries/LogBox/LogBox");function _interopDefaultLegacy(a){return a&&"object"==typeof a&&"default"in a?a:{default:a}}var NativeSourceCode__default=_interopDefaultLegacy(NativeSourceCode),React__default=_interopDefaultLegacy(React),_LogBox__default=_interopDefaultLegacy(_LogBox);function _callSuper(a,b,c){return b=_getPrototypeOf(b),_possibleConstructorReturn(a,_isNativeReflectConstruct()?Reflect.construct(b,c||[],_getPrototypeOf(a).constructor):b.apply(a,c))}function _isNativeReflectConstruct(){try{var a=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(a){}return(_isNativeReflectConstruct=function(){return!!a})()}function _iterableToArrayLimit(b,c){var d=null==b?null:"undefined"!=typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(null!=d){var g,h,j,k,l=[],a=!0,m=!1;try{if(j=(d=d.call(b)).next,0===c){if(Object(d)!==d)return;a=!1}else for(;!(a=(g=j.call(d)).done)&&(l.push(g.value),l.length!==c);a=!0);}catch(a){m=!0,h=a}finally{try{if(!a&&null!=d.return&&(k=d.return(),Object(k)!==k))return}finally{if(m)throw h}}return l}}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread2(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _regeneratorRuntime(){function b(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function f(b,d,e,f){var g=d&&d.prototype instanceof k?d:k,h=Object.create(g.prototype),a=new B(f||[]);return E(h,"_invoke",{value:w(b,e,a)}),h}function j(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function k(){}function l(){}function m(){}function q(a){["next","throw","return"].forEach(function(c){b(a,c,function(a){return this._invoke(c,a)})})}function s(b,d){function c(e,f,g,i){var a=j(b[e],b,f);if("throw"!==a.type){var k=a.arg,l=k.value;return l&&"object"==typeof l&&t.call(l,"__await")?d.resolve(l.__await).then(function(a){c("next",a,g,i)},function(a){c("throw",a,g,i)}):d.resolve(l).then(function(a){k.value=a,g(k)},function(a){return c("throw",a,g,i)})}i(a.arg)}var e;E(this,"_invoke",{value:function(a,b){function f(){return new d(function(d,e){c(a,b,d,e)})}return e=e?e.then(f,f):f()}})}function w(a,b,d){var e="suspendedStart";return function(f,g){if(e==="executing")throw new Error("Generator is already running");if("completed"===e){if("throw"===f)throw g;return{value:D,done:!0}}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=x(h,d);if(i){if(i===G)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"===e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=j(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===G)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function x(b,c){var d=c.method,e=b.iterator[d];if(e===D)return c.delegate=null,"throw"===d&&b.iterator.return&&(c.method="return",c.arg=D,x(b,c),"throw"===c.method)||"return"!==d&&(c.method="throw",c.arg=new TypeError("The iterator does not provide a '"+d+"' method")),G;var f=j(e,b.iterator,c.arg);if("throw"===f.type)return c.method="throw",c.arg=f.arg,c.delegate=null,G;var g=f.arg;return g?g.done?(c[b.resultName]=g.value,c.next=b.nextLoc,"return"!==c.method&&(c.method="next",c.arg=D),c.delegate=null,G):g:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,G)}function z(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function A(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function B(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(z,this),this.reset(!0)}function C(a){if(a||""===a){var b=a[F];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(t.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=D,b.done=!0,b};return d.next=d}}throw new TypeError(typeof a+" is not iterable")}_regeneratorRuntime=function(){return h};var D,h={},e=Object.prototype,t=e.hasOwnProperty,E=Object.defineProperty||function(a,b,c){a[b]=c.value},n="function"==typeof Symbol?Symbol:{},F=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";try{b({},"")}catch(a){b=function(a,b,c){return a[b]=c}}h.wrap=f;var G={},i={};b(i,F,function(){return this});var o=Object.getPrototypeOf,d=o&&o(o(C([])));d&&d!==e&&t.call(d,F)&&(i=d);var r=m.prototype=k.prototype=Object.create(i);return l.prototype=m,E(r,"constructor",{value:m,configurable:!0}),E(m,"constructor",{value:l,configurable:!0}),l.displayName=b(m,c,"GeneratorFunction"),h.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===l||"GeneratorFunction"===(b.displayName||b.name))},h.mark=function(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,m):(a.__proto__=m,b(a,c,"GeneratorFunction")),a.prototype=Object.create(r),a},h.awrap=function(a){return{__await:a}},q(s.prototype),b(s.prototype,a,function(){return this}),h.AsyncIterator=s,h.async=function(b,c,d,e,g){void 0===g&&(g=Promise);var j=new s(f(b,c,d,e),g);return h.isGeneratorFunction(c)?j:j.next().then(function(a){return a.done?a.value:j.next()})},q(r),b(r,c,"Generator"),b(r,F,function(){return this}),b(r,"toString",function(){return"[object Generator]"}),h.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},h.values=C,B.prototype={constructor:B,reset:function(a){if(this.prev=0,this.next=0,this.sent=this._sent=D,this.done=!1,this.delegate=null,this.method="next",this.arg=D,this.tryEntries.forEach(A),!a)for(var b in this)"t"===b.charAt(0)&&t.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=D)},stop:function(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function(b){function d(a,c){return h.type="throw",h.arg=b,e.next=a,c&&(e.method="next",e.arg=D),!!c}if(this.done)throw b;for(var e=this,f=this.tryEntries.length-1;0<=f;--f){var g=this.tryEntries[f],h=g.completion;if("root"===g.tryLoc)return d("end");if(g.tryLoc<=this.prev){var j=t.call(g,"catchLoc"),k=t.call(g,"finallyLoc");if(j&&k){if(this.prev<g.catchLoc)return d(g.catchLoc,!0);if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(!j){if(!k)throw new Error("try statement without catch or finally");if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(this.prev<g.catchLoc)return d(g.catchLoc,!0)}}},abrupt:function(b,c){for(var d,e=this.tryEntries.length-1;0<=e;--e)if(d=this.tryEntries[e],d.tryLoc<=this.prev&&t.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var f=d;break}f&&("break"===b||"continue"===b)&&f.tryLoc<=c&&c<=f.finallyLoc&&(f=null);var g=f?f.completion:{};return g.type=b,g.arg=c,f?(this.method="next",this.next=f.finallyLoc,G):this.complete(g)},complete:function(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),G},finish:function(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),A(b),G},catch:function(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var f=d.arg;A(b)}return f}throw new Error("illegal catch attempt")},delegateYield:function(a,b,c){return this.delegate={iterator:C(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=D),G}},h}function _toPrimitive(a,b){if("object"!=typeof a||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==typeof b?b:b+""}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),b&&_setPrototypeOf(a,b)}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(a)}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}function _assertThisInitialized(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function _possibleConstructorReturn(a,b){if(b&&("object"==typeof b||"function"==typeof b))return b;if(void 0!==b)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(a)}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _arrayWithHoles(a){if(Array.isArray(a))return a}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function getReactNativeVersionWithModules(a){try{if(!a)return null;if(!a.reactNativeVersion)return null;var b=a.reactNativeVersion.major,c=a.reactNativeVersion.minor,d=a.reactNativeVersion.patch,e=a.reactNativeVersion.prerelease;if("number"!=typeof b)return null;var f=[];return f.push("".concat(b,".").concat(c,".").concat(d)),e&&f.push("-".concat(e)),f.join("")}catch(a){}return null}function getReactNativeVersion(){return getReactNativeVersionWithModules(reactNative.Platform.constants)}function getReactNativeDimensionsWithDimensions(a,b){var c=Math.ceil;try{var d={},e={};return a&&(d={screenWidth:c(a.width),screenHeight:c(a.height),screenScale:a.scale,screenFontScale:a.fontScale}),b&&(e={windowWidth:c(b.width),windowHeight:c(b.height),windowScale:b.scale,windowFontScale:b.fontScale}),_objectSpread2(_objectSpread2({},d),e)}catch(a){}return null}function getReactNativeDimensions(){var a=null,b=null;try{a=reactNative.Dimensions.get("screen")}catch(a){}try{b=reactNative.Dimensions.get("window")}catch(a){}return getReactNativeDimensionsWithDimensions(a,b)}var PLUGIN_DEFAULTS$1={ignore:[]},asyncStorage=function(a){return function(b){var c,d,e,f,g,h,i,j=Object.assign({},PLUGIN_DEFAULTS$1,a||{}),k=j.ignore||PLUGIN_DEFAULTS$1.ignore,l=!1,m=function d(a,c){b.send("asyncStorage.mutation",{action:a,data:c})},n=function(){var a=_asyncToGenerator(_regeneratorRuntime().mark(function e(a,b,d){return _regeneratorRuntime().wrap(function f(e){for(;1;)switch(e.prev=e.next){case 0:try{0>k.indexOf(a)&&m("setItem",{key:a,value:b})}catch(a){}return e.abrupt("return",c(a,b,d));case 2:case"end":return e.stop()}},e)}));return function e(b,c,d){return a.apply(this,arguments)}}(),o=function(){var a=_asyncToGenerator(_regeneratorRuntime().mark(function c(a,b){return _regeneratorRuntime().wrap(function e(c){for(;1;)switch(c.prev=c.next){case 0:try{0>k.indexOf(a)&&m("removeItem",{key:a})}catch(a){}return c.abrupt("return",d(a,b));case 2:case"end":return c.stop()}},c)}));return function d(b,c){return a.apply(this,arguments)}}(),p=function(){var a=_asyncToGenerator(_regeneratorRuntime().mark(function d(a,b,c){return _regeneratorRuntime().wrap(function f(d){for(;1;)switch(d.prev=d.next){case 0:try{0>k.indexOf(a)&&m("mergeItem",{key:a,value:b})}catch(a){}return d.abrupt("return",e(a,b,c));case 2:case"end":return d.stop()}},d)}));return function e(b,c,d){return a.apply(this,arguments)}}(),q=function(){var a=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){return _regeneratorRuntime().wrap(function c(b){for(;1;)switch(b.prev=b.next){case 0:try{m("clear")}catch(a){}return b.abrupt("return",f(a));case 2:case"end":return b.stop()}},b)}));return function c(b){return a.apply(this,arguments)}}(),r=function(){var a=_asyncToGenerator(_regeneratorRuntime().mark(function c(a,b){var d;return _regeneratorRuntime().wrap(function e(c){for(;1;)switch(c.prev=c.next){case 0:try{d=(a||[]).filter(function(a){return a&&a[0]&&0>k.indexOf(a[0])}),0<d.length&&m("multiSet",{pairs:d})}catch(a){}return c.abrupt("return",g(a,b));case 2:case"end":return c.stop()}},c)}));return function d(b,c){return a.apply(this,arguments)}}(),s=function(){var a=_asyncToGenerator(_regeneratorRuntime().mark(function c(a,b){var d;return _regeneratorRuntime().wrap(function e(c){for(;1;)switch(c.prev=c.next){case 0:try{d=(a||[]).filter(function(a){return 0>k.indexOf(a)}),0<d.length&&m("multiRemove",{keys:d})}catch(a){}return c.abrupt("return",h(a,b));case 2:case"end":return c.stop()}},c)}));return function d(b,c){return a.apply(this,arguments)}}(),t=function(){var a=_asyncToGenerator(_regeneratorRuntime().mark(function c(a,b){var d;return _regeneratorRuntime().wrap(function e(c){for(;1;)switch(c.prev=c.next){case 0:try{d=(a||[]).filter(function(a){return a&&a[0]&&0>k.indexOf(a[0])}),0<d.length&&m("multiMerge",{pairs:d})}catch(a){}return c.abrupt("return",i(a,b));case 2:case"end":return c.stop()}},c)}));return function d(b,c){return a.apply(this,arguments)}}(),u=function a(){l||(c=b.asyncStorageHandler.setItem,b.asyncStorageHandler.setItem=n,d=b.asyncStorageHandler.removeItem,b.asyncStorageHandler.removeItem=o,e=b.asyncStorageHandler.mergeItem,b.asyncStorageHandler.mergeItem=p,f=b.asyncStorageHandler.clear,b.asyncStorageHandler.clear=q,g=b.asyncStorageHandler.multiSet,b.asyncStorageHandler.multiSet=r,h=b.asyncStorageHandler.multiRemove,b.asyncStorageHandler.multiRemove=s,i=b.asyncStorageHandler.multiMerge,b.asyncStorageHandler.multiMerge=t,l=!0)},v=function a(){l&&(b.asyncStorageHandler.setItem=c,b.asyncStorageHandler.removeItem=d,b.asyncStorageHandler.mergeItem=e,b.asyncStorageHandler.clear=f,b.asyncStorageHandler.multiSet=g,b.asyncStorageHandler.multiRemove=h,b.asyncStorageHandler.multiMerge=i,l=!1)};return b.asyncStorageHandler&&u(),{features:{trackAsyncStorage:u,untrackAsyncStorage:v}}}};function mitt(a){return{all:a=a||new Map,on:function(b,c){var d=a.get(b);d?d.push(c):a.set(b,[c])},off:function(b,c){var d=a.get(b);d&&(c?d.splice(d.indexOf(c)>>>0,1):a.set(b,[]))},emit:function(b,c){var d=a.get(b);d&&d.slice().map(function(a){a(c)}),(d=a.get("*"))&&d.slice().map(function(a){a(b,c)})}}}var Styles={container:{position:"absolute",left:0,top:0,right:0,bottom:0,zIndex:1e3,opacity:.25},debugContainer:{position:"absolute",top:0,left:0,right:0,bottom:0,justifyContent:"center",alignItems:"center",backgroundColor:"transparent",zIndex:2e3},debugTextContainer:{backgroundColor:"lightgray",margin:50,padding:20},debugText:{color:"red",fontSize:16,marginBottom:10}},FullScreenOverlay=function(a){function b(a){var c;return _classCallCheck(this,b),c=_callSuper(this,b,[a]),c.state={opacity:Styles.container.opacity,uri:null,justifyContent:"center",alignItems:"center"},a.emitter.on("overlay",function(a){c.setState(_objectSpread2(_objectSpread2({},c.state),a))}),c}return _inherits(b,a),_createClass(b,[{key:"createContainerStyle",value:function a(){var b=this.state,c=b.opacity,d=b.justifyContent,e=b.alignItems,f=reactNative.Dimensions.get("window"),g=f.width,h=f.height,i=_objectSpread2(_objectSpread2({},Styles.container),{},{opacity:c,width:g,height:h,justifyContent:d,alignItems:e});return i}},{key:"renderDebug",value:function a(){var b=this,c=this.state.showDebug;return __DEV__&&c?React__default["default"].createElement(reactNative.View,{style:Styles.debugContainer,pointerEvents:"none"},React__default["default"].createElement(reactNative.View,{style:Styles.debugTextContainer},Object.keys(this.state).map(function(a){if("showDebug"===a)return null;var c="uri"===a?"have image":a,d="uri"===a?!!b.state[a]:b.state[a];return React__default["default"].createElement(reactNative.Text,{key:a,style:Styles.debugText},"".concat(c,": ").concat(d))}))):null}},{key:"render",value:function a(){var b=this.state,c=b.uri,d=b.width,e=b.height,f=b.growToWindow,g=b.resizeMode,h=b.marginLeft,i=void 0===h?0:h,j=b.marginRight,k=void 0===j?0:j,l=b.marginTop,m=void 0===l?0:l,n=b.marginBottom,o=void 0===n?0:n,p={width:d,height:e,marginTop:m,marginRight:k,marginBottom:o,marginLeft:i};if(f){var q=reactNative.Dimensions.get("window");p.width=q.width,p.height=q.height}var r=c?React__default["default"].createElement(reactNative.Image,{source:{uri:c},style:p,resizeMode:f?g:null}):React__default["default"].createElement(reactNative.View,null);return React__default["default"].createElement(React__default["default"].Fragment,null,React__default["default"].createElement(reactNative.View,{style:this.createContainerStyle(),pointerEvents:"none"},r),this.renderDebug())}}]),b}(React.Component);function OverlayCreator(){return function a(){var b=mitt();return{onCommand:function c(a){"overlay"!==a.type||b.emit("overlay",a.payload)},features:{overlay:function c(a){return function(){var c=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{};return React__default["default"].createElement(reactNative.View,{style:{flex:1}},React__default["default"].createElement(a,c),React__default["default"].createElement(FullScreenOverlay,{emitter:b}))}}}}}}var parseErrorStack,symbolicateStackTrace,XHRInterceptorModule,DEFAULTS$2={url:"http://localhost:8081"},openInEditor=function a(){var b=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{};return function(){var a=Object.assign({},DEFAULTS$2,b);return{onCommand:function c(b){if("editor.open"===b.type){var d=b.payload,e=d.file,f=d.lineNumber,g="".concat(a.url,"/open-stack-frame"),h={file:e,lineNumber:f||1},i="POST";fetch(g,{method:i,body:JSON.stringify(h)})}}}}},LogBox=_LogBox__default["default"],PLUGIN_DEFAULTS={veto:null},objectifyError=function b(a){var c={};return Object.getOwnPropertyNames(a).forEach(function(b){c[b]=a[b]}),c},trackGlobalErrors=function b(a){return function(b){function c(a){try{parseErrorStack=parseErrorStack||require("react-native/Libraries/Core/Devtools/parseErrorStack"),symbolicateStackTrace=symbolicateStackTrace||require("react-native/Libraries/Core/Devtools/symbolicateStackTrace")}catch(a){return d.error("Unable to load \"react-native/Libraries/Core/Devtools/parseErrorStack\" or \"react-native/Libraries/Core/Devtools/symbolicateStackTrace\"",[]),void d.debug(objectifyError(a))}if(parseErrorStack&&symbolicateStackTrace){var b;try{b=parseErrorStack(a.stack)}catch(a){return d.error("Unable to parse stack trace from error object",[]),void d.debug(objectifyError(a))}symbolicateStackTrace(b).then(function(b){var c=b.stack.map(function(a){return{fileName:a.file,functionName:a.methodName,lineNumber:a.lineNumber}});e.veto&&(c=c.filter(function(a){return null===e||void 0===e?void 0:e.veto(a)})),d.error(a.message,c)})["catch"](function(a){d.error("Unable to symbolicate stack trace from error object",[]),d.debug(objectifyError(a))})}}reactotronCoreClient.assertHasLoggerPlugin(b);var d=b,e=Object.assign({},PLUGIN_DEFAULTS,a||{});return{onConnect:function a(){LogBox.addException=new Proxy(LogBox.addException,{apply:function e(a,b,d){var f=d[0];return c(f),a.apply(b,d)}})},features:{reportError:c}}}};try{XHRInterceptorModule=require("react-native/src/private/devsupport/devmenu/elementinspector/XHRInterceptor")}catch(a){try{XHRInterceptorModule=require("react-native/src/private/inspector/XHRInterceptor")}catch(b){try{XHRInterceptorModule=require("react-native/Libraries/Network/XHRInterceptor")}catch(c){console.error("Reactotron: Failed to require XHRInterceptor from all known paths.",a,b,c),console.warn("Reactotron: XHRInterceptor could not be loaded. Network monitoring will be disabled."),XHRInterceptorModule=null}}}var XHRInterceptor;XHRInterceptorModule&&("function"==typeof XHRInterceptorModule.setSendCallback&&"function"==typeof XHRInterceptorModule.setResponseCallback&&"function"==typeof XHRInterceptorModule.enableInterception?XHRInterceptor=XHRInterceptorModule:XHRInterceptorModule["default"]&&"function"==typeof XHRInterceptorModule["default"].setSendCallback&&"function"==typeof XHRInterceptorModule["default"].setResponseCallback&&"function"==typeof XHRInterceptorModule["default"].enableInterception&&(XHRInterceptor=XHRInterceptorModule["default"])),XHRInterceptor||(XHRInterceptorModule&&(console.error("Reactotron: Required XHRInterceptor module does not have expected methods."),console.warn("Reactotron: Network monitoring will be disabled.")),XHRInterceptor={setSendCallback:function a(){},setResponseCallback:function a(){},enableInterception:function a(){}});var DEFAULT_CONTENT_TYPES_RX=/^(image)\/.*$/i,DEFAULTS$1={},networking=function a(){var b=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{};return function(a){function c(b,c){return e.ignoreUrls&&e.ignoreUrls.test(c._url)?void(c._skipReactotron=!0):void(g++,c._trackingName=g,h[g]={data:b,xhr:c,stopTimer:a.startTimer()})}function d(b,c,d,e,g,i){if(!i._skipReactotron){var j=null,k=e?e.indexOf("?"):-1;-1<k&&(j={},e.substr(k+1).split("&").forEach(function(a){var b=a.split("="),c=_slicedToArray(b,2),d=c[0],e=c[1];d&&void 0!==e&&(j[d]=decodeURIComponent(e.replace(/\+/g," ")))}));var l=i._trackingName,m=h[l]||{xhr:i};h[l]=null;var n=m.data,o=m.stopTimer,p={url:e||m.xhr._url,method:i._method||null,data:n,headers:i._headers||null,params:j},q=i.responseHeaders&&i.responseHeaders["content-type"]||i.responseHeaders&&i.responseHeaders["Content-Type"]||"",r=function e(c){var f="~~~ skipped ~~~";if(c)try{f=JSON.parse(c)}catch(a){f=d}var g={body:f,status:b,headers:i.responseHeaders||null};a.apiResponse(p,g,o?o():null)},s=("string"==typeof d||"object"===_typeof(d))&&!f.test(q||"");if(!s)r("");else if("blob"===g&&"undefined"!=typeof FileReader&&d){var t=new FileReader,u=function a(){r(t.result),t.removeEventListener("loadend",a)};t.addEventListener("loadend",u),t.readAsText(d)}else r(d)}}var e=Object.assign({},DEFAULTS$1,b),f=e.ignoreContentTypes||DEFAULT_CONTENT_TYPES_RX,g=1e3,h={};return{onConnect:function a(){XHRInterceptor.setSendCallback(c),XHRInterceptor.setResponseCallback(d),XHRInterceptor.enableInterception()}}}},StorybookSwitcher=function(a){function b(a){var c;return _classCallCheck(this,b),c=_callSuper(this,b,[a]),c.state={showStorybook:!1},a.emitter.on("storybook",function(a){c.setState({showStorybook:a})}),c}return _inherits(b,a),_createClass(b,[{key:"render",value:function a(){var b=this.state.showStorybook,c=this.props,d=c.storybookUi,e=c.children;return React__default["default"].createElement(reactNative.View,{style:{flex:1}},b?React__default["default"].createElement(d,null):e)}}]),b}(React.Component),storybook=function(){return function(){var a=mitt();return{onCommand:function c(b){"storybook"!==b.type||a.emit("storybook",b.payload)},features:{storybookSwitcher:function c(b){return function(c){return function e(d){return React__default["default"].createElement(StorybookSwitcher,{storybookUi:b,emitter:a},React__default["default"].createElement(c,d))}}}}}}},getDevMenu=function a(){var b=function b(a){console.warn("DevMenu.".concat(a,"() not available in this environment"))},c={reload:function a(){b("reload")},show:function a(){b("show")},getConstants:function a(){return{}},debugRemotely:function a(){b("debugRemotely")},setHotLoadingEnabled:function a(){b("setHotLoadingEnabled")},setProfilingEnabled:function a(){b("setProfilingEnabled")}};if("ios"===reactNative.Platform.OS&&__DEV__)try{var d=reactNative.TurboModuleRegistry.get("DevMenu");return d?d:c}catch(a){return c}return c},devTools=function a(){return function(){return{onCommand:function b(a){if("devtools.open"===a.type||"devtools.reload"===a.type){if("devtools.open"===a.type){var c=getDevMenu();c.show()}if("devtools.reload"===a.type){var d=getDevMenu();d.reload()}}}}}},trackGlobalLogs=function a(){return function(a){reactotronCoreClient.assertHasLoggerPlugin(a);var b=a;return{onConnect:function a(){var c=console.log;console.log=function(){c.apply(void 0,arguments),b.log.apply(b,arguments)};var d=console.warn;console.warn=function(){d.apply(void 0,arguments),b.warn(0>=arguments.length?void 0:arguments[0])};var e=console.debug;console.debug=function(){e.apply(void 0,arguments),b.debug(0>=arguments.length?void 0:arguments[0])}}}}};function getHostFromUrl(a){var b,c=null===(b=a.match(/^(?:https?:\/\/)?(\[[^\]]+\]|[^/:\s]+)(?::\d+)?(?:[/?#]|$)/))||void 0===b?void 0:b[1];if("string"!=typeof c)throw new Error("Invalid URL - host not found");return c}function getReactNativePlatformConstants(){var a={osRelease:"",model:"",serverHost:"",uiMode:"",serial:"",forceTouch:!1,interfaceIdiom:"",systemName:""};if("android"===reactNative.Platform.OS){var b=reactNative.Platform.constants;return _objectSpread2(_objectSpread2({},a),{},{osRelease:b.Release,model:b.Model,serverHost:b.ServerHost,uiMode:b.uiMode,serial:b.Serial})}if("ios"===reactNative.Platform.OS){var c=reactNative.Platform.constants;return _objectSpread2(_objectSpread2({},a),{},{forceTouch:c.forceTouchAvailable||!1,interfaceIdiom:c.interfaceIdiom,systemName:c.systemName})}return a}var REACTOTRON_ASYNC_CLIENT_ID="@REACTOTRON/clientId",tempClientId=null,getHost=function a(){var b=0<arguments.length&&arguments[0]!==void 0?arguments[0]:"localhost";try{var c=NativeSourceCode__default["default"].getConstants().scriptURL;if("string"!=typeof c)throw new Error("Invalid non-string URL");return getHostFromUrl(c)}catch(a){return console.warn("getHost: \"".concat(a.message,"\" for scriptURL - Falling back to ").concat(b)),b}},_getReactNativePlatfo=getReactNativePlatformConstants(),osRelease=_getReactNativePlatfo.osRelease,model=_getReactNativePlatfo.model,serverHost=_getReactNativePlatfo.serverHost,forceTouch=_getReactNativePlatfo.forceTouch,interfaceIdiom=_getReactNativePlatfo.interfaceIdiom,systemName=_getReactNativePlatfo.systemName,uiMode=_getReactNativePlatfo.uiMode,serial=_getReactNativePlatfo.serial,DEFAULTS={createSocket:function b(a){return new WebSocket(a)},host:getHost("localhost"),port:9090,name:"React Native App",environment:process.env.NODE_ENV||(__DEV__?"development":"production"),client:_objectSpread2({reactotronLibraryName:"reactotron-react-native",reactotronLibraryVersion:"REACTOTRON_REACT_NATIVE_VERSION",platform:reactNative.Platform.OS,platformVersion:reactNative.Platform.Version,osRelease:osRelease,model:model,serverHost:serverHost,forceTouch:forceTouch,interfaceIdiom:interfaceIdiom,systemName:systemName,uiMode:uiMode,serial:serial,reactNativeVersion:getReactNativeVersion()},getReactNativeDimensions()),getClientId:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function a(){var b,c,d,e,f,g,h,i=arguments;return _regeneratorRuntime().wrap(function j(a){for(;1;)switch(a.prev=a.next){case 0:if(b=0<i.length&&void 0!==i[0]?i[0]:"",!reactotron.asyncStorageHandler){a.next=3;break}return a.abrupt("return",reactotron.asyncStorageHandler.getItem(REACTOTRON_ASYNC_CLIENT_ID));case 3:return c=getReactNativeDimensions(),d=c.screenWidth,e=c.screenHeight,f=c.screenScale,g=[d,e].sort().join("-"),h=reactNative.Platform.select({ios:systemName,android:model,default:""}),tempClientId=[b,reactNative.Platform.OS,reactNative.Platform.Version,h,g,f].filter(Boolean).join("-"),a.abrupt("return",tempClientId);case 8:case"end":return a.stop()}},a)}));return a}(),setClientId:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){return _regeneratorRuntime().wrap(function c(b){for(;1;)switch(b.prev=b.next){case 0:if(!reactotron.asyncStorageHandler){b.next=2;break}return b.abrupt("return",reactotron.asyncStorageHandler.setItem(REACTOTRON_ASYNC_CLIENT_ID,a));case 2:tempClientId=a;case 3:case"end":return b.stop()}},b)}));return a}(),proxyHack:!0},reactNativeCorePlugins=[asyncStorage(),trackGlobalErrors(),trackGlobalLogs(),openInEditor(),OverlayCreator(),networking(),storybook(),devTools()],reactotron=reactotronCoreClient.createClient(DEFAULTS);function getPluginOptions(a){return"object"===_typeof(a)?a:null}reactotron.useReactNative=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return!1!==a.errors&&reactotron.use(trackGlobalErrors(getPluginOptions(a.errors))),!1!==a.log&&reactotron.use(trackGlobalLogs()),!1!==a.editor&&reactotron.use(openInEditor(getPluginOptions(a.editor))),!1!==a.overlay&&reactotron.use(OverlayCreator()),!1!==a.asyncStorage&&reactotron.use(asyncStorage(getPluginOptions(a.asyncStorage))),!1!==a.networking&&reactotron.use(networking(getPluginOptions(a.networking))),!1!==a.storybook&&reactotron.use(storybook()),!1!==a.devTools&&reactotron.use(devTools()),reactotron},reactotron.setAsyncStorageHandler=function(a){return reactotron.asyncStorageHandler=a,reactotron},exports.asyncStorage=asyncStorage,exports["default"]=reactotron,exports.devTools=devTools,exports.networking=networking,exports.openInEditor=openInEditor,exports.overlay=OverlayCreator,exports.reactNativeCorePlugins=reactNativeCorePlugins,exports.storybook=storybook,exports.trackGlobalErrors=trackGlobalErrors,exports.trackGlobalLogs=trackGlobalLogs;