PageSourceSearch

https://app.screenclip.com/npm.react-router-dom.c80e3a89ddb9b18e545b.js

js screenclip.com collected 2026-09-24 09:07:01 UTC 10,707 bytes, 289 lines download raw bytes

1(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[33],{
2
3/***/ "55Ip":
4/***/ (function(module, __webpack_exports__, __webpack_require__) {
5
6"use strict";
7/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BrowserRouter; });
8/* unused harmony export HashRouter */
9/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Link; });
10/* unused harmony export NavLink */
11/* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("Ty5D");
12/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("dI71");
13/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("q1tI");
14/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
15/* harmony import */ var history__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("LhCv");
16/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("17x9");
17/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_4__);
18/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("wx14");
19/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("zLVn");
20/* harmony import */ var tiny_invariant__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("9R94");
21
22
23
24
25
26
27
28
29
30
31
32/**
33 * The public API for a <Router> that uses HTML5 history.
34 */
35
36var BrowserRouter =
37/*#__PURE__*/
38function (_React$Component) {
39  Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(BrowserRouter, _React$Component);
40
41  function BrowserRouter() {
42    var _this;
43
44    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
45      args[_key] = arguments[_key];
46    }
47
48    _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
49    _this.history = Object(history__WEBPACK_IMPORTED_MODULE_3__[/* createBrowserHistory */ "a"])(_this.props);
50    return _this;
51  }
52
53  var _proto = BrowserRouter.prototype;
54
55  _proto.render = function render() {
56    return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(react_router__WEBPACK_IMPORTED_MODULE_0__[/* Router */ "c"], {
57      history: this.history,
58      children: this.props.children
59    });
60  };
61
62  return BrowserRouter;
63}(react__WEBPACK_IMPORTED_MODULE_2___default.a.Component);
64
65if (false) {}
66
67/**
68 * The public API for a <Router> that uses window.location.hash.
69 */
70
71var HashRouter =
72/*#__PURE__*/
73function (_React$Component) {
74  Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(HashRouter, _React$Component);
75
76  function HashRouter() {
77    var _this;
78
79    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
80      args[_key] = arguments[_key];
81    }
82
83    _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
84    _this.history = Object(history__WEBPACK_IMPORTED_MODULE_3__[/* createHashHistory */ "b"])(_this.props);
85    return _this;
86  }
87
88  var _proto = HashRouter.prototype;
89
90  _proto.render = function render() {
91    return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(react_router__WEBPACK_IMPORTED_MODULE_0__[/* Router */ "c"], {
92      history: this.history,
93      children: this.props.children
94    });
95  };
96
97  return HashRouter;
98}(react__WEBPACK_IMPORTED_MODULE_2___default.a.Component);
99
100if (false) {}
101
102var resolveToLocation = function resolveToLocation(to, currentLocation) {
103  return typeof to === "function" ? to(currentLocation) : to;
104};
105var normalizeToLocation = function normalizeToLocation(to, currentLocation) {
106  return typeof to === "string" ? Object(history__WEBPACK_IMPORTED_MODULE_3__[/* createLocation */ "c"])(to, null, null, currentLocation) : to;
107};
108
109var forwardRefShim = function forwardRefShim(C) {
110  return C;
111};
112
113var forwardRef = react__WEBPACK_IMPORTED_MODULE_2___default.a.forwardRef;
114
115if (typeof forwardRef === "undefined") {
116  forwardRef = forwardRefShim;
117}
118
119function isModifiedEvent(event) {
120  return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
121}
122
123var LinkAnchor = forwardRef(function (_ref, forwardedRef) {
124  var innerRef = _ref.innerRef,
125      navigate = _ref.navigate,
126      _onClick = _ref.onClick,
127      rest = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_ref, ["innerRef", "navigate", "onClick"]);
128
129  var target = rest.target;
130
131  var props = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])({}, rest, {
132    onClick: function onClick(event) {
133      try {
134        if (_onClick) _onClick(event);
135      } catch (ex) {
136        event.preventDefault();
137        throw ex;
138      }
139
140      if (!event.defaultPrevented && // onClick prevented default
141      event.button === 0 && ( // ignore everything but left clicks
142      !target || target === "_self") && // let browser handle "target=_blank" etc.
143      !isModifiedEvent(event) // ignore clicks with modifier keys
144      ) {
145          event.preventDefault();
146          navigate();
147        }
148    }
149  }); // React 15 compat
150
151
152  if (forwardRefShim !== forwardRef) {
153    props.ref = forwardedRef || innerRef;
154  } else {
155    props.ref = innerRef;
156  }
157  /* eslint-disable-next-line jsx-a11y/anchor-has-content */
158
159
160  return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement("a", props);
161});
162
163if (false) {}
164/**
165 * The public API for rendering a history-aware <a>.
166 */
167
168
169var Link = forwardRef(function (_ref2, forwardedRef) {
170  var _ref2$component = _ref2.component,
171      component = _ref2$component === void 0 ? LinkAnchor : _ref2$component,
172      replace = _ref2.replace,
173      to = _ref2.to,
174      innerRef = _ref2.innerRef,
175      rest = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_ref2, ["component", "replace", "to", "innerRef"]);
176
177  return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(react_router__WEBPACK_IMPORTED_MODULE_0__[/* __RouterContext */ "e"].Consumer, null, function (context) {
178    !context ?  false ? undefined : Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])(false) : void 0;
179    var history = context.history;
180    var location = normalizeToLocation(resolveToLocation(to, context.location), context.location);
181    var href = location ? history.createHref(location) : "";
182
183    var props = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])({}, rest, {
184      href: href,
185      navigate: function navigate() {
186        var location = resolveToLocation(to, context.location);
187        var method = replace ? history.replace : history.push;
188        method(location);
189      }
190    }); // React 15 compat
191
192
193    if (forwardRefShim !== forwardRef) {
194      props.ref = forwardedRef || innerRef;
195    } else {
196      props.innerRef = innerRef;
197    }
198
199    return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(component, props);
200  });
201});
202
203if (false) { var refType, toType; }
204
205var forwardRefShim$1 = function forwardRefShim(C) {
206  return C;
207};
208
209var forwardRef$1 = react__WEBPACK_IMPORTED_MODULE_2___default.a.forwardRef;
210
211if (typeof forwardRef$1 === "undefined") {
212  forwardRef$1 = forwardRefShim$1;
213}
214
215function joinClassnames() {
216  for (var _len = arguments.length, classnames = new Array(_len), _key = 0; _key < _len; _key++) {
217    classnames[_key] = arguments[_key];
218  }
219
220  return classnames.filter(function (i) {
221    return i;
222  }).join(" ");
223}
224/**
225 * A <Link> wrapper that knows if it's "active" or not.
226 */
227
228
229var NavLink = forwardRef$1(function (_ref, forwardedRef) {
230  var _ref$ariaCurrent = _ref["aria-current"],
231      ariaCurrent = _ref$ariaCurrent === void 0 ? "page" : _ref$ariaCurrent,
232      _ref$activeClassName = _ref.activeClassName,
233      activeClassName = _ref$activeClassName === void 0 ? "active" : _ref$activeClassName,
234      activeStyle = _ref.activeStyle,
235      classNameProp = _ref.className,
236      exact = _ref.exact,
237      isActiveProp = _ref.isActive,
238      locationProp = _ref.location,
239      sensitive = _ref.sensitive,
240      strict = _ref.strict,
241      styleProp = _ref.style,
242      to = _ref.to,
243      innerRef = _ref.innerRef,
244      rest = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_ref, ["aria-current", "activeClassName", "activeStyle", "className", "exact", "isActive", "location", "sensitive", "strict", "style", "to", "innerRef"]);
245
246  return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(react_router__WEBPACK_IMPORTED_MODULE_0__[/* __RouterContext */ "e"].Consumer, null, function (context) {
247    !context ?  false ? undefined : Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])(false) : void 0;
248    var currentLocation = locationProp || context.location;
249    var toLocation = normalizeToLocation(resolveToLocation(to, currentLocation), currentLocation);
250    var path = toLocation.pathname; // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202
251
252    var escapedPath = path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
253    var match = escapedPath ? Object(react_router__WEBPACK_IMPORTED_MODULE_0__[/* matchPath */ "f"])(currentLocation.pathname, {
254      path: escapedPath,
255      exact: exact,
256      sensitive: sensitive,
257      strict: strict
258    }) : null;
259    var isActive = !!(isActiveProp ? isActiveProp(match, currentLocation) : match);
260    var className = isActive ? joinClassnames(classNameProp, activeClassName) : classNameProp;
261    var style = isActive ? Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])({}, styleProp, {}, activeStyle) : styleProp;
262
263    var props = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])({
264      "aria-current": isActive && ariaCurrent || null,
265      className: className,
266      style: style,
267      to: toLocation
268    }, rest); // React 15 compat
269
270
271    if (forwardRefShim$1 !== forwardRef$1) {
272      props.ref = forwardedRef || innerRef;
273    } else {
274      props.innerRef = innerRef;
275    }
276
277    return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(Link, props);
278  });
279});
280
281if (false) { var ariaCurrentType; }
282
283
284//# sourceMappingURL=react-router-dom.js.map
285
286
287/***/ })
288
289}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.