pallote-react 0.13.1 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +136 -2090
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import * as React from 'react';
2
- import React__default, { useState, useEffect, useRef, createContext, useContext } from 'react';
1
+ import React, { useState, useEffect, useRef, createContext, useContext } from 'react';
3
2
  import classnames from 'classnames';
4
3
  import PropTypes from 'prop-types';
5
4
  import { createPortal } from 'react-dom';
6
5
  import { X, CalendarBlank, Clock, CaretUpDown, ArrowSquareOut, CaretDoubleLeft, CaretLeft, CaretRight, CaretDoubleRight } from '@phosphor-icons/react';
6
+ import { Link as Link$1 } from 'react-router-dom';
7
7
  import SyntaxHighlighter from 'react-syntax-highlighter';
8
8
 
9
9
  const Color = ({
@@ -27,7 +27,7 @@ const Color = ({
27
27
  [`fill-${fill}`]: fill,
28
28
  [`stroke-${stroke}`]: stroke
29
29
  });
30
- return /*#__PURE__*/React__default.cloneElement(children, {
30
+ return /*#__PURE__*/React.cloneElement(children, {
31
31
  className: childClassName,
32
32
  style: {
33
33
  ...children.props.style,
@@ -77,7 +77,7 @@ const Display = ({
77
77
  window.addEventListener('resize', updateMedia);
78
78
  return () => window.removeEventListener('resize', updateMedia);
79
79
  }, [show, hide]);
80
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isDisplayed ? children : null);
80
+ return /*#__PURE__*/React.createElement(React.Fragment, null, isDisplayed ? children : null);
81
81
  };
82
82
  Display.propTypes = {
83
83
  show: PropTypes.oneOf(['mobile-sm', 'mobile', 'tablet', 'laptop', 'desktop', 'touch']),
@@ -113,7 +113,7 @@ const Grid = ({
113
113
  children,
114
114
  ...props
115
115
  }) => {
116
- return /*#__PURE__*/React__default.createElement("div", _extends({
116
+ return /*#__PURE__*/React.createElement("div", _extends({
117
117
  className: classnames('flex', {
118
118
  'flex-wrap': wrap,
119
119
  [`direction-${direction}`]: direction,
@@ -164,7 +164,7 @@ const Text = ({
164
164
  ...props
165
165
  }) => {
166
166
  const Component = component || 'p';
167
- return /*#__PURE__*/React__default.createElement(Component, _extends({
167
+ return /*#__PURE__*/React.createElement(Component, _extends({
168
168
  className: classnames([{
169
169
  [`${variant}`]: variant,
170
170
  [`text-${align}`]: align,
@@ -221,7 +221,7 @@ const Alert = ({
221
221
  const onAnimationEnd = () => {
222
222
  if (!show) setRender(false);
223
223
  };
224
- let alert = /*#__PURE__*/React__default.createElement("div", _extends({
224
+ let alert = /*#__PURE__*/React.createElement("div", _extends({
225
225
  className: classnames(['alert', {
226
226
  [`alert-${color}`]: color,
227
227
  [`alert-${variant}`]: variant,
@@ -231,22 +231,22 @@ const Alert = ({
231
231
  'alert-noIcon': noIcon
232
232
  }, className]),
233
233
  onAnimationEnd: onAnimationEnd
234
- }, props), /*#__PURE__*/React__default.createElement("div", {
234
+ }, props), /*#__PURE__*/React.createElement("div", {
235
235
  className: classnames('alert_content')
236
- }, title ? /*#__PURE__*/React__default.createElement(Text, {
236
+ }, title ? /*#__PURE__*/React.createElement(Text, {
237
237
  className: classnames('alert_title'),
238
238
  variant: dense ? 'caption' : 'body',
239
239
  weight: "bold"
240
- }, title) : null, subtitle ? /*#__PURE__*/React__default.createElement(Text, {
240
+ }, title) : null, subtitle ? /*#__PURE__*/React.createElement(Text, {
241
241
  variant: dense ? 'overline' : 'caption',
242
242
  className: classnames('alert_subtitle')
243
- }, subtitle) : null), onClose ? /*#__PURE__*/React__default.createElement(X, {
243
+ }, subtitle) : null), onClose ? /*#__PURE__*/React.createElement(X, {
244
244
  className: classnames('alert_close'),
245
245
  onClick: onClose,
246
246
  size: dense ? 14 : 16
247
247
  }) : null);
248
248
  if (variant === 'notice') {
249
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, alert);
249
+ return /*#__PURE__*/React.createElement(React.Fragment, null, alert);
250
250
  } else {
251
251
  return /*#__PURE__*/createPortal(shouldRender && alert, container);
252
252
  }
@@ -267,17 +267,17 @@ const Breadcrumbs = ({
267
267
  items,
268
268
  separator = "slash",
269
269
  className
270
- }) => /*#__PURE__*/React__default.createElement("nav", {
270
+ }) => /*#__PURE__*/React.createElement("nav", {
271
271
  "aria-label": "breadcrumbs",
272
272
  className: classnames(['breadcrumbs', {
273
273
  [`breadcrumbs-${separator}`]: separator
274
274
  }, className])
275
- }, /*#__PURE__*/React__default.createElement("ol", null, items.map((item, index) => /*#__PURE__*/React__default.createElement("li", {
275
+ }, /*#__PURE__*/React.createElement("ol", null, items.map((item, index) => /*#__PURE__*/React.createElement("li", {
276
276
  key: index,
277
277
  className: "breadcrumbs_item"
278
- }, index === items.length - 1 ? /*#__PURE__*/React__default.createElement("p", {
278
+ }, index === items.length - 1 ? /*#__PURE__*/React.createElement("p", {
279
279
  "aria-current": "page"
280
- }, item.label) : /*#__PURE__*/React__default.createElement("a", {
280
+ }, item.label) : /*#__PURE__*/React.createElement("a", {
281
281
  href: item.href
282
282
  }, item.label)))));
283
283
  Breadcrumbs.propTypes = {
@@ -286,7 +286,7 @@ Breadcrumbs.propTypes = {
286
286
  className: PropTypes.node
287
287
  };
288
288
 
289
- const Button = /*#__PURE__*/React__default.forwardRef(({
289
+ const Button = /*#__PURE__*/React.forwardRef(({
290
290
  component = 'button',
291
291
  kind,
292
292
  variant = 'fill',
@@ -305,9 +305,9 @@ const Button = /*#__PURE__*/React__default.forwardRef(({
305
305
  if (kind === 'icon') {
306
306
  content = children;
307
307
  } else {
308
- content = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, iconLeft && iconLeft, children, iconRight && iconRight);
308
+ content = /*#__PURE__*/React.createElement(React.Fragment, null, iconLeft && iconLeft, children, iconRight && iconRight);
309
309
  }
310
- return /*#__PURE__*/React__default.createElement(Component, _extends({
310
+ return /*#__PURE__*/React.createElement(Component, _extends({
311
311
  className: classnames(['button', {
312
312
  [`button-${size}`]: size,
313
313
  [`button-${color}`]: color,
@@ -343,7 +343,7 @@ const Buttons = ({
343
343
  children,
344
344
  ...props
345
345
  }) => {
346
- return /*#__PURE__*/React__default.createElement("div", _extends({
346
+ return /*#__PURE__*/React.createElement("div", _extends({
347
347
  className: classnames(['buttons', {
348
348
  [`buttons-${direction}`]: direction,
349
349
  'buttons-fullWidth': fullWidth,
@@ -370,9 +370,9 @@ const Card = ({
370
370
  children,
371
371
  ...props
372
372
  }) => {
373
- return /*#__PURE__*/React__default.createElement(Color, {
373
+ return /*#__PURE__*/React.createElement(Color, {
374
374
  fill: transparent ? null : fill
375
- }, /*#__PURE__*/React__default.createElement("div", _extends({
375
+ }, /*#__PURE__*/React.createElement("div", _extends({
376
376
  className: classnames(['card', {
377
377
  [`card-${size}`]: size,
378
378
  [`card-${direction}`]: direction,
@@ -399,7 +399,7 @@ const CardActions = ({
399
399
  children,
400
400
  ...props
401
401
  }) => {
402
- return /*#__PURE__*/React__default.createElement("div", _extends({
402
+ return /*#__PURE__*/React.createElement("div", _extends({
403
403
  className: classnames(['card_actions', {
404
404
  [`card_actions-${direction}`]: direction
405
405
  }, className])
@@ -417,7 +417,7 @@ const CardContent = ({
417
417
  children,
418
418
  ...props
419
419
  }) => {
420
- return /*#__PURE__*/React__default.createElement("div", _extends({
420
+ return /*#__PURE__*/React.createElement("div", _extends({
421
421
  className: classnames(['card_content', {
422
422
  'card_content-fullWidth': fullWidth
423
423
  }, className])
@@ -437,15 +437,15 @@ const CardHeader = ({
437
437
  className,
438
438
  ...props
439
439
  }) => {
440
- return /*#__PURE__*/React__default.createElement("div", _extends({
440
+ return /*#__PURE__*/React.createElement("div", _extends({
441
441
  className: classnames(['card_header', className])
442
- }, props), actions && /*#__PURE__*/React__default.createElement("div", {
442
+ }, props), actions && /*#__PURE__*/React.createElement("div", {
443
443
  className: "card_headerActions"
444
- }, actions), label ? /*#__PURE__*/React__default.createElement(Text, {
444
+ }, actions), label ? /*#__PURE__*/React.createElement(Text, {
445
445
  className: classnames('card_label')
446
- }, label) : null, /*#__PURE__*/React__default.createElement(Text, {
446
+ }, label) : null, /*#__PURE__*/React.createElement(Text, {
447
447
  className: classnames('card_title')
448
- }, title), subtitle ? /*#__PURE__*/React__default.createElement(Text, {
448
+ }, title), subtitle ? /*#__PURE__*/React.createElement(Text, {
449
449
  className: classnames('card_subtitle')
450
450
  }, subtitle) : null);
451
451
  };
@@ -466,11 +466,11 @@ const CardMedia = ({
466
466
  className,
467
467
  ...props
468
468
  }) => {
469
- return /*#__PURE__*/React__default.createElement("div", _extends({
469
+ return /*#__PURE__*/React.createElement("div", _extends({
470
470
  className: classnames(['card_media', {
471
471
  'card_media-fullWidth': fullWidth
472
472
  }, className])
473
- }, props), /*#__PURE__*/React__default.createElement("div", {
473
+ }, props), /*#__PURE__*/React.createElement("div", {
474
474
  className: 'card_mediaInner',
475
475
  style: {
476
476
  width: width + 'px',
@@ -497,11 +497,11 @@ const Checkbox = ({
497
497
  className,
498
498
  ...props
499
499
  }) => {
500
- return /*#__PURE__*/React__default.createElement("div", {
500
+ return /*#__PURE__*/React.createElement("div", {
501
501
  className: classnames(['checkbox', {
502
502
  'checkbox-disabled': disabled
503
503
  }, className])
504
- }, /*#__PURE__*/React__default.createElement("input", _extends({
504
+ }, /*#__PURE__*/React.createElement("input", _extends({
505
505
  className: classnames('checkbox_control'),
506
506
  type: "checkbox",
507
507
  name: id,
@@ -511,7 +511,7 @@ const Checkbox = ({
511
511
  "aria-checked": checked,
512
512
  disabled: disabled,
513
513
  required: !(disabled || optional)
514
- }, props)), /*#__PURE__*/React__default.createElement("label", {
514
+ }, props)), /*#__PURE__*/React.createElement("label", {
515
515
  className: classnames('checkbox_label'),
516
516
  htmlFor: id
517
517
  }, label));
@@ -534,14 +534,14 @@ const InputLabel = ({
534
534
  error
535
535
  }) => {
536
536
  const LabelTag = isLegend ? 'legend' : 'label';
537
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, label && /*#__PURE__*/React__default.createElement(LabelTag, _extends({
537
+ return /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement(LabelTag, _extends({
538
538
  className: 'input_label'
539
539
  }, !isLegend && {
540
540
  htmlFor
541
- }), label), hint && /*#__PURE__*/React__default.createElement("p", {
541
+ }), label), hint && /*#__PURE__*/React.createElement("p", {
542
542
  id: htmlFor + '-hint',
543
543
  className: 'input_hint'
544
- }, hint), error && /*#__PURE__*/React__default.createElement("p", {
544
+ }, hint), error && /*#__PURE__*/React.createElement("p", {
545
545
  id: htmlFor + '-error',
546
546
  className: 'input_error'
547
547
  }, error));
@@ -570,7 +570,7 @@ const Checkboxes = ({
570
570
  children,
571
571
  className
572
572
  }) => {
573
- return /*#__PURE__*/React__default.createElement("fieldset", _extends({
573
+ return /*#__PURE__*/React.createElement("fieldset", _extends({
574
574
  className: classnames(['input', {
575
575
  'js-error': error,
576
576
  'input-disabled': disabled,
@@ -579,16 +579,16 @@ const Checkboxes = ({
579
579
  onChange: onChange
580
580
  }, hint || error ? {
581
581
  'aria-describedby': [hint ? `${id}-hint` : null, error ? `${id}-error` : null].filter(Boolean).join(' ')
582
- } : null), /*#__PURE__*/React__default.createElement(InputLabel, {
582
+ } : null), /*#__PURE__*/React.createElement(InputLabel, {
583
583
  isLegend: true,
584
584
  label: label,
585
585
  hint: hint,
586
586
  error: error
587
- }), /*#__PURE__*/React__default.createElement("div", {
587
+ }), /*#__PURE__*/React.createElement("div", {
588
588
  className: classnames(['input_control', 'radios', {
589
589
  [`radios-${direction}`]: direction
590
590
  }])
591
- }, React__default.Children.map(children, child => /*#__PURE__*/React__default.isValidElement(child) ? /*#__PURE__*/React__default.cloneElement(child, {
591
+ }, React.Children.map(children, child => /*#__PURE__*/React.isValidElement(child) ? /*#__PURE__*/React.cloneElement(child, {
592
592
  optional,
593
593
  disabled
594
594
  }) : child)));
@@ -612,7 +612,7 @@ const Divider = ({
612
612
  className,
613
613
  ...props
614
614
  }) => {
615
- return /*#__PURE__*/React__default.createElement("div", _extends({
615
+ return /*#__PURE__*/React.createElement("div", _extends({
616
616
  className: classnames(['divider', {
617
617
  [`divider-${direction}`]: direction,
618
618
  [`divider-${padding}`]: padding
@@ -646,8 +646,8 @@ const Input = ({
646
646
  inputRef.current.focus();
647
647
  }
648
648
  }, [isFocused]);
649
- const customIcon = icon || type === 'date' && /*#__PURE__*/React__default.createElement(CalendarBlank, null) || type === 'time' && /*#__PURE__*/React__default.createElement(Clock, null) || type === 'number' && /*#__PURE__*/React__default.createElement(CaretUpDown, null);
650
- return /*#__PURE__*/React__default.createElement("div", {
649
+ const customIcon = icon || type === 'date' && /*#__PURE__*/React.createElement(CalendarBlank, null) || type === 'time' && /*#__PURE__*/React.createElement(Clock, null) || type === 'number' && /*#__PURE__*/React.createElement(CaretUpDown, null);
650
+ return /*#__PURE__*/React.createElement("div", {
651
651
  className: classnames(['input', {
652
652
  'js-error': error,
653
653
  'input-disabled': disabled,
@@ -655,14 +655,14 @@ const Input = ({
655
655
  'input-withIcon': icon
656
656
  }, className]),
657
657
  onChange: onChange
658
- }, /*#__PURE__*/React__default.createElement(InputLabel, {
658
+ }, /*#__PURE__*/React.createElement(InputLabel, {
659
659
  htmlFor: id,
660
660
  label: label,
661
661
  hint: hint,
662
662
  error: error
663
- }), customIcon && /*#__PURE__*/React__default.createElement("div", {
663
+ }), customIcon && /*#__PURE__*/React.createElement("div", {
664
664
  className: 'input_icon'
665
- }, customIcon), /*#__PURE__*/React__default.createElement("input", _extends({
665
+ }, customIcon), /*#__PURE__*/React.createElement("input", _extends({
666
666
  ref: inputRef,
667
667
  type: type,
668
668
  className: 'input_control',
@@ -690,7 +690,7 @@ Input.propTypes = {
690
690
  className: PropTypes.node
691
691
  };
692
692
 
693
- const Link$1 = ({
693
+ const Link = ({
694
694
  component = 'a',
695
695
  icon,
696
696
  color,
@@ -701,20 +701,20 @@ const Link$1 = ({
701
701
  ...props
702
702
  }) => {
703
703
  const Component = component || 'a';
704
- return /*#__PURE__*/React__default.createElement(Component, _extends({
704
+ return /*#__PURE__*/React.createElement(Component, _extends({
705
705
  className: classnames(['link', {
706
706
  [`text-${color}`]: color
707
707
  }, className]),
708
708
  href: isExternal ? href : undefined,
709
709
  target: isExternal ? '_blank' : undefined,
710
710
  rel: isExternal ? 'noopener noreferrer' : undefined
711
- }, props), children, icon && !isExternal && /*#__PURE__*/React__default.createElement("span", {
711
+ }, props), children, icon && !isExternal && /*#__PURE__*/React.createElement("span", {
712
712
  className: 'link_icon'
713
- }, icon), isExternal && /*#__PURE__*/React__default.createElement("span", {
713
+ }, icon), isExternal && /*#__PURE__*/React.createElement("span", {
714
714
  className: 'link_icon'
715
- }, /*#__PURE__*/React__default.createElement(ArrowSquareOut, null)));
715
+ }, /*#__PURE__*/React.createElement(ArrowSquareOut, null)));
716
716
  };
717
- Link$1.propTypes = {
717
+ Link.propTypes = {
718
718
  component: PropTypes.oneOfType(['a', PropTypes.elementType]),
719
719
  icon: PropTypes.node,
720
720
  color: PropTypes.oneOf(['default', 'alt', 'disabled', 'contrast', 'contrastAlt', 'contrastDisabled', 'primary', 'secondary', 'inherit']),
@@ -729,7 +729,7 @@ const List = ({
729
729
  children,
730
730
  ...props
731
731
  }) => {
732
- return /*#__PURE__*/React__default.createElement("div", _extends({
732
+ return /*#__PURE__*/React.createElement("div", _extends({
733
733
  className: classnames(['list', {
734
734
  'list-dense': dense
735
735
  }, className])
@@ -748,11 +748,11 @@ const ListItem = ({
748
748
  children = 'List item',
749
749
  ...props
750
750
  }) => {
751
- return /*#__PURE__*/React__default.createElement(Text, _extends({
751
+ return /*#__PURE__*/React.createElement(Text, _extends({
752
752
  className: classnames(['list_item', {
753
753
  'list_item-bold': bold
754
754
  }, className])
755
- }, props), icon ? /*#__PURE__*/React__default.cloneElement(icon, {
755
+ }, props), icon ? /*#__PURE__*/React.cloneElement(icon, {
756
756
  className: `${icon.props.className ?? ''} list_itemIcon`
757
757
  }) : null, children);
758
758
  };
@@ -770,12 +770,12 @@ const Nav = ({
770
770
  children,
771
771
  ...props
772
772
  }) => {
773
- return /*#__PURE__*/React__default.createElement("nav", _extends({
773
+ return /*#__PURE__*/React.createElement("nav", _extends({
774
774
  className: classnames(['nav', {
775
775
  [`nav-${direction}`]: direction,
776
776
  'nav-dense': dense
777
777
  }, className])
778
- }, props), /*#__PURE__*/React__default.createElement("div", {
778
+ }, props), /*#__PURE__*/React.createElement("div", {
779
779
  className: "nav_container"
780
780
  }, children));
781
781
  };
@@ -786,1960 +786,6 @@ Nav.propTypes = {
786
786
  children: PropTypes.node.isRequired
787
787
  };
788
788
 
789
- var dist = {};
790
-
791
- var hasRequiredDist;
792
- function requireDist() {
793
- if (hasRequiredDist) return dist;
794
- hasRequiredDist = 1;
795
- Object.defineProperty(dist, "__esModule", {
796
- value: true
797
- });
798
- dist.parse = parse;
799
- dist.serialize = serialize;
800
- /**
801
- * RegExp to match cookie-name in RFC 6265 sec 4.1.1
802
- * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
803
- * which has been replaced by the token definition in RFC 7230 appendix B.
804
- *
805
- * cookie-name = token
806
- * token = 1*tchar
807
- * tchar = "!" / "#" / "$" / "%" / "&" / "'" /
808
- * "*" / "+" / "-" / "." / "^" / "_" /
809
- * "`" / "|" / "~" / DIGIT / ALPHA
810
- *
811
- * Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191
812
- * Allow same range as cookie value, except `=`, which delimits end of name.
813
- */
814
- const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
815
- /**
816
- * RegExp to match cookie-value in RFC 6265 sec 4.1.1
817
- *
818
- * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
819
- * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
820
- * ; US-ASCII characters excluding CTLs,
821
- * ; whitespace DQUOTE, comma, semicolon,
822
- * ; and backslash
823
- *
824
- * Allowing more characters: https://github.com/jshttp/cookie/issues/191
825
- * Comma, backslash, and DQUOTE are not part of the parsing algorithm.
826
- */
827
- const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
828
- /**
829
- * RegExp to match domain-value in RFC 6265 sec 4.1.1
830
- *
831
- * domain-value = <subdomain>
832
- * ; defined in [RFC1034], Section 3.5, as
833
- * ; enhanced by [RFC1123], Section 2.1
834
- * <subdomain> = <label> | <subdomain> "." <label>
835
- * <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]
836
- * Labels must be 63 characters or less.
837
- * 'let-dig' not 'letter' in the first char, per RFC1123
838
- * <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
839
- * <let-dig-hyp> = <let-dig> | "-"
840
- * <let-dig> = <letter> | <digit>
841
- * <letter> = any one of the 52 alphabetic characters A through Z in
842
- * upper case and a through z in lower case
843
- * <digit> = any one of the ten digits 0 through 9
844
- *
845
- * Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
846
- *
847
- * > (Note that a leading %x2E ("."), if present, is ignored even though that
848
- * character is not permitted, but a trailing %x2E ("."), if present, will
849
- * cause the user agent to ignore the attribute.)
850
- */
851
- const domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
852
- /**
853
- * RegExp to match path-value in RFC 6265 sec 4.1.1
854
- *
855
- * path-value = <any CHAR except CTLs or ";">
856
- * CHAR = %x01-7F
857
- * ; defined in RFC 5234 appendix B.1
858
- */
859
- const pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
860
- const __toString = Object.prototype.toString;
861
- const NullObject = /* @__PURE__ */(() => {
862
- const C = function () {};
863
- C.prototype = Object.create(null);
864
- return C;
865
- })();
866
- /**
867
- * Parse a cookie header.
868
- *
869
- * Parse the given cookie header string into an object
870
- * The object has the various cookies as keys(names) => values
871
- */
872
- function parse(str, options) {
873
- const obj = new NullObject();
874
- const len = str.length;
875
- // RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.
876
- if (len < 2) return obj;
877
- const dec = options?.decode || decode;
878
- let index = 0;
879
- do {
880
- const eqIdx = str.indexOf("=", index);
881
- if (eqIdx === -1) break; // No more cookie pairs.
882
- const colonIdx = str.indexOf(";", index);
883
- const endIdx = colonIdx === -1 ? len : colonIdx;
884
- if (eqIdx > endIdx) {
885
- // backtrack on prior semicolon
886
- index = str.lastIndexOf(";", eqIdx - 1) + 1;
887
- continue;
888
- }
889
- const keyStartIdx = startIndex(str, index, eqIdx);
890
- const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
891
- const key = str.slice(keyStartIdx, keyEndIdx);
892
- // only assign once
893
- if (obj[key] === undefined) {
894
- let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
895
- let valEndIdx = endIndex(str, endIdx, valStartIdx);
896
- const value = dec(str.slice(valStartIdx, valEndIdx));
897
- obj[key] = value;
898
- }
899
- index = endIdx + 1;
900
- } while (index < len);
901
- return obj;
902
- }
903
- function startIndex(str, index, max) {
904
- do {
905
- const code = str.charCodeAt(index);
906
- if (code !== 0x20 /* */ && code !== 0x09 /* \t */) return index;
907
- } while (++index < max);
908
- return max;
909
- }
910
- function endIndex(str, index, min) {
911
- while (index > min) {
912
- const code = str.charCodeAt(--index);
913
- if (code !== 0x20 /* */ && code !== 0x09 /* \t */) return index + 1;
914
- }
915
- return min;
916
- }
917
- /**
918
- * Serialize data into a cookie header.
919
- *
920
- * Serialize a name value pair into a cookie string suitable for
921
- * http headers. An optional options object specifies cookie parameters.
922
- *
923
- * serialize('foo', 'bar', { httpOnly: true })
924
- * => "foo=bar; httpOnly"
925
- */
926
- function serialize(name, val, options) {
927
- const enc = options?.encode || encodeURIComponent;
928
- if (!cookieNameRegExp.test(name)) {
929
- throw new TypeError(`argument name is invalid: ${name}`);
930
- }
931
- const value = enc(val);
932
- if (!cookieValueRegExp.test(value)) {
933
- throw new TypeError(`argument val is invalid: ${val}`);
934
- }
935
- let str = name + "=" + value;
936
- if (!options) return str;
937
- if (options.maxAge !== undefined) {
938
- if (!Number.isInteger(options.maxAge)) {
939
- throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
940
- }
941
- str += "; Max-Age=" + options.maxAge;
942
- }
943
- if (options.domain) {
944
- if (!domainValueRegExp.test(options.domain)) {
945
- throw new TypeError(`option domain is invalid: ${options.domain}`);
946
- }
947
- str += "; Domain=" + options.domain;
948
- }
949
- if (options.path) {
950
- if (!pathValueRegExp.test(options.path)) {
951
- throw new TypeError(`option path is invalid: ${options.path}`);
952
- }
953
- str += "; Path=" + options.path;
954
- }
955
- if (options.expires) {
956
- if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) {
957
- throw new TypeError(`option expires is invalid: ${options.expires}`);
958
- }
959
- str += "; Expires=" + options.expires.toUTCString();
960
- }
961
- if (options.httpOnly) {
962
- str += "; HttpOnly";
963
- }
964
- if (options.secure) {
965
- str += "; Secure";
966
- }
967
- if (options.partitioned) {
968
- str += "; Partitioned";
969
- }
970
- if (options.priority) {
971
- const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : undefined;
972
- switch (priority) {
973
- case "low":
974
- str += "; Priority=Low";
975
- break;
976
- case "medium":
977
- str += "; Priority=Medium";
978
- break;
979
- case "high":
980
- str += "; Priority=High";
981
- break;
982
- default:
983
- throw new TypeError(`option priority is invalid: ${options.priority}`);
984
- }
985
- }
986
- if (options.sameSite) {
987
- const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite;
988
- switch (sameSite) {
989
- case true:
990
- case "strict":
991
- str += "; SameSite=Strict";
992
- break;
993
- case "lax":
994
- str += "; SameSite=Lax";
995
- break;
996
- case "none":
997
- str += "; SameSite=None";
998
- break;
999
- default:
1000
- throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
1001
- }
1002
- }
1003
- return str;
1004
- }
1005
- /**
1006
- * URL-decode string value. Optimized to skip native call when no %.
1007
- */
1008
- function decode(str) {
1009
- if (str.indexOf("%") === -1) return str;
1010
- try {
1011
- return decodeURIComponent(str);
1012
- } catch (e) {
1013
- return str;
1014
- }
1015
- }
1016
- /**
1017
- * Determine if value is a Date.
1018
- */
1019
- function isDate(val) {
1020
- return __toString.call(val) === "[object Date]";
1021
- }
1022
- return dist;
1023
- }
1024
-
1025
- requireDist();
1026
-
1027
- /**
1028
- * react-router v7.3.0
1029
- *
1030
- * Copyright (c) Remix Software Inc.
1031
- *
1032
- * This source code is licensed under the MIT license found in the
1033
- * LICENSE.md file in the root directory of this source tree.
1034
- *
1035
- * @license MIT
1036
- */
1037
- function invariant(value, message) {
1038
- if (value === false || value === null || typeof value === "undefined") {
1039
- throw new Error(message);
1040
- }
1041
- }
1042
- function warning(cond, message) {
1043
- if (!cond) {
1044
- if (typeof console !== "undefined") console.warn(message);
1045
- try {
1046
- throw new Error(message);
1047
- } catch (e) {
1048
- }
1049
- }
1050
- }
1051
- function createPath({
1052
- pathname = "/",
1053
- search = "",
1054
- hash = ""
1055
- }) {
1056
- if (search && search !== "?")
1057
- pathname += search.charAt(0) === "?" ? search : "?" + search;
1058
- if (hash && hash !== "#")
1059
- pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
1060
- return pathname;
1061
- }
1062
- function parsePath(path) {
1063
- let parsedPath = {};
1064
- if (path) {
1065
- let hashIndex = path.indexOf("#");
1066
- if (hashIndex >= 0) {
1067
- parsedPath.hash = path.substring(hashIndex);
1068
- path = path.substring(0, hashIndex);
1069
- }
1070
- let searchIndex = path.indexOf("?");
1071
- if (searchIndex >= 0) {
1072
- parsedPath.search = path.substring(searchIndex);
1073
- path = path.substring(0, searchIndex);
1074
- }
1075
- if (path) {
1076
- parsedPath.pathname = path;
1077
- }
1078
- }
1079
- return parsedPath;
1080
- }
1081
- function matchRoutes(routes, locationArg, basename = "/") {
1082
- return matchRoutesImpl(routes, locationArg, basename, false);
1083
- }
1084
- function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
1085
- let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
1086
- let pathname = stripBasename(location.pathname || "/", basename);
1087
- if (pathname == null) {
1088
- return null;
1089
- }
1090
- let branches = flattenRoutes(routes);
1091
- rankRouteBranches(branches);
1092
- let matches = null;
1093
- for (let i = 0; matches == null && i < branches.length; ++i) {
1094
- let decoded = decodePath(pathname);
1095
- matches = matchRouteBranch(
1096
- branches[i],
1097
- decoded,
1098
- allowPartial
1099
- );
1100
- }
1101
- return matches;
1102
- }
1103
- function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "") {
1104
- let flattenRoute = (route, index, relativePath) => {
1105
- let meta = {
1106
- relativePath: relativePath === void 0 ? route.path || "" : relativePath,
1107
- caseSensitive: route.caseSensitive === true,
1108
- childrenIndex: index,
1109
- route
1110
- };
1111
- if (meta.relativePath.startsWith("/")) {
1112
- invariant(
1113
- meta.relativePath.startsWith(parentPath),
1114
- `Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
1115
- );
1116
- meta.relativePath = meta.relativePath.slice(parentPath.length);
1117
- }
1118
- let path = joinPaths([parentPath, meta.relativePath]);
1119
- let routesMeta = parentsMeta.concat(meta);
1120
- if (route.children && route.children.length > 0) {
1121
- invariant(
1122
- // Our types know better, but runtime JS may not!
1123
- // @ts-expect-error
1124
- route.index !== true,
1125
- `Index routes must not have child routes. Please remove all child routes from route path "${path}".`
1126
- );
1127
- flattenRoutes(route.children, branches, routesMeta, path);
1128
- }
1129
- if (route.path == null && !route.index) {
1130
- return;
1131
- }
1132
- branches.push({
1133
- path,
1134
- score: computeScore(path, route.index),
1135
- routesMeta
1136
- });
1137
- };
1138
- routes.forEach((route, index) => {
1139
- if (route.path === "" || !route.path?.includes("?")) {
1140
- flattenRoute(route, index);
1141
- } else {
1142
- for (let exploded of explodeOptionalSegments(route.path)) {
1143
- flattenRoute(route, index, exploded);
1144
- }
1145
- }
1146
- });
1147
- return branches;
1148
- }
1149
- function explodeOptionalSegments(path) {
1150
- let segments = path.split("/");
1151
- if (segments.length === 0) return [];
1152
- let [first, ...rest] = segments;
1153
- let isOptional = first.endsWith("?");
1154
- let required = first.replace(/\?$/, "");
1155
- if (rest.length === 0) {
1156
- return isOptional ? [required, ""] : [required];
1157
- }
1158
- let restExploded = explodeOptionalSegments(rest.join("/"));
1159
- let result = [];
1160
- result.push(
1161
- ...restExploded.map(
1162
- (subpath) => subpath === "" ? required : [required, subpath].join("/")
1163
- )
1164
- );
1165
- if (isOptional) {
1166
- result.push(...restExploded);
1167
- }
1168
- return result.map(
1169
- (exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded
1170
- );
1171
- }
1172
- function rankRouteBranches(branches) {
1173
- branches.sort(
1174
- (a, b) => a.score !== b.score ? b.score - a.score : compareIndexes(
1175
- a.routesMeta.map((meta) => meta.childrenIndex),
1176
- b.routesMeta.map((meta) => meta.childrenIndex)
1177
- )
1178
- );
1179
- }
1180
- var paramRe = /^:[\w-]+$/;
1181
- var dynamicSegmentValue = 3;
1182
- var indexRouteValue = 2;
1183
- var emptySegmentValue = 1;
1184
- var staticSegmentValue = 10;
1185
- var splatPenalty = -2;
1186
- var isSplat = (s) => s === "*";
1187
- function computeScore(path, index) {
1188
- let segments = path.split("/");
1189
- let initialScore = segments.length;
1190
- if (segments.some(isSplat)) {
1191
- initialScore += splatPenalty;
1192
- }
1193
- if (index) {
1194
- initialScore += indexRouteValue;
1195
- }
1196
- return segments.filter((s) => !isSplat(s)).reduce(
1197
- (score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue),
1198
- initialScore
1199
- );
1200
- }
1201
- function compareIndexes(a, b) {
1202
- let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);
1203
- return siblings ? (
1204
- // If two routes are siblings, we should try to match the earlier sibling
1205
- // first. This allows people to have fine-grained control over the matching
1206
- // behavior by simply putting routes with identical paths in the order they
1207
- // want them tried.
1208
- a[a.length - 1] - b[b.length - 1]
1209
- ) : (
1210
- // Otherwise, it doesn't really make sense to rank non-siblings by index,
1211
- // so they sort equally.
1212
- 0
1213
- );
1214
- }
1215
- function matchRouteBranch(branch, pathname, allowPartial = false) {
1216
- let { routesMeta } = branch;
1217
- let matchedParams = {};
1218
- let matchedPathname = "/";
1219
- let matches = [];
1220
- for (let i = 0; i < routesMeta.length; ++i) {
1221
- let meta = routesMeta[i];
1222
- let end = i === routesMeta.length - 1;
1223
- let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
1224
- let match = matchPath(
1225
- { path: meta.relativePath, caseSensitive: meta.caseSensitive, end },
1226
- remainingPathname
1227
- );
1228
- let route = meta.route;
1229
- if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {
1230
- match = matchPath(
1231
- {
1232
- path: meta.relativePath,
1233
- caseSensitive: meta.caseSensitive,
1234
- end: false
1235
- },
1236
- remainingPathname
1237
- );
1238
- }
1239
- if (!match) {
1240
- return null;
1241
- }
1242
- Object.assign(matchedParams, match.params);
1243
- matches.push({
1244
- // TODO: Can this as be avoided?
1245
- params: matchedParams,
1246
- pathname: joinPaths([matchedPathname, match.pathname]),
1247
- pathnameBase: normalizePathname(
1248
- joinPaths([matchedPathname, match.pathnameBase])
1249
- ),
1250
- route
1251
- });
1252
- if (match.pathnameBase !== "/") {
1253
- matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);
1254
- }
1255
- }
1256
- return matches;
1257
- }
1258
- function matchPath(pattern, pathname) {
1259
- if (typeof pattern === "string") {
1260
- pattern = { path: pattern, caseSensitive: false, end: true };
1261
- }
1262
- let [matcher, compiledParams] = compilePath(
1263
- pattern.path,
1264
- pattern.caseSensitive,
1265
- pattern.end
1266
- );
1267
- let match = pathname.match(matcher);
1268
- if (!match) return null;
1269
- let matchedPathname = match[0];
1270
- let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
1271
- let captureGroups = match.slice(1);
1272
- let params = compiledParams.reduce(
1273
- (memo2, { paramName, isOptional }, index) => {
1274
- if (paramName === "*") {
1275
- let splatValue = captureGroups[index] || "";
1276
- pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
1277
- }
1278
- const value = captureGroups[index];
1279
- if (isOptional && !value) {
1280
- memo2[paramName] = void 0;
1281
- } else {
1282
- memo2[paramName] = (value || "").replace(/%2F/g, "/");
1283
- }
1284
- return memo2;
1285
- },
1286
- {}
1287
- );
1288
- return {
1289
- params,
1290
- pathname: matchedPathname,
1291
- pathnameBase,
1292
- pattern
1293
- };
1294
- }
1295
- function compilePath(path, caseSensitive = false, end = true) {
1296
- warning(
1297
- path === "*" || !path.endsWith("*") || path.endsWith("/*"),
1298
- `Route path "${path}" will be treated as if it were "${path.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${path.replace(/\*$/, "/*")}".`
1299
- );
1300
- let params = [];
1301
- let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
1302
- /\/:([\w-]+)(\?)?/g,
1303
- (_, paramName, isOptional) => {
1304
- params.push({ paramName, isOptional: isOptional != null });
1305
- return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
1306
- }
1307
- );
1308
- if (path.endsWith("*")) {
1309
- params.push({ paramName: "*" });
1310
- regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
1311
- } else if (end) {
1312
- regexpSource += "\\/*$";
1313
- } else if (path !== "" && path !== "/") {
1314
- regexpSource += "(?:(?=\\/|$))";
1315
- } else ;
1316
- let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
1317
- return [matcher, params];
1318
- }
1319
- function decodePath(value) {
1320
- try {
1321
- return value.split("/").map((v) => decodeURIComponent(v).replace(/\//g, "%2F")).join("/");
1322
- } catch (error) {
1323
- warning(
1324
- false,
1325
- `The URL path "${value}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${error}).`
1326
- );
1327
- return value;
1328
- }
1329
- }
1330
- function stripBasename(pathname, basename) {
1331
- if (basename === "/") return pathname;
1332
- if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
1333
- return null;
1334
- }
1335
- let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
1336
- let nextChar = pathname.charAt(startIndex);
1337
- if (nextChar && nextChar !== "/") {
1338
- return null;
1339
- }
1340
- return pathname.slice(startIndex) || "/";
1341
- }
1342
- function resolvePath(to, fromPathname = "/") {
1343
- let {
1344
- pathname: toPathname,
1345
- search = "",
1346
- hash = ""
1347
- } = typeof to === "string" ? parsePath(to) : to;
1348
- let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;
1349
- return {
1350
- pathname,
1351
- search: normalizeSearch(search),
1352
- hash: normalizeHash(hash)
1353
- };
1354
- }
1355
- function resolvePathname(relativePath, fromPathname) {
1356
- let segments = fromPathname.replace(/\/+$/, "").split("/");
1357
- let relativeSegments = relativePath.split("/");
1358
- relativeSegments.forEach((segment) => {
1359
- if (segment === "..") {
1360
- if (segments.length > 1) segments.pop();
1361
- } else if (segment !== ".") {
1362
- segments.push(segment);
1363
- }
1364
- });
1365
- return segments.length > 1 ? segments.join("/") : "/";
1366
- }
1367
- function getInvalidPathError(char, field, dest, path) {
1368
- return `Cannot include a '${char}' character in a manually specified \`to.${field}\` field [${JSON.stringify(
1369
- path
1370
- )}]. Please separate it out to the \`to.${dest}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
1371
- }
1372
- function getPathContributingMatches(matches) {
1373
- return matches.filter(
1374
- (match, index) => index === 0 || match.route.path && match.route.path.length > 0
1375
- );
1376
- }
1377
- function getResolveToMatches(matches) {
1378
- let pathMatches = getPathContributingMatches(matches);
1379
- return pathMatches.map(
1380
- (match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase
1381
- );
1382
- }
1383
- function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = false) {
1384
- let to;
1385
- if (typeof toArg === "string") {
1386
- to = parsePath(toArg);
1387
- } else {
1388
- to = { ...toArg };
1389
- invariant(
1390
- !to.pathname || !to.pathname.includes("?"),
1391
- getInvalidPathError("?", "pathname", "search", to)
1392
- );
1393
- invariant(
1394
- !to.pathname || !to.pathname.includes("#"),
1395
- getInvalidPathError("#", "pathname", "hash", to)
1396
- );
1397
- invariant(
1398
- !to.search || !to.search.includes("#"),
1399
- getInvalidPathError("#", "search", "hash", to)
1400
- );
1401
- }
1402
- let isEmptyPath = toArg === "" || to.pathname === "";
1403
- let toPathname = isEmptyPath ? "/" : to.pathname;
1404
- let from;
1405
- if (toPathname == null) {
1406
- from = locationPathname;
1407
- } else {
1408
- let routePathnameIndex = routePathnames.length - 1;
1409
- if (!isPathRelative && toPathname.startsWith("..")) {
1410
- let toSegments = toPathname.split("/");
1411
- while (toSegments[0] === "..") {
1412
- toSegments.shift();
1413
- routePathnameIndex -= 1;
1414
- }
1415
- to.pathname = toSegments.join("/");
1416
- }
1417
- from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
1418
- }
1419
- let path = resolvePath(to, from);
1420
- let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
1421
- let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
1422
- if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
1423
- path.pathname += "/";
1424
- }
1425
- return path;
1426
- }
1427
- var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
1428
- var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
1429
- var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
1430
- var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
1431
- function isRouteErrorResponse(error) {
1432
- return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
1433
- }
1434
-
1435
- // lib/router/router.ts
1436
- var validMutationMethodsArr = [
1437
- "POST",
1438
- "PUT",
1439
- "PATCH",
1440
- "DELETE"
1441
- ];
1442
- new Set(
1443
- validMutationMethodsArr
1444
- );
1445
- var validRequestMethodsArr = [
1446
- "GET",
1447
- ...validMutationMethodsArr
1448
- ];
1449
- new Set(validRequestMethodsArr);
1450
- var DataRouterContext = React.createContext(null);
1451
- DataRouterContext.displayName = "DataRouter";
1452
- var DataRouterStateContext = React.createContext(null);
1453
- DataRouterStateContext.displayName = "DataRouterState";
1454
- var ViewTransitionContext = React.createContext({
1455
- isTransitioning: false
1456
- });
1457
- ViewTransitionContext.displayName = "ViewTransition";
1458
- var FetchersContext = React.createContext(
1459
- /* @__PURE__ */ new Map()
1460
- );
1461
- FetchersContext.displayName = "Fetchers";
1462
- var AwaitContext = React.createContext(null);
1463
- AwaitContext.displayName = "Await";
1464
- var NavigationContext = React.createContext(
1465
- null
1466
- );
1467
- NavigationContext.displayName = "Navigation";
1468
- var LocationContext = React.createContext(
1469
- null
1470
- );
1471
- LocationContext.displayName = "Location";
1472
- var RouteContext = React.createContext({
1473
- outlet: null,
1474
- matches: [],
1475
- isDataRoute: false
1476
- });
1477
- RouteContext.displayName = "Route";
1478
- var RouteErrorContext = React.createContext(null);
1479
- RouteErrorContext.displayName = "RouteError";
1480
- function useHref(to, { relative } = {}) {
1481
- invariant(
1482
- useInRouterContext(),
1483
- // TODO: This error is probably because they somehow have 2 versions of the
1484
- // router loaded. We can help them understand how to avoid that.
1485
- `useHref() may be used only in the context of a <Router> component.`
1486
- );
1487
- let { basename, navigator: navigator2 } = React.useContext(NavigationContext);
1488
- let { hash, pathname, search } = useResolvedPath(to, { relative });
1489
- let joinedPathname = pathname;
1490
- if (basename !== "/") {
1491
- joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
1492
- }
1493
- return navigator2.createHref({ pathname: joinedPathname, search, hash });
1494
- }
1495
- function useInRouterContext() {
1496
- return React.useContext(LocationContext) != null;
1497
- }
1498
- function useLocation() {
1499
- invariant(
1500
- useInRouterContext(),
1501
- // TODO: This error is probably because they somehow have 2 versions of the
1502
- // router loaded. We can help them understand how to avoid that.
1503
- `useLocation() may be used only in the context of a <Router> component.`
1504
- );
1505
- return React.useContext(LocationContext).location;
1506
- }
1507
- var navigateEffectWarning = `You should call navigate() in a React.useEffect(), not when your component is first rendered.`;
1508
- function useIsomorphicLayoutEffect(cb) {
1509
- let isStatic = React.useContext(NavigationContext).static;
1510
- if (!isStatic) {
1511
- React.useLayoutEffect(cb);
1512
- }
1513
- }
1514
- function useNavigate() {
1515
- let { isDataRoute } = React.useContext(RouteContext);
1516
- return isDataRoute ? useNavigateStable() : useNavigateUnstable();
1517
- }
1518
- function useNavigateUnstable() {
1519
- invariant(
1520
- useInRouterContext(),
1521
- // TODO: This error is probably because they somehow have 2 versions of the
1522
- // router loaded. We can help them understand how to avoid that.
1523
- `useNavigate() may be used only in the context of a <Router> component.`
1524
- );
1525
- let dataRouterContext = React.useContext(DataRouterContext);
1526
- let { basename, navigator: navigator2 } = React.useContext(NavigationContext);
1527
- let { matches } = React.useContext(RouteContext);
1528
- let { pathname: locationPathname } = useLocation();
1529
- let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
1530
- let activeRef = React.useRef(false);
1531
- useIsomorphicLayoutEffect(() => {
1532
- activeRef.current = true;
1533
- });
1534
- let navigate = React.useCallback(
1535
- (to, options = {}) => {
1536
- warning(activeRef.current, navigateEffectWarning);
1537
- if (!activeRef.current) return;
1538
- if (typeof to === "number") {
1539
- navigator2.go(to);
1540
- return;
1541
- }
1542
- let path = resolveTo(
1543
- to,
1544
- JSON.parse(routePathnamesJson),
1545
- locationPathname,
1546
- options.relative === "path"
1547
- );
1548
- if (dataRouterContext == null && basename !== "/") {
1549
- path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
1550
- }
1551
- (!!options.replace ? navigator2.replace : navigator2.push)(
1552
- path,
1553
- options.state,
1554
- options
1555
- );
1556
- },
1557
- [
1558
- basename,
1559
- navigator2,
1560
- routePathnamesJson,
1561
- locationPathname,
1562
- dataRouterContext
1563
- ]
1564
- );
1565
- return navigate;
1566
- }
1567
- React.createContext(null);
1568
- function useResolvedPath(to, { relative } = {}) {
1569
- let { matches } = React.useContext(RouteContext);
1570
- let { pathname: locationPathname } = useLocation();
1571
- let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
1572
- return React.useMemo(
1573
- () => resolveTo(
1574
- to,
1575
- JSON.parse(routePathnamesJson),
1576
- locationPathname,
1577
- relative === "path"
1578
- ),
1579
- [to, routePathnamesJson, locationPathname, relative]
1580
- );
1581
- }
1582
- function useRoutesImpl(routes, locationArg, dataRouterState, future) {
1583
- invariant(
1584
- useInRouterContext(),
1585
- // TODO: This error is probably because they somehow have 2 versions of the
1586
- // router loaded. We can help them understand how to avoid that.
1587
- `useRoutes() may be used only in the context of a <Router> component.`
1588
- );
1589
- let { navigator: navigator2, static: isStatic } = React.useContext(NavigationContext);
1590
- let { matches: parentMatches } = React.useContext(RouteContext);
1591
- let routeMatch = parentMatches[parentMatches.length - 1];
1592
- let parentParams = routeMatch ? routeMatch.params : {};
1593
- let parentPathname = routeMatch ? routeMatch.pathname : "/";
1594
- let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
1595
- let parentRoute = routeMatch && routeMatch.route;
1596
- {
1597
- let parentPath = parentRoute && parentRoute.path || "";
1598
- warningOnce(
1599
- parentPathname,
1600
- !parentRoute || parentPath.endsWith("*") || parentPath.endsWith("*?"),
1601
- `You rendered descendant <Routes> (or called \`useRoutes()\`) at "${parentPathname}" (under <Route path="${parentPath}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
1602
-
1603
- Please change the parent <Route path="${parentPath}"> to <Route path="${parentPath === "/" ? "*" : `${parentPath}/*`}">.`
1604
- );
1605
- }
1606
- let locationFromContext = useLocation();
1607
- let location;
1608
- {
1609
- location = locationFromContext;
1610
- }
1611
- let pathname = location.pathname || "/";
1612
- let remainingPathname = pathname;
1613
- if (parentPathnameBase !== "/") {
1614
- let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
1615
- let segments = pathname.replace(/^\//, "").split("/");
1616
- remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
1617
- }
1618
- let matches = !isStatic && dataRouterState && dataRouterState.matches && dataRouterState.matches.length > 0 ? dataRouterState.matches : matchRoutes(routes, { pathname: remainingPathname });
1619
- {
1620
- warning(
1621
- parentRoute || matches != null,
1622
- `No routes matched location "${location.pathname}${location.search}${location.hash}" `
1623
- );
1624
- warning(
1625
- matches == null || matches[matches.length - 1].route.element !== void 0 || matches[matches.length - 1].route.Component !== void 0 || matches[matches.length - 1].route.lazy !== void 0,
1626
- `Matched leaf route at location "${location.pathname}${location.search}${location.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`
1627
- );
1628
- }
1629
- let renderedMatches = _renderMatches(
1630
- matches && matches.map(
1631
- (match) => Object.assign({}, match, {
1632
- params: Object.assign({}, parentParams, match.params),
1633
- pathname: joinPaths([
1634
- parentPathnameBase,
1635
- // Re-encode pathnames that were decoded inside matchRoutes
1636
- navigator2.encodeLocation ? navigator2.encodeLocation(match.pathname).pathname : match.pathname
1637
- ]),
1638
- pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([
1639
- parentPathnameBase,
1640
- // Re-encode pathnames that were decoded inside matchRoutes
1641
- navigator2.encodeLocation ? navigator2.encodeLocation(match.pathnameBase).pathname : match.pathnameBase
1642
- ])
1643
- })
1644
- ),
1645
- parentMatches,
1646
- dataRouterState,
1647
- future
1648
- );
1649
- return renderedMatches;
1650
- }
1651
- function DefaultErrorComponent() {
1652
- let error = useRouteError();
1653
- let message = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error);
1654
- let stack = error instanceof Error ? error.stack : null;
1655
- let lightgrey = "rgba(200,200,200, 0.5)";
1656
- let preStyles = { padding: "0.5rem", backgroundColor: lightgrey };
1657
- let codeStyles = { padding: "2px 4px", backgroundColor: lightgrey };
1658
- let devInfo = null;
1659
- {
1660
- console.error(
1661
- "Error handled by React Router default ErrorBoundary:",
1662
- error
1663
- );
1664
- devInfo = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", null, "\u{1F4BF} Hey developer \u{1F44B}"), /* @__PURE__ */ React.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ React.createElement("code", { style: codeStyles }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ React.createElement("code", { style: codeStyles }, "errorElement"), " prop on your route."));
1665
- }
1666
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ React.createElement("h3", { style: { fontStyle: "italic" } }, message), stack ? /* @__PURE__ */ React.createElement("pre", { style: preStyles }, stack) : null, devInfo);
1667
- }
1668
- var defaultErrorElement = /* @__PURE__ */ React.createElement(DefaultErrorComponent, null);
1669
- var RenderErrorBoundary = class extends React.Component {
1670
- constructor(props) {
1671
- super(props);
1672
- this.state = {
1673
- location: props.location,
1674
- revalidation: props.revalidation,
1675
- error: props.error
1676
- };
1677
- }
1678
- static getDerivedStateFromError(error) {
1679
- return { error };
1680
- }
1681
- static getDerivedStateFromProps(props, state) {
1682
- if (state.location !== props.location || state.revalidation !== "idle" && props.revalidation === "idle") {
1683
- return {
1684
- error: props.error,
1685
- location: props.location,
1686
- revalidation: props.revalidation
1687
- };
1688
- }
1689
- return {
1690
- error: props.error !== void 0 ? props.error : state.error,
1691
- location: state.location,
1692
- revalidation: props.revalidation || state.revalidation
1693
- };
1694
- }
1695
- componentDidCatch(error, errorInfo) {
1696
- console.error(
1697
- "React Router caught the following error during render",
1698
- error,
1699
- errorInfo
1700
- );
1701
- }
1702
- render() {
1703
- return this.state.error !== void 0 ? /* @__PURE__ */ React.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ React.createElement(
1704
- RouteErrorContext.Provider,
1705
- {
1706
- value: this.state.error,
1707
- children: this.props.component
1708
- }
1709
- )) : this.props.children;
1710
- }
1711
- };
1712
- function RenderedRoute({ routeContext, match, children }) {
1713
- let dataRouterContext = React.useContext(DataRouterContext);
1714
- if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {
1715
- dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;
1716
- }
1717
- return /* @__PURE__ */ React.createElement(RouteContext.Provider, { value: routeContext }, children);
1718
- }
1719
- function _renderMatches(matches, parentMatches = [], dataRouterState = null, future = null) {
1720
- if (matches == null) {
1721
- if (!dataRouterState) {
1722
- return null;
1723
- }
1724
- if (dataRouterState.errors) {
1725
- matches = dataRouterState.matches;
1726
- } else if (parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {
1727
- matches = dataRouterState.matches;
1728
- } else {
1729
- return null;
1730
- }
1731
- }
1732
- let renderedMatches = matches;
1733
- let errors = dataRouterState?.errors;
1734
- if (errors != null) {
1735
- let errorIndex = renderedMatches.findIndex(
1736
- (m) => m.route.id && errors?.[m.route.id] !== void 0
1737
- );
1738
- invariant(
1739
- errorIndex >= 0,
1740
- `Could not find a matching route for errors on route IDs: ${Object.keys(
1741
- errors
1742
- ).join(",")}`
1743
- );
1744
- renderedMatches = renderedMatches.slice(
1745
- 0,
1746
- Math.min(renderedMatches.length, errorIndex + 1)
1747
- );
1748
- }
1749
- let renderFallback = false;
1750
- let fallbackIndex = -1;
1751
- if (dataRouterState) {
1752
- for (let i = 0; i < renderedMatches.length; i++) {
1753
- let match = renderedMatches[i];
1754
- if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {
1755
- fallbackIndex = i;
1756
- }
1757
- if (match.route.id) {
1758
- let { loaderData, errors: errors2 } = dataRouterState;
1759
- let needsToRunLoader = match.route.loader && !loaderData.hasOwnProperty(match.route.id) && (!errors2 || errors2[match.route.id] === void 0);
1760
- if (match.route.lazy || needsToRunLoader) {
1761
- renderFallback = true;
1762
- if (fallbackIndex >= 0) {
1763
- renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
1764
- } else {
1765
- renderedMatches = [renderedMatches[0]];
1766
- }
1767
- break;
1768
- }
1769
- }
1770
- }
1771
- }
1772
- return renderedMatches.reduceRight((outlet, match, index) => {
1773
- let error;
1774
- let shouldRenderHydrateFallback = false;
1775
- let errorElement = null;
1776
- let hydrateFallbackElement = null;
1777
- if (dataRouterState) {
1778
- error = errors && match.route.id ? errors[match.route.id] : void 0;
1779
- errorElement = match.route.errorElement || defaultErrorElement;
1780
- if (renderFallback) {
1781
- if (fallbackIndex < 0 && index === 0) {
1782
- warningOnce(
1783
- "route-fallback",
1784
- false,
1785
- "No `HydrateFallback` element provided to render during initial hydration"
1786
- );
1787
- shouldRenderHydrateFallback = true;
1788
- hydrateFallbackElement = null;
1789
- } else if (fallbackIndex === index) {
1790
- shouldRenderHydrateFallback = true;
1791
- hydrateFallbackElement = match.route.hydrateFallbackElement || null;
1792
- }
1793
- }
1794
- }
1795
- let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
1796
- let getChildren = () => {
1797
- let children;
1798
- if (error) {
1799
- children = errorElement;
1800
- } else if (shouldRenderHydrateFallback) {
1801
- children = hydrateFallbackElement;
1802
- } else if (match.route.Component) {
1803
- children = /* @__PURE__ */ React.createElement(match.route.Component, null);
1804
- } else if (match.route.element) {
1805
- children = match.route.element;
1806
- } else {
1807
- children = outlet;
1808
- }
1809
- return /* @__PURE__ */ React.createElement(
1810
- RenderedRoute,
1811
- {
1812
- match,
1813
- routeContext: {
1814
- outlet,
1815
- matches: matches2,
1816
- isDataRoute: dataRouterState != null
1817
- },
1818
- children
1819
- }
1820
- );
1821
- };
1822
- return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React.createElement(
1823
- RenderErrorBoundary,
1824
- {
1825
- location: dataRouterState.location,
1826
- revalidation: dataRouterState.revalidation,
1827
- component: errorElement,
1828
- error,
1829
- children: getChildren(),
1830
- routeContext: { outlet: null, matches: matches2, isDataRoute: true }
1831
- }
1832
- ) : getChildren();
1833
- }, null);
1834
- }
1835
- function getDataRouterConsoleError(hookName) {
1836
- return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
1837
- }
1838
- function useDataRouterContext(hookName) {
1839
- let ctx = React.useContext(DataRouterContext);
1840
- invariant(ctx, getDataRouterConsoleError(hookName));
1841
- return ctx;
1842
- }
1843
- function useDataRouterState(hookName) {
1844
- let state = React.useContext(DataRouterStateContext);
1845
- invariant(state, getDataRouterConsoleError(hookName));
1846
- return state;
1847
- }
1848
- function useRouteContext(hookName) {
1849
- let route = React.useContext(RouteContext);
1850
- invariant(route, getDataRouterConsoleError(hookName));
1851
- return route;
1852
- }
1853
- function useCurrentRouteId(hookName) {
1854
- let route = useRouteContext(hookName);
1855
- let thisRoute = route.matches[route.matches.length - 1];
1856
- invariant(
1857
- thisRoute.route.id,
1858
- `${hookName} can only be used on routes that contain a unique "id"`
1859
- );
1860
- return thisRoute.route.id;
1861
- }
1862
- function useRouteId() {
1863
- return useCurrentRouteId("useRouteId" /* UseRouteId */);
1864
- }
1865
- function useRouteError() {
1866
- let error = React.useContext(RouteErrorContext);
1867
- let state = useDataRouterState("useRouteError" /* UseRouteError */);
1868
- let routeId = useCurrentRouteId("useRouteError" /* UseRouteError */);
1869
- if (error !== void 0) {
1870
- return error;
1871
- }
1872
- return state.errors?.[routeId];
1873
- }
1874
- function useNavigateStable() {
1875
- let { router } = useDataRouterContext("useNavigate" /* UseNavigateStable */);
1876
- let id = useCurrentRouteId("useNavigate" /* UseNavigateStable */);
1877
- let activeRef = React.useRef(false);
1878
- useIsomorphicLayoutEffect(() => {
1879
- activeRef.current = true;
1880
- });
1881
- let navigate = React.useCallback(
1882
- async (to, options = {}) => {
1883
- warning(activeRef.current, navigateEffectWarning);
1884
- if (!activeRef.current) return;
1885
- if (typeof to === "number") {
1886
- router.navigate(to);
1887
- } else {
1888
- await router.navigate(to, { fromRouteId: id, ...options });
1889
- }
1890
- },
1891
- [router, id]
1892
- );
1893
- return navigate;
1894
- }
1895
- var alreadyWarned = {};
1896
- function warningOnce(key, cond, message) {
1897
- if (!cond && !alreadyWarned[key]) {
1898
- alreadyWarned[key] = true;
1899
- warning(false, message);
1900
- }
1901
- }
1902
- React.memo(DataRoutes);
1903
- function DataRoutes({
1904
- routes,
1905
- future,
1906
- state
1907
- }) {
1908
- return useRoutesImpl(routes, void 0, state, future);
1909
- }
1910
-
1911
- // lib/dom/dom.ts
1912
- var defaultMethod = "get";
1913
- var defaultEncType = "application/x-www-form-urlencoded";
1914
- function isHtmlElement(object) {
1915
- return object != null && typeof object.tagName === "string";
1916
- }
1917
- function isButtonElement(object) {
1918
- return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
1919
- }
1920
- function isFormElement(object) {
1921
- return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
1922
- }
1923
- function isInputElement(object) {
1924
- return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
1925
- }
1926
- function isModifiedEvent(event) {
1927
- return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
1928
- }
1929
- function shouldProcessLinkClick(event, target) {
1930
- return event.button === 0 && // Ignore everything but left clicks
1931
- (!target || target === "_self") && // Let browser handle "target=_blank" etc.
1932
- !isModifiedEvent(event);
1933
- }
1934
- var _formDataSupportsSubmitter = null;
1935
- function isFormDataSubmitterSupported() {
1936
- if (_formDataSupportsSubmitter === null) {
1937
- try {
1938
- new FormData(
1939
- document.createElement("form"),
1940
- // @ts-expect-error if FormData supports the submitter parameter, this will throw
1941
- 0
1942
- );
1943
- _formDataSupportsSubmitter = false;
1944
- } catch (e) {
1945
- _formDataSupportsSubmitter = true;
1946
- }
1947
- }
1948
- return _formDataSupportsSubmitter;
1949
- }
1950
- var supportedFormEncTypes = /* @__PURE__ */ new Set([
1951
- "application/x-www-form-urlencoded",
1952
- "multipart/form-data",
1953
- "text/plain"
1954
- ]);
1955
- function getFormEncType(encType) {
1956
- if (encType != null && !supportedFormEncTypes.has(encType)) {
1957
- warning(
1958
- false,
1959
- `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
1960
- );
1961
- return null;
1962
- }
1963
- return encType;
1964
- }
1965
- function getFormSubmissionInfo(target, basename) {
1966
- let method;
1967
- let action;
1968
- let encType;
1969
- let formData;
1970
- let body;
1971
- if (isFormElement(target)) {
1972
- let attr = target.getAttribute("action");
1973
- action = attr ? stripBasename(attr, basename) : null;
1974
- method = target.getAttribute("method") || defaultMethod;
1975
- encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
1976
- formData = new FormData(target);
1977
- } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
1978
- let form = target.form;
1979
- if (form == null) {
1980
- throw new Error(
1981
- `Cannot submit a <button> or <input type="submit"> without a <form>`
1982
- );
1983
- }
1984
- let attr = target.getAttribute("formaction") || form.getAttribute("action");
1985
- action = attr ? stripBasename(attr, basename) : null;
1986
- method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
1987
- encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
1988
- formData = new FormData(form, target);
1989
- if (!isFormDataSubmitterSupported()) {
1990
- let { name, type, value } = target;
1991
- if (type === "image") {
1992
- let prefix = name ? `${name}.` : "";
1993
- formData.append(`${prefix}x`, "0");
1994
- formData.append(`${prefix}y`, "0");
1995
- } else if (name) {
1996
- formData.append(name, value);
1997
- }
1998
- }
1999
- } else if (isHtmlElement(target)) {
2000
- throw new Error(
2001
- `Cannot submit element that is not <form>, <button>, or <input type="submit|image">`
2002
- );
2003
- } else {
2004
- method = defaultMethod;
2005
- action = null;
2006
- encType = defaultEncType;
2007
- body = target;
2008
- }
2009
- if (formData && encType === "text/plain") {
2010
- body = formData;
2011
- formData = void 0;
2012
- }
2013
- return { action, method: method.toLowerCase(), encType, formData, body };
2014
- }
2015
-
2016
- // lib/dom/ssr/invariant.ts
2017
- function invariant2(value, message) {
2018
- if (value === false || value === null || typeof value === "undefined") {
2019
- throw new Error(message);
2020
- }
2021
- }
2022
-
2023
- // lib/dom/ssr/routeModules.ts
2024
- async function loadRouteModule(route, routeModulesCache) {
2025
- if (route.id in routeModulesCache) {
2026
- return routeModulesCache[route.id];
2027
- }
2028
- try {
2029
- let routeModule = await import(
2030
- /* @vite-ignore */
2031
- /* webpackIgnore: true */
2032
- route.module
2033
- );
2034
- routeModulesCache[route.id] = routeModule;
2035
- return routeModule;
2036
- } catch (error) {
2037
- console.error(
2038
- `Error loading route module \`${route.module}\`, reloading page...`
2039
- );
2040
- console.error(error);
2041
- if (window.__reactRouterContext && window.__reactRouterContext.isSpaMode && // @ts-expect-error
2042
- import.meta.hot) {
2043
- throw error;
2044
- }
2045
- window.location.reload();
2046
- return new Promise(() => {
2047
- });
2048
- }
2049
- }
2050
- function isHtmlLinkDescriptor(object) {
2051
- if (object == null) {
2052
- return false;
2053
- }
2054
- if (object.href == null) {
2055
- return object.rel === "preload" && typeof object.imageSrcSet === "string" && typeof object.imageSizes === "string";
2056
- }
2057
- return typeof object.rel === "string" && typeof object.href === "string";
2058
- }
2059
- async function getKeyedPrefetchLinks(matches, manifest, routeModules) {
2060
- let links = await Promise.all(
2061
- matches.map(async (match) => {
2062
- let route = manifest.routes[match.route.id];
2063
- if (route) {
2064
- let mod = await loadRouteModule(route, routeModules);
2065
- return mod.links ? mod.links() : [];
2066
- }
2067
- return [];
2068
- })
2069
- );
2070
- return dedupeLinkDescriptors(
2071
- links.flat(1).filter(isHtmlLinkDescriptor).filter((link) => link.rel === "stylesheet" || link.rel === "preload").map(
2072
- (link) => link.rel === "stylesheet" ? { ...link, rel: "prefetch", as: "style" } : { ...link, rel: "prefetch" }
2073
- )
2074
- );
2075
- }
2076
- function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, location, mode) {
2077
- let isNew = (match, index) => {
2078
- if (!currentMatches[index]) return true;
2079
- return match.route.id !== currentMatches[index].route.id;
2080
- };
2081
- let matchPathChanged = (match, index) => {
2082
- return (
2083
- // param change, /users/123 -> /users/456
2084
- currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
2085
- // e.g. /files/images/avatar.jpg -> files/finances.xls
2086
- currentMatches[index].route.path?.endsWith("*") && currentMatches[index].params["*"] !== match.params["*"]
2087
- );
2088
- };
2089
- if (mode === "assets") {
2090
- return nextMatches.filter(
2091
- (match, index) => isNew(match, index) || matchPathChanged(match, index)
2092
- );
2093
- }
2094
- if (mode === "data") {
2095
- return nextMatches.filter((match, index) => {
2096
- let manifestRoute = manifest.routes[match.route.id];
2097
- if (!manifestRoute || !manifestRoute.hasLoader) {
2098
- return false;
2099
- }
2100
- if (isNew(match, index) || matchPathChanged(match, index)) {
2101
- return true;
2102
- }
2103
- if (match.route.shouldRevalidate) {
2104
- let routeChoice = match.route.shouldRevalidate({
2105
- currentUrl: new URL(
2106
- location.pathname + location.search + location.hash,
2107
- window.origin
2108
- ),
2109
- currentParams: currentMatches[0]?.params || {},
2110
- nextUrl: new URL(page, window.origin),
2111
- nextParams: match.params,
2112
- defaultShouldRevalidate: true
2113
- });
2114
- if (typeof routeChoice === "boolean") {
2115
- return routeChoice;
2116
- }
2117
- }
2118
- return true;
2119
- });
2120
- }
2121
- return [];
2122
- }
2123
- function getModuleLinkHrefs(matches, manifest, { includeHydrateFallback } = {}) {
2124
- return dedupeHrefs(
2125
- matches.map((match) => {
2126
- let route = manifest.routes[match.route.id];
2127
- if (!route) return [];
2128
- let hrefs = [route.module];
2129
- if (route.clientActionModule) {
2130
- hrefs = hrefs.concat(route.clientActionModule);
2131
- }
2132
- if (route.clientLoaderModule) {
2133
- hrefs = hrefs.concat(route.clientLoaderModule);
2134
- }
2135
- if (includeHydrateFallback && route.hydrateFallbackModule) {
2136
- hrefs = hrefs.concat(route.hydrateFallbackModule);
2137
- }
2138
- if (route.imports) {
2139
- hrefs = hrefs.concat(route.imports);
2140
- }
2141
- return hrefs;
2142
- }).flat(1)
2143
- );
2144
- }
2145
- function dedupeHrefs(hrefs) {
2146
- return [...new Set(hrefs)];
2147
- }
2148
- function sortKeys(obj) {
2149
- let sorted = {};
2150
- let keys = Object.keys(obj).sort();
2151
- for (let key of keys) {
2152
- sorted[key] = obj[key];
2153
- }
2154
- return sorted;
2155
- }
2156
- function dedupeLinkDescriptors(descriptors, preloads) {
2157
- let set = /* @__PURE__ */ new Set();
2158
- new Set(preloads);
2159
- return descriptors.reduce((deduped, descriptor) => {
2160
- let key = JSON.stringify(sortKeys(descriptor));
2161
- if (!set.has(key)) {
2162
- set.add(key);
2163
- deduped.push({ key, link: descriptor });
2164
- }
2165
- return deduped;
2166
- }, []);
2167
- }
2168
- function singleFetchUrl(reqUrl, basename) {
2169
- let url = typeof reqUrl === "string" ? new URL(
2170
- reqUrl,
2171
- // This can be called during the SSR flow via PrefetchPageLinksImpl so
2172
- // don't assume window is available
2173
- typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
2174
- ) : reqUrl;
2175
- if (url.pathname === "/") {
2176
- url.pathname = "_root.data";
2177
- } else if (basename && stripBasename(url.pathname, basename) === "/") {
2178
- url.pathname = `${basename.replace(/\/$/, "")}/_root.data`;
2179
- } else {
2180
- url.pathname = `${url.pathname.replace(/\/$/, "")}.data`;
2181
- }
2182
- return url;
2183
- }
2184
-
2185
- // lib/dom/ssr/components.tsx
2186
- function useDataRouterContext2() {
2187
- let context = React.useContext(DataRouterContext);
2188
- invariant2(
2189
- context,
2190
- "You must render this element inside a <DataRouterContext.Provider> element"
2191
- );
2192
- return context;
2193
- }
2194
- function useDataRouterStateContext() {
2195
- let context = React.useContext(DataRouterStateContext);
2196
- invariant2(
2197
- context,
2198
- "You must render this element inside a <DataRouterStateContext.Provider> element"
2199
- );
2200
- return context;
2201
- }
2202
- var FrameworkContext = React.createContext(void 0);
2203
- FrameworkContext.displayName = "FrameworkContext";
2204
- function useFrameworkContext() {
2205
- let context = React.useContext(FrameworkContext);
2206
- invariant2(
2207
- context,
2208
- "You must render this element inside a <HydratedRouter> element"
2209
- );
2210
- return context;
2211
- }
2212
- function usePrefetchBehavior(prefetch, theirElementProps) {
2213
- let frameworkContext = React.useContext(FrameworkContext);
2214
- let [maybePrefetch, setMaybePrefetch] = React.useState(false);
2215
- let [shouldPrefetch, setShouldPrefetch] = React.useState(false);
2216
- let { onFocus, onBlur, onMouseEnter, onMouseLeave, onTouchStart } = theirElementProps;
2217
- let ref = React.useRef(null);
2218
- React.useEffect(() => {
2219
- if (prefetch === "render") {
2220
- setShouldPrefetch(true);
2221
- }
2222
- if (prefetch === "viewport") {
2223
- let callback = (entries) => {
2224
- entries.forEach((entry) => {
2225
- setShouldPrefetch(entry.isIntersecting);
2226
- });
2227
- };
2228
- let observer = new IntersectionObserver(callback, { threshold: 0.5 });
2229
- if (ref.current) observer.observe(ref.current);
2230
- return () => {
2231
- observer.disconnect();
2232
- };
2233
- }
2234
- }, [prefetch]);
2235
- React.useEffect(() => {
2236
- if (maybePrefetch) {
2237
- let id = setTimeout(() => {
2238
- setShouldPrefetch(true);
2239
- }, 100);
2240
- return () => {
2241
- clearTimeout(id);
2242
- };
2243
- }
2244
- }, [maybePrefetch]);
2245
- let setIntent = () => {
2246
- setMaybePrefetch(true);
2247
- };
2248
- let cancelIntent = () => {
2249
- setMaybePrefetch(false);
2250
- setShouldPrefetch(false);
2251
- };
2252
- if (!frameworkContext) {
2253
- return [false, ref, {}];
2254
- }
2255
- if (prefetch !== "intent") {
2256
- return [shouldPrefetch, ref, {}];
2257
- }
2258
- return [
2259
- shouldPrefetch,
2260
- ref,
2261
- {
2262
- onFocus: composeEventHandlers(onFocus, setIntent),
2263
- onBlur: composeEventHandlers(onBlur, cancelIntent),
2264
- onMouseEnter: composeEventHandlers(onMouseEnter, setIntent),
2265
- onMouseLeave: composeEventHandlers(onMouseLeave, cancelIntent),
2266
- onTouchStart: composeEventHandlers(onTouchStart, setIntent)
2267
- }
2268
- ];
2269
- }
2270
- function composeEventHandlers(theirHandler, ourHandler) {
2271
- return (event) => {
2272
- theirHandler && theirHandler(event);
2273
- if (!event.defaultPrevented) {
2274
- ourHandler(event);
2275
- }
2276
- };
2277
- }
2278
- function PrefetchPageLinks({
2279
- page,
2280
- ...dataLinkProps
2281
- }) {
2282
- let { router } = useDataRouterContext2();
2283
- let matches = React.useMemo(
2284
- () => matchRoutes(router.routes, page, router.basename),
2285
- [router.routes, page, router.basename]
2286
- );
2287
- if (!matches) {
2288
- return null;
2289
- }
2290
- return /* @__PURE__ */ React.createElement(PrefetchPageLinksImpl, { page, matches, ...dataLinkProps });
2291
- }
2292
- function useKeyedPrefetchLinks(matches) {
2293
- let { manifest, routeModules } = useFrameworkContext();
2294
- let [keyedPrefetchLinks, setKeyedPrefetchLinks] = React.useState([]);
2295
- React.useEffect(() => {
2296
- let interrupted = false;
2297
- void getKeyedPrefetchLinks(matches, manifest, routeModules).then(
2298
- (links) => {
2299
- if (!interrupted) {
2300
- setKeyedPrefetchLinks(links);
2301
- }
2302
- }
2303
- );
2304
- return () => {
2305
- interrupted = true;
2306
- };
2307
- }, [matches, manifest, routeModules]);
2308
- return keyedPrefetchLinks;
2309
- }
2310
- function PrefetchPageLinksImpl({
2311
- page,
2312
- matches: nextMatches,
2313
- ...linkProps
2314
- }) {
2315
- let location = useLocation();
2316
- let { manifest, routeModules } = useFrameworkContext();
2317
- let { basename } = useDataRouterContext2();
2318
- let { loaderData, matches } = useDataRouterStateContext();
2319
- let newMatchesForData = React.useMemo(
2320
- () => getNewMatchesForLinks(
2321
- page,
2322
- nextMatches,
2323
- matches,
2324
- manifest,
2325
- location,
2326
- "data"
2327
- ),
2328
- [page, nextMatches, matches, manifest, location]
2329
- );
2330
- let newMatchesForAssets = React.useMemo(
2331
- () => getNewMatchesForLinks(
2332
- page,
2333
- nextMatches,
2334
- matches,
2335
- manifest,
2336
- location,
2337
- "assets"
2338
- ),
2339
- [page, nextMatches, matches, manifest, location]
2340
- );
2341
- let dataHrefs = React.useMemo(() => {
2342
- if (page === location.pathname + location.search + location.hash) {
2343
- return [];
2344
- }
2345
- let routesParams = /* @__PURE__ */ new Set();
2346
- let foundOptOutRoute = false;
2347
- nextMatches.forEach((m) => {
2348
- let manifestRoute = manifest.routes[m.route.id];
2349
- if (!manifestRoute || !manifestRoute.hasLoader) {
2350
- return;
2351
- }
2352
- if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && routeModules[m.route.id]?.shouldRevalidate) {
2353
- foundOptOutRoute = true;
2354
- } else if (manifestRoute.hasClientLoader) {
2355
- foundOptOutRoute = true;
2356
- } else {
2357
- routesParams.add(m.route.id);
2358
- }
2359
- });
2360
- if (routesParams.size === 0) {
2361
- return [];
2362
- }
2363
- let url = singleFetchUrl(page, basename);
2364
- if (foundOptOutRoute && routesParams.size > 0) {
2365
- url.searchParams.set(
2366
- "_routes",
2367
- nextMatches.filter((m) => routesParams.has(m.route.id)).map((m) => m.route.id).join(",")
2368
- );
2369
- }
2370
- return [url.pathname + url.search];
2371
- }, [
2372
- basename,
2373
- loaderData,
2374
- location,
2375
- manifest,
2376
- newMatchesForData,
2377
- nextMatches,
2378
- page,
2379
- routeModules
2380
- ]);
2381
- let moduleHrefs = React.useMemo(
2382
- () => getModuleLinkHrefs(newMatchesForAssets, manifest),
2383
- [newMatchesForAssets, manifest]
2384
- );
2385
- let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
2386
- return /* @__PURE__ */ React.createElement(React.Fragment, null, dataHrefs.map((href2) => /* @__PURE__ */ React.createElement("link", { key: href2, rel: "prefetch", as: "fetch", href: href2, ...linkProps })), moduleHrefs.map((href2) => /* @__PURE__ */ React.createElement("link", { key: href2, rel: "modulepreload", href: href2, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
2387
- // these don't spread `linkProps` because they are full link descriptors
2388
- // already with their own props
2389
- /* @__PURE__ */ React.createElement("link", { key, ...link })
2390
- )));
2391
- }
2392
- function mergeRefs(...refs) {
2393
- return (value) => {
2394
- refs.forEach((ref) => {
2395
- if (typeof ref === "function") {
2396
- ref(value);
2397
- } else if (ref != null) {
2398
- ref.current = value;
2399
- }
2400
- });
2401
- };
2402
- }
2403
-
2404
- // lib/dom/lib.tsx
2405
- var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
2406
- try {
2407
- if (isBrowser) {
2408
- window.__reactRouterVersion = "7.3.0";
2409
- }
2410
- } catch (e) {
2411
- }
2412
- var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
2413
- var Link = React.forwardRef(
2414
- function LinkWithRef({
2415
- onClick,
2416
- discover = "render",
2417
- prefetch = "none",
2418
- relative,
2419
- reloadDocument,
2420
- replace: replace2,
2421
- state,
2422
- target,
2423
- to,
2424
- preventScrollReset,
2425
- viewTransition,
2426
- ...rest
2427
- }, forwardedRef) {
2428
- let { basename } = React.useContext(NavigationContext);
2429
- let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX2.test(to);
2430
- let absoluteHref;
2431
- let isExternal = false;
2432
- if (typeof to === "string" && isAbsolute) {
2433
- absoluteHref = to;
2434
- if (isBrowser) {
2435
- try {
2436
- let currentUrl = new URL(window.location.href);
2437
- let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
2438
- let path = stripBasename(targetUrl.pathname, basename);
2439
- if (targetUrl.origin === currentUrl.origin && path != null) {
2440
- to = path + targetUrl.search + targetUrl.hash;
2441
- } else {
2442
- isExternal = true;
2443
- }
2444
- } catch (e) {
2445
- warning(
2446
- false,
2447
- `<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
2448
- );
2449
- }
2450
- }
2451
- }
2452
- let href2 = useHref(to, { relative });
2453
- let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
2454
- prefetch,
2455
- rest
2456
- );
2457
- let internalOnClick = useLinkClickHandler(to, {
2458
- replace: replace2,
2459
- state,
2460
- target,
2461
- preventScrollReset,
2462
- relative,
2463
- viewTransition
2464
- });
2465
- function handleClick(event) {
2466
- if (onClick) onClick(event);
2467
- if (!event.defaultPrevented) {
2468
- internalOnClick(event);
2469
- }
2470
- }
2471
- let link = (
2472
- // eslint-disable-next-line jsx-a11y/anchor-has-content
2473
- /* @__PURE__ */ React.createElement(
2474
- "a",
2475
- {
2476
- ...rest,
2477
- ...prefetchHandlers,
2478
- href: absoluteHref || href2,
2479
- onClick: isExternal || reloadDocument ? onClick : handleClick,
2480
- ref: mergeRefs(forwardedRef, prefetchRef),
2481
- target,
2482
- "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
2483
- }
2484
- )
2485
- );
2486
- return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(PrefetchPageLinks, { page: href2 })) : link;
2487
- }
2488
- );
2489
- Link.displayName = "Link";
2490
- var NavLink = React.forwardRef(
2491
- function NavLinkWithRef({
2492
- "aria-current": ariaCurrentProp = "page",
2493
- caseSensitive = false,
2494
- className: classNameProp = "",
2495
- end = false,
2496
- style: styleProp,
2497
- to,
2498
- viewTransition,
2499
- children,
2500
- ...rest
2501
- }, ref) {
2502
- let path = useResolvedPath(to, { relative: rest.relative });
2503
- let location = useLocation();
2504
- let routerState = React.useContext(DataRouterStateContext);
2505
- let { navigator: navigator2, basename } = React.useContext(NavigationContext);
2506
- let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
2507
- // eslint-disable-next-line react-hooks/rules-of-hooks
2508
- useViewTransitionState(path) && viewTransition === true;
2509
- let toPathname = navigator2.encodeLocation ? navigator2.encodeLocation(path).pathname : path.pathname;
2510
- let locationPathname = location.pathname;
2511
- let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
2512
- if (!caseSensitive) {
2513
- locationPathname = locationPathname.toLowerCase();
2514
- nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
2515
- toPathname = toPathname.toLowerCase();
2516
- }
2517
- if (nextLocationPathname && basename) {
2518
- nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;
2519
- }
2520
- const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
2521
- let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
2522
- let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
2523
- let renderProps = {
2524
- isActive,
2525
- isPending,
2526
- isTransitioning
2527
- };
2528
- let ariaCurrent = isActive ? ariaCurrentProp : void 0;
2529
- let className;
2530
- if (typeof classNameProp === "function") {
2531
- className = classNameProp(renderProps);
2532
- } else {
2533
- className = [
2534
- classNameProp,
2535
- isActive ? "active" : null,
2536
- isPending ? "pending" : null,
2537
- isTransitioning ? "transitioning" : null
2538
- ].filter(Boolean).join(" ");
2539
- }
2540
- let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
2541
- return /* @__PURE__ */ React.createElement(
2542
- Link,
2543
- {
2544
- ...rest,
2545
- "aria-current": ariaCurrent,
2546
- className,
2547
- ref,
2548
- style,
2549
- to,
2550
- viewTransition
2551
- },
2552
- typeof children === "function" ? children(renderProps) : children
2553
- );
2554
- }
2555
- );
2556
- NavLink.displayName = "NavLink";
2557
- var Form = React.forwardRef(
2558
- ({
2559
- discover = "render",
2560
- fetcherKey,
2561
- navigate,
2562
- reloadDocument,
2563
- replace: replace2,
2564
- state,
2565
- method = defaultMethod,
2566
- action,
2567
- onSubmit,
2568
- relative,
2569
- preventScrollReset,
2570
- viewTransition,
2571
- ...props
2572
- }, forwardedRef) => {
2573
- let submit = useSubmit();
2574
- let formAction = useFormAction(action, { relative });
2575
- let formMethod = method.toLowerCase() === "get" ? "get" : "post";
2576
- let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX2.test(action);
2577
- let submitHandler = (event) => {
2578
- onSubmit && onSubmit(event);
2579
- if (event.defaultPrevented) return;
2580
- event.preventDefault();
2581
- let submitter = event.nativeEvent.submitter;
2582
- let submitMethod = submitter?.getAttribute("formmethod") || method;
2583
- submit(submitter || event.currentTarget, {
2584
- fetcherKey,
2585
- method: submitMethod,
2586
- navigate,
2587
- replace: replace2,
2588
- state,
2589
- relative,
2590
- preventScrollReset,
2591
- viewTransition
2592
- });
2593
- };
2594
- return /* @__PURE__ */ React.createElement(
2595
- "form",
2596
- {
2597
- ref: forwardedRef,
2598
- method: formMethod,
2599
- action: formAction,
2600
- onSubmit: reloadDocument ? onSubmit : submitHandler,
2601
- ...props,
2602
- "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
2603
- }
2604
- );
2605
- }
2606
- );
2607
- Form.displayName = "Form";
2608
- function getDataRouterConsoleError2(hookName) {
2609
- return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
2610
- }
2611
- function useDataRouterContext3(hookName) {
2612
- let ctx = React.useContext(DataRouterContext);
2613
- invariant(ctx, getDataRouterConsoleError2(hookName));
2614
- return ctx;
2615
- }
2616
- function useLinkClickHandler(to, {
2617
- target,
2618
- replace: replaceProp,
2619
- state,
2620
- preventScrollReset,
2621
- relative,
2622
- viewTransition
2623
- } = {}) {
2624
- let navigate = useNavigate();
2625
- let location = useLocation();
2626
- let path = useResolvedPath(to, { relative });
2627
- return React.useCallback(
2628
- (event) => {
2629
- if (shouldProcessLinkClick(event, target)) {
2630
- event.preventDefault();
2631
- let replace2 = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
2632
- navigate(to, {
2633
- replace: replace2,
2634
- state,
2635
- preventScrollReset,
2636
- relative,
2637
- viewTransition
2638
- });
2639
- }
2640
- },
2641
- [
2642
- location,
2643
- navigate,
2644
- path,
2645
- replaceProp,
2646
- state,
2647
- target,
2648
- to,
2649
- preventScrollReset,
2650
- relative,
2651
- viewTransition
2652
- ]
2653
- );
2654
- }
2655
- var fetcherId = 0;
2656
- var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
2657
- function useSubmit() {
2658
- let { router } = useDataRouterContext3("useSubmit" /* UseSubmit */);
2659
- let { basename } = React.useContext(NavigationContext);
2660
- let currentRouteId = useRouteId();
2661
- return React.useCallback(
2662
- async (target, options = {}) => {
2663
- let { action, method, encType, formData, body } = getFormSubmissionInfo(
2664
- target,
2665
- basename
2666
- );
2667
- if (options.navigate === false) {
2668
- let key = options.fetcherKey || getUniqueFetcherId();
2669
- await router.fetch(key, currentRouteId, options.action || action, {
2670
- preventScrollReset: options.preventScrollReset,
2671
- formData,
2672
- body,
2673
- formMethod: options.method || method,
2674
- formEncType: options.encType || encType,
2675
- flushSync: options.flushSync
2676
- });
2677
- } else {
2678
- await router.navigate(options.action || action, {
2679
- preventScrollReset: options.preventScrollReset,
2680
- formData,
2681
- body,
2682
- formMethod: options.method || method,
2683
- formEncType: options.encType || encType,
2684
- replace: options.replace,
2685
- state: options.state,
2686
- fromRouteId: currentRouteId,
2687
- flushSync: options.flushSync,
2688
- viewTransition: options.viewTransition
2689
- });
2690
- }
2691
- },
2692
- [router, basename, currentRouteId]
2693
- );
2694
- }
2695
- function useFormAction(action, { relative } = {}) {
2696
- let { basename } = React.useContext(NavigationContext);
2697
- let routeContext = React.useContext(RouteContext);
2698
- invariant(routeContext, "useFormAction must be used inside a RouteContext");
2699
- let [match] = routeContext.matches.slice(-1);
2700
- let path = { ...useResolvedPath(action ? action : ".", { relative }) };
2701
- let location = useLocation();
2702
- if (action == null) {
2703
- path.search = location.search;
2704
- let params = new URLSearchParams(path.search);
2705
- let indexValues = params.getAll("index");
2706
- let hasNakedIndexParam = indexValues.some((v) => v === "");
2707
- if (hasNakedIndexParam) {
2708
- params.delete("index");
2709
- indexValues.filter((v) => v).forEach((v) => params.append("index", v));
2710
- let qs = params.toString();
2711
- path.search = qs ? `?${qs}` : "";
2712
- }
2713
- }
2714
- if ((!action || action === ".") && match.route.index) {
2715
- path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
2716
- }
2717
- if (basename !== "/") {
2718
- path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
2719
- }
2720
- return createPath(path);
2721
- }
2722
- function useViewTransitionState(to, opts = {}) {
2723
- let vtContext = React.useContext(ViewTransitionContext);
2724
- invariant(
2725
- vtContext != null,
2726
- "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
2727
- );
2728
- let { basename } = useDataRouterContext3(
2729
- "useViewTransitionState" /* useViewTransitionState */
2730
- );
2731
- let path = useResolvedPath(to, { relative: opts.relative });
2732
- if (!vtContext.isTransitioning) {
2733
- return false;
2734
- }
2735
- let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
2736
- let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
2737
- return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
2738
- }
2739
-
2740
- // lib/server-runtime/crypto.ts
2741
- new TextEncoder();
2742
-
2743
789
  const SectionHeader = ({
2744
790
  label,
2745
791
  title,
@@ -2750,16 +796,16 @@ const SectionHeader = ({
2750
796
  className,
2751
797
  ...props
2752
798
  }) => {
2753
- return /*#__PURE__*/React__default.createElement("div", _extends({
799
+ return /*#__PURE__*/React.createElement("div", _extends({
2754
800
  className: classnames(['section_header', className])
2755
- }, props), label ? /*#__PURE__*/React__default.createElement(Text, {
801
+ }, props), label ? /*#__PURE__*/React.createElement(Text, {
2756
802
  className: classnames('section_label')
2757
- }, label) : null, /*#__PURE__*/React__default.createElement(Text, {
803
+ }, label) : null, /*#__PURE__*/React.createElement(Text, {
2758
804
  className: "section_title",
2759
805
  component: titleComponent || (promoteTitle ? 'h1' : 'h2')
2760
- }, title), subtitle ? /*#__PURE__*/React__default.createElement(Text, {
806
+ }, title), subtitle ? /*#__PURE__*/React.createElement(Text, {
2761
807
  className: classnames('section_subtitle')
2762
- }, subtitle) : null, actions ? /*#__PURE__*/React__default.createElement("div", {
808
+ }, subtitle) : null, actions ? /*#__PURE__*/React.createElement("div", {
2763
809
  className: "section_actions"
2764
810
  }, actions) : null);
2765
811
  };
@@ -2782,18 +828,18 @@ const Section = ({
2782
828
  children,
2783
829
  ...props
2784
830
  }) => {
2785
- return /*#__PURE__*/React__default.createElement("div", _extends({
831
+ return /*#__PURE__*/React.createElement("div", _extends({
2786
832
  className: classnames(['section', {
2787
833
  [`section-${align}`]: align,
2788
834
  [`section-${color}`]: color,
2789
835
  'section-landing': landing,
2790
836
  'section-header': header
2791
837
  }, className])
2792
- }, props), /*#__PURE__*/React__default.createElement("div", {
838
+ }, props), /*#__PURE__*/React.createElement("div", {
2793
839
  className: 'section_container'
2794
- }, React__default.Children.map(children, child => {
2795
- if (/*#__PURE__*/React__default.isValidElement(child) && child.type === SectionHeader) {
2796
- return /*#__PURE__*/React__default.cloneElement(child, {
840
+ }, React.Children.map(children, child => {
841
+ if (/*#__PURE__*/React.isValidElement(child) && child.type === SectionHeader) {
842
+ return /*#__PURE__*/React.cloneElement(child, {
2797
843
  promoteTitle: landing || header
2798
844
  });
2799
845
  }
@@ -2821,27 +867,27 @@ const NavBar = ({
2821
867
  setIsOpen(!isOpen);
2822
868
  document.body.classList.toggle('js-navbar', !isOpen);
2823
869
  };
2824
- return /*#__PURE__*/React__default.createElement("header", null, /*#__PURE__*/React__default.createElement(Section, _extends({
870
+ return /*#__PURE__*/React.createElement("header", null, /*#__PURE__*/React.createElement(Section, _extends({
2825
871
  className: classnames(['navbar', {
2826
872
  [`navbar-${align}`]: align,
2827
873
  'js-opened': isOpen
2828
874
  }, className])
2829
- }, props), /*#__PURE__*/React__default.createElement("div", {
875
+ }, props), /*#__PURE__*/React.createElement("div", {
2830
876
  className: "navbar_main"
2831
- }, /*#__PURE__*/React__default.createElement("div", {
877
+ }, /*#__PURE__*/React.createElement("div", {
2832
878
  className: "navbar_logo"
2833
- }, logo), /*#__PURE__*/React__default.createElement("button", {
879
+ }, logo), /*#__PURE__*/React.createElement("button", {
2834
880
  "aria-label": "Open mobile menu",
2835
881
  className: classnames('navbar_button', {
2836
882
  'js-opened': isOpen
2837
883
  }),
2838
884
  onClick: toggleNav
2839
- }, /*#__PURE__*/React__default.createElement("span", null))), /*#__PURE__*/React__default.createElement("nav", {
885
+ }, /*#__PURE__*/React.createElement("span", null))), /*#__PURE__*/React.createElement("nav", {
2840
886
  "aria-label": "main-nav",
2841
887
  className: classnames('navbar_nav nav', {
2842
888
  'js-opened': isOpen
2843
889
  })
2844
- }, /*#__PURE__*/React__default.createElement("div", {
890
+ }, /*#__PURE__*/React.createElement("div", {
2845
891
  className: "nav_container"
2846
892
  }, children))));
2847
893
  };
@@ -2870,23 +916,23 @@ const NavItem = ({
2870
916
  if (dropdown) {
2871
917
  Component = 'button';
2872
918
  } else {
2873
- Component = component || Link;
919
+ Component = component || Link$1;
2874
920
  }
2875
- return /*#__PURE__*/React__default.createElement("div", {
921
+ return /*#__PURE__*/React.createElement("div", {
2876
922
  className: classnames(['nav_item', {
2877
923
  'nav_item-dropdown': dropdown,
2878
924
  'js-show': isExpanded
2879
925
  }, className])
2880
- }, /*#__PURE__*/React__default.createElement(Component, _extends({
926
+ }, /*#__PURE__*/React.createElement(Component, _extends({
2881
927
  end: end,
2882
928
  to: to,
2883
929
  className: classnames(['nav_trigger', {
2884
930
  'nav_trigger-active': active
2885
931
  }]),
2886
932
  onClick: onClick
2887
- }, props), icon ? /*#__PURE__*/React__default.createElement("span", {
933
+ }, props), icon ? /*#__PURE__*/React.createElement("span", {
2888
934
  className: classnames('nav_icon')
2889
- }, icon) : null, label), dropdown ? /*#__PURE__*/React__default.createElement("div", {
935
+ }, icon) : null, label), dropdown ? /*#__PURE__*/React.createElement("div", {
2890
936
  ref: dropdownRef,
2891
937
  className: "nav_target"
2892
938
  }, dropdown) : null);
@@ -2912,11 +958,11 @@ const Radio = ({
2912
958
  className,
2913
959
  ...props
2914
960
  }) => {
2915
- return /*#__PURE__*/React__default.createElement("div", {
961
+ return /*#__PURE__*/React.createElement("div", {
2916
962
  className: classnames(['radio', {
2917
963
  'radio-disabled': disabled
2918
964
  }, className])
2919
- }, /*#__PURE__*/React__default.createElement("input", _extends({
965
+ }, /*#__PURE__*/React.createElement("input", _extends({
2920
966
  className: classnames('radio_control'),
2921
967
  type: "radio",
2922
968
  id: id,
@@ -2926,7 +972,7 @@ const Radio = ({
2926
972
  "aria-checked": checked,
2927
973
  disabled: disabled,
2928
974
  required: !(disabled || optional)
2929
- }, props)), /*#__PURE__*/React__default.createElement("label", {
975
+ }, props)), /*#__PURE__*/React.createElement("label", {
2930
976
  className: classnames('radio_label'),
2931
977
  htmlFor: id
2932
978
  }, label));
@@ -2954,7 +1000,7 @@ const RadioButtons = ({
2954
1000
  children,
2955
1001
  className
2956
1002
  }) => {
2957
- return /*#__PURE__*/React__default.createElement("fieldset", _extends({
1003
+ return /*#__PURE__*/React.createElement("fieldset", _extends({
2958
1004
  className: classnames(['input', {
2959
1005
  'js-error': error,
2960
1006
  'input-disabled': disabled,
@@ -2963,16 +1009,16 @@ const RadioButtons = ({
2963
1009
  onChange: onChange
2964
1010
  }, hint || error ? {
2965
1011
  'aria-describedby': [hint ? `${id}-hint` : null, error ? `${id}-error` : null].filter(Boolean).join(' ')
2966
- } : null), /*#__PURE__*/React__default.createElement(InputLabel, {
1012
+ } : null), /*#__PURE__*/React.createElement(InputLabel, {
2967
1013
  isLegend: true,
2968
1014
  label: label,
2969
1015
  hint: hint,
2970
1016
  error: error
2971
- }), /*#__PURE__*/React__default.createElement("div", {
1017
+ }), /*#__PURE__*/React.createElement("div", {
2972
1018
  className: classnames(['input_control', 'radios', {
2973
1019
  [`radios-${direction}`]: direction
2974
1020
  }])
2975
- }, React__default.Children.map(children, child => /*#__PURE__*/React__default.isValidElement(child) ? /*#__PURE__*/React__default.cloneElement(child, {
1021
+ }, React.Children.map(children, child => /*#__PURE__*/React.isValidElement(child) ? /*#__PURE__*/React.cloneElement(child, {
2976
1022
  optional,
2977
1023
  disabled
2978
1024
  }) : child)));
@@ -2996,7 +1042,7 @@ const SectionContent = ({
2996
1042
  children,
2997
1043
  ...props
2998
1044
  }) => {
2999
- return /*#__PURE__*/React__default.createElement("div", _extends({
1045
+ return /*#__PURE__*/React.createElement("div", _extends({
3000
1046
  className: classnames(['section_content', {
3001
1047
  [`section_content-${align}`]: align
3002
1048
  }, className])
@@ -3028,7 +1074,7 @@ const Select = ({
3028
1074
  inputRef.current.focus();
3029
1075
  }
3030
1076
  }, [isFocused]);
3031
- return /*#__PURE__*/React__default.createElement("div", {
1077
+ return /*#__PURE__*/React.createElement("div", {
3032
1078
  className: classnames(['input', 'select', {
3033
1079
  'input-focused': isFocused,
3034
1080
  'js-error': error,
@@ -3037,12 +1083,12 @@ const Select = ({
3037
1083
  'input-dense': dense
3038
1084
  }, className]),
3039
1085
  onChange: onChange
3040
- }, /*#__PURE__*/React__default.createElement(InputLabel, {
1086
+ }, /*#__PURE__*/React.createElement(InputLabel, {
3041
1087
  htmlFor: id,
3042
1088
  label: label,
3043
1089
  hint: hint,
3044
1090
  error: error
3045
- }), /*#__PURE__*/React__default.createElement("select", _extends({
1091
+ }), /*#__PURE__*/React.createElement("select", _extends({
3046
1092
  ref: inputRef,
3047
1093
  className: 'input_control',
3048
1094
  name: id,
@@ -3191,9 +1237,9 @@ const Snippet = ({
3191
1237
  className,
3192
1238
  ...props
3193
1239
  }) => {
3194
- return /*#__PURE__*/React__default.createElement("div", {
1240
+ return /*#__PURE__*/React.createElement("div", {
3195
1241
  className: classnames('snippet_wrapper')
3196
- }, /*#__PURE__*/React__default.createElement(SyntaxHighlighter, _extends({
1242
+ }, /*#__PURE__*/React.createElement(SyntaxHighlighter, _extends({
3197
1243
  language: "javascript",
3198
1244
  style: nnfxDark,
3199
1245
  className: classnames(['snippet', {
@@ -3217,7 +1263,7 @@ const Status = ({
3217
1263
  children = 'Status',
3218
1264
  ...props
3219
1265
  }) => {
3220
- return /*#__PURE__*/React__default.createElement(Text, _extends({
1266
+ return /*#__PURE__*/React.createElement(Text, _extends({
3221
1267
  className: classnames(['status', {
3222
1268
  [`status-${color}`]: color,
3223
1269
  'status-dense': dense
@@ -3239,25 +1285,25 @@ const Switch = ({
3239
1285
  className,
3240
1286
  ...props
3241
1287
  }) => {
3242
- return /*#__PURE__*/React__default.createElement("div", {
1288
+ return /*#__PURE__*/React.createElement("div", {
3243
1289
  className: classnames(['switch', {
3244
1290
  'switch-disabled': disabled
3245
1291
  }, className])
3246
- }, startLabel ? /*#__PURE__*/React__default.createElement(Text, {
1292
+ }, startLabel ? /*#__PURE__*/React.createElement(Text, {
3247
1293
  className: classnames('switch_label'),
3248
1294
  variant: "body"
3249
- }, startLabel) : null, /*#__PURE__*/React__default.createElement("input", _extends({
1295
+ }, startLabel) : null, /*#__PURE__*/React.createElement("input", _extends({
3250
1296
  className: classnames('switch_input'),
3251
1297
  type: "checkbox",
3252
1298
  name: id,
3253
1299
  id: id,
3254
1300
  disabled: disabled
3255
- }, props)), /*#__PURE__*/React__default.createElement("label", {
1301
+ }, props)), /*#__PURE__*/React.createElement("label", {
3256
1302
  className: classnames('switch_switch'),
3257
1303
  htmlFor: id
3258
- }, /*#__PURE__*/React__default.createElement("div", {
1304
+ }, /*#__PURE__*/React.createElement("div", {
3259
1305
  className: classnames('switch_toggle')
3260
- })), endLabel ? /*#__PURE__*/React__default.createElement(Text, {
1306
+ })), endLabel ? /*#__PURE__*/React.createElement(Text, {
3261
1307
  className: classnames('switch_label'),
3262
1308
  variant: "body"
3263
1309
  }, endLabel) : null);
@@ -3279,12 +1325,12 @@ const Tabs = ({
3279
1325
  children
3280
1326
  }) => {
3281
1327
  const [activeIndex, setActiveIndex] = useState(0);
3282
- return /*#__PURE__*/React__default.createElement(TabsContext.Provider, {
1328
+ return /*#__PURE__*/React.createElement(TabsContext.Provider, {
3283
1329
  value: {
3284
1330
  activeIndex,
3285
1331
  setActiveIndex
3286
1332
  }
3287
- }, /*#__PURE__*/React__default.createElement("div", {
1333
+ }, /*#__PURE__*/React.createElement("div", {
3288
1334
  className: classnames(['tabs', {
3289
1335
  [`tabs-${direction}`]: direction,
3290
1336
  'tabs-dense': dense,
@@ -3310,7 +1356,7 @@ const Tab = ({
3310
1356
  setActiveIndex
3311
1357
  } = useContext(TabsContext);
3312
1358
  const isSelected = activeIndex === index;
3313
- return /*#__PURE__*/React__default.createElement("button", {
1359
+ return /*#__PURE__*/React.createElement("button", {
3314
1360
  className: classnames(['tab', {
3315
1361
  'tab-active': isSelected
3316
1362
  }, className]),
@@ -3331,60 +1377,60 @@ const TableFooter = ({
3331
1377
  className,
3332
1378
  ...props
3333
1379
  }) => {
3334
- return /*#__PURE__*/React__default.createElement("div", _extends({
1380
+ return /*#__PURE__*/React.createElement("div", _extends({
3335
1381
  className: classnames(['table_footer', className])
3336
- }, props), /*#__PURE__*/React__default.createElement(Select, {
1382
+ }, props), /*#__PURE__*/React.createElement(Select, {
3337
1383
  dense: true,
3338
1384
  id: "rows",
3339
1385
  className: "table_rowSelect"
3340
- }, /*#__PURE__*/React__default.createElement("option", {
1386
+ }, /*#__PURE__*/React.createElement("option", {
3341
1387
  value: "1"
3342
- }, "10"), /*#__PURE__*/React__default.createElement("option", {
1388
+ }, "10"), /*#__PURE__*/React.createElement("option", {
3343
1389
  value: "2"
3344
- }, "25"), /*#__PURE__*/React__default.createElement("option", {
1390
+ }, "25"), /*#__PURE__*/React.createElement("option", {
3345
1391
  value: "2"
3346
- }, "50"), /*#__PURE__*/React__default.createElement("option", {
1392
+ }, "50"), /*#__PURE__*/React.createElement("option", {
3347
1393
  value: "2"
3348
- }, "100"), /*#__PURE__*/React__default.createElement("option", {
1394
+ }, "100"), /*#__PURE__*/React.createElement("option", {
3349
1395
  value: "2"
3350
- }, "All")), /*#__PURE__*/React__default.createElement(Buttons, {
1396
+ }, "All")), /*#__PURE__*/React.createElement(Buttons, {
3351
1397
  className: "table_pagination"
3352
- }, /*#__PURE__*/React__default.createElement(Button, {
1398
+ }, /*#__PURE__*/React.createElement(Button, {
3353
1399
  kind: "icon",
3354
1400
  variant: "transparent",
3355
1401
  size: "sm"
3356
- }, /*#__PURE__*/React__default.createElement(CaretDoubleLeft, null)), /*#__PURE__*/React__default.createElement(Button, {
1402
+ }, /*#__PURE__*/React.createElement(CaretDoubleLeft, null)), /*#__PURE__*/React.createElement(Button, {
3357
1403
  kind: "icon",
3358
1404
  variant: "transparent",
3359
1405
  size: "sm"
3360
- }, /*#__PURE__*/React__default.createElement(CaretLeft, null)), /*#__PURE__*/React__default.createElement(Button, {
1406
+ }, /*#__PURE__*/React.createElement(CaretLeft, null)), /*#__PURE__*/React.createElement(Button, {
3361
1407
  kind: "icon",
3362
1408
  size: "sm"
3363
- }, "1"), /*#__PURE__*/React__default.createElement(Button, {
1409
+ }, "1"), /*#__PURE__*/React.createElement(Button, {
3364
1410
  kind: "icon",
3365
1411
  variant: "transparent",
3366
1412
  size: "sm"
3367
- }, "2"), /*#__PURE__*/React__default.createElement(Button, {
1413
+ }, "2"), /*#__PURE__*/React.createElement(Button, {
3368
1414
  kind: "icon",
3369
1415
  variant: "transparent",
3370
1416
  size: "sm"
3371
- }, "3"), /*#__PURE__*/React__default.createElement(Button, {
1417
+ }, "3"), /*#__PURE__*/React.createElement(Button, {
3372
1418
  kind: "icon",
3373
1419
  variant: "transparent",
3374
1420
  size: "sm"
3375
- }, "\u2026"), /*#__PURE__*/React__default.createElement(Button, {
1421
+ }, "\u2026"), /*#__PURE__*/React.createElement(Button, {
3376
1422
  kind: "icon",
3377
1423
  variant: "transparent",
3378
1424
  size: "sm"
3379
- }, "8"), /*#__PURE__*/React__default.createElement(Button, {
1425
+ }, "8"), /*#__PURE__*/React.createElement(Button, {
3380
1426
  kind: "icon",
3381
1427
  variant: "transparent",
3382
1428
  size: "sm"
3383
- }, /*#__PURE__*/React__default.createElement(CaretRight, null)), /*#__PURE__*/React__default.createElement(Button, {
1429
+ }, /*#__PURE__*/React.createElement(CaretRight, null)), /*#__PURE__*/React.createElement(Button, {
3384
1430
  kind: "icon",
3385
1431
  variant: "transparent",
3386
1432
  size: "sm"
3387
- }, /*#__PURE__*/React__default.createElement(CaretDoubleRight, null))));
1433
+ }, /*#__PURE__*/React.createElement(CaretDoubleRight, null))));
3388
1434
  };
3389
1435
  TableFooter.propTypes = {
3390
1436
  className: PropTypes.node
@@ -3401,20 +1447,20 @@ const Table = ({
3401
1447
  children,
3402
1448
  ...props
3403
1449
  }) => {
3404
- return /*#__PURE__*/React__default.createElement(DenseContext.Provider, {
1450
+ return /*#__PURE__*/React.createElement(DenseContext.Provider, {
3405
1451
  value: dense
3406
- }, /*#__PURE__*/React__default.createElement("div", {
1452
+ }, /*#__PURE__*/React.createElement("div", {
3407
1453
  className: classnames(['table', {
3408
1454
  'table-striped': striped,
3409
1455
  'table-hasHover': hasHover,
3410
1456
  'table-dense': dense,
3411
1457
  'table-border': border
3412
1458
  }, className])
3413
- }, /*#__PURE__*/React__default.createElement("table", _extends({
1459
+ }, /*#__PURE__*/React.createElement("table", _extends({
3414
1460
  cellPadding: 0,
3415
1461
  cellSpacing: 0,
3416
1462
  className: classnames('table_content')
3417
- }, props), children), withFooter ? /*#__PURE__*/React__default.createElement(TableFooter, {
1463
+ }, props), children), withFooter ? /*#__PURE__*/React.createElement(TableFooter, {
3418
1464
  dense: dense ? dense : null
3419
1465
  }) : null));
3420
1466
  };
@@ -3433,7 +1479,7 @@ const TableBody = ({
3433
1479
  children,
3434
1480
  ...props
3435
1481
  }) => {
3436
- return /*#__PURE__*/React__default.createElement("tbody", _extends({
1482
+ return /*#__PURE__*/React.createElement("tbody", _extends({
3437
1483
  className: classnames(['table_body', className])
3438
1484
  }, props), children);
3439
1485
  };
@@ -3448,9 +1494,9 @@ const TableHead = ({
3448
1494
  children,
3449
1495
  ...props
3450
1496
  }) => {
3451
- return /*#__PURE__*/React__default.createElement(TableCellComponentContext.Provider, {
1497
+ return /*#__PURE__*/React.createElement(TableCellComponentContext.Provider, {
3452
1498
  value: "th"
3453
- }, /*#__PURE__*/React__default.createElement("thead", _extends({
1499
+ }, /*#__PURE__*/React.createElement("thead", _extends({
3454
1500
  className: classnames(['table_head', className])
3455
1501
  }, props), children));
3456
1502
  };
@@ -3467,7 +1513,7 @@ const TableCell = ({
3467
1513
  }) => {
3468
1514
  const useTableCellComponent = () => useContext(TableCellComponentContext);
3469
1515
  const Component = useTableCellComponent();
3470
- return /*#__PURE__*/React__default.createElement(Component, _extends({
1516
+ return /*#__PURE__*/React.createElement(Component, _extends({
3471
1517
  className: classnames(['table_cell', {
3472
1518
  [`table_cell-${kind}`]: kind
3473
1519
  }, className])
@@ -3484,7 +1530,7 @@ const TableRow = ({
3484
1530
  children,
3485
1531
  ...props
3486
1532
  }) => {
3487
- return /*#__PURE__*/React__default.createElement("tr", _extends({
1533
+ return /*#__PURE__*/React.createElement("tr", _extends({
3488
1534
  className: classnames(['table_row', className])
3489
1535
  }, props), children);
3490
1536
  };
@@ -3497,7 +1543,7 @@ const TabsControl = ({
3497
1543
  className,
3498
1544
  children
3499
1545
  }) => {
3500
- return /*#__PURE__*/React__default.createElement("div", {
1546
+ return /*#__PURE__*/React.createElement("div", {
3501
1547
  role: "tablist",
3502
1548
  className: classnames(['tabs_controls', className])
3503
1549
  }, children);
@@ -3516,7 +1562,7 @@ const TabsPanel = ({
3516
1562
  activeIndex
3517
1563
  } = useContext(TabsContext);
3518
1564
  const isActive = activeIndex === index;
3519
- return isActive ? /*#__PURE__*/React__default.createElement("div", {
1565
+ return isActive ? /*#__PURE__*/React.createElement("div", {
3520
1566
  className: classnames(['tabs_panel', className]),
3521
1567
  role: "tabpanel",
3522
1568
  id: `tabpanel-${index}`,
@@ -3536,7 +1582,7 @@ const Tag = ({
3536
1582
  children = 'Tag',
3537
1583
  ...props
3538
1584
  }) => {
3539
- return /*#__PURE__*/React__default.createElement(Text, _extends({
1585
+ return /*#__PURE__*/React.createElement(Text, _extends({
3540
1586
  className: classnames(['tag', {
3541
1587
  [`tag-${color}`]: color,
3542
1588
  'tag-dense': dense
@@ -3569,19 +1615,19 @@ const Textarea = ({
3569
1615
  inputRef.current.focus();
3570
1616
  }
3571
1617
  }, [isFocused]);
3572
- return /*#__PURE__*/React__default.createElement("div", {
1618
+ return /*#__PURE__*/React.createElement("div", {
3573
1619
  className: classnames(['input', {
3574
1620
  'js-error': error,
3575
1621
  'input-disabled': disabled,
3576
1622
  'input-optional': optional
3577
1623
  }, className]),
3578
1624
  onChange: onChange
3579
- }, /*#__PURE__*/React__default.createElement(InputLabel, {
1625
+ }, /*#__PURE__*/React.createElement(InputLabel, {
3580
1626
  htmlFor: id,
3581
1627
  label: label,
3582
1628
  hint: hint,
3583
1629
  error: error
3584
- }), /*#__PURE__*/React__default.createElement("textarea", _extends({
1630
+ }), /*#__PURE__*/React.createElement("textarea", _extends({
3585
1631
  ref: inputRef,
3586
1632
  className: 'input_control',
3587
1633
  name: id,
@@ -3607,4 +1653,4 @@ Textarea.propTypes = {
3607
1653
  className: PropTypes.node
3608
1654
  };
3609
1655
 
3610
- export { Alert, Breadcrumbs, Button, Buttons, Card, CardActions, CardContent, CardHeader, CardMedia, Checkbox, Checkboxes, Color, Display, Divider, Grid, Input, InputLabel, Link$1 as Link, List, ListItem, Nav, NavBar, NavItem, Radio, RadioButtons, Section, SectionContent, SectionHeader, Select, Snippet, Status, Switch, Tab, Table, TableBody, TableCell, TableFooter, TableHead, TableRow, Tabs, TabsControl, TabsPanel, Tag, Text, Textarea };
1656
+ export { Alert, Breadcrumbs, Button, Buttons, Card, CardActions, CardContent, CardHeader, CardMedia, Checkbox, Checkboxes, Color, Display, Divider, Grid, Input, InputLabel, Link, List, ListItem, Nav, NavBar, NavItem, Radio, RadioButtons, Section, SectionContent, SectionHeader, Select, Snippet, Status, Switch, Tab, Table, TableBody, TableCell, TableFooter, TableHead, TableRow, Tabs, TabsControl, TabsPanel, Tag, Text, Textarea };