"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "ACC", {
  enumerable: true,
  get: function () {
    return _Code.ACC;
  }
});
Object.defineProperty(exports, "ANV", {
  enumerable: true,
  get: function () {
    return _Code.ANV;
  }
});
Object.defineProperty(exports, "AccountIcon", {
  enumerable: true,
  get: function () {
    return _AccountIcon.AccountIcon;
  }
});
exports.AnvilProvider = AnvilProvider;
Object.defineProperty(exports, "Auth", {
  enumerable: true,
  get: function () {
    return _Auth.Auth;
  }
});
Object.defineProperty(exports, "AuthII", {
  enumerable: true,
  get: function () {
    return _Auth.AuthII;
  }
});
Object.defineProperty(exports, "FT", {
  enumerable: true,
  get: function () {
    return _FT.FT;
  }
});
Object.defineProperty(exports, "FTAbstract", {
  enumerable: true,
  get: function () {
    return _FT.FTAbstract;
  }
});
Object.defineProperty(exports, "FTI", {
  enumerable: true,
  get: function () {
    return _Code.FTI;
  }
});
Object.defineProperty(exports, "FTImage", {
  enumerable: true,
  get: function () {
    return _FT.FTImage;
  }
});
Object.defineProperty(exports, "FTMeta", {
  enumerable: true,
  get: function () {
    return _FT.FTMeta;
  }
});
Object.defineProperty(exports, "FTSelect", {
  enumerable: true,
  get: function () {
    return _FT.FTSelect;
  }
});
Object.defineProperty(exports, "HASH", {
  enumerable: true,
  get: function () {
    return _Code.HASH;
  }
});
Object.defineProperty(exports, "HistoryEvent", {
  enumerable: true,
  get: function () {
    return _History.HistoryEvent;
  }
});
Object.defineProperty(exports, "ICP", {
  enumerable: true,
  get: function () {
    return _Code.ICP;
  }
});
Object.defineProperty(exports, "Inventory", {
  enumerable: true,
  get: function () {
    return _Inventory.Inventory;
  }
});
Object.defineProperty(exports, "InventoryLarge", {
  enumerable: true,
  get: function () {
    return _InventoryLarge.InventoryLarge;
  }
});
Object.defineProperty(exports, "LoginRequired", {
  enumerable: true,
  get: function () {
    return _LoginRequired.LoginRequired;
  }
});
Object.defineProperty(exports, "MarketplaceFilters", {
  enumerable: true,
  get: function () {
    return _Marketplace.MarketplaceFilters;
  }
});
Object.defineProperty(exports, "MarketplaceLoad", {
  enumerable: true,
  get: function () {
    return _Marketplace.MarketplaceLoad;
  }
});
Object.defineProperty(exports, "NFT", {
  enumerable: true,
  get: function () {
    return _NFT.NFT;
  }
});
Object.defineProperty(exports, "NFTA", {
  enumerable: true,
  get: function () {
    return _Code.NFTA;
  }
});
Object.defineProperty(exports, "NFTContent", {
  enumerable: true,
  get: function () {
    return _NFT.NFTContent;
  }
});
Object.defineProperty(exports, "NFTInfo", {
  enumerable: true,
  get: function () {
    return _NFT.NFTInfo;
  }
});
Object.defineProperty(exports, "NFTMenu", {
  enumerable: true,
  get: function () {
    return _NFT.NFTMenu;
  }
});
Object.defineProperty(exports, "NFTPreview", {
  enumerable: true,
  get: function () {
    return _NFT.NFTPreview;
  }
});
Object.defineProperty(exports, "NFTProInfo", {
  enumerable: true,
  get: function () {
    return _NFT.NFTProInfo;
  }
});
Object.defineProperty(exports, "NFTThumb", {
  enumerable: true,
  get: function () {
    return _NFT.NFTThumb;
  }
});
Object.defineProperty(exports, "NftHistory", {
  enumerable: true,
  get: function () {
    return _History.NftHistory;
  }
});
Object.defineProperty(exports, "Offers", {
  enumerable: true,
  get: function () {
    return _Inventory.Offers;
  }
});
Object.defineProperty(exports, "PRI", {
  enumerable: true,
  get: function () {
    return _Code.PRI;
  }
});
Object.defineProperty(exports, "TX", {
  enumerable: true,
  get: function () {
    return _Code.TX;
  }
});
Object.defineProperty(exports, "TaskButton", {
  enumerable: true,
  get: function () {
    return _TaskButton.TaskButton;
  }
});
Object.defineProperty(exports, "dex_add_liquidity", {
  enumerable: true,
  get: function () {
    return _dex.dex_add_liquidity;
  }
});
Object.defineProperty(exports, "dex_add_liquidity_dialog", {
  enumerable: true,
  get: function () {
    return _dex.dex_add_liquidity_dialog;
  }
});
Object.defineProperty(exports, "dex_create_pool", {
  enumerable: true,
  get: function () {
    return _dex.dex_create_pool;
  }
});
Object.defineProperty(exports, "dex_pools", {
  enumerable: true,
  get: function () {
    return _dex.dex_pools;
  }
});
Object.defineProperty(exports, "dex_rem_liquidity", {
  enumerable: true,
  get: function () {
    return _dex.dex_rem_liquidity;
  }
});
Object.defineProperty(exports, "dex_swap", {
  enumerable: true,
  get: function () {
    return _dex.dex_swap;
  }
});
Object.defineProperty(exports, "dialog_open", {
  enumerable: true,
  get: function () {
    return _dialog.dialog_open;
  }
});
Object.defineProperty(exports, "ft_all_tokens", {
  enumerable: true,
  get: function () {
    return _ft.ft_all_tokens;
  }
});
Object.defineProperty(exports, "ft_fetch_meta", {
  enumerable: true,
  get: function () {
    return _ft.ft_fetch_meta;
  }
});
Object.defineProperty(exports, "ft_mint", {
  enumerable: true,
  get: function () {
    return _ft.ft_mint;
  }
});
Object.defineProperty(exports, "ft_promote", {
  enumerable: true,
  get: function () {
    return _ft.ft_promote;
  }
});
Object.defineProperty(exports, "ft_transfer", {
  enumerable: true,
  get: function () {
    return _ft.ft_transfer;
  }
});
Object.defineProperty(exports, "history_load", {
  enumerable: true,
  get: function () {
    return _history.history_load;
  }
});
Object.defineProperty(exports, "history_load_info", {
  enumerable: true,
  get: function () {
    return _history.history_load_info;
  }
});
exports.icons = void 0;
Object.defineProperty(exports, "identities", {
  enumerable: true,
  get: function () {
    return _identities.default;
  }
});
Object.defineProperty(exports, "inv_accept_offer", {
  enumerable: true,
  get: function () {
    return _inventory.inv_accept_offer;
  }
});
Object.defineProperty(exports, "inv_clear_temporary", {
  enumerable: true,
  get: function () {
    return _inventory.inv_clear_temporary;
  }
});
Object.defineProperty(exports, "inv_container_unlock", {
  enumerable: true,
  get: function () {
    return _inventory.inv_container_unlock;
  }
});
Object.defineProperty(exports, "inv_containers_list", {
  enumerable: true,
  get: function () {
    return _inventory.inv_containers_list;
  }
});
Object.defineProperty(exports, "inv_create_offer", {
  enumerable: true,
  get: function () {
    return _inventory.inv_create_offer;
  }
});
Object.defineProperty(exports, "inv_offer_info", {
  enumerable: true,
  get: function () {
    return _inventory.inv_offer_info;
  }
});
Object.defineProperty(exports, "inv_send_temporary", {
  enumerable: true,
  get: function () {
    return _inventory.inv_send_temporary;
  }
});
Object.defineProperty(exports, "load_author", {
  enumerable: true,
  get: function () {
    return _inventory.load_author;
  }
});
Object.defineProperty(exports, "load_inventory", {
  enumerable: true,
  get: function () {
    return _inventory.load_inventory;
  }
});
Object.defineProperty(exports, "nft_burn", {
  enumerable: true,
  get: function () {
    return _nft.nft_burn;
  }
});
Object.defineProperty(exports, "nft_claim_link", {
  enumerable: true,
  get: function () {
    return _nft.nft_claim_link;
  }
});
Object.defineProperty(exports, "nft_enter_code", {
  enumerable: true,
  get: function () {
    return _nft.nft_enter_code;
  }
});
Object.defineProperty(exports, "nft_fetch", {
  enumerable: true,
  get: function () {
    return _nft.nft_fetch;
  }
});
Object.defineProperty(exports, "nft_media_get", {
  enumerable: true,
  get: function () {
    return _nft.nft_media_get;
  }
});
Object.defineProperty(exports, "nft_mint", {
  enumerable: true,
  get: function () {
    return _nft.nft_mint;
  }
});
Object.defineProperty(exports, "nft_mint_quote", {
  enumerable: true,
  get: function () {
    return _nft.nft_mint_quote;
  }
});
Object.defineProperty(exports, "nft_plug", {
  enumerable: true,
  get: function () {
    return _nft.nft_plug;
  }
});
Object.defineProperty(exports, "nft_purchase", {
  enumerable: true,
  get: function () {
    return _nft.nft_purchase;
  }
});
Object.defineProperty(exports, "nft_recharge", {
  enumerable: true,
  get: function () {
    return _nft.nft_recharge;
  }
});
Object.defineProperty(exports, "nft_recharge_quote", {
  enumerable: true,
  get: function () {
    return _nft.nft_recharge_quote;
  }
});
Object.defineProperty(exports, "nft_set_price", {
  enumerable: true,
  get: function () {
    return _nft.nft_set_price;
  }
});
Object.defineProperty(exports, "nft_transfer", {
  enumerable: true,
  get: function () {
    return _nft.nft_transfer;
  }
});
Object.defineProperty(exports, "nft_transfer_link", {
  enumerable: true,
  get: function () {
    return _nft.nft_transfer_link;
  }
});
Object.defineProperty(exports, "nft_unsocket", {
  enumerable: true,
  get: function () {
    return _nft.nft_unsocket;
  }
});
Object.defineProperty(exports, "nft_use", {
  enumerable: true,
  get: function () {
    return _nft.nft_use;
  }
});
exports.store = void 0;
Object.defineProperty(exports, "task_end", {
  enumerable: true,
  get: function () {
    return _task.task_end;
  }
});
Object.defineProperty(exports, "task_run", {
  enumerable: true,
  get: function () {
    return _task.task_run;
  }
});
Object.defineProperty(exports, "task_start", {
  enumerable: true,
  get: function () {
    return _task.task_start;
  }
});
Object.defineProperty(exports, "toast_create", {
  enumerable: true,
  get: function () {
    return _toast.toast_create;
  }
});
Object.defineProperty(exports, "toast_update", {
  enumerable: true,
  get: function () {
    return _toast.toast_update;
  }
});
Object.defineProperty(exports, "tokenSelector", {
  enumerable: true,
  get: function () {
    return _inventory.tokenSelector;
  }
});
Object.defineProperty(exports, "ui_pro_set", {
  enumerable: true,
  get: function () {
    return _ui.ui_pro_set;
  }
});
exports.useAnvilStore = exports.useAnvilSelector = exports.useAnvilDispatch = void 0;
Object.defineProperty(exports, "useDexPools", {
  enumerable: true,
  get: function () {
    return _Hooks.useDexPools;
  }
});
Object.defineProperty(exports, "useFT", {
  enumerable: true,
  get: function () {
    return _Hooks.useFT;
  }
});
Object.defineProperty(exports, "useInventoryToken", {
  enumerable: true,
  get: function () {
    return _Hooks.useInventoryToken;
  }
});
Object.defineProperty(exports, "user_login", {
  enumerable: true,
  get: function () {
    return _user.user_login;
  }
});
Object.defineProperty(exports, "user_login_ii", {
  enumerable: true,
  get: function () {
    return _user.user_login_ii;
  }
});
Object.defineProperty(exports, "user_logout", {
  enumerable: true,
  get: function () {
    return _user.user_logout;
  }
});
Object.defineProperty(exports, "user_refresh_balances", {
  enumerable: true,
  get: function () {
    return _user.user_refresh_balances;
  }
});
Object.defineProperty(exports, "user_refresh_config", {
  enumerable: true,
  get: function () {
    return _user.user_refresh_config;
  }
});
Object.defineProperty(exports, "user_set_main_account", {
  enumerable: true,
  get: function () {
    return _user.user_set_main_account;
  }
});
Object.defineProperty(exports, "user_transfer_icp", {
  enumerable: true,
  get: function () {
    return _user.user_transfer_icp;
  }
});
Object.defineProperty(exports, "verify_domain", {
  enumerable: true,
  get: function () {
    return _verify.verify_domain;
  }
});
Object.defineProperty(exports, "verify_domain_twitter", {
  enumerable: true,
  get: function () {
    return _verify.verify_domain_twitter;
  }
});
var _react = _interopRequireDefault(require("react"));
var _toolkit = require("@reduxjs/toolkit");
var _router = require("@vvv-interactive/nftanvil-canisters/cjs/router.js");
var _reduxObservable = require("redux-observable");
var _epics = require("./epics.js");
var _user = _interopRequireWildcard(require("./reducers/user"));
var _history = _interopRequireWildcard(require("./reducers/history"));
var _History = require("./components/History");
var _LoginRequired = require("./components/LoginRequired");
var _react2 = require("@chakra-ui/react");
var _identities = _interopRequireDefault(require("../identities"));
var _reactRedux = require("react-redux");
var _reactDnd = require("react-dnd");
var _reactDndHtml5Backend = require("react-dnd-html5-backend");
var _reactDndTouchBackend = require("react-dnd-touch-backend");
var _DialogHandler = require("./components/DialogHandler");
var _inventory = _interopRequireWildcard(require("./reducers/inventory"));
var icons = _interopRequireWildcard(require("./icons"));
exports.icons = icons;
var _dialog = _interopRequireWildcard(require("./reducers/dialog"));
var _Auth = require("./components/Auth");
var _AccountIcon = require("./components/AccountIcon");
var _nft = _interopRequireWildcard(require("./reducers/nft"));
var _ft = _interopRequireWildcard(require("./reducers/ft"));
var _ui = _interopRequireWildcard(require("./reducers/ui"));
var _dex = _interopRequireWildcard(require("./reducers/dex"));
var _FT = require("./components/FT");
var _ic = _interopRequireWildcard(require("./reducers/ic"));
var _verify = _interopRequireWildcard(require("./reducers/verify"));
var _toast = _interopRequireWildcard(require("./reducers/toast"));
var _task = _interopRequireWildcard(require("./reducers/task"));
var _TaskButton = require("./components/TaskButton");
var _ToastHandler = require("./components/ToastHandler");
var _Inventory = require("./components/Inventory");
var _InventoryLarge = require("./components/InventoryLarge");
var _Code = require("./components/Code");
var _theme = require("./theme.js");
var _Marketplace = require("./components//Marketplace.js");
var _NFT = require("./components/NFT");
var _Hooks = require("./Hooks");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const MyContext = /*#__PURE__*/_react.default.createContext(null);

// Export your custom hooks if you wish to use them in other files.
const useAnvilStore = (0, _reactRedux.createStoreHook)(MyContext);
exports.useAnvilStore = useAnvilStore;
const useAnvilDispatch = (0, _reactRedux.createDispatchHook)(MyContext);
exports.useAnvilDispatch = useAnvilDispatch;
const useAnvilSelector = (0, _reactRedux.createSelectorHook)(MyContext);
exports.useAnvilSelector = useAnvilSelector;
const epicMiddleware = (0, _reduxObservable.createEpicMiddleware)();
const store = (0, _toolkit.configureStore)({
  // devTools: { name: "Anvil" },
  reducer: {
    user: _user.default,
    task: _task.default,
    nft: _nft.default,
    ft: _ft.default,
    inventory: _inventory.default,
    dialog: _dialog.default,
    toast: _toast.default,
    ic: _ic.default,
    ui: _ui.default,
    verify: _verify.default,
    history: _history.default,
    dex: _dex.default
  },
  devTools: process.env.NODE_ENV !== "production",
  middleware: getDefaultMiddleware => getDefaultMiddleware({
    thunk: true
  }).concat(epicMiddleware)
});
exports.store = store;
const rootEpic = (0, _reduxObservable.combineEpics)(..._epics.activeEpics);
epicMiddleware.run(rootEpic);
function isTouchDevice() {
  return "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
}
function AnvilProvider(_ref) {
  let {
    children
  } = _ref;
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_react2.ColorModeScript, {
    initialColorMode: _theme.theme.config.initialColorMode
  }), /*#__PURE__*/_react.default.createElement(_reactRedux.Provider, {
    context: MyContext,
    store: store
  }, /*#__PURE__*/_react.default.createElement(_react2.ChakraProvider, {
    theme: _theme.theme
  }, /*#__PURE__*/_react.default.createElement(_reactDnd.DndProvider, {
    backend: isTouchDevice() ? _reactDndTouchBackend.TouchBackend : _reactDndHtml5Backend.HTML5Backend
  }, children, /*#__PURE__*/_react.default.createElement(_ToastHandler.ToastHandler, null), /*#__PURE__*/_react.default.createElement(_DialogHandler.DialogHandler, null)))));
}

// Extra
const init = async () => {
  await store.dispatch((0, _ic.anvil_discover)());
  // await store.dispatch(user_auth());
};

_router.router.setOptions(process.env.REACT_APP_ROUTER_CANISTER_ID, {}); // maybe figure a better way without breaking everything else

setTimeout(init, 100);
if (typeof window !== "undefined") {
  window.addEventListener("focus", () => {
    store.dispatch((0, _ui.window_focus)());
    store.dispatch((0, _user.user_refresh_all_balances)());
  });
  window.addEventListener("blur", () => store.dispatch((0, _ui.window_blur)()));
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64, 