"use strict";

exports.__esModule = true;
exports.TransientKey = exports.StoreKey = exports.ShadowImplKey = exports.ReferenceKey = exports.CollectionPojoEndpointPropertyKey = exports.CollectionRestEndpointPropertyKey = exports.CollectionPropertyKey = exports.CollectionAllKey = exports.AllKey = exports.warn = exports.info = exports.error = undefined;

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

exports.default = devDebug;

var _akutils = require("akutils");

var debug = (0, _akutils.isNative)() ? require("react-native-debug") : require("debug");

//-----------------------------------------------------------------------------------------------------------
// Debug level functions
//-----------------------------------------------------------------------------------------------------------

var ErrorKey = 'f.lux:error';
var InfoKey = 'f.lux:info';
var WarningKey = 'f.lux:warn';

if (process.env.NODE_ENV !== 'production') {
	// comment out one or more of following line to disable error/warning reporting
	debug.enable(ErrorKey);
	debug.enable(InfoKey);
	debug.enable(WarningKey);
}

/** @ignore */
var error = exports.error = debug(ErrorKey);
/** @ignore */
var info = exports.info = debug(InfoKey);
/** @ignore */
var warn = exports.warn = debug(WarningKey);

//-----------------------------------------------------------------------------------------------------------
// Functional flags
//-----------------------------------------------------------------------------------------------------------

/** @ignore */
var AllKey = exports.AllKey = 'f.lux:*';

/** @ignore */
var CollectionAllKey = exports.CollectionAllKey = 'f.lux:collection:*';
/** @ignore */
var CollectionPropertyKey = exports.CollectionPropertyKey = 'f.lux:collection:property';
/** @ignore */
var CollectionRestEndpointPropertyKey = exports.CollectionRestEndpointPropertyKey = 'f.lux:collection:restEnpointProperty';
/** @ignore */
var CollectionPojoEndpointPropertyKey = exports.CollectionPojoEndpointPropertyKey = 'f.lux:collection:pojoEnpointProperty';

/** @ignore */
var ReferenceKey = exports.ReferenceKey = 'f.lux:reference';
/** @ignore */
var ShadowImplKey = exports.ShadowImplKey = 'f.lux:shadowImpl';
/** @ignore */
var StoreKey = exports.StoreKey = 'f.lux:store';
/** @ignore */
var TransientKey = exports.TransientKey = 'f.lux:transient';

// uncomment to turn on all postop-stores logging (or selectively using one of keys above)
//debug.enable(AllKey);

function debugoff() {}

/** @ignore */
function devDebug(modname) {
	if (process.env.NODE_ENV !== 'production') {
		var _ret = function () {
			var appDebug = debug(modname);

			return {
				v: function appDebugFn(cb) {
					cb(appDebug);
				}
			};
		}();

		if ((typeof _ret === "undefined" ? "undefined" : _typeof(_ret)) === "object") return _ret.v;
	} else {
		return debugoff;
	}
}