"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = require("react");
var _reactRouterDom = require("react-router-dom");
// 兼容 react-router-dom v5&v6，拿到真正的 history

// import path from 'path';

var path = require('path');
var useRealHistory = function useRealHistory() {
  var history;
  if (_reactRouterDom.useHistory) {
    history = (0, _reactRouterDom.useHistory)();
  }
  (0, _react.useEffect)(function () {
    if (window.HistoryLibrary) {
      history = window.HistoryLibrary.createBrowserHistory();
      var oldPush = history.push;
      history.push = function (p) {
        var _window$ICESTARK;
        oldPush(path.join(((_window$ICESTARK = window.ICESTARK) === null || _window$ICESTARK === void 0 ? void 0 : _window$ICESTARK.basename) || '/', p));
      };
    }
  }, []);
  return history;
};
var _default = useRealHistory;
exports.default = _default;