lkd-web-kit 0.0.1 → 0.0.3

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.
@@ -1,8 +1,8 @@
1
1
  import require$$1, { jsx, jsxs } from 'react/jsx-runtime';
2
- import { Center, Loader, useCombobox, Combobox, InputBase, Input, ScrollArea, Stack, NavLink } from '@mantine/core';
3
- import require$$0, { useRef } from 'react';
4
- import { u as useFetchNextPageOnScroll } from './useFetchNextPageOnScroll-08q9N5OE.js';
5
- import { r as require_interop_require_wildcard, a as requireSegment, b as require_interop_require_default, n as navigationExports } from './navigation-sZaWnl2V.js';
2
+ import { Center, Loader, useCombobox, Combobox, InputBase, Input, ScrollArea, Stack, NavLink, Box, Button } from '@mantine/core';
3
+ import require$$0, { useEffect, useRef, createContext, useState, useContext } from 'react';
4
+ import { FormProvider, useFormContext, Controller } from 'react-hook-form';
5
+ import { z } from 'zod';
6
6
 
7
7
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
8
8
 
@@ -96,6 +96,52 @@ const InfinityLoader = ({ infinity, loaderProps, ...props }) => {
96
96
  return /* @__PURE__ */ jsx(Center, { ...props, children: infinity.isFetching ? /* @__PURE__ */ jsx(Loader, { ...loaderProps }) : !infinity.hasNextPage && (infinity.data?.pages.length ?? 0) > 1 && /* @__PURE__ */ jsx("p", { children: "No hay más resultados" }) });
97
97
  };
98
98
 
99
+ const useOnScrollProgress = (triggerPercentage, callback, elementRef) => {
100
+ if (triggerPercentage < 0 || triggerPercentage > 1) {
101
+ throw new Error("El porcentaje debe estar entre 0 y 1");
102
+ }
103
+ useEffect(() => {
104
+ let hasTriggered = false;
105
+ const handleScroll = () => {
106
+ const el = elementRef?.current;
107
+ const target = el ?? document.documentElement;
108
+ const scrollHeight = target.scrollHeight - target.clientHeight;
109
+ const scrollTop = el ? target.scrollTop : window.scrollY;
110
+ const scrollProgress = scrollHeight > 0 ? Math.min(1, scrollTop / scrollHeight) : 0;
111
+ if (!hasTriggered && scrollProgress >= triggerPercentage) {
112
+ callback();
113
+ hasTriggered = true;
114
+ }
115
+ };
116
+ const scrollTarget = elementRef?.current ?? window;
117
+ scrollTarget.addEventListener("scroll", handleScroll);
118
+ handleScroll();
119
+ return () => {
120
+ scrollTarget.removeEventListener("scroll", handleScroll);
121
+ };
122
+ }, [triggerPercentage, callback, elementRef]);
123
+ };
124
+
125
+ const useFetchNextPageOnScroll = (infinity, elementRef) => {
126
+ useOnScrollProgress(
127
+ 0.9,
128
+ () => {
129
+ if (infinity.hasNextPage) {
130
+ infinity.fetchNextPage();
131
+ }
132
+ },
133
+ elementRef
134
+ );
135
+ useEffect(() => {
136
+ const el = elementRef?.current;
137
+ const scrollTarget = el ?? document.documentElement;
138
+ const hasScroll = scrollTarget.scrollHeight > scrollTarget.clientHeight;
139
+ if (!hasScroll && infinity.hasNextPage) {
140
+ infinity.fetchNextPage();
141
+ }
142
+ }, [infinity.data, elementRef]);
143
+ };
144
+
99
145
  function SelectInfinity({
100
146
  value,
101
147
  onChange,
@@ -208,6 +254,53 @@ function getDefaultExportFromCjs (x) {
208
254
 
209
255
  var link$1 = {exports: {}};
210
256
 
257
+ var _interop_require_wildcard = {};
258
+
259
+ var hasRequired_interop_require_wildcard;
260
+
261
+ function require_interop_require_wildcard () {
262
+ if (hasRequired_interop_require_wildcard) return _interop_require_wildcard;
263
+ hasRequired_interop_require_wildcard = 1;
264
+
265
+ function _getRequireWildcardCache(nodeInterop) {
266
+ if (typeof WeakMap !== "function") return null;
267
+
268
+ var cacheBabelInterop = new WeakMap();
269
+ var cacheNodeInterop = new WeakMap();
270
+
271
+ return (_getRequireWildcardCache = function(nodeInterop) {
272
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
273
+ })(nodeInterop);
274
+ }
275
+ function _interop_require_wildcard$1(obj, nodeInterop) {
276
+ if (!nodeInterop && obj && obj.__esModule) return obj;
277
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") return { default: obj };
278
+
279
+ var cache = _getRequireWildcardCache(nodeInterop);
280
+
281
+ if (cache && cache.has(obj)) return cache.get(obj);
282
+
283
+ var newObj = { __proto__: null };
284
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
285
+
286
+ for (var key in obj) {
287
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
288
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
289
+ if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
290
+ else newObj[key] = obj[key];
291
+ }
292
+ }
293
+
294
+ newObj.default = obj;
295
+
296
+ if (cache) cache.set(obj, newObj);
297
+
298
+ return newObj;
299
+ }
300
+ _interop_require_wildcard._ = _interop_require_wildcard$1;
301
+ return _interop_require_wildcard;
302
+ }
303
+
211
304
  var resolveHref = {exports: {}};
212
305
 
213
306
  var querystring = {};
@@ -1149,6 +1242,63 @@ function requireEnsureLeadingSlash () {
1149
1242
  return ensureLeadingSlash;
1150
1243
  }
1151
1244
 
1245
+ var segment = {};
1246
+
1247
+ var hasRequiredSegment;
1248
+
1249
+ function requireSegment () {
1250
+ if (hasRequiredSegment) return segment;
1251
+ hasRequiredSegment = 1;
1252
+ (function (exports) {
1253
+ Object.defineProperty(exports, "__esModule", {
1254
+ value: true
1255
+ });
1256
+ function _export(target, all) {
1257
+ for(var name in all)Object.defineProperty(target, name, {
1258
+ enumerable: true,
1259
+ get: all[name]
1260
+ });
1261
+ }
1262
+ _export(exports, {
1263
+ DEFAULT_SEGMENT_KEY: function() {
1264
+ return DEFAULT_SEGMENT_KEY;
1265
+ },
1266
+ PAGE_SEGMENT_KEY: function() {
1267
+ return PAGE_SEGMENT_KEY;
1268
+ },
1269
+ addSearchParamsIfPageSegment: function() {
1270
+ return addSearchParamsIfPageSegment;
1271
+ },
1272
+ isGroupSegment: function() {
1273
+ return isGroupSegment;
1274
+ },
1275
+ isParallelRouteSegment: function() {
1276
+ return isParallelRouteSegment;
1277
+ }
1278
+ });
1279
+ function isGroupSegment(segment) {
1280
+ // Use array[0] for performant purpose
1281
+ return segment[0] === '(' && segment.endsWith(')');
1282
+ }
1283
+ function isParallelRouteSegment(segment) {
1284
+ return segment.startsWith('@') && segment !== '@children';
1285
+ }
1286
+ function addSearchParamsIfPageSegment(segment, searchParams) {
1287
+ const isPageSegment = segment.includes(PAGE_SEGMENT_KEY);
1288
+ if (isPageSegment) {
1289
+ const stringifiedQuery = JSON.stringify(searchParams);
1290
+ return stringifiedQuery !== '{}' ? PAGE_SEGMENT_KEY + '?' + stringifiedQuery : PAGE_SEGMENT_KEY;
1291
+ }
1292
+ return segment;
1293
+ }
1294
+ const PAGE_SEGMENT_KEY = '__PAGE__';
1295
+ const DEFAULT_SEGMENT_KEY = '__DEFAULT__';
1296
+
1297
+
1298
+ } (segment));
1299
+ return segment;
1300
+ }
1301
+
1152
1302
  var hasRequiredAppPaths;
1153
1303
 
1154
1304
  function requireAppPaths () {
@@ -2338,6 +2488,21 @@ function requireAddLocale () {
2338
2488
 
2339
2489
  var routerContext_sharedRuntime = {};
2340
2490
 
2491
+ var _interop_require_default = {};
2492
+
2493
+ var hasRequired_interop_require_default;
2494
+
2495
+ function require_interop_require_default () {
2496
+ if (hasRequired_interop_require_default) return _interop_require_default;
2497
+ hasRequired_interop_require_default = 1;
2498
+
2499
+ function _interop_require_default$1(obj) {
2500
+ return obj && obj.__esModule ? obj : { default: obj };
2501
+ }
2502
+ _interop_require_default._ = _interop_require_default$1;
2503
+ return _interop_require_default;
2504
+ }
2505
+
2341
2506
  var hasRequiredRouterContext_sharedRuntime;
2342
2507
 
2343
2508
  function requireRouterContext_sharedRuntime () {
@@ -3363,33 +3528,2776 @@ function requireLink () {
3363
3528
  var linkExports = requireLink();
3364
3529
  const Link = /*@__PURE__*/getDefaultExportFromCjs(linkExports);
3365
3530
 
3366
- const NavItems = ({ items }) => {
3367
- const pathname = navigationExports.usePathname();
3368
- return /* @__PURE__ */ jsx(Stack, { gap: 0, children: items.map(({ href, isActive, ...navLinkProps }) => {
3369
- if (href) {
3370
- const active = isActive ?? href.includes(pathname);
3371
- return /* @__PURE__ */ jsx(
3372
- NavLink,
3373
- {
3374
- active,
3375
- component: Link,
3376
- prefetch: false,
3377
- href,
3378
- ...navLinkProps
3379
- },
3380
- navLinkProps.label
3381
- );
3382
- }
3383
- return /* @__PURE__ */ jsx(
3384
- NavLink,
3385
- {
3386
- active: isActive,
3387
- component: "button",
3388
- ...navLinkProps
3389
- },
3390
- navLinkProps.label
3391
- );
3392
- }) });
3531
+ var navigation$1 = {exports: {}};
3532
+
3533
+ var appRouterContext_sharedRuntime = {};
3534
+
3535
+ var hasRequiredAppRouterContext_sharedRuntime;
3536
+
3537
+ function requireAppRouterContext_sharedRuntime () {
3538
+ if (hasRequiredAppRouterContext_sharedRuntime) return appRouterContext_sharedRuntime;
3539
+ hasRequiredAppRouterContext_sharedRuntime = 1;
3540
+ (function (exports) {
3541
+ 'use client';
3542
+ Object.defineProperty(exports, "__esModule", {
3543
+ value: true
3544
+ });
3545
+ function _export(target, all) {
3546
+ for(var name in all)Object.defineProperty(target, name, {
3547
+ enumerable: true,
3548
+ get: all[name]
3549
+ });
3550
+ }
3551
+ _export(exports, {
3552
+ AppRouterContext: function() {
3553
+ return AppRouterContext;
3554
+ },
3555
+ GlobalLayoutRouterContext: function() {
3556
+ return GlobalLayoutRouterContext;
3557
+ },
3558
+ LayoutRouterContext: function() {
3559
+ return LayoutRouterContext;
3560
+ },
3561
+ MissingSlotContext: function() {
3562
+ return MissingSlotContext;
3563
+ },
3564
+ TemplateContext: function() {
3565
+ return TemplateContext;
3566
+ }
3567
+ });
3568
+ const _interop_require_default = /*@__PURE__*/ require_interop_require_default();
3569
+ const _react = /*#__PURE__*/ _interop_require_default._(require$$0);
3570
+ const AppRouterContext = _react.default.createContext(null);
3571
+ const LayoutRouterContext = _react.default.createContext(null);
3572
+ const GlobalLayoutRouterContext = _react.default.createContext(null);
3573
+ const TemplateContext = _react.default.createContext(null);
3574
+ if (process.env.NODE_ENV !== 'production') {
3575
+ AppRouterContext.displayName = 'AppRouterContext';
3576
+ LayoutRouterContext.displayName = 'LayoutRouterContext';
3577
+ GlobalLayoutRouterContext.displayName = 'GlobalLayoutRouterContext';
3578
+ TemplateContext.displayName = 'TemplateContext';
3579
+ }
3580
+ const MissingSlotContext = _react.default.createContext(new Set());
3581
+
3582
+
3583
+ } (appRouterContext_sharedRuntime));
3584
+ return appRouterContext_sharedRuntime;
3585
+ }
3586
+
3587
+ var hooksClientContext_sharedRuntime = {};
3588
+
3589
+ var hasRequiredHooksClientContext_sharedRuntime;
3590
+
3591
+ function requireHooksClientContext_sharedRuntime () {
3592
+ if (hasRequiredHooksClientContext_sharedRuntime) return hooksClientContext_sharedRuntime;
3593
+ hasRequiredHooksClientContext_sharedRuntime = 1;
3594
+ (function (exports) {
3595
+ 'use client';
3596
+ Object.defineProperty(exports, "__esModule", {
3597
+ value: true
3598
+ });
3599
+ function _export(target, all) {
3600
+ for(var name in all)Object.defineProperty(target, name, {
3601
+ enumerable: true,
3602
+ get: all[name]
3603
+ });
3604
+ }
3605
+ _export(exports, {
3606
+ PathParamsContext: function() {
3607
+ return PathParamsContext;
3608
+ },
3609
+ PathnameContext: function() {
3610
+ return PathnameContext;
3611
+ },
3612
+ SearchParamsContext: function() {
3613
+ return SearchParamsContext;
3614
+ }
3615
+ });
3616
+ const _react = require$$0;
3617
+ const SearchParamsContext = (0, _react.createContext)(null);
3618
+ const PathnameContext = (0, _react.createContext)(null);
3619
+ const PathParamsContext = (0, _react.createContext)(null);
3620
+ if (process.env.NODE_ENV !== 'production') {
3621
+ SearchParamsContext.displayName = 'SearchParamsContext';
3622
+ PathnameContext.displayName = 'PathnameContext';
3623
+ PathParamsContext.displayName = 'PathParamsContext';
3624
+ }
3625
+
3626
+
3627
+ } (hooksClientContext_sharedRuntime));
3628
+ return hooksClientContext_sharedRuntime;
3629
+ }
3630
+
3631
+ var getSegmentValue = {exports: {}};
3632
+
3633
+ var hasRequiredGetSegmentValue;
3634
+
3635
+ function requireGetSegmentValue () {
3636
+ if (hasRequiredGetSegmentValue) return getSegmentValue.exports;
3637
+ hasRequiredGetSegmentValue = 1;
3638
+ (function (module, exports) {
3639
+ Object.defineProperty(exports, "__esModule", {
3640
+ value: true
3641
+ });
3642
+ Object.defineProperty(exports, "getSegmentValue", {
3643
+ enumerable: true,
3644
+ get: function() {
3645
+ return getSegmentValue;
3646
+ }
3647
+ });
3648
+ function getSegmentValue(segment) {
3649
+ return Array.isArray(segment) ? segment[1] : segment;
3650
+ }
3651
+
3652
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
3653
+ Object.defineProperty(exports.default, '__esModule', { value: true });
3654
+ Object.assign(exports.default, exports);
3655
+ module.exports = exports.default;
3656
+ }
3657
+
3658
+
3659
+ } (getSegmentValue, getSegmentValue.exports));
3660
+ return getSegmentValue.exports;
3661
+ }
3662
+
3663
+ var navigation_reactServer = {exports: {}};
3664
+
3665
+ var redirect = {exports: {}};
3666
+
3667
+ var redirectStatusCode = {exports: {}};
3668
+
3669
+ var hasRequiredRedirectStatusCode;
3670
+
3671
+ function requireRedirectStatusCode () {
3672
+ if (hasRequiredRedirectStatusCode) return redirectStatusCode.exports;
3673
+ hasRequiredRedirectStatusCode = 1;
3674
+ (function (module, exports) {
3675
+ Object.defineProperty(exports, "__esModule", {
3676
+ value: true
3677
+ });
3678
+ Object.defineProperty(exports, "RedirectStatusCode", {
3679
+ enumerable: true,
3680
+ get: function() {
3681
+ return RedirectStatusCode;
3682
+ }
3683
+ });
3684
+ var RedirectStatusCode = /*#__PURE__*/ function(RedirectStatusCode) {
3685
+ RedirectStatusCode[RedirectStatusCode["SeeOther"] = 303] = "SeeOther";
3686
+ RedirectStatusCode[RedirectStatusCode["TemporaryRedirect"] = 307] = "TemporaryRedirect";
3687
+ RedirectStatusCode[RedirectStatusCode["PermanentRedirect"] = 308] = "PermanentRedirect";
3688
+ return RedirectStatusCode;
3689
+ }({});
3690
+
3691
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
3692
+ Object.defineProperty(exports.default, '__esModule', { value: true });
3693
+ Object.assign(exports.default, exports);
3694
+ module.exports = exports.default;
3695
+ }
3696
+
3697
+
3698
+ } (redirectStatusCode, redirectStatusCode.exports));
3699
+ return redirectStatusCode.exports;
3700
+ }
3701
+
3702
+ var redirectError = {exports: {}};
3703
+
3704
+ var hasRequiredRedirectError;
3705
+
3706
+ function requireRedirectError () {
3707
+ if (hasRequiredRedirectError) return redirectError.exports;
3708
+ hasRequiredRedirectError = 1;
3709
+ (function (module, exports) {
3710
+ Object.defineProperty(exports, "__esModule", {
3711
+ value: true
3712
+ });
3713
+ function _export(target, all) {
3714
+ for(var name in all)Object.defineProperty(target, name, {
3715
+ enumerable: true,
3716
+ get: all[name]
3717
+ });
3718
+ }
3719
+ _export(exports, {
3720
+ REDIRECT_ERROR_CODE: function() {
3721
+ return REDIRECT_ERROR_CODE;
3722
+ },
3723
+ RedirectType: function() {
3724
+ return RedirectType;
3725
+ },
3726
+ isRedirectError: function() {
3727
+ return isRedirectError;
3728
+ }
3729
+ });
3730
+ const _redirectstatuscode = requireRedirectStatusCode();
3731
+ const REDIRECT_ERROR_CODE = 'NEXT_REDIRECT';
3732
+ var RedirectType = /*#__PURE__*/ function(RedirectType) {
3733
+ RedirectType["push"] = "push";
3734
+ RedirectType["replace"] = "replace";
3735
+ return RedirectType;
3736
+ }({});
3737
+ function isRedirectError(error) {
3738
+ if (typeof error !== 'object' || error === null || !('digest' in error) || typeof error.digest !== 'string') {
3739
+ return false;
3740
+ }
3741
+ const digest = error.digest.split(';');
3742
+ const [errorCode, type] = digest;
3743
+ const destination = digest.slice(2, -2).join(';');
3744
+ const status = digest.at(-2);
3745
+ const statusCode = Number(status);
3746
+ return errorCode === REDIRECT_ERROR_CODE && (type === 'replace' || type === 'push') && typeof destination === 'string' && !isNaN(statusCode) && statusCode in _redirectstatuscode.RedirectStatusCode;
3747
+ }
3748
+
3749
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
3750
+ Object.defineProperty(exports.default, '__esModule', { value: true });
3751
+ Object.assign(exports.default, exports);
3752
+ module.exports = exports.default;
3753
+ }
3754
+
3755
+
3756
+ } (redirectError, redirectError.exports));
3757
+ return redirectError.exports;
3758
+ }
3759
+
3760
+ var actionAsyncStorage_external = {};
3761
+
3762
+ var actionAsyncStorageInstance = {};
3763
+
3764
+ var asyncLocalStorage = {};
3765
+
3766
+ var hasRequiredAsyncLocalStorage;
3767
+
3768
+ function requireAsyncLocalStorage () {
3769
+ if (hasRequiredAsyncLocalStorage) return asyncLocalStorage;
3770
+ hasRequiredAsyncLocalStorage = 1;
3771
+ (function (exports) {
3772
+ Object.defineProperty(exports, "__esModule", {
3773
+ value: true
3774
+ });
3775
+ function _export(target, all) {
3776
+ for(var name in all)Object.defineProperty(target, name, {
3777
+ enumerable: true,
3778
+ get: all[name]
3779
+ });
3780
+ }
3781
+ _export(exports, {
3782
+ bindSnapshot: function() {
3783
+ return bindSnapshot;
3784
+ },
3785
+ createAsyncLocalStorage: function() {
3786
+ return createAsyncLocalStorage;
3787
+ },
3788
+ createSnapshot: function() {
3789
+ return createSnapshot;
3790
+ }
3791
+ });
3792
+ const sharedAsyncLocalStorageNotAvailableError = Object.defineProperty(new Error('Invariant: AsyncLocalStorage accessed in runtime where it is not available'), "__NEXT_ERROR_CODE", {
3793
+ value: "E504",
3794
+ enumerable: false,
3795
+ configurable: true
3796
+ });
3797
+ class FakeAsyncLocalStorage {
3798
+ disable() {
3799
+ throw sharedAsyncLocalStorageNotAvailableError;
3800
+ }
3801
+ getStore() {
3802
+ // This fake implementation of AsyncLocalStorage always returns `undefined`.
3803
+ return undefined;
3804
+ }
3805
+ run() {
3806
+ throw sharedAsyncLocalStorageNotAvailableError;
3807
+ }
3808
+ exit() {
3809
+ throw sharedAsyncLocalStorageNotAvailableError;
3810
+ }
3811
+ enterWith() {
3812
+ throw sharedAsyncLocalStorageNotAvailableError;
3813
+ }
3814
+ static bind(fn) {
3815
+ return fn;
3816
+ }
3817
+ }
3818
+ const maybeGlobalAsyncLocalStorage = typeof globalThis !== 'undefined' && globalThis.AsyncLocalStorage;
3819
+ function createAsyncLocalStorage() {
3820
+ if (maybeGlobalAsyncLocalStorage) {
3821
+ return new maybeGlobalAsyncLocalStorage();
3822
+ }
3823
+ return new FakeAsyncLocalStorage();
3824
+ }
3825
+ function bindSnapshot(fn) {
3826
+ if (maybeGlobalAsyncLocalStorage) {
3827
+ return maybeGlobalAsyncLocalStorage.bind(fn);
3828
+ }
3829
+ return FakeAsyncLocalStorage.bind(fn);
3830
+ }
3831
+ function createSnapshot() {
3832
+ if (maybeGlobalAsyncLocalStorage) {
3833
+ return maybeGlobalAsyncLocalStorage.snapshot();
3834
+ }
3835
+ return function(fn, ...args) {
3836
+ return fn(...args);
3837
+ };
3838
+ }
3839
+
3840
+
3841
+ } (asyncLocalStorage));
3842
+ return asyncLocalStorage;
3843
+ }
3844
+
3845
+ var hasRequiredActionAsyncStorageInstance;
3846
+
3847
+ function requireActionAsyncStorageInstance () {
3848
+ if (hasRequiredActionAsyncStorageInstance) return actionAsyncStorageInstance;
3849
+ hasRequiredActionAsyncStorageInstance = 1;
3850
+ (function (exports) {
3851
+ Object.defineProperty(exports, "__esModule", {
3852
+ value: true
3853
+ });
3854
+ Object.defineProperty(exports, "actionAsyncStorageInstance", {
3855
+ enumerable: true,
3856
+ get: function() {
3857
+ return actionAsyncStorageInstance;
3858
+ }
3859
+ });
3860
+ const _asynclocalstorage = requireAsyncLocalStorage();
3861
+ const actionAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();
3862
+
3863
+
3864
+ } (actionAsyncStorageInstance));
3865
+ return actionAsyncStorageInstance;
3866
+ }
3867
+
3868
+ var hasRequiredActionAsyncStorage_external;
3869
+
3870
+ function requireActionAsyncStorage_external () {
3871
+ if (hasRequiredActionAsyncStorage_external) return actionAsyncStorage_external;
3872
+ hasRequiredActionAsyncStorage_external = 1;
3873
+ (function (exports) {
3874
+ Object.defineProperty(exports, "__esModule", {
3875
+ value: true
3876
+ });
3877
+ Object.defineProperty(exports, "actionAsyncStorage", {
3878
+ enumerable: true,
3879
+ get: function() {
3880
+ return _actionasyncstorageinstance.actionAsyncStorageInstance;
3881
+ }
3882
+ });
3883
+ const _actionasyncstorageinstance = requireActionAsyncStorageInstance();
3884
+
3885
+
3886
+ } (actionAsyncStorage_external));
3887
+ return actionAsyncStorage_external;
3888
+ }
3889
+
3890
+ var hasRequiredRedirect;
3891
+
3892
+ function requireRedirect () {
3893
+ if (hasRequiredRedirect) return redirect.exports;
3894
+ hasRequiredRedirect = 1;
3895
+ (function (module, exports) {
3896
+ Object.defineProperty(exports, "__esModule", {
3897
+ value: true
3898
+ });
3899
+ function _export(target, all) {
3900
+ for(var name in all)Object.defineProperty(target, name, {
3901
+ enumerable: true,
3902
+ get: all[name]
3903
+ });
3904
+ }
3905
+ _export(exports, {
3906
+ getRedirectError: function() {
3907
+ return getRedirectError;
3908
+ },
3909
+ getRedirectStatusCodeFromError: function() {
3910
+ return getRedirectStatusCodeFromError;
3911
+ },
3912
+ getRedirectTypeFromError: function() {
3913
+ return getRedirectTypeFromError;
3914
+ },
3915
+ getURLFromRedirectError: function() {
3916
+ return getURLFromRedirectError;
3917
+ },
3918
+ permanentRedirect: function() {
3919
+ return permanentRedirect;
3920
+ },
3921
+ redirect: function() {
3922
+ return redirect;
3923
+ }
3924
+ });
3925
+ const _redirectstatuscode = requireRedirectStatusCode();
3926
+ const _redirecterror = requireRedirectError();
3927
+ const actionAsyncStorage = typeof window === 'undefined' ? requireActionAsyncStorage_external().actionAsyncStorage : undefined;
3928
+ function getRedirectError(url, type, statusCode) {
3929
+ if (statusCode === void 0) statusCode = _redirectstatuscode.RedirectStatusCode.TemporaryRedirect;
3930
+ const error = Object.defineProperty(new Error(_redirecterror.REDIRECT_ERROR_CODE), "__NEXT_ERROR_CODE", {
3931
+ value: "E394",
3932
+ enumerable: false,
3933
+ configurable: true
3934
+ });
3935
+ error.digest = _redirecterror.REDIRECT_ERROR_CODE + ";" + type + ";" + url + ";" + statusCode + ";";
3936
+ return error;
3937
+ }
3938
+ function redirect(/** The URL to redirect to */ url, type) {
3939
+ var _actionAsyncStorage_getStore;
3940
+ type != null ? type : type = (actionAsyncStorage == null ? void 0 : (_actionAsyncStorage_getStore = actionAsyncStorage.getStore()) == null ? void 0 : _actionAsyncStorage_getStore.isAction) ? _redirecterror.RedirectType.push : _redirecterror.RedirectType.replace;
3941
+ throw getRedirectError(url, type, _redirectstatuscode.RedirectStatusCode.TemporaryRedirect);
3942
+ }
3943
+ function permanentRedirect(/** The URL to redirect to */ url, type) {
3944
+ if (type === void 0) type = _redirecterror.RedirectType.replace;
3945
+ throw getRedirectError(url, type, _redirectstatuscode.RedirectStatusCode.PermanentRedirect);
3946
+ }
3947
+ function getURLFromRedirectError(error) {
3948
+ if (!(0, _redirecterror.isRedirectError)(error)) return null;
3949
+ // Slices off the beginning of the digest that contains the code and the
3950
+ // separating ';'.
3951
+ return error.digest.split(';').slice(2, -2).join(';');
3952
+ }
3953
+ function getRedirectTypeFromError(error) {
3954
+ if (!(0, _redirecterror.isRedirectError)(error)) {
3955
+ throw Object.defineProperty(new Error('Not a redirect error'), "__NEXT_ERROR_CODE", {
3956
+ value: "E260",
3957
+ enumerable: false,
3958
+ configurable: true
3959
+ });
3960
+ }
3961
+ return error.digest.split(';', 2)[1];
3962
+ }
3963
+ function getRedirectStatusCodeFromError(error) {
3964
+ if (!(0, _redirecterror.isRedirectError)(error)) {
3965
+ throw Object.defineProperty(new Error('Not a redirect error'), "__NEXT_ERROR_CODE", {
3966
+ value: "E260",
3967
+ enumerable: false,
3968
+ configurable: true
3969
+ });
3970
+ }
3971
+ return Number(error.digest.split(';').at(-2));
3972
+ }
3973
+
3974
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
3975
+ Object.defineProperty(exports.default, '__esModule', { value: true });
3976
+ Object.assign(exports.default, exports);
3977
+ module.exports = exports.default;
3978
+ }
3979
+
3980
+
3981
+ } (redirect, redirect.exports));
3982
+ return redirect.exports;
3983
+ }
3984
+
3985
+ var notFound = {exports: {}};
3986
+
3987
+ var httpAccessFallback = {exports: {}};
3988
+
3989
+ var hasRequiredHttpAccessFallback;
3990
+
3991
+ function requireHttpAccessFallback () {
3992
+ if (hasRequiredHttpAccessFallback) return httpAccessFallback.exports;
3993
+ hasRequiredHttpAccessFallback = 1;
3994
+ (function (module, exports) {
3995
+ Object.defineProperty(exports, "__esModule", {
3996
+ value: true
3997
+ });
3998
+ function _export(target, all) {
3999
+ for(var name in all)Object.defineProperty(target, name, {
4000
+ enumerable: true,
4001
+ get: all[name]
4002
+ });
4003
+ }
4004
+ _export(exports, {
4005
+ HTTPAccessErrorStatus: function() {
4006
+ return HTTPAccessErrorStatus;
4007
+ },
4008
+ HTTP_ERROR_FALLBACK_ERROR_CODE: function() {
4009
+ return HTTP_ERROR_FALLBACK_ERROR_CODE;
4010
+ },
4011
+ getAccessFallbackErrorTypeByStatus: function() {
4012
+ return getAccessFallbackErrorTypeByStatus;
4013
+ },
4014
+ getAccessFallbackHTTPStatus: function() {
4015
+ return getAccessFallbackHTTPStatus;
4016
+ },
4017
+ isHTTPAccessFallbackError: function() {
4018
+ return isHTTPAccessFallbackError;
4019
+ }
4020
+ });
4021
+ const HTTPAccessErrorStatus = {
4022
+ NOT_FOUND: 404,
4023
+ FORBIDDEN: 403,
4024
+ UNAUTHORIZED: 401
4025
+ };
4026
+ const ALLOWED_CODES = new Set(Object.values(HTTPAccessErrorStatus));
4027
+ const HTTP_ERROR_FALLBACK_ERROR_CODE = 'NEXT_HTTP_ERROR_FALLBACK';
4028
+ function isHTTPAccessFallbackError(error) {
4029
+ if (typeof error !== 'object' || error === null || !('digest' in error) || typeof error.digest !== 'string') {
4030
+ return false;
4031
+ }
4032
+ const [prefix, httpStatus] = error.digest.split(';');
4033
+ return prefix === HTTP_ERROR_FALLBACK_ERROR_CODE && ALLOWED_CODES.has(Number(httpStatus));
4034
+ }
4035
+ function getAccessFallbackHTTPStatus(error) {
4036
+ const httpStatus = error.digest.split(';')[1];
4037
+ return Number(httpStatus);
4038
+ }
4039
+ function getAccessFallbackErrorTypeByStatus(status) {
4040
+ switch(status){
4041
+ case 401:
4042
+ return 'unauthorized';
4043
+ case 403:
4044
+ return 'forbidden';
4045
+ case 404:
4046
+ return 'not-found';
4047
+ default:
4048
+ return;
4049
+ }
4050
+ }
4051
+
4052
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
4053
+ Object.defineProperty(exports.default, '__esModule', { value: true });
4054
+ Object.assign(exports.default, exports);
4055
+ module.exports = exports.default;
4056
+ }
4057
+
4058
+
4059
+ } (httpAccessFallback, httpAccessFallback.exports));
4060
+ return httpAccessFallback.exports;
4061
+ }
4062
+
4063
+ var hasRequiredNotFound;
4064
+
4065
+ function requireNotFound () {
4066
+ if (hasRequiredNotFound) return notFound.exports;
4067
+ hasRequiredNotFound = 1;
4068
+ (function (module, exports) {
4069
+ Object.defineProperty(exports, "__esModule", {
4070
+ value: true
4071
+ });
4072
+ Object.defineProperty(exports, "notFound", {
4073
+ enumerable: true,
4074
+ get: function() {
4075
+ return notFound;
4076
+ }
4077
+ });
4078
+ const _httpaccessfallback = requireHttpAccessFallback();
4079
+ /**
4080
+ * This function allows you to render the [not-found.js file](https://nextjs.org/docs/app/api-reference/file-conventions/not-found)
4081
+ * within a route segment as well as inject a tag.
4082
+ *
4083
+ * `notFound()` can be used in
4084
+ * [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),
4085
+ * [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and
4086
+ * [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).
4087
+ *
4088
+ * - In a Server Component, this will insert a `<meta name="robots" content="noindex" />` meta tag and set the status code to 404.
4089
+ * - In a Route Handler or Server Action, it will serve a 404 to the caller.
4090
+ *
4091
+ * Read more: [Next.js Docs: `notFound`](https://nextjs.org/docs/app/api-reference/functions/not-found)
4092
+ */ const DIGEST = "" + _httpaccessfallback.HTTP_ERROR_FALLBACK_ERROR_CODE + ";404";
4093
+ function notFound() {
4094
+ // eslint-disable-next-line no-throw-literal
4095
+ const error = Object.defineProperty(new Error(DIGEST), "__NEXT_ERROR_CODE", {
4096
+ value: "E394",
4097
+ enumerable: false,
4098
+ configurable: true
4099
+ });
4100
+ error.digest = DIGEST;
4101
+ throw error;
4102
+ }
4103
+
4104
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
4105
+ Object.defineProperty(exports.default, '__esModule', { value: true });
4106
+ Object.assign(exports.default, exports);
4107
+ module.exports = exports.default;
4108
+ }
4109
+
4110
+
4111
+ } (notFound, notFound.exports));
4112
+ return notFound.exports;
4113
+ }
4114
+
4115
+ var forbidden = {exports: {}};
4116
+
4117
+ var hasRequiredForbidden;
4118
+
4119
+ function requireForbidden () {
4120
+ if (hasRequiredForbidden) return forbidden.exports;
4121
+ hasRequiredForbidden = 1;
4122
+ (function (module, exports) {
4123
+ Object.defineProperty(exports, "__esModule", {
4124
+ value: true
4125
+ });
4126
+ Object.defineProperty(exports, "forbidden", {
4127
+ enumerable: true,
4128
+ get: function() {
4129
+ return forbidden;
4130
+ }
4131
+ });
4132
+ const _httpaccessfallback = requireHttpAccessFallback();
4133
+ // TODO: Add `forbidden` docs
4134
+ /**
4135
+ * @experimental
4136
+ * This function allows you to render the [forbidden.js file](https://nextjs.org/docs/app/api-reference/file-conventions/forbidden)
4137
+ * within a route segment as well as inject a tag.
4138
+ *
4139
+ * `forbidden()` can be used in
4140
+ * [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),
4141
+ * [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and
4142
+ * [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).
4143
+ *
4144
+ * Read more: [Next.js Docs: `forbidden`](https://nextjs.org/docs/app/api-reference/functions/forbidden)
4145
+ */ const DIGEST = "" + _httpaccessfallback.HTTP_ERROR_FALLBACK_ERROR_CODE + ";403";
4146
+ function forbidden() {
4147
+ if (!process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS) {
4148
+ throw Object.defineProperty(new Error("`forbidden()` is experimental and only allowed to be enabled when `experimental.authInterrupts` is enabled."), "__NEXT_ERROR_CODE", {
4149
+ value: "E488",
4150
+ enumerable: false,
4151
+ configurable: true
4152
+ });
4153
+ }
4154
+ // eslint-disable-next-line no-throw-literal
4155
+ const error = Object.defineProperty(new Error(DIGEST), "__NEXT_ERROR_CODE", {
4156
+ value: "E394",
4157
+ enumerable: false,
4158
+ configurable: true
4159
+ });
4160
+ error.digest = DIGEST;
4161
+ throw error;
4162
+ }
4163
+
4164
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
4165
+ Object.defineProperty(exports.default, '__esModule', { value: true });
4166
+ Object.assign(exports.default, exports);
4167
+ module.exports = exports.default;
4168
+ }
4169
+
4170
+
4171
+ } (forbidden, forbidden.exports));
4172
+ return forbidden.exports;
4173
+ }
4174
+
4175
+ var unauthorized = {exports: {}};
4176
+
4177
+ var hasRequiredUnauthorized;
4178
+
4179
+ function requireUnauthorized () {
4180
+ if (hasRequiredUnauthorized) return unauthorized.exports;
4181
+ hasRequiredUnauthorized = 1;
4182
+ (function (module, exports) {
4183
+ Object.defineProperty(exports, "__esModule", {
4184
+ value: true
4185
+ });
4186
+ Object.defineProperty(exports, "unauthorized", {
4187
+ enumerable: true,
4188
+ get: function() {
4189
+ return unauthorized;
4190
+ }
4191
+ });
4192
+ const _httpaccessfallback = requireHttpAccessFallback();
4193
+ // TODO: Add `unauthorized` docs
4194
+ /**
4195
+ * @experimental
4196
+ * This function allows you to render the [unauthorized.js file](https://nextjs.org/docs/app/api-reference/file-conventions/unauthorized)
4197
+ * within a route segment as well as inject a tag.
4198
+ *
4199
+ * `unauthorized()` can be used in
4200
+ * [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),
4201
+ * [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and
4202
+ * [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).
4203
+ *
4204
+ *
4205
+ * Read more: [Next.js Docs: `unauthorized`](https://nextjs.org/docs/app/api-reference/functions/unauthorized)
4206
+ */ const DIGEST = "" + _httpaccessfallback.HTTP_ERROR_FALLBACK_ERROR_CODE + ";401";
4207
+ function unauthorized() {
4208
+ if (!process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS) {
4209
+ throw Object.defineProperty(new Error("`unauthorized()` is experimental and only allowed to be used when `experimental.authInterrupts` is enabled."), "__NEXT_ERROR_CODE", {
4210
+ value: "E411",
4211
+ enumerable: false,
4212
+ configurable: true
4213
+ });
4214
+ }
4215
+ // eslint-disable-next-line no-throw-literal
4216
+ const error = Object.defineProperty(new Error(DIGEST), "__NEXT_ERROR_CODE", {
4217
+ value: "E394",
4218
+ enumerable: false,
4219
+ configurable: true
4220
+ });
4221
+ error.digest = DIGEST;
4222
+ throw error;
4223
+ }
4224
+
4225
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
4226
+ Object.defineProperty(exports.default, '__esModule', { value: true });
4227
+ Object.assign(exports.default, exports);
4228
+ module.exports = exports.default;
4229
+ }
4230
+
4231
+
4232
+ } (unauthorized, unauthorized.exports));
4233
+ return unauthorized.exports;
4234
+ }
4235
+
4236
+ var unstableRethrow = {exports: {}};
4237
+
4238
+ var unstableRethrow_server = {exports: {}};
4239
+
4240
+ var dynamicRenderingUtils = {};
4241
+
4242
+ var hasRequiredDynamicRenderingUtils;
4243
+
4244
+ function requireDynamicRenderingUtils () {
4245
+ if (hasRequiredDynamicRenderingUtils) return dynamicRenderingUtils;
4246
+ hasRequiredDynamicRenderingUtils = 1;
4247
+ (function (exports) {
4248
+ Object.defineProperty(exports, "__esModule", {
4249
+ value: true
4250
+ });
4251
+ function _export(target, all) {
4252
+ for(var name in all)Object.defineProperty(target, name, {
4253
+ enumerable: true,
4254
+ get: all[name]
4255
+ });
4256
+ }
4257
+ _export(exports, {
4258
+ isHangingPromiseRejectionError: function() {
4259
+ return isHangingPromiseRejectionError;
4260
+ },
4261
+ makeHangingPromise: function() {
4262
+ return makeHangingPromise;
4263
+ }
4264
+ });
4265
+ function isHangingPromiseRejectionError(err) {
4266
+ if (typeof err !== 'object' || err === null || !('digest' in err)) {
4267
+ return false;
4268
+ }
4269
+ return err.digest === HANGING_PROMISE_REJECTION;
4270
+ }
4271
+ const HANGING_PROMISE_REJECTION = 'HANGING_PROMISE_REJECTION';
4272
+ class HangingPromiseRejectionError extends Error {
4273
+ constructor(expression){
4274
+ super(`During prerendering, ${expression} rejects when the prerender is complete. Typically these errors are handled by React but if you move ${expression} to a different context by using \`setTimeout\`, \`after\`, or similar functions you may observe this error and you should handle it in that context.`), this.expression = expression, this.digest = HANGING_PROMISE_REJECTION;
4275
+ }
4276
+ }
4277
+ const abortListenersBySignal = new WeakMap();
4278
+ function makeHangingPromise(signal, expression) {
4279
+ if (signal.aborted) {
4280
+ return Promise.reject(new HangingPromiseRejectionError(expression));
4281
+ } else {
4282
+ const hangingPromise = new Promise((_, reject)=>{
4283
+ const boundRejection = reject.bind(null, new HangingPromiseRejectionError(expression));
4284
+ let currentListeners = abortListenersBySignal.get(signal);
4285
+ if (currentListeners) {
4286
+ currentListeners.push(boundRejection);
4287
+ } else {
4288
+ const listeners = [
4289
+ boundRejection
4290
+ ];
4291
+ abortListenersBySignal.set(signal, listeners);
4292
+ signal.addEventListener('abort', ()=>{
4293
+ for(let i = 0; i < listeners.length; i++){
4294
+ listeners[i]();
4295
+ }
4296
+ }, {
4297
+ once: true
4298
+ });
4299
+ }
4300
+ });
4301
+ // We are fine if no one actually awaits this promise. We shouldn't consider this an unhandled rejection so
4302
+ // we attach a noop catch handler here to suppress this warning. If you actually await somewhere or construct
4303
+ // your own promise out of it you'll need to ensure you handle the error when it rejects.
4304
+ hangingPromise.catch(ignoreReject);
4305
+ return hangingPromise;
4306
+ }
4307
+ }
4308
+ function ignoreReject() {}
4309
+
4310
+
4311
+ } (dynamicRenderingUtils));
4312
+ return dynamicRenderingUtils;
4313
+ }
4314
+
4315
+ var isPostpone = {};
4316
+
4317
+ var hasRequiredIsPostpone;
4318
+
4319
+ function requireIsPostpone () {
4320
+ if (hasRequiredIsPostpone) return isPostpone;
4321
+ hasRequiredIsPostpone = 1;
4322
+ (function (exports) {
4323
+ Object.defineProperty(exports, "__esModule", {
4324
+ value: true
4325
+ });
4326
+ Object.defineProperty(exports, "isPostpone", {
4327
+ enumerable: true,
4328
+ get: function() {
4329
+ return isPostpone;
4330
+ }
4331
+ });
4332
+ const REACT_POSTPONE_TYPE = Symbol.for('react.postpone');
4333
+ function isPostpone(error) {
4334
+ return typeof error === 'object' && error !== null && error.$$typeof === REACT_POSTPONE_TYPE;
4335
+ }
4336
+
4337
+
4338
+ } (isPostpone));
4339
+ return isPostpone;
4340
+ }
4341
+
4342
+ var bailoutToCsr = {};
4343
+
4344
+ var hasRequiredBailoutToCsr;
4345
+
4346
+ function requireBailoutToCsr () {
4347
+ if (hasRequiredBailoutToCsr) return bailoutToCsr;
4348
+ hasRequiredBailoutToCsr = 1;
4349
+ (function (exports) {
4350
+ Object.defineProperty(exports, "__esModule", {
4351
+ value: true
4352
+ });
4353
+ function _export(target, all) {
4354
+ for(var name in all)Object.defineProperty(target, name, {
4355
+ enumerable: true,
4356
+ get: all[name]
4357
+ });
4358
+ }
4359
+ _export(exports, {
4360
+ BailoutToCSRError: function() {
4361
+ return BailoutToCSRError;
4362
+ },
4363
+ isBailoutToCSRError: function() {
4364
+ return isBailoutToCSRError;
4365
+ }
4366
+ });
4367
+ const BAILOUT_TO_CSR = 'BAILOUT_TO_CLIENT_SIDE_RENDERING';
4368
+ class BailoutToCSRError extends Error {
4369
+ constructor(reason){
4370
+ super("Bail out to client-side rendering: " + reason), this.reason = reason, this.digest = BAILOUT_TO_CSR;
4371
+ }
4372
+ }
4373
+ function isBailoutToCSRError(err) {
4374
+ if (typeof err !== 'object' || err === null || !('digest' in err)) {
4375
+ return false;
4376
+ }
4377
+ return err.digest === BAILOUT_TO_CSR;
4378
+ }
4379
+
4380
+
4381
+ } (bailoutToCsr));
4382
+ return bailoutToCsr;
4383
+ }
4384
+
4385
+ var isNextRouterError = {exports: {}};
4386
+
4387
+ var hasRequiredIsNextRouterError;
4388
+
4389
+ function requireIsNextRouterError () {
4390
+ if (hasRequiredIsNextRouterError) return isNextRouterError.exports;
4391
+ hasRequiredIsNextRouterError = 1;
4392
+ (function (module, exports) {
4393
+ Object.defineProperty(exports, "__esModule", {
4394
+ value: true
4395
+ });
4396
+ Object.defineProperty(exports, "isNextRouterError", {
4397
+ enumerable: true,
4398
+ get: function() {
4399
+ return isNextRouterError;
4400
+ }
4401
+ });
4402
+ const _httpaccessfallback = requireHttpAccessFallback();
4403
+ const _redirecterror = requireRedirectError();
4404
+ function isNextRouterError(error) {
4405
+ return (0, _redirecterror.isRedirectError)(error) || (0, _httpaccessfallback.isHTTPAccessFallbackError)(error);
4406
+ }
4407
+
4408
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
4409
+ Object.defineProperty(exports.default, '__esModule', { value: true });
4410
+ Object.assign(exports.default, exports);
4411
+ module.exports = exports.default;
4412
+ }
4413
+
4414
+
4415
+ } (isNextRouterError, isNextRouterError.exports));
4416
+ return isNextRouterError.exports;
4417
+ }
4418
+
4419
+ var dynamicRendering = {};
4420
+
4421
+ var hooksServerContext = {exports: {}};
4422
+
4423
+ var hasRequiredHooksServerContext;
4424
+
4425
+ function requireHooksServerContext () {
4426
+ if (hasRequiredHooksServerContext) return hooksServerContext.exports;
4427
+ hasRequiredHooksServerContext = 1;
4428
+ (function (module, exports) {
4429
+ Object.defineProperty(exports, "__esModule", {
4430
+ value: true
4431
+ });
4432
+ function _export(target, all) {
4433
+ for(var name in all)Object.defineProperty(target, name, {
4434
+ enumerable: true,
4435
+ get: all[name]
4436
+ });
4437
+ }
4438
+ _export(exports, {
4439
+ DynamicServerError: function() {
4440
+ return DynamicServerError;
4441
+ },
4442
+ isDynamicServerError: function() {
4443
+ return isDynamicServerError;
4444
+ }
4445
+ });
4446
+ const DYNAMIC_ERROR_CODE = 'DYNAMIC_SERVER_USAGE';
4447
+ class DynamicServerError extends Error {
4448
+ constructor(description){
4449
+ super("Dynamic server usage: " + description), this.description = description, this.digest = DYNAMIC_ERROR_CODE;
4450
+ }
4451
+ }
4452
+ function isDynamicServerError(err) {
4453
+ if (typeof err !== 'object' || err === null || !('digest' in err) || typeof err.digest !== 'string') {
4454
+ return false;
4455
+ }
4456
+ return err.digest === DYNAMIC_ERROR_CODE;
4457
+ }
4458
+
4459
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
4460
+ Object.defineProperty(exports.default, '__esModule', { value: true });
4461
+ Object.assign(exports.default, exports);
4462
+ module.exports = exports.default;
4463
+ }
4464
+
4465
+
4466
+ } (hooksServerContext, hooksServerContext.exports));
4467
+ return hooksServerContext.exports;
4468
+ }
4469
+
4470
+ var staticGenerationBailout = {exports: {}};
4471
+
4472
+ var hasRequiredStaticGenerationBailout;
4473
+
4474
+ function requireStaticGenerationBailout () {
4475
+ if (hasRequiredStaticGenerationBailout) return staticGenerationBailout.exports;
4476
+ hasRequiredStaticGenerationBailout = 1;
4477
+ (function (module, exports) {
4478
+ Object.defineProperty(exports, "__esModule", {
4479
+ value: true
4480
+ });
4481
+ function _export(target, all) {
4482
+ for(var name in all)Object.defineProperty(target, name, {
4483
+ enumerable: true,
4484
+ get: all[name]
4485
+ });
4486
+ }
4487
+ _export(exports, {
4488
+ StaticGenBailoutError: function() {
4489
+ return StaticGenBailoutError;
4490
+ },
4491
+ isStaticGenBailoutError: function() {
4492
+ return isStaticGenBailoutError;
4493
+ }
4494
+ });
4495
+ const NEXT_STATIC_GEN_BAILOUT = 'NEXT_STATIC_GEN_BAILOUT';
4496
+ class StaticGenBailoutError extends Error {
4497
+ constructor(...args){
4498
+ super(...args), this.code = NEXT_STATIC_GEN_BAILOUT;
4499
+ }
4500
+ }
4501
+ function isStaticGenBailoutError(error) {
4502
+ if (typeof error !== 'object' || error === null || !('code' in error)) {
4503
+ return false;
4504
+ }
4505
+ return error.code === NEXT_STATIC_GEN_BAILOUT;
4506
+ }
4507
+
4508
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
4509
+ Object.defineProperty(exports.default, '__esModule', { value: true });
4510
+ Object.assign(exports.default, exports);
4511
+ module.exports = exports.default;
4512
+ }
4513
+
4514
+
4515
+ } (staticGenerationBailout, staticGenerationBailout.exports));
4516
+ return staticGenerationBailout.exports;
4517
+ }
4518
+
4519
+ var workUnitAsyncStorage_external = {};
4520
+
4521
+ var workUnitAsyncStorageInstance = {};
4522
+
4523
+ var hasRequiredWorkUnitAsyncStorageInstance;
4524
+
4525
+ function requireWorkUnitAsyncStorageInstance () {
4526
+ if (hasRequiredWorkUnitAsyncStorageInstance) return workUnitAsyncStorageInstance;
4527
+ hasRequiredWorkUnitAsyncStorageInstance = 1;
4528
+ (function (exports) {
4529
+ Object.defineProperty(exports, "__esModule", {
4530
+ value: true
4531
+ });
4532
+ Object.defineProperty(exports, "workUnitAsyncStorageInstance", {
4533
+ enumerable: true,
4534
+ get: function() {
4535
+ return workUnitAsyncStorageInstance;
4536
+ }
4537
+ });
4538
+ const _asynclocalstorage = requireAsyncLocalStorage();
4539
+ const workUnitAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();
4540
+
4541
+
4542
+ } (workUnitAsyncStorageInstance));
4543
+ return workUnitAsyncStorageInstance;
4544
+ }
4545
+
4546
+ var appRouterHeaders = {exports: {}};
4547
+
4548
+ var hasRequiredAppRouterHeaders;
4549
+
4550
+ function requireAppRouterHeaders () {
4551
+ if (hasRequiredAppRouterHeaders) return appRouterHeaders.exports;
4552
+ hasRequiredAppRouterHeaders = 1;
4553
+ (function (module, exports) {
4554
+ Object.defineProperty(exports, "__esModule", {
4555
+ value: true
4556
+ });
4557
+ function _export(target, all) {
4558
+ for(var name in all)Object.defineProperty(target, name, {
4559
+ enumerable: true,
4560
+ get: all[name]
4561
+ });
4562
+ }
4563
+ _export(exports, {
4564
+ ACTION_HEADER: function() {
4565
+ return ACTION_HEADER;
4566
+ },
4567
+ FLIGHT_HEADERS: function() {
4568
+ return FLIGHT_HEADERS;
4569
+ },
4570
+ NEXT_DID_POSTPONE_HEADER: function() {
4571
+ return NEXT_DID_POSTPONE_HEADER;
4572
+ },
4573
+ NEXT_HMR_REFRESH_HASH_COOKIE: function() {
4574
+ return NEXT_HMR_REFRESH_HASH_COOKIE;
4575
+ },
4576
+ NEXT_HMR_REFRESH_HEADER: function() {
4577
+ return NEXT_HMR_REFRESH_HEADER;
4578
+ },
4579
+ NEXT_IS_PRERENDER_HEADER: function() {
4580
+ return NEXT_IS_PRERENDER_HEADER;
4581
+ },
4582
+ NEXT_REWRITTEN_PATH_HEADER: function() {
4583
+ return NEXT_REWRITTEN_PATH_HEADER;
4584
+ },
4585
+ NEXT_REWRITTEN_QUERY_HEADER: function() {
4586
+ return NEXT_REWRITTEN_QUERY_HEADER;
4587
+ },
4588
+ NEXT_ROUTER_PREFETCH_HEADER: function() {
4589
+ return NEXT_ROUTER_PREFETCH_HEADER;
4590
+ },
4591
+ NEXT_ROUTER_SEGMENT_PREFETCH_HEADER: function() {
4592
+ return NEXT_ROUTER_SEGMENT_PREFETCH_HEADER;
4593
+ },
4594
+ NEXT_ROUTER_STALE_TIME_HEADER: function() {
4595
+ return NEXT_ROUTER_STALE_TIME_HEADER;
4596
+ },
4597
+ NEXT_ROUTER_STATE_TREE_HEADER: function() {
4598
+ return NEXT_ROUTER_STATE_TREE_HEADER;
4599
+ },
4600
+ NEXT_RSC_UNION_QUERY: function() {
4601
+ return NEXT_RSC_UNION_QUERY;
4602
+ },
4603
+ NEXT_URL: function() {
4604
+ return NEXT_URL;
4605
+ },
4606
+ RSC_CONTENT_TYPE_HEADER: function() {
4607
+ return RSC_CONTENT_TYPE_HEADER;
4608
+ },
4609
+ RSC_HEADER: function() {
4610
+ return RSC_HEADER;
4611
+ }
4612
+ });
4613
+ const RSC_HEADER = 'RSC';
4614
+ const ACTION_HEADER = 'Next-Action';
4615
+ const NEXT_ROUTER_STATE_TREE_HEADER = 'Next-Router-State-Tree';
4616
+ const NEXT_ROUTER_PREFETCH_HEADER = 'Next-Router-Prefetch';
4617
+ const NEXT_ROUTER_SEGMENT_PREFETCH_HEADER = 'Next-Router-Segment-Prefetch';
4618
+ const NEXT_HMR_REFRESH_HEADER = 'Next-HMR-Refresh';
4619
+ const NEXT_HMR_REFRESH_HASH_COOKIE = '__next_hmr_refresh_hash__';
4620
+ const NEXT_URL = 'Next-Url';
4621
+ const RSC_CONTENT_TYPE_HEADER = 'text/x-component';
4622
+ const FLIGHT_HEADERS = [
4623
+ RSC_HEADER,
4624
+ NEXT_ROUTER_STATE_TREE_HEADER,
4625
+ NEXT_ROUTER_PREFETCH_HEADER,
4626
+ NEXT_HMR_REFRESH_HEADER,
4627
+ NEXT_ROUTER_SEGMENT_PREFETCH_HEADER
4628
+ ];
4629
+ const NEXT_RSC_UNION_QUERY = '_rsc';
4630
+ const NEXT_ROUTER_STALE_TIME_HEADER = 'x-nextjs-stale-time';
4631
+ const NEXT_DID_POSTPONE_HEADER = 'x-nextjs-postponed';
4632
+ const NEXT_REWRITTEN_PATH_HEADER = 'x-nextjs-rewritten-path';
4633
+ const NEXT_REWRITTEN_QUERY_HEADER = 'x-nextjs-rewritten-query';
4634
+ const NEXT_IS_PRERENDER_HEADER = 'x-nextjs-prerender';
4635
+
4636
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
4637
+ Object.defineProperty(exports.default, '__esModule', { value: true });
4638
+ Object.assign(exports.default, exports);
4639
+ module.exports = exports.default;
4640
+ }
4641
+
4642
+
4643
+ } (appRouterHeaders, appRouterHeaders.exports));
4644
+ return appRouterHeaders.exports;
4645
+ }
4646
+
4647
+ var hasRequiredWorkUnitAsyncStorage_external;
4648
+
4649
+ function requireWorkUnitAsyncStorage_external () {
4650
+ if (hasRequiredWorkUnitAsyncStorage_external) return workUnitAsyncStorage_external;
4651
+ hasRequiredWorkUnitAsyncStorage_external = 1;
4652
+ (function (exports) {
4653
+ Object.defineProperty(exports, "__esModule", {
4654
+ value: true
4655
+ });
4656
+ function _export(target, all) {
4657
+ for(var name in all)Object.defineProperty(target, name, {
4658
+ enumerable: true,
4659
+ get: all[name]
4660
+ });
4661
+ }
4662
+ _export(exports, {
4663
+ getDraftModeProviderForCacheScope: function() {
4664
+ return getDraftModeProviderForCacheScope;
4665
+ },
4666
+ getExpectedRequestStore: function() {
4667
+ return getExpectedRequestStore;
4668
+ },
4669
+ getHmrRefreshHash: function() {
4670
+ return getHmrRefreshHash;
4671
+ },
4672
+ getPrerenderResumeDataCache: function() {
4673
+ return getPrerenderResumeDataCache;
4674
+ },
4675
+ getRenderResumeDataCache: function() {
4676
+ return getRenderResumeDataCache;
4677
+ },
4678
+ throwForMissingRequestStore: function() {
4679
+ return throwForMissingRequestStore;
4680
+ },
4681
+ workUnitAsyncStorage: function() {
4682
+ return _workunitasyncstorageinstance.workUnitAsyncStorageInstance;
4683
+ }
4684
+ });
4685
+ const _workunitasyncstorageinstance = requireWorkUnitAsyncStorageInstance();
4686
+ const _approuterheaders = requireAppRouterHeaders();
4687
+ function getExpectedRequestStore(callingExpression) {
4688
+ const workUnitStore = _workunitasyncstorageinstance.workUnitAsyncStorageInstance.getStore();
4689
+ if (!workUnitStore) {
4690
+ throwForMissingRequestStore(callingExpression);
4691
+ }
4692
+ switch(workUnitStore.type){
4693
+ case 'request':
4694
+ return workUnitStore;
4695
+ case 'prerender':
4696
+ case 'prerender-ppr':
4697
+ case 'prerender-legacy':
4698
+ // This should not happen because we should have checked it already.
4699
+ throw Object.defineProperty(new Error(`\`${callingExpression}\` cannot be called inside a prerender. This is a bug in Next.js.`), "__NEXT_ERROR_CODE", {
4700
+ value: "E401",
4701
+ enumerable: false,
4702
+ configurable: true
4703
+ });
4704
+ case 'cache':
4705
+ throw Object.defineProperty(new Error(`\`${callingExpression}\` cannot be called inside "use cache". Call it outside and pass an argument instead. Read more: https://nextjs.org/docs/messages/next-request-in-use-cache`), "__NEXT_ERROR_CODE", {
4706
+ value: "E37",
4707
+ enumerable: false,
4708
+ configurable: true
4709
+ });
4710
+ case 'unstable-cache':
4711
+ throw Object.defineProperty(new Error(`\`${callingExpression}\` cannot be called inside unstable_cache. Call it outside and pass an argument instead. Read more: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`), "__NEXT_ERROR_CODE", {
4712
+ value: "E69",
4713
+ enumerable: false,
4714
+ configurable: true
4715
+ });
4716
+ default:
4717
+ const _exhaustiveCheck = workUnitStore;
4718
+ return _exhaustiveCheck;
4719
+ }
4720
+ }
4721
+ function throwForMissingRequestStore(callingExpression) {
4722
+ throw Object.defineProperty(new Error(`\`${callingExpression}\` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context`), "__NEXT_ERROR_CODE", {
4723
+ value: "E251",
4724
+ enumerable: false,
4725
+ configurable: true
4726
+ });
4727
+ }
4728
+ function getPrerenderResumeDataCache(workUnitStore) {
4729
+ if (workUnitStore.type === 'prerender' || workUnitStore.type === 'prerender-ppr') {
4730
+ return workUnitStore.prerenderResumeDataCache;
4731
+ }
4732
+ return null;
4733
+ }
4734
+ function getRenderResumeDataCache(workUnitStore) {
4735
+ if (workUnitStore.type !== 'prerender-legacy' && workUnitStore.type !== 'cache' && workUnitStore.type !== 'unstable-cache') {
4736
+ if (workUnitStore.type === 'request') {
4737
+ return workUnitStore.renderResumeDataCache;
4738
+ }
4739
+ // We return the mutable resume data cache here as an immutable version of
4740
+ // the cache as it can also be used for reading.
4741
+ return workUnitStore.prerenderResumeDataCache;
4742
+ }
4743
+ return null;
4744
+ }
4745
+ function getHmrRefreshHash(workStore, workUnitStore) {
4746
+ var _workUnitStore_cookies_get;
4747
+ if (!workStore.dev) {
4748
+ return undefined;
4749
+ }
4750
+ return workUnitStore.type === 'cache' || workUnitStore.type === 'prerender' ? workUnitStore.hmrRefreshHash : workUnitStore.type === 'request' ? (_workUnitStore_cookies_get = workUnitStore.cookies.get(_approuterheaders.NEXT_HMR_REFRESH_HASH_COOKIE)) == null ? void 0 : _workUnitStore_cookies_get.value : undefined;
4751
+ }
4752
+ function getDraftModeProviderForCacheScope(workStore, workUnitStore) {
4753
+ if (workStore.isDraftMode) {
4754
+ switch(workUnitStore.type){
4755
+ case 'cache':
4756
+ case 'unstable-cache':
4757
+ case 'request':
4758
+ return workUnitStore.draftMode;
4759
+ default:
4760
+ return undefined;
4761
+ }
4762
+ }
4763
+ return undefined;
4764
+ }
4765
+
4766
+
4767
+ } (workUnitAsyncStorage_external));
4768
+ return workUnitAsyncStorage_external;
4769
+ }
4770
+
4771
+ var workAsyncStorage_external = {};
4772
+
4773
+ var workAsyncStorageInstance = {};
4774
+
4775
+ var hasRequiredWorkAsyncStorageInstance;
4776
+
4777
+ function requireWorkAsyncStorageInstance () {
4778
+ if (hasRequiredWorkAsyncStorageInstance) return workAsyncStorageInstance;
4779
+ hasRequiredWorkAsyncStorageInstance = 1;
4780
+ (function (exports) {
4781
+ Object.defineProperty(exports, "__esModule", {
4782
+ value: true
4783
+ });
4784
+ Object.defineProperty(exports, "workAsyncStorageInstance", {
4785
+ enumerable: true,
4786
+ get: function() {
4787
+ return workAsyncStorageInstance;
4788
+ }
4789
+ });
4790
+ const _asynclocalstorage = requireAsyncLocalStorage();
4791
+ const workAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();
4792
+
4793
+
4794
+ } (workAsyncStorageInstance));
4795
+ return workAsyncStorageInstance;
4796
+ }
4797
+
4798
+ var hasRequiredWorkAsyncStorage_external;
4799
+
4800
+ function requireWorkAsyncStorage_external () {
4801
+ if (hasRequiredWorkAsyncStorage_external) return workAsyncStorage_external;
4802
+ hasRequiredWorkAsyncStorage_external = 1;
4803
+ (function (exports) {
4804
+ Object.defineProperty(exports, "__esModule", {
4805
+ value: true
4806
+ });
4807
+ Object.defineProperty(exports, "workAsyncStorage", {
4808
+ enumerable: true,
4809
+ get: function() {
4810
+ return _workasyncstorageinstance.workAsyncStorageInstance;
4811
+ }
4812
+ });
4813
+ const _workasyncstorageinstance = requireWorkAsyncStorageInstance();
4814
+
4815
+
4816
+ } (workAsyncStorage_external));
4817
+ return workAsyncStorage_external;
4818
+ }
4819
+
4820
+ var metadataConstants = {};
4821
+
4822
+ var hasRequiredMetadataConstants;
4823
+
4824
+ function requireMetadataConstants () {
4825
+ if (hasRequiredMetadataConstants) return metadataConstants;
4826
+ hasRequiredMetadataConstants = 1;
4827
+ (function (exports) {
4828
+ Object.defineProperty(exports, "__esModule", {
4829
+ value: true
4830
+ });
4831
+ function _export(target, all) {
4832
+ for(var name in all)Object.defineProperty(target, name, {
4833
+ enumerable: true,
4834
+ get: all[name]
4835
+ });
4836
+ }
4837
+ _export(exports, {
4838
+ METADATA_BOUNDARY_NAME: function() {
4839
+ return METADATA_BOUNDARY_NAME;
4840
+ },
4841
+ OUTLET_BOUNDARY_NAME: function() {
4842
+ return OUTLET_BOUNDARY_NAME;
4843
+ },
4844
+ VIEWPORT_BOUNDARY_NAME: function() {
4845
+ return VIEWPORT_BOUNDARY_NAME;
4846
+ }
4847
+ });
4848
+ const METADATA_BOUNDARY_NAME = '__next_metadata_boundary__';
4849
+ const VIEWPORT_BOUNDARY_NAME = '__next_viewport_boundary__';
4850
+ const OUTLET_BOUNDARY_NAME = '__next_outlet_boundary__';
4851
+
4852
+
4853
+ } (metadataConstants));
4854
+ return metadataConstants;
4855
+ }
4856
+
4857
+ var scheduler = {};
4858
+
4859
+ var hasRequiredScheduler;
4860
+
4861
+ function requireScheduler () {
4862
+ if (hasRequiredScheduler) return scheduler;
4863
+ hasRequiredScheduler = 1;
4864
+ (function (exports) {
4865
+ Object.defineProperty(exports, "__esModule", {
4866
+ value: true
4867
+ });
4868
+ function _export(target, all) {
4869
+ for(var name in all)Object.defineProperty(target, name, {
4870
+ enumerable: true,
4871
+ get: all[name]
4872
+ });
4873
+ }
4874
+ _export(exports, {
4875
+ atLeastOneTask: function() {
4876
+ return atLeastOneTask;
4877
+ },
4878
+ scheduleImmediate: function() {
4879
+ return scheduleImmediate;
4880
+ },
4881
+ scheduleOnNextTick: function() {
4882
+ return scheduleOnNextTick;
4883
+ },
4884
+ waitAtLeastOneReactRenderTask: function() {
4885
+ return waitAtLeastOneReactRenderTask;
4886
+ }
4887
+ });
4888
+ const scheduleOnNextTick = (cb)=>{
4889
+ // We use Promise.resolve().then() here so that the operation is scheduled at
4890
+ // the end of the promise job queue, we then add it to the next process tick
4891
+ // to ensure it's evaluated afterwards.
4892
+ //
4893
+ // This was inspired by the implementation of the DataLoader interface: https://github.com/graphql/dataloader/blob/d336bd15282664e0be4b4a657cb796f09bafbc6b/src/index.js#L213-L255
4894
+ //
4895
+ Promise.resolve().then(()=>{
4896
+ if (process.env.NEXT_RUNTIME === 'edge') {
4897
+ setTimeout(cb, 0);
4898
+ } else {
4899
+ process.nextTick(cb);
4900
+ }
4901
+ });
4902
+ };
4903
+ const scheduleImmediate = (cb)=>{
4904
+ if (process.env.NEXT_RUNTIME === 'edge') {
4905
+ setTimeout(cb, 0);
4906
+ } else {
4907
+ setImmediate(cb);
4908
+ }
4909
+ };
4910
+ function atLeastOneTask() {
4911
+ return new Promise((resolve)=>scheduleImmediate(resolve));
4912
+ }
4913
+ function waitAtLeastOneReactRenderTask() {
4914
+ if (process.env.NEXT_RUNTIME === 'edge') {
4915
+ return new Promise((r)=>setTimeout(r, 0));
4916
+ } else {
4917
+ return new Promise((r)=>setImmediate(r));
4918
+ }
4919
+ }
4920
+
4921
+
4922
+ } (scheduler));
4923
+ return scheduler;
4924
+ }
4925
+
4926
+ /**
4927
+ * The functions provided by this module are used to communicate certain properties
4928
+ * about the currently running code so that Next.js can make decisions on how to handle
4929
+ * the current execution in different rendering modes such as pre-rendering, resuming, and SSR.
4930
+ *
4931
+ * Today Next.js treats all code as potentially static. Certain APIs may only make sense when dynamically rendering.
4932
+ * Traditionally this meant deopting the entire render to dynamic however with PPR we can now deopt parts
4933
+ * of a React tree as dynamic while still keeping other parts static. There are really two different kinds of
4934
+ * Dynamic indications.
4935
+ *
4936
+ * The first is simply an intention to be dynamic. unstable_noStore is an example of this where
4937
+ * the currently executing code simply declares that the current scope is dynamic but if you use it
4938
+ * inside unstable_cache it can still be cached. This type of indication can be removed if we ever
4939
+ * make the default dynamic to begin with because the only way you would ever be static is inside
4940
+ * a cache scope which this indication does not affect.
4941
+ *
4942
+ * The second is an indication that a dynamic data source was read. This is a stronger form of dynamic
4943
+ * because it means that it is inappropriate to cache this at all. using a dynamic data source inside
4944
+ * unstable_cache should error. If you want to use some dynamic data inside unstable_cache you should
4945
+ * read that data outside the cache and pass it in as an argument to the cached function.
4946
+ */
4947
+
4948
+ var hasRequiredDynamicRendering;
4949
+
4950
+ function requireDynamicRendering () {
4951
+ if (hasRequiredDynamicRendering) return dynamicRendering;
4952
+ hasRequiredDynamicRendering = 1;
4953
+ (function (exports) {
4954
+ Object.defineProperty(exports, "__esModule", {
4955
+ value: true
4956
+ });
4957
+ function _export(target, all) {
4958
+ for(var name in all)Object.defineProperty(target, name, {
4959
+ enumerable: true,
4960
+ get: all[name]
4961
+ });
4962
+ }
4963
+ _export(exports, {
4964
+ Postpone: function() {
4965
+ return Postpone;
4966
+ },
4967
+ abortAndThrowOnSynchronousRequestDataAccess: function() {
4968
+ return abortAndThrowOnSynchronousRequestDataAccess;
4969
+ },
4970
+ abortOnSynchronousPlatformIOAccess: function() {
4971
+ return abortOnSynchronousPlatformIOAccess;
4972
+ },
4973
+ accessedDynamicData: function() {
4974
+ return accessedDynamicData;
4975
+ },
4976
+ annotateDynamicAccess: function() {
4977
+ return annotateDynamicAccess;
4978
+ },
4979
+ consumeDynamicAccess: function() {
4980
+ return consumeDynamicAccess;
4981
+ },
4982
+ createDynamicTrackingState: function() {
4983
+ return createDynamicTrackingState;
4984
+ },
4985
+ createDynamicValidationState: function() {
4986
+ return createDynamicValidationState;
4987
+ },
4988
+ createHangingInputAbortSignal: function() {
4989
+ return createHangingInputAbortSignal;
4990
+ },
4991
+ createPostponedAbortSignal: function() {
4992
+ return createPostponedAbortSignal;
4993
+ },
4994
+ formatDynamicAPIAccesses: function() {
4995
+ return formatDynamicAPIAccesses;
4996
+ },
4997
+ getFirstDynamicReason: function() {
4998
+ return getFirstDynamicReason;
4999
+ },
5000
+ isDynamicPostpone: function() {
5001
+ return isDynamicPostpone;
5002
+ },
5003
+ isPrerenderInterruptedError: function() {
5004
+ return isPrerenderInterruptedError;
5005
+ },
5006
+ markCurrentScopeAsDynamic: function() {
5007
+ return markCurrentScopeAsDynamic;
5008
+ },
5009
+ postponeWithTracking: function() {
5010
+ return postponeWithTracking;
5011
+ },
5012
+ throwIfDisallowedDynamic: function() {
5013
+ return throwIfDisallowedDynamic;
5014
+ },
5015
+ throwToInterruptStaticGeneration: function() {
5016
+ return throwToInterruptStaticGeneration;
5017
+ },
5018
+ trackAllowedDynamicAccess: function() {
5019
+ return trackAllowedDynamicAccess;
5020
+ },
5021
+ trackDynamicDataInDynamicRender: function() {
5022
+ return trackDynamicDataInDynamicRender;
5023
+ },
5024
+ trackFallbackParamAccessed: function() {
5025
+ return trackFallbackParamAccessed;
5026
+ },
5027
+ trackSynchronousPlatformIOAccessInDev: function() {
5028
+ return trackSynchronousPlatformIOAccessInDev;
5029
+ },
5030
+ trackSynchronousRequestDataAccessInDev: function() {
5031
+ return trackSynchronousRequestDataAccessInDev;
5032
+ },
5033
+ useDynamicRouteParams: function() {
5034
+ return useDynamicRouteParams;
5035
+ }
5036
+ });
5037
+ const _react = /*#__PURE__*/ _interop_require_default(require$$0);
5038
+ const _hooksservercontext = requireHooksServerContext();
5039
+ const _staticgenerationbailout = requireStaticGenerationBailout();
5040
+ const _workunitasyncstorageexternal = requireWorkUnitAsyncStorage_external();
5041
+ const _workasyncstorageexternal = requireWorkAsyncStorage_external();
5042
+ const _dynamicrenderingutils = requireDynamicRenderingUtils();
5043
+ const _metadataconstants = requireMetadataConstants();
5044
+ const _scheduler = requireScheduler();
5045
+ function _interop_require_default(obj) {
5046
+ return obj && obj.__esModule ? obj : {
5047
+ default: obj
5048
+ };
5049
+ }
5050
+ const hasPostpone = typeof _react.default.unstable_postpone === 'function';
5051
+ function createDynamicTrackingState(isDebugDynamicAccesses) {
5052
+ return {
5053
+ isDebugDynamicAccesses,
5054
+ dynamicAccesses: [],
5055
+ syncDynamicExpression: undefined,
5056
+ syncDynamicErrorWithStack: null
5057
+ };
5058
+ }
5059
+ function createDynamicValidationState() {
5060
+ return {
5061
+ hasSuspendedDynamic: false,
5062
+ hasDynamicMetadata: false,
5063
+ hasDynamicViewport: false,
5064
+ hasSyncDynamicErrors: false,
5065
+ dynamicErrors: []
5066
+ };
5067
+ }
5068
+ function getFirstDynamicReason(trackingState) {
5069
+ var _trackingState_dynamicAccesses_;
5070
+ return (_trackingState_dynamicAccesses_ = trackingState.dynamicAccesses[0]) == null ? void 0 : _trackingState_dynamicAccesses_.expression;
5071
+ }
5072
+ function markCurrentScopeAsDynamic(store, workUnitStore, expression) {
5073
+ if (workUnitStore) {
5074
+ if (workUnitStore.type === 'cache' || workUnitStore.type === 'unstable-cache') {
5075
+ // inside cache scopes marking a scope as dynamic has no effect because the outer cache scope
5076
+ // creates a cache boundary. This is subtly different from reading a dynamic data source which is
5077
+ // forbidden inside a cache scope.
5078
+ return;
5079
+ }
5080
+ }
5081
+ // If we're forcing dynamic rendering or we're forcing static rendering, we
5082
+ // don't need to do anything here because the entire page is already dynamic
5083
+ // or it's static and it should not throw or postpone here.
5084
+ if (store.forceDynamic || store.forceStatic) return;
5085
+ if (store.dynamicShouldError) {
5086
+ throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route ${store.route} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${expression}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`), "__NEXT_ERROR_CODE", {
5087
+ value: "E553",
5088
+ enumerable: false,
5089
+ configurable: true
5090
+ });
5091
+ }
5092
+ if (workUnitStore) {
5093
+ if (workUnitStore.type === 'prerender-ppr') {
5094
+ postponeWithTracking(store.route, expression, workUnitStore.dynamicTracking);
5095
+ } else if (workUnitStore.type === 'prerender-legacy') {
5096
+ workUnitStore.revalidate = 0;
5097
+ // We aren't prerendering but we are generating a static page. We need to bail out of static generation
5098
+ const err = Object.defineProperty(new _hooksservercontext.DynamicServerError(`Route ${store.route} couldn't be rendered statically because it used ${expression}. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`), "__NEXT_ERROR_CODE", {
5099
+ value: "E550",
5100
+ enumerable: false,
5101
+ configurable: true
5102
+ });
5103
+ store.dynamicUsageDescription = expression;
5104
+ store.dynamicUsageStack = err.stack;
5105
+ throw err;
5106
+ } else if (process.env.NODE_ENV === 'development' && workUnitStore && workUnitStore.type === 'request') {
5107
+ workUnitStore.usedDynamic = true;
5108
+ }
5109
+ }
5110
+ }
5111
+ function trackFallbackParamAccessed(store, expression) {
5112
+ const prerenderStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
5113
+ if (!prerenderStore || prerenderStore.type !== 'prerender-ppr') return;
5114
+ postponeWithTracking(store.route, expression, prerenderStore.dynamicTracking);
5115
+ }
5116
+ function throwToInterruptStaticGeneration(expression, store, prerenderStore) {
5117
+ // We aren't prerendering but we are generating a static page. We need to bail out of static generation
5118
+ const err = Object.defineProperty(new _hooksservercontext.DynamicServerError(`Route ${store.route} couldn't be rendered statically because it used \`${expression}\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`), "__NEXT_ERROR_CODE", {
5119
+ value: "E558",
5120
+ enumerable: false,
5121
+ configurable: true
5122
+ });
5123
+ prerenderStore.revalidate = 0;
5124
+ store.dynamicUsageDescription = expression;
5125
+ store.dynamicUsageStack = err.stack;
5126
+ throw err;
5127
+ }
5128
+ function trackDynamicDataInDynamicRender(_store, workUnitStore) {
5129
+ if (workUnitStore) {
5130
+ if (workUnitStore.type === 'cache' || workUnitStore.type === 'unstable-cache') {
5131
+ // inside cache scopes marking a scope as dynamic has no effect because the outer cache scope
5132
+ // creates a cache boundary. This is subtly different from reading a dynamic data source which is
5133
+ // forbidden inside a cache scope.
5134
+ return;
5135
+ }
5136
+ if (workUnitStore.type === 'prerender' || workUnitStore.type === 'prerender-legacy') {
5137
+ workUnitStore.revalidate = 0;
5138
+ }
5139
+ if (process.env.NODE_ENV === 'development' && workUnitStore.type === 'request') {
5140
+ workUnitStore.usedDynamic = true;
5141
+ }
5142
+ }
5143
+ }
5144
+ // Despite it's name we don't actually abort unless we have a controller to call abort on
5145
+ // There are times when we let a prerender run long to discover caches where we want the semantics
5146
+ // of tracking dynamic access without terminating the prerender early
5147
+ function abortOnSynchronousDynamicDataAccess(route, expression, prerenderStore) {
5148
+ const reason = `Route ${route} needs to bail out of prerendering at this point because it used ${expression}.`;
5149
+ const error = createPrerenderInterruptedError(reason);
5150
+ prerenderStore.controller.abort(error);
5151
+ const dynamicTracking = prerenderStore.dynamicTracking;
5152
+ if (dynamicTracking) {
5153
+ dynamicTracking.dynamicAccesses.push({
5154
+ // When we aren't debugging, we don't need to create another error for the
5155
+ // stack trace.
5156
+ stack: dynamicTracking.isDebugDynamicAccesses ? new Error().stack : undefined,
5157
+ expression
5158
+ });
5159
+ }
5160
+ }
5161
+ function abortOnSynchronousPlatformIOAccess(route, expression, errorWithStack, prerenderStore) {
5162
+ const dynamicTracking = prerenderStore.dynamicTracking;
5163
+ if (dynamicTracking) {
5164
+ if (dynamicTracking.syncDynamicErrorWithStack === null) {
5165
+ dynamicTracking.syncDynamicExpression = expression;
5166
+ dynamicTracking.syncDynamicErrorWithStack = errorWithStack;
5167
+ }
5168
+ }
5169
+ abortOnSynchronousDynamicDataAccess(route, expression, prerenderStore);
5170
+ }
5171
+ function trackSynchronousPlatformIOAccessInDev(requestStore) {
5172
+ // We don't actually have a controller to abort but we do the semantic equivalent by
5173
+ // advancing the request store out of prerender mode
5174
+ requestStore.prerenderPhase = false;
5175
+ }
5176
+ function abortAndThrowOnSynchronousRequestDataAccess(route, expression, errorWithStack, prerenderStore) {
5177
+ const prerenderSignal = prerenderStore.controller.signal;
5178
+ if (prerenderSignal.aborted === false) {
5179
+ // TODO it would be better to move this aborted check into the callsite so we can avoid making
5180
+ // the error object when it isn't relevant to the aborting of the prerender however
5181
+ // since we need the throw semantics regardless of whether we abort it is easier to land
5182
+ // this way. See how this was handled with `abortOnSynchronousPlatformIOAccess` for a closer
5183
+ // to ideal implementation
5184
+ const dynamicTracking = prerenderStore.dynamicTracking;
5185
+ if (dynamicTracking) {
5186
+ if (dynamicTracking.syncDynamicErrorWithStack === null) {
5187
+ dynamicTracking.syncDynamicExpression = expression;
5188
+ dynamicTracking.syncDynamicErrorWithStack = errorWithStack;
5189
+ if (prerenderStore.validating === true) {
5190
+ // We always log Request Access in dev at the point of calling the function
5191
+ // So we mark the dynamic validation as not requiring it to be printed
5192
+ dynamicTracking.syncDynamicLogged = true;
5193
+ }
5194
+ }
5195
+ }
5196
+ abortOnSynchronousDynamicDataAccess(route, expression, prerenderStore);
5197
+ }
5198
+ throw createPrerenderInterruptedError(`Route ${route} needs to bail out of prerendering at this point because it used ${expression}.`);
5199
+ }
5200
+ const trackSynchronousRequestDataAccessInDev = trackSynchronousPlatformIOAccessInDev;
5201
+ function Postpone({ reason, route }) {
5202
+ const prerenderStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
5203
+ const dynamicTracking = prerenderStore && prerenderStore.type === 'prerender-ppr' ? prerenderStore.dynamicTracking : null;
5204
+ postponeWithTracking(route, reason, dynamicTracking);
5205
+ }
5206
+ function postponeWithTracking(route, expression, dynamicTracking) {
5207
+ assertPostpone();
5208
+ if (dynamicTracking) {
5209
+ dynamicTracking.dynamicAccesses.push({
5210
+ // When we aren't debugging, we don't need to create another error for the
5211
+ // stack trace.
5212
+ stack: dynamicTracking.isDebugDynamicAccesses ? new Error().stack : undefined,
5213
+ expression
5214
+ });
5215
+ }
5216
+ _react.default.unstable_postpone(createPostponeReason(route, expression));
5217
+ }
5218
+ function createPostponeReason(route, expression) {
5219
+ return `Route ${route} needs to bail out of prerendering at this point because it used ${expression}. ` + `React throws this special object to indicate where. It should not be caught by ` + `your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error`;
5220
+ }
5221
+ function isDynamicPostpone(err) {
5222
+ if (typeof err === 'object' && err !== null && typeof err.message === 'string') {
5223
+ return isDynamicPostponeReason(err.message);
5224
+ }
5225
+ return false;
5226
+ }
5227
+ function isDynamicPostponeReason(reason) {
5228
+ return reason.includes('needs to bail out of prerendering at this point because it used') && reason.includes('Learn more: https://nextjs.org/docs/messages/ppr-caught-error');
5229
+ }
5230
+ if (isDynamicPostponeReason(createPostponeReason('%%%', '^^^')) === false) {
5231
+ throw Object.defineProperty(new Error('Invariant: isDynamicPostpone misidentified a postpone reason. This is a bug in Next.js'), "__NEXT_ERROR_CODE", {
5232
+ value: "E296",
5233
+ enumerable: false,
5234
+ configurable: true
5235
+ });
5236
+ }
5237
+ const NEXT_PRERENDER_INTERRUPTED = 'NEXT_PRERENDER_INTERRUPTED';
5238
+ function createPrerenderInterruptedError(message) {
5239
+ const error = Object.defineProperty(new Error(message), "__NEXT_ERROR_CODE", {
5240
+ value: "E394",
5241
+ enumerable: false,
5242
+ configurable: true
5243
+ });
5244
+ error.digest = NEXT_PRERENDER_INTERRUPTED;
5245
+ return error;
5246
+ }
5247
+ function isPrerenderInterruptedError(error) {
5248
+ return typeof error === 'object' && error !== null && error.digest === NEXT_PRERENDER_INTERRUPTED && 'name' in error && 'message' in error && error instanceof Error;
5249
+ }
5250
+ function accessedDynamicData(dynamicAccesses) {
5251
+ return dynamicAccesses.length > 0;
5252
+ }
5253
+ function consumeDynamicAccess(serverDynamic, clientDynamic) {
5254
+ // We mutate because we only call this once we are no longer writing
5255
+ // to the dynamicTrackingState and it's more efficient than creating a new
5256
+ // array.
5257
+ serverDynamic.dynamicAccesses.push(...clientDynamic.dynamicAccesses);
5258
+ return serverDynamic.dynamicAccesses;
5259
+ }
5260
+ function formatDynamicAPIAccesses(dynamicAccesses) {
5261
+ return dynamicAccesses.filter((access)=>typeof access.stack === 'string' && access.stack.length > 0).map(({ expression, stack })=>{
5262
+ stack = stack.split('\n')// Remove the "Error: " prefix from the first line of the stack trace as
5263
+ // well as the first 4 lines of the stack trace which is the distance
5264
+ // from the user code and the `new Error().stack` call.
5265
+ .slice(4).filter((line)=>{
5266
+ // Exclude Next.js internals from the stack trace.
5267
+ if (line.includes('node_modules/next/')) {
5268
+ return false;
5269
+ }
5270
+ // Exclude anonymous functions from the stack trace.
5271
+ if (line.includes(' (<anonymous>)')) {
5272
+ return false;
5273
+ }
5274
+ // Exclude Node.js internals from the stack trace.
5275
+ if (line.includes(' (node:')) {
5276
+ return false;
5277
+ }
5278
+ return true;
5279
+ }).join('\n');
5280
+ return `Dynamic API Usage Debug - ${expression}:\n${stack}`;
5281
+ });
5282
+ }
5283
+ function assertPostpone() {
5284
+ if (!hasPostpone) {
5285
+ throw Object.defineProperty(new Error(`Invariant: React.unstable_postpone is not defined. This suggests the wrong version of React was loaded. This is a bug in Next.js`), "__NEXT_ERROR_CODE", {
5286
+ value: "E224",
5287
+ enumerable: false,
5288
+ configurable: true
5289
+ });
5290
+ }
5291
+ }
5292
+ function createPostponedAbortSignal(reason) {
5293
+ assertPostpone();
5294
+ const controller = new AbortController();
5295
+ // We get our hands on a postpone instance by calling postpone and catching the throw
5296
+ try {
5297
+ _react.default.unstable_postpone(reason);
5298
+ } catch (x) {
5299
+ controller.abort(x);
5300
+ }
5301
+ return controller.signal;
5302
+ }
5303
+ function createHangingInputAbortSignal(workUnitStore) {
5304
+ const controller = new AbortController();
5305
+ if (workUnitStore.cacheSignal) {
5306
+ // If we have a cacheSignal it means we're in a prospective render. If the input
5307
+ // we're waiting on is coming from another cache, we do want to wait for it so that
5308
+ // we can resolve this cache entry too.
5309
+ workUnitStore.cacheSignal.inputReady().then(()=>{
5310
+ controller.abort();
5311
+ });
5312
+ } else {
5313
+ // Otherwise we're in the final render and we should already have all our caches
5314
+ // filled. We might still be waiting on some microtasks so we wait one tick before
5315
+ // giving up. When we give up, we still want to render the content of this cache
5316
+ // as deeply as we can so that we can suspend as deeply as possible in the tree
5317
+ // or not at all if we don't end up waiting for the input.
5318
+ (0, _scheduler.scheduleOnNextTick)(()=>controller.abort());
5319
+ }
5320
+ return controller.signal;
5321
+ }
5322
+ function annotateDynamicAccess(expression, prerenderStore) {
5323
+ const dynamicTracking = prerenderStore.dynamicTracking;
5324
+ if (dynamicTracking) {
5325
+ dynamicTracking.dynamicAccesses.push({
5326
+ stack: dynamicTracking.isDebugDynamicAccesses ? new Error().stack : undefined,
5327
+ expression
5328
+ });
5329
+ }
5330
+ }
5331
+ function useDynamicRouteParams(expression) {
5332
+ const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
5333
+ if (workStore && workStore.isStaticGeneration && workStore.fallbackRouteParams && workStore.fallbackRouteParams.size > 0) {
5334
+ // There are fallback route params, we should track these as dynamic
5335
+ // accesses.
5336
+ const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
5337
+ if (workUnitStore) {
5338
+ // We're prerendering with dynamicIO or PPR or both
5339
+ if (workUnitStore.type === 'prerender') {
5340
+ // We are in a prerender with dynamicIO semantics
5341
+ // We are going to hang here and never resolve. This will cause the currently
5342
+ // rendering component to effectively be a dynamic hole
5343
+ _react.default.use((0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, expression));
5344
+ } else if (workUnitStore.type === 'prerender-ppr') {
5345
+ // We're prerendering with PPR
5346
+ postponeWithTracking(workStore.route, expression, workUnitStore.dynamicTracking);
5347
+ } else if (workUnitStore.type === 'prerender-legacy') {
5348
+ throwToInterruptStaticGeneration(expression, workStore, workUnitStore);
5349
+ }
5350
+ }
5351
+ }
5352
+ }
5353
+ const hasSuspenseRegex = /\n\s+at Suspense \(<anonymous>\)/;
5354
+ const hasMetadataRegex = new RegExp(`\\n\\s+at ${_metadataconstants.METADATA_BOUNDARY_NAME}[\\n\\s]`);
5355
+ const hasViewportRegex = new RegExp(`\\n\\s+at ${_metadataconstants.VIEWPORT_BOUNDARY_NAME}[\\n\\s]`);
5356
+ const hasOutletRegex = new RegExp(`\\n\\s+at ${_metadataconstants.OUTLET_BOUNDARY_NAME}[\\n\\s]`);
5357
+ function trackAllowedDynamicAccess(route, componentStack, dynamicValidation, serverDynamic, clientDynamic) {
5358
+ if (hasOutletRegex.test(componentStack)) {
5359
+ // We don't need to track that this is dynamic. It is only so when something else is also dynamic.
5360
+ return;
5361
+ } else if (hasMetadataRegex.test(componentStack)) {
5362
+ dynamicValidation.hasDynamicMetadata = true;
5363
+ return;
5364
+ } else if (hasViewportRegex.test(componentStack)) {
5365
+ dynamicValidation.hasDynamicViewport = true;
5366
+ return;
5367
+ } else if (hasSuspenseRegex.test(componentStack)) {
5368
+ dynamicValidation.hasSuspendedDynamic = true;
5369
+ return;
5370
+ } else if (serverDynamic.syncDynamicErrorWithStack || clientDynamic.syncDynamicErrorWithStack) {
5371
+ dynamicValidation.hasSyncDynamicErrors = true;
5372
+ return;
5373
+ } else {
5374
+ const message = `Route "${route}": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it. We don't have the exact line number added to error messages yet but you can see which component in the stack below. See more info: https://nextjs.org/docs/messages/next-prerender-missing-suspense`;
5375
+ const error = createErrorWithComponentStack(message, componentStack);
5376
+ dynamicValidation.dynamicErrors.push(error);
5377
+ return;
5378
+ }
5379
+ }
5380
+ function createErrorWithComponentStack(message, componentStack) {
5381
+ const error = Object.defineProperty(new Error(message), "__NEXT_ERROR_CODE", {
5382
+ value: "E394",
5383
+ enumerable: false,
5384
+ configurable: true
5385
+ });
5386
+ error.stack = 'Error: ' + message + componentStack;
5387
+ return error;
5388
+ }
5389
+ function throwIfDisallowedDynamic(route, dynamicValidation, serverDynamic, clientDynamic) {
5390
+ let syncError;
5391
+ let syncExpression;
5392
+ let syncLogged;
5393
+ if (serverDynamic.syncDynamicErrorWithStack) {
5394
+ syncError = serverDynamic.syncDynamicErrorWithStack;
5395
+ syncExpression = serverDynamic.syncDynamicExpression;
5396
+ syncLogged = serverDynamic.syncDynamicLogged === true;
5397
+ } else if (clientDynamic.syncDynamicErrorWithStack) {
5398
+ syncError = clientDynamic.syncDynamicErrorWithStack;
5399
+ syncExpression = clientDynamic.syncDynamicExpression;
5400
+ syncLogged = clientDynamic.syncDynamicLogged === true;
5401
+ } else {
5402
+ syncError = null;
5403
+ syncExpression = undefined;
5404
+ syncLogged = false;
5405
+ }
5406
+ if (dynamicValidation.hasSyncDynamicErrors && syncError) {
5407
+ if (!syncLogged) {
5408
+ // In dev we already log errors about sync dynamic access. But during builds we need to ensure
5409
+ // the offending sync error is logged before we exit the build
5410
+ console.error(syncError);
5411
+ }
5412
+ // The actual error should have been logged when the sync access ocurred
5413
+ throw new _staticgenerationbailout.StaticGenBailoutError();
5414
+ }
5415
+ const dynamicErrors = dynamicValidation.dynamicErrors;
5416
+ if (dynamicErrors.length) {
5417
+ for(let i = 0; i < dynamicErrors.length; i++){
5418
+ console.error(dynamicErrors[i]);
5419
+ }
5420
+ throw new _staticgenerationbailout.StaticGenBailoutError();
5421
+ }
5422
+ if (!dynamicValidation.hasSuspendedDynamic) {
5423
+ if (dynamicValidation.hasDynamicMetadata) {
5424
+ if (syncError) {
5425
+ console.error(syncError);
5426
+ throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route "${route}" has a \`generateMetadata\` that could not finish rendering before ${syncExpression} was used. Follow the instructions in the error for this expression to resolve.`), "__NEXT_ERROR_CODE", {
5427
+ value: "E608",
5428
+ enumerable: false,
5429
+ configurable: true
5430
+ });
5431
+ }
5432
+ throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route "${route}" has a \`generateMetadata\` that depends on Request data (\`cookies()\`, etc...) or external data (\`fetch(...)\`, etc...) but the rest of the route was static or only used cached data (\`"use cache"\`). If you expected this route to be prerenderable update your \`generateMetadata\` to not use Request data and only use cached external data. Otherwise, add \`await connection()\` somewhere within this route to indicate explicitly it should not be prerendered.`), "__NEXT_ERROR_CODE", {
5433
+ value: "E534",
5434
+ enumerable: false,
5435
+ configurable: true
5436
+ });
5437
+ } else if (dynamicValidation.hasDynamicViewport) {
5438
+ if (syncError) {
5439
+ console.error(syncError);
5440
+ throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route "${route}" has a \`generateViewport\` that could not finish rendering before ${syncExpression} was used. Follow the instructions in the error for this expression to resolve.`), "__NEXT_ERROR_CODE", {
5441
+ value: "E573",
5442
+ enumerable: false,
5443
+ configurable: true
5444
+ });
5445
+ }
5446
+ throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route "${route}" has a \`generateViewport\` that depends on Request data (\`cookies()\`, etc...) or external data (\`fetch(...)\`, etc...) but the rest of the route was static or only used cached data (\`"use cache"\`). If you expected this route to be prerenderable update your \`generateViewport\` to not use Request data and only use cached external data. Otherwise, add \`await connection()\` somewhere within this route to indicate explicitly it should not be prerendered.`), "__NEXT_ERROR_CODE", {
5447
+ value: "E590",
5448
+ enumerable: false,
5449
+ configurable: true
5450
+ });
5451
+ }
5452
+ }
5453
+ }
5454
+
5455
+
5456
+ } (dynamicRendering));
5457
+ return dynamicRendering;
5458
+ }
5459
+
5460
+ var hasRequiredUnstableRethrow_server;
5461
+
5462
+ function requireUnstableRethrow_server () {
5463
+ if (hasRequiredUnstableRethrow_server) return unstableRethrow_server.exports;
5464
+ hasRequiredUnstableRethrow_server = 1;
5465
+ (function (module, exports) {
5466
+ Object.defineProperty(exports, "__esModule", {
5467
+ value: true
5468
+ });
5469
+ Object.defineProperty(exports, "unstable_rethrow", {
5470
+ enumerable: true,
5471
+ get: function() {
5472
+ return unstable_rethrow;
5473
+ }
5474
+ });
5475
+ const _dynamicrenderingutils = requireDynamicRenderingUtils();
5476
+ const _ispostpone = requireIsPostpone();
5477
+ const _bailouttocsr = requireBailoutToCsr();
5478
+ const _isnextroutererror = requireIsNextRouterError();
5479
+ const _dynamicrendering = requireDynamicRendering();
5480
+ const _hooksservercontext = requireHooksServerContext();
5481
+ function unstable_rethrow(error) {
5482
+ if ((0, _isnextroutererror.isNextRouterError)(error) || (0, _bailouttocsr.isBailoutToCSRError)(error) || (0, _hooksservercontext.isDynamicServerError)(error) || (0, _dynamicrendering.isDynamicPostpone)(error) || (0, _ispostpone.isPostpone)(error) || (0, _dynamicrenderingutils.isHangingPromiseRejectionError)(error)) {
5483
+ throw error;
5484
+ }
5485
+ if (error instanceof Error && 'cause' in error) {
5486
+ unstable_rethrow(error.cause);
5487
+ }
5488
+ }
5489
+
5490
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
5491
+ Object.defineProperty(exports.default, '__esModule', { value: true });
5492
+ Object.assign(exports.default, exports);
5493
+ module.exports = exports.default;
5494
+ }
5495
+
5496
+
5497
+ } (unstableRethrow_server, unstableRethrow_server.exports));
5498
+ return unstableRethrow_server.exports;
5499
+ }
5500
+
5501
+ var unstableRethrow_browser = {exports: {}};
5502
+
5503
+ var hasRequiredUnstableRethrow_browser;
5504
+
5505
+ function requireUnstableRethrow_browser () {
5506
+ if (hasRequiredUnstableRethrow_browser) return unstableRethrow_browser.exports;
5507
+ hasRequiredUnstableRethrow_browser = 1;
5508
+ (function (module, exports) {
5509
+ Object.defineProperty(exports, "__esModule", {
5510
+ value: true
5511
+ });
5512
+ Object.defineProperty(exports, "unstable_rethrow", {
5513
+ enumerable: true,
5514
+ get: function() {
5515
+ return unstable_rethrow;
5516
+ }
5517
+ });
5518
+ const _bailouttocsr = requireBailoutToCsr();
5519
+ const _isnextroutererror = requireIsNextRouterError();
5520
+ function unstable_rethrow(error) {
5521
+ if ((0, _isnextroutererror.isNextRouterError)(error) || (0, _bailouttocsr.isBailoutToCSRError)(error)) {
5522
+ throw error;
5523
+ }
5524
+ if (error instanceof Error && 'cause' in error) {
5525
+ unstable_rethrow(error.cause);
5526
+ }
5527
+ }
5528
+
5529
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
5530
+ Object.defineProperty(exports.default, '__esModule', { value: true });
5531
+ Object.assign(exports.default, exports);
5532
+ module.exports = exports.default;
5533
+ }
5534
+
5535
+
5536
+ } (unstableRethrow_browser, unstableRethrow_browser.exports));
5537
+ return unstableRethrow_browser.exports;
5538
+ }
5539
+
5540
+ /**
5541
+ * This function should be used to rethrow internal Next.js errors so that they can be handled by the framework.
5542
+ * When wrapping an API that uses errors to interrupt control flow, you should use this function before you do any error handling.
5543
+ * This function will rethrow the error if it is a Next.js error so it can be handled, otherwise it will do nothing.
5544
+ *
5545
+ * Read more: [Next.js Docs: `unstable_rethrow`](https://nextjs.org/docs/app/api-reference/functions/unstable_rethrow)
5546
+ */
5547
+
5548
+ var hasRequiredUnstableRethrow;
5549
+
5550
+ function requireUnstableRethrow () {
5551
+ if (hasRequiredUnstableRethrow) return unstableRethrow.exports;
5552
+ hasRequiredUnstableRethrow = 1;
5553
+ (function (module, exports) {
5554
+ Object.defineProperty(exports, "__esModule", {
5555
+ value: true
5556
+ });
5557
+ Object.defineProperty(exports, "unstable_rethrow", {
5558
+ enumerable: true,
5559
+ get: function() {
5560
+ return unstable_rethrow;
5561
+ }
5562
+ });
5563
+ const unstable_rethrow = typeof window === 'undefined' ? requireUnstableRethrow_server().unstable_rethrow : requireUnstableRethrow_browser().unstable_rethrow;
5564
+
5565
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
5566
+ Object.defineProperty(exports.default, '__esModule', { value: true });
5567
+ Object.assign(exports.default, exports);
5568
+ module.exports = exports.default;
5569
+ }
5570
+
5571
+
5572
+ } (unstableRethrow, unstableRethrow.exports));
5573
+ return unstableRethrow.exports;
5574
+ }
5575
+
5576
+ /** @internal */
5577
+
5578
+ var hasRequiredNavigation_reactServer;
5579
+
5580
+ function requireNavigation_reactServer () {
5581
+ if (hasRequiredNavigation_reactServer) return navigation_reactServer.exports;
5582
+ hasRequiredNavigation_reactServer = 1;
5583
+ (function (module, exports) {
5584
+ Object.defineProperty(exports, "__esModule", {
5585
+ value: true
5586
+ });
5587
+ function _export(target, all) {
5588
+ for(var name in all)Object.defineProperty(target, name, {
5589
+ enumerable: true,
5590
+ get: all[name]
5591
+ });
5592
+ }
5593
+ _export(exports, {
5594
+ ReadonlyURLSearchParams: function() {
5595
+ return ReadonlyURLSearchParams;
5596
+ },
5597
+ RedirectType: function() {
5598
+ return _redirecterror.RedirectType;
5599
+ },
5600
+ forbidden: function() {
5601
+ return _forbidden.forbidden;
5602
+ },
5603
+ notFound: function() {
5604
+ return _notfound.notFound;
5605
+ },
5606
+ permanentRedirect: function() {
5607
+ return _redirect.permanentRedirect;
5608
+ },
5609
+ redirect: function() {
5610
+ return _redirect.redirect;
5611
+ },
5612
+ unauthorized: function() {
5613
+ return _unauthorized.unauthorized;
5614
+ },
5615
+ unstable_rethrow: function() {
5616
+ return _unstablerethrow.unstable_rethrow;
5617
+ }
5618
+ });
5619
+ const _redirect = requireRedirect();
5620
+ const _redirecterror = requireRedirectError();
5621
+ const _notfound = requireNotFound();
5622
+ const _forbidden = requireForbidden();
5623
+ const _unauthorized = requireUnauthorized();
5624
+ const _unstablerethrow = requireUnstableRethrow();
5625
+ class ReadonlyURLSearchParamsError extends Error {
5626
+ constructor(){
5627
+ super('Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams');
5628
+ }
5629
+ }
5630
+ class ReadonlyURLSearchParams extends URLSearchParams {
5631
+ /** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */ append() {
5632
+ throw new ReadonlyURLSearchParamsError();
5633
+ }
5634
+ /** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */ delete() {
5635
+ throw new ReadonlyURLSearchParamsError();
5636
+ }
5637
+ /** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */ set() {
5638
+ throw new ReadonlyURLSearchParamsError();
5639
+ }
5640
+ /** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */ sort() {
5641
+ throw new ReadonlyURLSearchParamsError();
5642
+ }
5643
+ }
5644
+
5645
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
5646
+ Object.defineProperty(exports.default, '__esModule', { value: true });
5647
+ Object.assign(exports.default, exports);
5648
+ module.exports = exports.default;
5649
+ }
5650
+
5651
+
5652
+ } (navigation_reactServer, navigation_reactServer.exports));
5653
+ return navigation_reactServer.exports;
5654
+ }
5655
+
5656
+ var serverInsertedHtml_sharedRuntime = {};
5657
+
5658
+ var hasRequiredServerInsertedHtml_sharedRuntime;
5659
+
5660
+ function requireServerInsertedHtml_sharedRuntime () {
5661
+ if (hasRequiredServerInsertedHtml_sharedRuntime) return serverInsertedHtml_sharedRuntime;
5662
+ hasRequiredServerInsertedHtml_sharedRuntime = 1;
5663
+ (function (exports) {
5664
+ 'use client';
5665
+ Object.defineProperty(exports, "__esModule", {
5666
+ value: true
5667
+ });
5668
+ function _export(target, all) {
5669
+ for(var name in all)Object.defineProperty(target, name, {
5670
+ enumerable: true,
5671
+ get: all[name]
5672
+ });
5673
+ }
5674
+ _export(exports, {
5675
+ ServerInsertedHTMLContext: function() {
5676
+ return ServerInsertedHTMLContext;
5677
+ },
5678
+ useServerInsertedHTML: function() {
5679
+ return useServerInsertedHTML;
5680
+ }
5681
+ });
5682
+ const _interop_require_wildcard = /*@__PURE__*/ require_interop_require_wildcard();
5683
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require$$0);
5684
+ const ServerInsertedHTMLContext = /*#__PURE__*/ _react.default.createContext(null);
5685
+ function useServerInsertedHTML(callback) {
5686
+ const addInsertedServerHTMLCallback = (0, _react.useContext)(ServerInsertedHTMLContext);
5687
+ // Should have no effects on client where there's no flush effects provider
5688
+ if (addInsertedServerHTMLCallback) {
5689
+ addInsertedServerHTMLCallback(callback);
5690
+ }
5691
+ }
5692
+
5693
+
5694
+ } (serverInsertedHtml_sharedRuntime));
5695
+ return serverInsertedHtml_sharedRuntime;
5696
+ }
5697
+
5698
+ var bailoutToClientRendering = {exports: {}};
5699
+
5700
+ var hasRequiredBailoutToClientRendering;
5701
+
5702
+ function requireBailoutToClientRendering () {
5703
+ if (hasRequiredBailoutToClientRendering) return bailoutToClientRendering.exports;
5704
+ hasRequiredBailoutToClientRendering = 1;
5705
+ (function (module, exports) {
5706
+ Object.defineProperty(exports, "__esModule", {
5707
+ value: true
5708
+ });
5709
+ Object.defineProperty(exports, "bailoutToClientRendering", {
5710
+ enumerable: true,
5711
+ get: function() {
5712
+ return bailoutToClientRendering;
5713
+ }
5714
+ });
5715
+ const _bailouttocsr = requireBailoutToCsr();
5716
+ const _workasyncstorageexternal = requireWorkAsyncStorage_external();
5717
+ function bailoutToClientRendering(reason) {
5718
+ const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
5719
+ if (workStore == null ? void 0 : workStore.forceStatic) return;
5720
+ if (workStore == null ? void 0 : workStore.isStaticGeneration) throw Object.defineProperty(new _bailouttocsr.BailoutToCSRError(reason), "__NEXT_ERROR_CODE", {
5721
+ value: "E394",
5722
+ enumerable: false,
5723
+ configurable: true
5724
+ });
5725
+ }
5726
+
5727
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
5728
+ Object.defineProperty(exports.default, '__esModule', { value: true });
5729
+ Object.assign(exports.default, exports);
5730
+ module.exports = exports.default;
5731
+ }
5732
+
5733
+
5734
+ } (bailoutToClientRendering, bailoutToClientRendering.exports));
5735
+ return bailoutToClientRendering.exports;
5736
+ }
5737
+
5738
+ var hasRequiredNavigation$1;
5739
+
5740
+ function requireNavigation$1 () {
5741
+ if (hasRequiredNavigation$1) return navigation$1.exports;
5742
+ hasRequiredNavigation$1 = 1;
5743
+ (function (module, exports) {
5744
+ Object.defineProperty(exports, "__esModule", {
5745
+ value: true
5746
+ });
5747
+ function _export(target, all) {
5748
+ for(var name in all)Object.defineProperty(target, name, {
5749
+ enumerable: true,
5750
+ get: all[name]
5751
+ });
5752
+ }
5753
+ _export(exports, {
5754
+ ReadonlyURLSearchParams: function() {
5755
+ return _navigationreactserver.ReadonlyURLSearchParams;
5756
+ },
5757
+ RedirectType: function() {
5758
+ return _navigationreactserver.RedirectType;
5759
+ },
5760
+ ServerInsertedHTMLContext: function() {
5761
+ return _serverinsertedhtmlsharedruntime.ServerInsertedHTMLContext;
5762
+ },
5763
+ forbidden: function() {
5764
+ return _navigationreactserver.forbidden;
5765
+ },
5766
+ notFound: function() {
5767
+ return _navigationreactserver.notFound;
5768
+ },
5769
+ permanentRedirect: function() {
5770
+ return _navigationreactserver.permanentRedirect;
5771
+ },
5772
+ redirect: function() {
5773
+ return _navigationreactserver.redirect;
5774
+ },
5775
+ unauthorized: function() {
5776
+ return _navigationreactserver.unauthorized;
5777
+ },
5778
+ unstable_rethrow: function() {
5779
+ return _navigationreactserver.unstable_rethrow;
5780
+ },
5781
+ useParams: function() {
5782
+ return useParams;
5783
+ },
5784
+ usePathname: function() {
5785
+ return usePathname;
5786
+ },
5787
+ useRouter: function() {
5788
+ return useRouter;
5789
+ },
5790
+ useSearchParams: function() {
5791
+ return useSearchParams;
5792
+ },
5793
+ useSelectedLayoutSegment: function() {
5794
+ return useSelectedLayoutSegment;
5795
+ },
5796
+ useSelectedLayoutSegments: function() {
5797
+ return useSelectedLayoutSegments;
5798
+ },
5799
+ useServerInsertedHTML: function() {
5800
+ return _serverinsertedhtmlsharedruntime.useServerInsertedHTML;
5801
+ }
5802
+ });
5803
+ const _react = require$$0;
5804
+ const _approutercontextsharedruntime = requireAppRouterContext_sharedRuntime();
5805
+ const _hooksclientcontextsharedruntime = requireHooksClientContext_sharedRuntime();
5806
+ const _getsegmentvalue = requireGetSegmentValue();
5807
+ const _segment = requireSegment();
5808
+ const _navigationreactserver = requireNavigation_reactServer();
5809
+ const _serverinsertedhtmlsharedruntime = requireServerInsertedHtml_sharedRuntime();
5810
+ const useDynamicRouteParams = typeof window === 'undefined' ? requireDynamicRendering().useDynamicRouteParams : undefined;
5811
+ function useSearchParams() {
5812
+ const searchParams = (0, _react.useContext)(_hooksclientcontextsharedruntime.SearchParamsContext);
5813
+ // In the case where this is `null`, the compat types added in
5814
+ // `next-env.d.ts` will add a new overload that changes the return type to
5815
+ // include `null`.
5816
+ const readonlySearchParams = (0, _react.useMemo)(()=>{
5817
+ if (!searchParams) {
5818
+ // When the router is not ready in pages, we won't have the search params
5819
+ // available.
5820
+ return null;
5821
+ }
5822
+ return new _navigationreactserver.ReadonlyURLSearchParams(searchParams);
5823
+ }, [
5824
+ searchParams
5825
+ ]);
5826
+ if (typeof window === 'undefined') {
5827
+ // AsyncLocalStorage should not be included in the client bundle.
5828
+ const { bailoutToClientRendering } = requireBailoutToClientRendering();
5829
+ // TODO-APP: handle dynamic = 'force-static' here and on the client
5830
+ bailoutToClientRendering('useSearchParams()');
5831
+ }
5832
+ return readonlySearchParams;
5833
+ }
5834
+ function usePathname() {
5835
+ useDynamicRouteParams == null ? void 0 : useDynamicRouteParams('usePathname()');
5836
+ // In the case where this is `null`, the compat types added in `next-env.d.ts`
5837
+ // will add a new overload that changes the return type to include `null`.
5838
+ return (0, _react.useContext)(_hooksclientcontextsharedruntime.PathnameContext);
5839
+ }
5840
+ function useRouter() {
5841
+ const router = (0, _react.useContext)(_approutercontextsharedruntime.AppRouterContext);
5842
+ if (router === null) {
5843
+ throw Object.defineProperty(new Error('invariant expected app router to be mounted'), "__NEXT_ERROR_CODE", {
5844
+ value: "E238",
5845
+ enumerable: false,
5846
+ configurable: true
5847
+ });
5848
+ }
5849
+ return router;
5850
+ }
5851
+ function useParams() {
5852
+ useDynamicRouteParams == null ? void 0 : useDynamicRouteParams('useParams()');
5853
+ return (0, _react.useContext)(_hooksclientcontextsharedruntime.PathParamsContext);
5854
+ }
5855
+ /** Get the canonical parameters from the current level to the leaf node. */ // Client components API
5856
+ function getSelectedLayoutSegmentPath(tree, parallelRouteKey, first, segmentPath) {
5857
+ if (first === void 0) first = true;
5858
+ if (segmentPath === void 0) segmentPath = [];
5859
+ let node;
5860
+ if (first) {
5861
+ // Use the provided parallel route key on the first parallel route
5862
+ node = tree[1][parallelRouteKey];
5863
+ } else {
5864
+ // After first parallel route prefer children, if there's no children pick the first parallel route.
5865
+ const parallelRoutes = tree[1];
5866
+ var _parallelRoutes_children;
5867
+ node = (_parallelRoutes_children = parallelRoutes.children) != null ? _parallelRoutes_children : Object.values(parallelRoutes)[0];
5868
+ }
5869
+ if (!node) return segmentPath;
5870
+ const segment = node[0];
5871
+ let segmentValue = (0, _getsegmentvalue.getSegmentValue)(segment);
5872
+ if (!segmentValue || segmentValue.startsWith(_segment.PAGE_SEGMENT_KEY)) {
5873
+ return segmentPath;
5874
+ }
5875
+ segmentPath.push(segmentValue);
5876
+ return getSelectedLayoutSegmentPath(node, parallelRouteKey, false, segmentPath);
5877
+ }
5878
+ function useSelectedLayoutSegments(parallelRouteKey) {
5879
+ if (parallelRouteKey === void 0) parallelRouteKey = 'children';
5880
+ useDynamicRouteParams == null ? void 0 : useDynamicRouteParams('useSelectedLayoutSegments()');
5881
+ const context = (0, _react.useContext)(_approutercontextsharedruntime.LayoutRouterContext);
5882
+ // @ts-expect-error This only happens in `pages`. Type is overwritten in navigation.d.ts
5883
+ if (!context) return null;
5884
+ return getSelectedLayoutSegmentPath(context.parentTree, parallelRouteKey);
5885
+ }
5886
+ function useSelectedLayoutSegment(parallelRouteKey) {
5887
+ if (parallelRouteKey === void 0) parallelRouteKey = 'children';
5888
+ useDynamicRouteParams == null ? void 0 : useDynamicRouteParams('useSelectedLayoutSegment()');
5889
+ const selectedLayoutSegments = useSelectedLayoutSegments(parallelRouteKey);
5890
+ if (!selectedLayoutSegments || selectedLayoutSegments.length === 0) {
5891
+ return null;
5892
+ }
5893
+ const selectedLayoutSegment = parallelRouteKey === 'children' ? selectedLayoutSegments[0] : selectedLayoutSegments[selectedLayoutSegments.length - 1];
5894
+ // if the default slot is showing, we return null since it's not technically "selected" (it's a fallback)
5895
+ // and returning an internal value like `__DEFAULT__` would be confusing.
5896
+ return selectedLayoutSegment === _segment.DEFAULT_SEGMENT_KEY ? null : selectedLayoutSegment;
5897
+ }
5898
+
5899
+ if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
5900
+ Object.defineProperty(exports.default, '__esModule', { value: true });
5901
+ Object.assign(exports.default, exports);
5902
+ module.exports = exports.default;
5903
+ }
5904
+
5905
+
5906
+ } (navigation$1, navigation$1.exports));
5907
+ return navigation$1.exports;
5908
+ }
5909
+
5910
+ var navigation;
5911
+ var hasRequiredNavigation;
5912
+
5913
+ function requireNavigation () {
5914
+ if (hasRequiredNavigation) return navigation;
5915
+ hasRequiredNavigation = 1;
5916
+ navigation = requireNavigation$1();
5917
+ return navigation;
5918
+ }
5919
+
5920
+ var navigationExports = requireNavigation();
5921
+
5922
+ const NavItems = ({ items }) => {
5923
+ const pathname = navigationExports.usePathname();
5924
+ return /* @__PURE__ */ jsx(Stack, { gap: 0, children: items.map(({ href, isActive, ...navLinkProps }) => {
5925
+ if (href) {
5926
+ const active = isActive ?? href.includes(pathname);
5927
+ return /* @__PURE__ */ jsx(
5928
+ NavLink,
5929
+ {
5930
+ active,
5931
+ component: Link,
5932
+ prefetch: false,
5933
+ href,
5934
+ ...navLinkProps
5935
+ },
5936
+ navLinkProps.label
5937
+ );
5938
+ }
5939
+ return /* @__PURE__ */ jsx(
5940
+ NavLink,
5941
+ {
5942
+ active: isActive,
5943
+ component: "button",
5944
+ ...navLinkProps
5945
+ },
5946
+ navLinkProps.label
5947
+ );
5948
+ }) });
5949
+ };
5950
+
5951
+ var HttpStatus = /* @__PURE__ */ ((HttpStatus2) => {
5952
+ HttpStatus2[HttpStatus2["Continue"] = 100] = "Continue";
5953
+ HttpStatus2[HttpStatus2["SwitchingProtocols"] = 101] = "SwitchingProtocols";
5954
+ HttpStatus2[HttpStatus2["Processing"] = 102] = "Processing";
5955
+ HttpStatus2[HttpStatus2["EarlyHints"] = 103] = "EarlyHints";
5956
+ HttpStatus2[HttpStatus2["Ok"] = 200] = "Ok";
5957
+ HttpStatus2[HttpStatus2["Created"] = 201] = "Created";
5958
+ HttpStatus2[HttpStatus2["Accepted"] = 202] = "Accepted";
5959
+ HttpStatus2[HttpStatus2["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
5960
+ HttpStatus2[HttpStatus2["NoContent"] = 204] = "NoContent";
5961
+ HttpStatus2[HttpStatus2["ResetContent"] = 205] = "ResetContent";
5962
+ HttpStatus2[HttpStatus2["PartialContent"] = 206] = "PartialContent";
5963
+ HttpStatus2[HttpStatus2["MultiStatus"] = 207] = "MultiStatus";
5964
+ HttpStatus2[HttpStatus2["AlreadyReported"] = 208] = "AlreadyReported";
5965
+ HttpStatus2[HttpStatus2["ImUsed"] = 226] = "ImUsed";
5966
+ HttpStatus2[HttpStatus2["MultipleChoices"] = 300] = "MultipleChoices";
5967
+ HttpStatus2[HttpStatus2["MovedPermanently"] = 301] = "MovedPermanently";
5968
+ HttpStatus2[HttpStatus2["Found"] = 302] = "Found";
5969
+ HttpStatus2[HttpStatus2["SeeOther"] = 303] = "SeeOther";
5970
+ HttpStatus2[HttpStatus2["NotModified"] = 304] = "NotModified";
5971
+ HttpStatus2[HttpStatus2["UseProxy"] = 305] = "UseProxy";
5972
+ HttpStatus2[HttpStatus2["TemporaryRedirect"] = 307] = "TemporaryRedirect";
5973
+ HttpStatus2[HttpStatus2["PermanentRedirect"] = 308] = "PermanentRedirect";
5974
+ HttpStatus2[HttpStatus2["BadRequest"] = 400] = "BadRequest";
5975
+ HttpStatus2[HttpStatus2["Unauthorized"] = 401] = "Unauthorized";
5976
+ HttpStatus2[HttpStatus2["PaymentRequired"] = 402] = "PaymentRequired";
5977
+ HttpStatus2[HttpStatus2["Forbidden"] = 403] = "Forbidden";
5978
+ HttpStatus2[HttpStatus2["NotFound"] = 404] = "NotFound";
5979
+ HttpStatus2[HttpStatus2["MethodNotAllowed"] = 405] = "MethodNotAllowed";
5980
+ HttpStatus2[HttpStatus2["NotAcceptable"] = 406] = "NotAcceptable";
5981
+ HttpStatus2[HttpStatus2["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
5982
+ HttpStatus2[HttpStatus2["RequestTimeout"] = 408] = "RequestTimeout";
5983
+ HttpStatus2[HttpStatus2["Conflict"] = 409] = "Conflict";
5984
+ HttpStatus2[HttpStatus2["Gone"] = 410] = "Gone";
5985
+ HttpStatus2[HttpStatus2["LengthRequired"] = 411] = "LengthRequired";
5986
+ HttpStatus2[HttpStatus2["PreconditionFailed"] = 412] = "PreconditionFailed";
5987
+ HttpStatus2[HttpStatus2["PayloadTooLarge"] = 413] = "PayloadTooLarge";
5988
+ HttpStatus2[HttpStatus2["UriTooLong"] = 414] = "UriTooLong";
5989
+ HttpStatus2[HttpStatus2["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
5990
+ HttpStatus2[HttpStatus2["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
5991
+ HttpStatus2[HttpStatus2["ExpectationFailed"] = 417] = "ExpectationFailed";
5992
+ HttpStatus2[HttpStatus2["MisdirectedRequest"] = 421] = "MisdirectedRequest";
5993
+ HttpStatus2[HttpStatus2["UnprocessableEntity"] = 422] = "UnprocessableEntity";
5994
+ HttpStatus2[HttpStatus2["Locked"] = 423] = "Locked";
5995
+ HttpStatus2[HttpStatus2["FailedDependency"] = 424] = "FailedDependency";
5996
+ HttpStatus2[HttpStatus2["TooEarly"] = 425] = "TooEarly";
5997
+ HttpStatus2[HttpStatus2["UpgradeRequired"] = 426] = "UpgradeRequired";
5998
+ HttpStatus2[HttpStatus2["PreconditionRequired"] = 428] = "PreconditionRequired";
5999
+ HttpStatus2[HttpStatus2["TooManyRequests"] = 429] = "TooManyRequests";
6000
+ HttpStatus2[HttpStatus2["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
6001
+ HttpStatus2[HttpStatus2["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
6002
+ HttpStatus2[HttpStatus2["InternalServerError"] = 500] = "InternalServerError";
6003
+ HttpStatus2[HttpStatus2["NotImplemented"] = 501] = "NotImplemented";
6004
+ HttpStatus2[HttpStatus2["BadGateway"] = 502] = "BadGateway";
6005
+ HttpStatus2[HttpStatus2["ServiceUnavailable"] = 503] = "ServiceUnavailable";
6006
+ HttpStatus2[HttpStatus2["GatewayTimeout"] = 504] = "GatewayTimeout";
6007
+ HttpStatus2[HttpStatus2["HttpVersionNotSupported"] = 505] = "HttpVersionNotSupported";
6008
+ HttpStatus2[HttpStatus2["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
6009
+ HttpStatus2[HttpStatus2["InsufficientStorage"] = 507] = "InsufficientStorage";
6010
+ HttpStatus2[HttpStatus2["LoopDetected"] = 508] = "LoopDetected";
6011
+ HttpStatus2[HttpStatus2["NotExtended"] = 510] = "NotExtended";
6012
+ HttpStatus2[HttpStatus2["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
6013
+ return HttpStatus2;
6014
+ })(HttpStatus || {});
6015
+
6016
+ var Revalidate = /* @__PURE__ */ ((Revalidate2) => {
6017
+ Revalidate2[Revalidate2["OneHour"] = 3600] = "OneHour";
6018
+ Revalidate2[Revalidate2["OneDay"] = 86400] = "OneDay";
6019
+ Revalidate2[Revalidate2["OneWeek"] = 604800] = "OneWeek";
6020
+ Revalidate2[Revalidate2["OneMonth"] = 2592e3] = "OneMonth";
6021
+ Revalidate2[Revalidate2["OneYear"] = 31536e3] = "OneYear";
6022
+ return Revalidate2;
6023
+ })(Revalidate || {});
6024
+
6025
+ const NavigationHistoryContext = createContext(null);
6026
+ function NavigationHistoryProvider({ children }) {
6027
+ const pathname = navigationExports.usePathname();
6028
+ const searchParams = navigationExports.useSearchParams();
6029
+ const [history, setHistory] = useState([]);
6030
+ useEffect(() => {
6031
+ const fullPath = searchParams?.size ? `${pathname}?${searchParams.toString()}` : pathname;
6032
+ if (fullPath) {
6033
+ setHistory((prev) => {
6034
+ if (prev.length > 0 && prev[prev.length - 1] === fullPath) {
6035
+ return prev;
6036
+ }
6037
+ return [...prev, fullPath];
6038
+ });
6039
+ }
6040
+ }, [pathname, searchParams]);
6041
+ return /* @__PURE__ */ jsx(NavigationHistoryContext.Provider, { value: { history }, children });
6042
+ }
6043
+ const QP_BACK_URL_NAME = "backUrl";
6044
+ function useNavigationHistory() {
6045
+ const context = useContext(NavigationHistoryContext);
6046
+ const router = navigationExports.useRouter();
6047
+ if (!context) {
6048
+ throw new Error("useNavigationHistory debe usarse dentro de un NavigationHistoryProvider");
6049
+ }
6050
+ const searchParams = navigationExports.useSearchParams();
6051
+ const { history } = context;
6052
+ const goBack = (fallback) => {
6053
+ const returnUrl = searchParams.get(QP_BACK_URL_NAME);
6054
+ if (returnUrl) {
6055
+ router.push(returnUrl);
6056
+ return;
6057
+ }
6058
+ if (history.length <= 1) {
6059
+ router.push(fallback ?? "/");
6060
+ return;
6061
+ }
6062
+ const previousRoute = history[history.length - 2];
6063
+ const currentRoute = history[history.length - 1];
6064
+ if (history.length >= 3 && history[history.length - 3] === currentRoute) {
6065
+ router.push(fallback ?? "/");
6066
+ return;
6067
+ }
6068
+ router.push(previousRoute ?? "/");
6069
+ };
6070
+ return {
6071
+ history,
6072
+ goBack,
6073
+ currentRoute: history.length > 0 ? history[history.length - 1] : null,
6074
+ hasPreviousRoute: history.length > 1,
6075
+ getPreviousRoute: () => history.length >= 2 ? history[history.length - 2] : null
6076
+ };
6077
+ }
6078
+
6079
+ const PageData = createContext(void 0);
6080
+ const PageDataProvider = ({
6081
+ value,
6082
+ children
6083
+ }) => /* @__PURE__ */ jsx(PageData.Provider, { value, children });
6084
+ const usePageData = () => {
6085
+ const data = useContext(PageData);
6086
+ if (data === void 0) throw new Error("Out of context: usePageData");
6087
+ return data;
6088
+ };
6089
+
6090
+ const Form = ({
6091
+ methods,
6092
+ onSubmit = () => {
6093
+ },
6094
+ onSubmitError,
6095
+ ...rest
6096
+ }) => {
6097
+ return /* @__PURE__ */ jsx(FormProvider, { ...methods, children: /* @__PURE__ */ jsx(
6098
+ Box,
6099
+ {
6100
+ component: "form",
6101
+ onSubmit: methods.handleSubmit(onSubmit, onSubmitError),
6102
+ ...rest
6103
+ }
6104
+ ) });
6105
+ };
6106
+
6107
+ const FormButtonSubmit = (props) => {
6108
+ const { formState } = useFormContext();
6109
+ const { isSubmitting } = formState;
6110
+ return /* @__PURE__ */ jsx(
6111
+ Button,
6112
+ {
6113
+ loading: isSubmitting,
6114
+ type: "submit",
6115
+ ...props
6116
+ }
6117
+ );
6118
+ };
6119
+
6120
+ const zodValidator = (schema) => {
6121
+ return (values) => {
6122
+ const result = schema.safeParse(values);
6123
+ if (result.success) return;
6124
+ const { error } = result;
6125
+ const firstError = error.issues[0];
6126
+ return firstError?.message;
6127
+ };
6128
+ };
6129
+
6130
+ const nullableInput = (schema, message = "Campo requerido") => {
6131
+ return schema.nullable().transform((val, ctx) => {
6132
+ if (val === null) {
6133
+ ctx.addIssue({
6134
+ code: z.ZodIssueCode.custom,
6135
+ fatal: true,
6136
+ message
6137
+ });
6138
+ return z.NEVER;
6139
+ }
6140
+ return val;
6141
+ });
6142
+ };
6143
+
6144
+ const withForm = (WrappedComponent, getControllerProps) => {
6145
+ const FormField = (props) => {
6146
+ const { validate, name = "", placeholder, label, description, ...withFormRestProps } = props;
6147
+ return /* @__PURE__ */ jsx(
6148
+ Controller,
6149
+ {
6150
+ name,
6151
+ defaultValue: "",
6152
+ rules: {
6153
+ validate: validate && !props.disabled ? zodValidator(validate) : void 0
6154
+ },
6155
+ disabled: props.disabled,
6156
+ ...getControllerProps?.(props),
6157
+ render: (renderProps) => {
6158
+ const {
6159
+ fieldState: { isTouched, error }
6160
+ } = renderProps;
6161
+ const fieldProps = {
6162
+ ...renderProps,
6163
+ props: {
6164
+ ...props,
6165
+ validate: void 0
6166
+ },
6167
+ field: {
6168
+ ...renderProps.field,
6169
+ label,
6170
+ placeholder,
6171
+ description,
6172
+ error: error?.message
6173
+ },
6174
+ ...withFormRestProps
6175
+ };
6176
+ return /* @__PURE__ */ jsx(WrappedComponent, { ...fieldProps });
6177
+ }
6178
+ }
6179
+ );
6180
+ };
6181
+ FormField.displayName = `withForm(${WrappedComponent.displayName})`;
6182
+ return FormField;
6183
+ };
6184
+
6185
+ const withModalManager = (WrappedComponent) => {
6186
+ const Component = ({
6187
+ removeModal,
6188
+ opened,
6189
+ ...props
6190
+ }) => {
6191
+ const [isOpen, setIsOpen] = useState(false);
6192
+ const onClose = () => {
6193
+ setIsOpen(false);
6194
+ setTimeout(() => removeModal(), 200);
6195
+ props.onClose?.();
6196
+ };
6197
+ useEffect(() => {
6198
+ if (opened) setTimeout(() => setIsOpen(true), 0);
6199
+ else onClose();
6200
+ }, [opened]);
6201
+ return /* @__PURE__ */ jsx(WrappedComponent, { ...props, opened: isOpen, onClose });
6202
+ };
6203
+ Component.displayName = `withModalManager(${WrappedComponent.displayName})`;
6204
+ return Component;
6205
+ };
6206
+
6207
+ const breakpointsWithPx = {
6208
+ xs: "576px",
6209
+ sm: "640px",
6210
+ md: "768px",
6211
+ lg: "1024px",
6212
+ xl: "1280px",
6213
+ ["2xl"]: "1536px"
6214
+ };
6215
+
6216
+ const toTailwindColors = (colors) => Object.entries(colors).reduce(
6217
+ (acc, [key, value]) => {
6218
+ acc[key] = value.reduce(
6219
+ (acc2, color, index) => {
6220
+ acc2[index] = color;
6221
+ return acc2;
6222
+ },
6223
+ {}
6224
+ );
6225
+ return acc;
6226
+ },
6227
+ {}
6228
+ );
6229
+
6230
+ function formatBytes(bytes, decimals = 2) {
6231
+ if (!+bytes) return "0 Bytes";
6232
+ const k = 1024;
6233
+ const dm = decimals < 0 ? 0 : decimals;
6234
+ const sizes = ["Bytes", "KB", "MB"];
6235
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
6236
+ return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
6237
+ }
6238
+
6239
+ const parseJSON = async (response) => {
6240
+ return response.text().then(function(text) {
6241
+ return text ? JSON.parse(text) : {};
6242
+ });
6243
+ };
6244
+
6245
+ const addBodyJsonHook = async (error) => {
6246
+ error.response.bodyJson = await parseJSON(error.response);
6247
+ return error;
6248
+ };
6249
+
6250
+ function indexBy(arr, getKey, getValue) {
6251
+ if (getValue)
6252
+ return arr.reduce(
6253
+ (acc, item) => {
6254
+ const key = getKey(item);
6255
+ if (key === void 0) return acc;
6256
+ acc[key] = getValue(item);
6257
+ return acc;
6258
+ },
6259
+ {}
6260
+ );
6261
+ return arr.reduce(
6262
+ (acc, item) => {
6263
+ const key = getKey(item);
6264
+ if (key === void 0) return acc;
6265
+ acc[key] = item;
6266
+ return acc;
6267
+ },
6268
+ {}
6269
+ );
6270
+ }
6271
+ const groupBy = (arr, getKey) => {
6272
+ const groups = {};
6273
+ arr?.forEach((item) => {
6274
+ const key = getKey(item);
6275
+ if (key === null) return;
6276
+ if (Array.isArray(key)) {
6277
+ key.forEach((k) => {
6278
+ if (!groups[k]) groups[k] = [];
6279
+ groups[k]?.push(item);
6280
+ });
6281
+ return;
6282
+ }
6283
+ if (!groups[key]) groups[key] = [];
6284
+ groups[key]?.push(item);
6285
+ });
6286
+ return groups;
6287
+ };
6288
+
6289
+ const shuffleArray = (array) => {
6290
+ const shuffledArray = [...array];
6291
+ let currentIndex = shuffledArray.length, randomIndex;
6292
+ while (currentIndex > 0) {
6293
+ randomIndex = Math.floor(Math.random() * currentIndex);
6294
+ currentIndex--;
6295
+ [shuffledArray[currentIndex], shuffledArray[randomIndex]] = [
6296
+ shuffledArray[randomIndex],
6297
+ shuffledArray[currentIndex]
6298
+ ];
6299
+ }
6300
+ return shuffledArray;
3393
6301
  };
3394
6302
 
3395
- export { EmptyState, InfinityLoader, NavItems, SelectInfinity };
6303
+ export { EmptyState, Form, FormButtonSubmit, HttpStatus, InfinityLoader, NavItems, NavigationHistoryProvider, PageDataProvider, QP_BACK_URL_NAME, Revalidate, SelectInfinity, addBodyJsonHook, breakpointsWithPx, formatBytes, groupBy, indexBy, nullableInput, parseJSON, shuffleArray, toTailwindColors, useFetchNextPageOnScroll, useNavigationHistory, useOnScrollProgress, usePageData, withForm, withModalManager, zodValidator };