'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var React = require('react');
var ttag = require('ttag');

function _interopNamespaceCompat(e) {
    if (e && typeof e === 'object' && 'default' in e) return e;
    var n = Object.create(null);
    if (e) {
        Object.keys(e).forEach(function (k) {
            if (k !== 'default') {
                var d = Object.getOwnPropertyDescriptor(e, k);
                Object.defineProperty(n, k, d.get ? d : {
                    enumerable: true,
                    get: function () { return e[k]; }
                });
            }
        });
    }
    n.default = e;
    return Object.freeze(n);
}

var React__namespace = /*#__PURE__*/_interopNamespaceCompat(React);

// PDS core

var idConstructor = function idConstructor() {
  var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  var me = {
    id: 0,
    get: function get() {
      return ":".concat(prefix, "p").concat(me.id++, ":");
    }
  };
  return me;
};
var useIdGetter = function useIdGetter(prefix) {
  var ref = React__namespace.useRef();
  if (!ref.current) {
    ref.current = idConstructor(prefix);
  }
  return ref.current.get;
};

// default instances of unused BodyProvider
var globalTTag = new ttag.TTag();
var globalGetUseId = idConstructor().get;
var globalSnackBarManager = {
  open: function open() {},
  close: function close() {}
};
var BodyContext = /*#__PURE__*/React__namespace.createContext({
  globalTTag: globalTTag,
  globalGetUseId: globalGetUseId,
  globalSnackBarManager: globalSnackBarManager
});
BodyContext.displayName = 'BodyContext';

exports.BodyContext = BodyContext;
exports.useIdGetter = useIdGetter;
