@dust-tt/sparkle 0.2.214-pr → 0.2.214

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.
package/dist/cjs/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  var React = require('react');
4
4
  var url = require('url');
5
- var require$$1 = require('react/jsx-runtime');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -39797,7 +39797,7 @@ function createEmojiAndBackgroundUrlSuffix(_a) {
39797
39797
  return "emojis/".concat(backgroundColor, "/").concat(id, "/").concat(unified);
39798
39798
  }
39799
39799
 
39800
- var utils$2 = /*#__PURE__*/Object.freeze({
39800
+ var utils = /*#__PURE__*/Object.freeze({
39801
39801
  __proto__: null,
39802
39802
  createEmojiAndBackgroundUrlSuffix: createEmojiAndBackgroundUrlSuffix,
39803
39803
  getEmojiAndBackgroundFromUrl: getEmojiAndBackgroundFromUrl
@@ -120070,7 +120070,7 @@ function linkReference(state, node) {
120070
120070
  * @returns {Element}
120071
120071
  * hast node.
120072
120072
  */
120073
- function link$2(state, node) {
120073
+ function link(state, node) {
120074
120074
  /** @type {Properties} */
120075
120075
  const properties = {href: normalizeUri(node.url)};
120076
120076
 
@@ -120653,7 +120653,7 @@ const handlers = {
120653
120653
  image,
120654
120654
  inlineCode,
120655
120655
  linkReference,
120656
- link: link$2,
120656
+ link,
120657
120657
  listItem,
120658
120658
  list,
120659
120659
  paragraph,
@@ -125567,11 +125567,11 @@ function Markdown$1(options) {
125567
125567
  visit(hastTree, transform);
125568
125568
 
125569
125569
  return toJsxRuntime(hastTree, {
125570
- Fragment: require$$1.Fragment,
125570
+ Fragment: jsxRuntime.Fragment,
125571
125571
  components,
125572
125572
  ignoreInvalidStyle: true,
125573
- jsx: require$$1.jsx,
125574
- jsxs: require$$1.jsxs,
125573
+ jsx: jsxRuntime.jsx,
125574
+ jsxs: jsxRuntime.jsxs,
125575
125575
  passKeys: true,
125576
125576
  passNode: true
125577
125577
  })
@@ -129182,2734 +129182,10 @@ DataTable.Caption = function Caption(_a) {
129182
129182
  return (React.createElement("caption", __assign({ className: className }, props), children));
129183
129183
  };
129184
129184
 
129185
- var link$1 = {exports: {}};
129186
-
129187
- var _interop_require_default$1 = {};
129188
-
129189
- _interop_require_default$1._ = _interop_require_default$1._interop_require_default = _interop_require_default;
129190
- function _interop_require_default(obj) {
129191
- return obj && obj.__esModule ? obj : { default: obj };
129192
- }
129193
-
129194
- var resolveHref = {exports: {}};
129195
-
129196
- var querystring = {};
129197
-
129198
- var hasRequiredQuerystring;
129199
-
129200
- function requireQuerystring () {
129201
- if (hasRequiredQuerystring) return querystring;
129202
- hasRequiredQuerystring = 1;
129203
- (function (exports) {
129204
- Object.defineProperty(exports, "__esModule", {
129205
- value: true
129206
- });
129207
- function _export(target, all) {
129208
- for(var name in all)Object.defineProperty(target, name, {
129209
- enumerable: true,
129210
- get: all[name]
129211
- });
129212
- }
129213
- _export(exports, {
129214
- assign: function() {
129215
- return assign;
129216
- },
129217
- searchParamsToUrlQuery: function() {
129218
- return searchParamsToUrlQuery;
129219
- },
129220
- urlQueryToSearchParams: function() {
129221
- return urlQueryToSearchParams;
129222
- }
129223
- });
129224
- function searchParamsToUrlQuery(searchParams) {
129225
- const query = {};
129226
- searchParams.forEach((value, key)=>{
129227
- if (typeof query[key] === "undefined") {
129228
- query[key] = value;
129229
- } else if (Array.isArray(query[key])) {
129230
- query[key].push(value);
129231
- } else {
129232
- query[key] = [
129233
- query[key],
129234
- value
129235
- ];
129236
- }
129237
- });
129238
- return query;
129239
- }
129240
- function stringifyUrlQueryParam(param) {
129241
- if (typeof param === "string" || typeof param === "number" && !isNaN(param) || typeof param === "boolean") {
129242
- return String(param);
129243
- } else {
129244
- return "";
129245
- }
129246
- }
129247
- function urlQueryToSearchParams(urlQuery) {
129248
- const result = new URLSearchParams();
129249
- Object.entries(urlQuery).forEach((param)=>{
129250
- let [key, value] = param;
129251
- if (Array.isArray(value)) {
129252
- value.forEach((item)=>result.append(key, stringifyUrlQueryParam(item)));
129253
- } else {
129254
- result.set(key, stringifyUrlQueryParam(value));
129255
- }
129256
- });
129257
- return result;
129258
- }
129259
- function assign(target) {
129260
- for(var _len = arguments.length, searchParamsList = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
129261
- searchParamsList[_key - 1] = arguments[_key];
129262
- }
129263
- searchParamsList.forEach((searchParams)=>{
129264
- Array.from(searchParams.keys()).forEach((key)=>target.delete(key));
129265
- searchParams.forEach((value, key)=>target.append(key, value));
129266
- });
129267
- return target;
129268
- }
129269
-
129270
-
129271
- } (querystring));
129272
- return querystring;
129273
- }
129274
-
129275
- var formatUrl = {};
129276
-
129277
- var _interop_require_wildcard = {};
129278
-
129279
- var hasRequired_interop_require_wildcard;
129280
-
129281
- function require_interop_require_wildcard () {
129282
- if (hasRequired_interop_require_wildcard) return _interop_require_wildcard;
129283
- hasRequired_interop_require_wildcard = 1;
129284
-
129285
- function _getRequireWildcardCache(nodeInterop) {
129286
- if (typeof WeakMap !== "function") return null;
129287
-
129288
- var cacheBabelInterop = new WeakMap();
129289
- var cacheNodeInterop = new WeakMap();
129290
-
129291
- return (_getRequireWildcardCache = function(nodeInterop) {
129292
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
129293
- })(nodeInterop);
129294
- }
129295
- _interop_require_wildcard._ = _interop_require_wildcard._interop_require_wildcard = _interop_require_wildcard$1;
129296
- function _interop_require_wildcard$1(obj, nodeInterop) {
129297
- if (!nodeInterop && obj && obj.__esModule) return obj;
129298
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") return { default: obj };
129299
-
129300
- var cache = _getRequireWildcardCache(nodeInterop);
129301
-
129302
- if (cache && cache.has(obj)) return cache.get(obj);
129303
-
129304
- var newObj = { __proto__: null };
129305
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
129306
-
129307
- for (var key in obj) {
129308
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
129309
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
129310
- if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
129311
- else newObj[key] = obj[key];
129312
- }
129313
- }
129314
-
129315
- newObj.default = obj;
129316
-
129317
- if (cache) cache.set(obj, newObj);
129318
-
129319
- return newObj;
129320
- }
129321
- return _interop_require_wildcard;
129322
- }
129323
-
129324
- var hasRequiredFormatUrl;
129325
-
129326
- function requireFormatUrl () {
129327
- if (hasRequiredFormatUrl) return formatUrl;
129328
- hasRequiredFormatUrl = 1;
129329
- (function (exports) {
129330
- Object.defineProperty(exports, "__esModule", {
129331
- value: true
129332
- });
129333
- function _export(target, all) {
129334
- for(var name in all)Object.defineProperty(target, name, {
129335
- enumerable: true,
129336
- get: all[name]
129337
- });
129338
- }
129339
- _export(exports, {
129340
- formatUrl: function() {
129341
- return formatUrl;
129342
- },
129343
- formatWithValidation: function() {
129344
- return formatWithValidation;
129345
- },
129346
- urlObjectKeys: function() {
129347
- return urlObjectKeys;
129348
- }
129349
- });
129350
- const _interop_require_wildcard = require_interop_require_wildcard();
129351
- const _querystring = /*#__PURE__*/ _interop_require_wildcard._(requireQuerystring());
129352
- const slashedProtocols = /https?|ftp|gopher|file/;
129353
- function formatUrl(urlObj) {
129354
- let { auth, hostname } = urlObj;
129355
- let protocol = urlObj.protocol || "";
129356
- let pathname = urlObj.pathname || "";
129357
- let hash = urlObj.hash || "";
129358
- let query = urlObj.query || "";
129359
- let host = false;
129360
- auth = auth ? encodeURIComponent(auth).replace(/%3A/i, ":") + "@" : "";
129361
- if (urlObj.host) {
129362
- host = auth + urlObj.host;
129363
- } else if (hostname) {
129364
- host = auth + (~hostname.indexOf(":") ? "[" + hostname + "]" : hostname);
129365
- if (urlObj.port) {
129366
- host += ":" + urlObj.port;
129367
- }
129368
- }
129369
- if (query && typeof query === "object") {
129370
- query = String(_querystring.urlQueryToSearchParams(query));
129371
- }
129372
- let search = urlObj.search || query && "?" + query || "";
129373
- if (protocol && !protocol.endsWith(":")) protocol += ":";
129374
- if (urlObj.slashes || (!protocol || slashedProtocols.test(protocol)) && host !== false) {
129375
- host = "//" + (host || "");
129376
- if (pathname && pathname[0] !== "/") pathname = "/" + pathname;
129377
- } else if (!host) {
129378
- host = "";
129379
- }
129380
- if (hash && hash[0] !== "#") hash = "#" + hash;
129381
- if (search && search[0] !== "?") search = "?" + search;
129382
- pathname = pathname.replace(/[?#]/g, encodeURIComponent);
129383
- search = search.replace("#", "%23");
129384
- return "" + protocol + host + pathname + search + hash;
129385
- }
129386
- const urlObjectKeys = [
129387
- "auth",
129388
- "hash",
129389
- "host",
129390
- "hostname",
129391
- "href",
129392
- "path",
129393
- "pathname",
129394
- "port",
129395
- "protocol",
129396
- "query",
129397
- "search",
129398
- "slashes"
129399
- ];
129400
- function formatWithValidation(url) {
129401
- if (process.env.NODE_ENV === "development") {
129402
- if (url !== null && typeof url === "object") {
129403
- Object.keys(url).forEach((key)=>{
129404
- if (!urlObjectKeys.includes(key)) {
129405
- console.warn("Unknown key passed via urlObject into url.format: " + key);
129406
- }
129407
- });
129408
- }
129409
- }
129410
- return formatUrl(url);
129411
- }
129412
-
129413
-
129414
- } (formatUrl));
129415
- return formatUrl;
129416
- }
129417
-
129418
- var omit = {};
129419
-
129420
- var hasRequiredOmit;
129421
-
129422
- function requireOmit () {
129423
- if (hasRequiredOmit) return omit;
129424
- hasRequiredOmit = 1;
129425
- (function (exports) {
129426
- Object.defineProperty(exports, "__esModule", {
129427
- value: true
129428
- });
129429
- Object.defineProperty(exports, "omit", {
129430
- enumerable: true,
129431
- get: function() {
129432
- return omit;
129433
- }
129434
- });
129435
- function omit(object, keys) {
129436
- const omitted = {};
129437
- Object.keys(object).forEach((key)=>{
129438
- if (!keys.includes(key)) {
129439
- omitted[key] = object[key];
129440
- }
129441
- });
129442
- return omitted;
129443
- }
129444
-
129445
-
129446
- } (omit));
129447
- return omit;
129448
- }
129449
-
129450
- var utils$1 = {};
129451
-
129452
- var hasRequiredUtils$1;
129453
-
129454
- function requireUtils$1 () {
129455
- if (hasRequiredUtils$1) return utils$1;
129456
- hasRequiredUtils$1 = 1;
129457
- (function (exports) {
129458
- Object.defineProperty(exports, "__esModule", {
129459
- value: true
129460
- });
129461
- function _export(target, all) {
129462
- for(var name in all)Object.defineProperty(target, name, {
129463
- enumerable: true,
129464
- get: all[name]
129465
- });
129466
- }
129467
- _export(exports, {
129468
- DecodeError: function() {
129469
- return DecodeError;
129470
- },
129471
- MiddlewareNotFoundError: function() {
129472
- return MiddlewareNotFoundError;
129473
- },
129474
- MissingStaticPage: function() {
129475
- return MissingStaticPage;
129476
- },
129477
- NormalizeError: function() {
129478
- return NormalizeError;
129479
- },
129480
- PageNotFoundError: function() {
129481
- return PageNotFoundError;
129482
- },
129483
- SP: function() {
129484
- return SP;
129485
- },
129486
- ST: function() {
129487
- return ST;
129488
- },
129489
- WEB_VITALS: function() {
129490
- return WEB_VITALS;
129491
- },
129492
- execOnce: function() {
129493
- return execOnce;
129494
- },
129495
- getDisplayName: function() {
129496
- return getDisplayName;
129497
- },
129498
- getLocationOrigin: function() {
129499
- return getLocationOrigin;
129500
- },
129501
- getURL: function() {
129502
- return getURL;
129503
- },
129504
- isAbsoluteUrl: function() {
129505
- return isAbsoluteUrl;
129506
- },
129507
- isResSent: function() {
129508
- return isResSent;
129509
- },
129510
- loadGetInitialProps: function() {
129511
- return loadGetInitialProps;
129512
- },
129513
- normalizeRepeatedSlashes: function() {
129514
- return normalizeRepeatedSlashes;
129515
- },
129516
- stringifyError: function() {
129517
- return stringifyError;
129518
- }
129519
- });
129520
- const WEB_VITALS = [
129521
- "CLS",
129522
- "FCP",
129523
- "FID",
129524
- "INP",
129525
- "LCP",
129526
- "TTFB"
129527
- ];
129528
- function execOnce(fn) {
129529
- let used = false;
129530
- let result;
129531
- return function() {
129532
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
129533
- args[_key] = arguments[_key];
129534
- }
129535
- if (!used) {
129536
- used = true;
129537
- result = fn(...args);
129538
- }
129539
- return result;
129540
- };
129541
- }
129542
- // Scheme: https://tools.ietf.org/html/rfc3986#section-3.1
129543
- // Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3
129544
- const ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/;
129545
- const isAbsoluteUrl = (url)=>ABSOLUTE_URL_REGEX.test(url);
129546
- function getLocationOrigin() {
129547
- const { protocol, hostname, port } = window.location;
129548
- return protocol + "//" + hostname + (port ? ":" + port : "");
129549
- }
129550
- function getURL() {
129551
- const { href } = window.location;
129552
- const origin = getLocationOrigin();
129553
- return href.substring(origin.length);
129554
- }
129555
- function getDisplayName(Component) {
129556
- return typeof Component === "string" ? Component : Component.displayName || Component.name || "Unknown";
129557
- }
129558
- function isResSent(res) {
129559
- return res.finished || res.headersSent;
129560
- }
129561
- function normalizeRepeatedSlashes(url) {
129562
- const urlParts = url.split("?");
129563
- const urlNoQuery = urlParts[0];
129564
- return urlNoQuery// first we replace any non-encoded backslashes with forward
129565
- // then normalize repeated forward slashes
129566
- .replace(/\\/g, "/").replace(/\/\/+/g, "/") + (urlParts[1] ? "?" + urlParts.slice(1).join("?") : "");
129567
- }
129568
- async function loadGetInitialProps(App, ctx) {
129569
- if (process.env.NODE_ENV !== "production") {
129570
- var _App_prototype;
129571
- if ((_App_prototype = App.prototype) == null ? void 0 : _App_prototype.getInitialProps) {
129572
- const message = '"' + getDisplayName(App) + '.getInitialProps()" is defined as an instance method - visit https://nextjs.org/docs/messages/get-initial-props-as-an-instance-method for more information.';
129573
- throw new Error(message);
129574
- }
129575
- }
129576
- // when called from _app `ctx` is nested in `ctx`
129577
- const res = ctx.res || ctx.ctx && ctx.ctx.res;
129578
- if (!App.getInitialProps) {
129579
- if (ctx.ctx && ctx.Component) {
129580
- // @ts-ignore pageProps default
129581
- return {
129582
- pageProps: await loadGetInitialProps(ctx.Component, ctx.ctx)
129583
- };
129584
- }
129585
- return {};
129586
- }
129587
- const props = await App.getInitialProps(ctx);
129588
- if (res && isResSent(res)) {
129589
- return props;
129590
- }
129591
- if (!props) {
129592
- const message = '"' + getDisplayName(App) + '.getInitialProps()" should resolve to an object. But found "' + props + '" instead.';
129593
- throw new Error(message);
129594
- }
129595
- if (process.env.NODE_ENV !== "production") {
129596
- if (Object.keys(props).length === 0 && !ctx.ctx) {
129597
- console.warn("" + getDisplayName(App) + " returned an empty object from `getInitialProps`. This de-optimizes and prevents automatic static optimization. https://nextjs.org/docs/messages/empty-object-getInitialProps");
129598
- }
129599
- }
129600
- return props;
129601
- }
129602
- const SP = typeof performance !== "undefined";
129603
- const ST = SP && [
129604
- "mark",
129605
- "measure",
129606
- "getEntriesByName"
129607
- ].every((method)=>typeof performance[method] === "function");
129608
- class DecodeError extends Error {
129609
- }
129610
- class NormalizeError extends Error {
129611
- }
129612
- class PageNotFoundError extends Error {
129613
- constructor(page){
129614
- super();
129615
- this.code = "ENOENT";
129616
- this.name = "PageNotFoundError";
129617
- this.message = "Cannot find module for page: " + page;
129618
- }
129619
- }
129620
- class MissingStaticPage extends Error {
129621
- constructor(page, message){
129622
- super();
129623
- this.message = "Failed to load static file for page: " + page + " " + message;
129624
- }
129625
- }
129626
- class MiddlewareNotFoundError extends Error {
129627
- constructor(){
129628
- super();
129629
- this.code = "ENOENT";
129630
- this.message = "Cannot find the middleware module";
129631
- }
129632
- }
129633
- function stringifyError(error) {
129634
- return JSON.stringify({
129635
- message: error.message,
129636
- stack: error.stack
129637
- });
129638
- }
129639
-
129640
-
129641
- } (utils$1));
129642
- return utils$1;
129643
- }
129644
-
129645
- var normalizeTrailingSlash = {exports: {}};
129646
-
129647
- var removeTrailingSlash = {};
129648
-
129649
- /**
129650
- * Removes the trailing slash for a given route or page path. Preserves the
129651
- * root page. Examples:
129652
- * - `/foo/bar/` -> `/foo/bar`
129653
- * - `/foo/bar` -> `/foo/bar`
129654
- * - `/` -> `/`
129655
- */
129656
-
129657
- var hasRequiredRemoveTrailingSlash;
129658
-
129659
- function requireRemoveTrailingSlash () {
129660
- if (hasRequiredRemoveTrailingSlash) return removeTrailingSlash;
129661
- hasRequiredRemoveTrailingSlash = 1;
129662
- (function (exports) {
129663
- Object.defineProperty(exports, "__esModule", {
129664
- value: true
129665
- });
129666
- Object.defineProperty(exports, "removeTrailingSlash", {
129667
- enumerable: true,
129668
- get: function() {
129669
- return removeTrailingSlash;
129670
- }
129671
- });
129672
- function removeTrailingSlash(route) {
129673
- return route.replace(/\/$/, "") || "/";
129674
- }
129675
-
129676
-
129677
- } (removeTrailingSlash));
129678
- return removeTrailingSlash;
129679
- }
129680
-
129681
- var parsePath = {};
129682
-
129683
- /**
129684
- * Given a path this function will find the pathname, query and hash and return
129685
- * them. This is useful to parse full paths on the client side.
129686
- * @param path A path to parse e.g. /foo/bar?id=1#hash
129687
- */
129688
-
129689
- var hasRequiredParsePath;
129690
-
129691
- function requireParsePath () {
129692
- if (hasRequiredParsePath) return parsePath;
129693
- hasRequiredParsePath = 1;
129694
- (function (exports) {
129695
- Object.defineProperty(exports, "__esModule", {
129696
- value: true
129697
- });
129698
- Object.defineProperty(exports, "parsePath", {
129699
- enumerable: true,
129700
- get: function() {
129701
- return parsePath;
129702
- }
129703
- });
129704
- function parsePath(path) {
129705
- const hashIndex = path.indexOf("#");
129706
- const queryIndex = path.indexOf("?");
129707
- const hasQuery = queryIndex > -1 && (hashIndex < 0 || queryIndex < hashIndex);
129708
- if (hasQuery || hashIndex > -1) {
129709
- return {
129710
- pathname: path.substring(0, hasQuery ? queryIndex : hashIndex),
129711
- query: hasQuery ? path.substring(queryIndex, hashIndex > -1 ? hashIndex : undefined) : "",
129712
- hash: hashIndex > -1 ? path.slice(hashIndex) : ""
129713
- };
129714
- }
129715
- return {
129716
- pathname: path,
129717
- query: "",
129718
- hash: ""
129719
- };
129720
- }
129721
-
129722
-
129723
- } (parsePath));
129724
- return parsePath;
129725
- }
129726
-
129727
- var hasRequiredNormalizeTrailingSlash;
129728
-
129729
- function requireNormalizeTrailingSlash () {
129730
- if (hasRequiredNormalizeTrailingSlash) return normalizeTrailingSlash.exports;
129731
- hasRequiredNormalizeTrailingSlash = 1;
129732
- (function (module, exports) {
129733
- Object.defineProperty(exports, "__esModule", {
129734
- value: true
129735
- });
129736
- Object.defineProperty(exports, "normalizePathTrailingSlash", {
129737
- enumerable: true,
129738
- get: function() {
129739
- return normalizePathTrailingSlash;
129740
- }
129741
- });
129742
- const _removetrailingslash = requireRemoveTrailingSlash();
129743
- const _parsepath = requireParsePath();
129744
- const normalizePathTrailingSlash = (path)=>{
129745
- if (!path.startsWith("/") || process.env.__NEXT_MANUAL_TRAILING_SLASH) {
129746
- return path;
129747
- }
129748
- const { pathname, query, hash } = (0, _parsepath.parsePath)(path);
129749
- if (process.env.__NEXT_TRAILING_SLASH) {
129750
- if (/\.[^/]+\/?$/.test(pathname)) {
129751
- return "" + (0, _removetrailingslash.removeTrailingSlash)(pathname) + query + hash;
129752
- } else if (pathname.endsWith("/")) {
129753
- return "" + pathname + query + hash;
129754
- } else {
129755
- return pathname + "/" + query + hash;
129756
- }
129757
- }
129758
- return "" + (0, _removetrailingslash.removeTrailingSlash)(pathname) + query + hash;
129759
- };
129760
-
129761
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
129762
- Object.defineProperty(exports.default, '__esModule', { value: true });
129763
- Object.assign(exports.default, exports);
129764
- module.exports = exports.default;
129765
- }
129766
-
129767
-
129768
- } (normalizeTrailingSlash, normalizeTrailingSlash.exports));
129769
- return normalizeTrailingSlash.exports;
129770
- }
129771
-
129772
- var isLocalUrl = {};
129773
-
129774
- var hasBasePath = {exports: {}};
129775
-
129776
- var pathHasPrefix = {};
129777
-
129778
- var hasRequiredPathHasPrefix;
129779
-
129780
- function requirePathHasPrefix () {
129781
- if (hasRequiredPathHasPrefix) return pathHasPrefix;
129782
- hasRequiredPathHasPrefix = 1;
129783
- (function (exports) {
129784
- Object.defineProperty(exports, "__esModule", {
129785
- value: true
129786
- });
129787
- Object.defineProperty(exports, "pathHasPrefix", {
129788
- enumerable: true,
129789
- get: function() {
129790
- return pathHasPrefix;
129791
- }
129792
- });
129793
- const _parsepath = requireParsePath();
129794
- function pathHasPrefix(path, prefix) {
129795
- if (typeof path !== "string") {
129796
- return false;
129797
- }
129798
- const { pathname } = (0, _parsepath.parsePath)(path);
129799
- return pathname === prefix || pathname.startsWith(prefix + "/");
129800
- }
129801
-
129802
-
129803
- } (pathHasPrefix));
129804
- return pathHasPrefix;
129805
- }
129806
-
129807
- var hasRequiredHasBasePath;
129808
-
129809
- function requireHasBasePath () {
129810
- if (hasRequiredHasBasePath) return hasBasePath.exports;
129811
- hasRequiredHasBasePath = 1;
129812
- (function (module, exports) {
129813
- Object.defineProperty(exports, "__esModule", {
129814
- value: true
129815
- });
129816
- Object.defineProperty(exports, "hasBasePath", {
129817
- enumerable: true,
129818
- get: function() {
129819
- return hasBasePath;
129820
- }
129821
- });
129822
- const _pathhasprefix = requirePathHasPrefix();
129823
- const basePath = process.env.__NEXT_ROUTER_BASEPATH || "";
129824
- function hasBasePath(path) {
129825
- return (0, _pathhasprefix.pathHasPrefix)(path, basePath);
129826
- }
129827
-
129828
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
129829
- Object.defineProperty(exports.default, '__esModule', { value: true });
129830
- Object.assign(exports.default, exports);
129831
- module.exports = exports.default;
129832
- }
129833
-
129834
-
129835
- } (hasBasePath, hasBasePath.exports));
129836
- return hasBasePath.exports;
129837
- }
129838
-
129839
- var hasRequiredIsLocalUrl;
129840
-
129841
- function requireIsLocalUrl () {
129842
- if (hasRequiredIsLocalUrl) return isLocalUrl;
129843
- hasRequiredIsLocalUrl = 1;
129844
- (function (exports) {
129845
- Object.defineProperty(exports, "__esModule", {
129846
- value: true
129847
- });
129848
- Object.defineProperty(exports, "isLocalURL", {
129849
- enumerable: true,
129850
- get: function() {
129851
- return isLocalURL;
129852
- }
129853
- });
129854
- const _utils = requireUtils$1();
129855
- const _hasbasepath = requireHasBasePath();
129856
- function isLocalURL(url) {
129857
- // prevent a hydration mismatch on href for url with anchor refs
129858
- if (!(0, _utils.isAbsoluteUrl)(url)) return true;
129859
- try {
129860
- // absolute urls can be local if they are on the same origin
129861
- const locationOrigin = (0, _utils.getLocationOrigin)();
129862
- const resolved = new URL(url, locationOrigin);
129863
- return resolved.origin === locationOrigin && (0, _hasbasepath.hasBasePath)(resolved.pathname);
129864
- } catch (_) {
129865
- return false;
129866
- }
129867
- }
129868
-
129869
-
129870
- } (isLocalUrl));
129871
- return isLocalUrl;
129872
- }
129873
-
129874
- var utils = {};
129875
-
129876
- var sortedRoutes = {};
129877
-
129878
- var hasRequiredSortedRoutes;
129879
-
129880
- function requireSortedRoutes () {
129881
- if (hasRequiredSortedRoutes) return sortedRoutes;
129882
- hasRequiredSortedRoutes = 1;
129883
- (function (exports) {
129884
- Object.defineProperty(exports, "__esModule", {
129885
- value: true
129886
- });
129887
- Object.defineProperty(exports, "getSortedRoutes", {
129888
- enumerable: true,
129889
- get: function() {
129890
- return getSortedRoutes;
129891
- }
129892
- });
129893
- class UrlNode {
129894
- insert(urlPath) {
129895
- this._insert(urlPath.split("/").filter(Boolean), [], false);
129896
- }
129897
- smoosh() {
129898
- return this._smoosh();
129899
- }
129900
- _smoosh(prefix) {
129901
- if (prefix === void 0) prefix = "/";
129902
- const childrenPaths = [
129903
- ...this.children.keys()
129904
- ].sort();
129905
- if (this.slugName !== null) {
129906
- childrenPaths.splice(childrenPaths.indexOf("[]"), 1);
129907
- }
129908
- if (this.restSlugName !== null) {
129909
- childrenPaths.splice(childrenPaths.indexOf("[...]"), 1);
129910
- }
129911
- if (this.optionalRestSlugName !== null) {
129912
- childrenPaths.splice(childrenPaths.indexOf("[[...]]"), 1);
129913
- }
129914
- const routes = childrenPaths.map((c)=>this.children.get(c)._smoosh("" + prefix + c + "/")).reduce((prev, curr)=>[
129915
- ...prev,
129916
- ...curr
129917
- ], []);
129918
- if (this.slugName !== null) {
129919
- routes.push(...this.children.get("[]")._smoosh(prefix + "[" + this.slugName + "]/"));
129920
- }
129921
- if (!this.placeholder) {
129922
- const r = prefix === "/" ? "/" : prefix.slice(0, -1);
129923
- if (this.optionalRestSlugName != null) {
129924
- throw new Error('You cannot define a route with the same specificity as a optional catch-all route ("' + r + '" and "' + r + "[[..." + this.optionalRestSlugName + ']]").');
129925
- }
129926
- routes.unshift(r);
129927
- }
129928
- if (this.restSlugName !== null) {
129929
- routes.push(...this.children.get("[...]")._smoosh(prefix + "[..." + this.restSlugName + "]/"));
129930
- }
129931
- if (this.optionalRestSlugName !== null) {
129932
- routes.push(...this.children.get("[[...]]")._smoosh(prefix + "[[..." + this.optionalRestSlugName + "]]/"));
129933
- }
129934
- return routes;
129935
- }
129936
- _insert(urlPaths, slugNames, isCatchAll) {
129937
- if (urlPaths.length === 0) {
129938
- this.placeholder = false;
129939
- return;
129940
- }
129941
- if (isCatchAll) {
129942
- throw new Error("Catch-all must be the last part of the URL.");
129943
- }
129944
- // The next segment in the urlPaths list
129945
- let nextSegment = urlPaths[0];
129946
- // Check if the segment matches `[something]`
129947
- if (nextSegment.startsWith("[") && nextSegment.endsWith("]")) {
129948
- // Strip `[` and `]`, leaving only `something`
129949
- let segmentName = nextSegment.slice(1, -1);
129950
- let isOptional = false;
129951
- if (segmentName.startsWith("[") && segmentName.endsWith("]")) {
129952
- // Strip optional `[` and `]`, leaving only `something`
129953
- segmentName = segmentName.slice(1, -1);
129954
- isOptional = true;
129955
- }
129956
- if (segmentName.startsWith("...")) {
129957
- // Strip `...`, leaving only `something`
129958
- segmentName = segmentName.substring(3);
129959
- isCatchAll = true;
129960
- }
129961
- if (segmentName.startsWith("[") || segmentName.endsWith("]")) {
129962
- throw new Error("Segment names may not start or end with extra brackets ('" + segmentName + "').");
129963
- }
129964
- if (segmentName.startsWith(".")) {
129965
- throw new Error("Segment names may not start with erroneous periods ('" + segmentName + "').");
129966
- }
129967
- function handleSlug(previousSlug, nextSlug) {
129968
- if (previousSlug !== null) {
129969
- // If the specific segment already has a slug but the slug is not `something`
129970
- // This prevents collisions like:
129971
- // pages/[post]/index.js
129972
- // pages/[id]/index.js
129973
- // Because currently multiple dynamic params on the same segment level are not supported
129974
- if (previousSlug !== nextSlug) {
129975
- // TODO: This error seems to be confusing for users, needs an error link, the description can be based on above comment.
129976
- throw new Error("You cannot use different slug names for the same dynamic path ('" + previousSlug + "' !== '" + nextSlug + "').");
129977
- }
129978
- }
129979
- slugNames.forEach((slug)=>{
129980
- if (slug === nextSlug) {
129981
- throw new Error('You cannot have the same slug name "' + nextSlug + '" repeat within a single dynamic path');
129982
- }
129983
- if (slug.replace(/\W/g, "") === nextSegment.replace(/\W/g, "")) {
129984
- throw new Error('You cannot have the slug names "' + slug + '" and "' + nextSlug + '" differ only by non-word symbols within a single dynamic path');
129985
- }
129986
- });
129987
- slugNames.push(nextSlug);
129988
- }
129989
- if (isCatchAll) {
129990
- if (isOptional) {
129991
- if (this.restSlugName != null) {
129992
- throw new Error('You cannot use both an required and optional catch-all route at the same level ("[...' + this.restSlugName + ']" and "' + urlPaths[0] + '" ).');
129993
- }
129994
- handleSlug(this.optionalRestSlugName, segmentName);
129995
- // slugName is kept as it can only be one particular slugName
129996
- this.optionalRestSlugName = segmentName;
129997
- // nextSegment is overwritten to [[...]] so that it can later be sorted specifically
129998
- nextSegment = "[[...]]";
129999
- } else {
130000
- if (this.optionalRestSlugName != null) {
130001
- throw new Error('You cannot use both an optional and required catch-all route at the same level ("[[...' + this.optionalRestSlugName + ']]" and "' + urlPaths[0] + '").');
130002
- }
130003
- handleSlug(this.restSlugName, segmentName);
130004
- // slugName is kept as it can only be one particular slugName
130005
- this.restSlugName = segmentName;
130006
- // nextSegment is overwritten to [...] so that it can later be sorted specifically
130007
- nextSegment = "[...]";
130008
- }
130009
- } else {
130010
- if (isOptional) {
130011
- throw new Error('Optional route parameters are not yet supported ("' + urlPaths[0] + '").');
130012
- }
130013
- handleSlug(this.slugName, segmentName);
130014
- // slugName is kept as it can only be one particular slugName
130015
- this.slugName = segmentName;
130016
- // nextSegment is overwritten to [] so that it can later be sorted specifically
130017
- nextSegment = "[]";
130018
- }
130019
- }
130020
- // If this UrlNode doesn't have the nextSegment yet we create a new child UrlNode
130021
- if (!this.children.has(nextSegment)) {
130022
- this.children.set(nextSegment, new UrlNode());
130023
- }
130024
- this.children.get(nextSegment)._insert(urlPaths.slice(1), slugNames, isCatchAll);
130025
- }
130026
- constructor(){
130027
- this.placeholder = true;
130028
- this.children = new Map();
130029
- this.slugName = null;
130030
- this.restSlugName = null;
130031
- this.optionalRestSlugName = null;
130032
- }
130033
- }
130034
- function getSortedRoutes(normalizedPages) {
130035
- // First the UrlNode is created, and every UrlNode can have only 1 dynamic segment
130036
- // Eg you can't have pages/[post]/abc.js and pages/[hello]/something-else.js
130037
- // Only 1 dynamic segment per nesting level
130038
- // So in the case that is test/integration/dynamic-routing it'll be this:
130039
- // pages/[post]/comments.js
130040
- // pages/blog/[post]/comment/[id].js
130041
- // Both are fine because `pages/[post]` and `pages/blog` are on the same level
130042
- // So in this case `UrlNode` created here has `this.slugName === 'post'`
130043
- // And since your PR passed through `slugName` as an array basically it'd including it in too many possibilities
130044
- // Instead what has to be passed through is the upwards path's dynamic names
130045
- const root = new UrlNode();
130046
- // Here the `root` gets injected multiple paths, and insert will break them up into sublevels
130047
- normalizedPages.forEach((pagePath)=>root.insert(pagePath));
130048
- // Smoosh will then sort those sublevels up to the point where you get the correct route definition priority
130049
- return root.smoosh();
130050
- }
130051
-
130052
-
130053
- } (sortedRoutes));
130054
- return sortedRoutes;
130055
- }
130056
-
130057
- var isDynamic = {};
130058
-
130059
- var interceptionRoutes = {};
130060
-
130061
- var appPaths = {};
130062
-
130063
- var ensureLeadingSlash = {};
130064
-
130065
- /**
130066
- * For a given page path, this function ensures that there is a leading slash.
130067
- * If there is not a leading slash, one is added, otherwise it is noop.
130068
- */
130069
-
130070
- var hasRequiredEnsureLeadingSlash;
130071
-
130072
- function requireEnsureLeadingSlash () {
130073
- if (hasRequiredEnsureLeadingSlash) return ensureLeadingSlash;
130074
- hasRequiredEnsureLeadingSlash = 1;
130075
- (function (exports) {
130076
- Object.defineProperty(exports, "__esModule", {
130077
- value: true
130078
- });
130079
- Object.defineProperty(exports, "ensureLeadingSlash", {
130080
- enumerable: true,
130081
- get: function() {
130082
- return ensureLeadingSlash;
130083
- }
130084
- });
130085
- function ensureLeadingSlash(path) {
130086
- return path.startsWith("/") ? path : "/" + path;
130087
- }
130088
-
130089
-
130090
- } (ensureLeadingSlash));
130091
- return ensureLeadingSlash;
130092
- }
130093
-
130094
- var segment = {};
130095
-
130096
- var hasRequiredSegment;
130097
-
130098
- function requireSegment () {
130099
- if (hasRequiredSegment) return segment;
130100
- hasRequiredSegment = 1;
130101
- (function (exports) {
130102
- Object.defineProperty(exports, "__esModule", {
130103
- value: true
130104
- });
130105
- function _export(target, all) {
130106
- for(var name in all)Object.defineProperty(target, name, {
130107
- enumerable: true,
130108
- get: all[name]
130109
- });
130110
- }
130111
- _export(exports, {
130112
- DEFAULT_SEGMENT_KEY: function() {
130113
- return DEFAULT_SEGMENT_KEY;
130114
- },
130115
- PAGE_SEGMENT_KEY: function() {
130116
- return PAGE_SEGMENT_KEY;
130117
- },
130118
- isGroupSegment: function() {
130119
- return isGroupSegment;
130120
- }
130121
- });
130122
- function isGroupSegment(segment) {
130123
- // Use array[0] for performant purpose
130124
- return segment[0] === "(" && segment.endsWith(")");
130125
- }
130126
- const PAGE_SEGMENT_KEY = "__PAGE__";
130127
- const DEFAULT_SEGMENT_KEY = "__DEFAULT__";
130128
-
130129
-
130130
- } (segment));
130131
- return segment;
130132
- }
130133
-
130134
- var hasRequiredAppPaths;
130135
-
130136
- function requireAppPaths () {
130137
- if (hasRequiredAppPaths) return appPaths;
130138
- hasRequiredAppPaths = 1;
130139
- (function (exports) {
130140
- Object.defineProperty(exports, "__esModule", {
130141
- value: true
130142
- });
130143
- function _export(target, all) {
130144
- for(var name in all)Object.defineProperty(target, name, {
130145
- enumerable: true,
130146
- get: all[name]
130147
- });
130148
- }
130149
- _export(exports, {
130150
- normalizeAppPath: function() {
130151
- return normalizeAppPath;
130152
- },
130153
- normalizeRscURL: function() {
130154
- return normalizeRscURL;
130155
- }
130156
- });
130157
- const _ensureleadingslash = requireEnsureLeadingSlash();
130158
- const _segment = requireSegment();
130159
- function normalizeAppPath(route) {
130160
- return (0, _ensureleadingslash.ensureLeadingSlash)(route.split("/").reduce((pathname, segment, index, segments)=>{
130161
- // Empty segments are ignored.
130162
- if (!segment) {
130163
- return pathname;
130164
- }
130165
- // Groups are ignored.
130166
- if ((0, _segment.isGroupSegment)(segment)) {
130167
- return pathname;
130168
- }
130169
- // Parallel segments are ignored.
130170
- if (segment[0] === "@") {
130171
- return pathname;
130172
- }
130173
- // The last segment (if it's a leaf) should be ignored.
130174
- if ((segment === "page" || segment === "route") && index === segments.length - 1) {
130175
- return pathname;
130176
- }
130177
- return pathname + "/" + segment;
130178
- }, ""));
130179
- }
130180
- function normalizeRscURL(url) {
130181
- return url.replace(/\.rsc($|\?)/, // $1 ensures `?` is preserved
130182
- "$1");
130183
- }
130184
-
130185
-
130186
- } (appPaths));
130187
- return appPaths;
130188
- }
130189
-
130190
- var hasRequiredInterceptionRoutes;
130191
-
130192
- function requireInterceptionRoutes () {
130193
- if (hasRequiredInterceptionRoutes) return interceptionRoutes;
130194
- hasRequiredInterceptionRoutes = 1;
130195
- (function (exports) {
130196
- Object.defineProperty(exports, "__esModule", {
130197
- value: true
130198
- });
130199
- function _export(target, all) {
130200
- for(var name in all)Object.defineProperty(target, name, {
130201
- enumerable: true,
130202
- get: all[name]
130203
- });
130204
- }
130205
- _export(exports, {
130206
- INTERCEPTION_ROUTE_MARKERS: function() {
130207
- return INTERCEPTION_ROUTE_MARKERS;
130208
- },
130209
- extractInterceptionRouteInformation: function() {
130210
- return extractInterceptionRouteInformation;
130211
- },
130212
- isInterceptionRouteAppPath: function() {
130213
- return isInterceptionRouteAppPath;
130214
- }
130215
- });
130216
- const _apppaths = requireAppPaths();
130217
- const INTERCEPTION_ROUTE_MARKERS = [
130218
- "(..)(..)",
130219
- "(.)",
130220
- "(..)",
130221
- "(...)"
130222
- ];
130223
- function isInterceptionRouteAppPath(path) {
130224
- // TODO-APP: add more serious validation
130225
- return path.split("/").find((segment)=>INTERCEPTION_ROUTE_MARKERS.find((m)=>segment.startsWith(m))) !== undefined;
130226
- }
130227
- function extractInterceptionRouteInformation(path) {
130228
- let interceptingRoute, marker, interceptedRoute;
130229
- for (const segment of path.split("/")){
130230
- marker = INTERCEPTION_ROUTE_MARKERS.find((m)=>segment.startsWith(m));
130231
- if (marker) {
130232
- [interceptingRoute, interceptedRoute] = path.split(marker, 2);
130233
- break;
130234
- }
130235
- }
130236
- if (!interceptingRoute || !marker || !interceptedRoute) {
130237
- throw new Error(`Invalid interception route: ${path}. Must be in the format /<intercepting route>/(..|...|..)(..)/<intercepted route>`);
130238
- }
130239
- interceptingRoute = (0, _apppaths.normalizeAppPath)(interceptingRoute) // normalize the path, e.g. /(blog)/feed -> /feed
130240
- ;
130241
- switch(marker){
130242
- case "(.)":
130243
- // (.) indicates that we should match with sibling routes, so we just need to append the intercepted route to the intercepting route
130244
- if (interceptingRoute === "/") {
130245
- interceptedRoute = `/${interceptedRoute}`;
130246
- } else {
130247
- interceptedRoute = interceptingRoute + "/" + interceptedRoute;
130248
- }
130249
- break;
130250
- case "(..)":
130251
- // (..) indicates that we should match at one level up, so we need to remove the last segment of the intercepting route
130252
- if (interceptingRoute === "/") {
130253
- throw new Error(`Invalid interception route: ${path}. Cannot use (..) marker at the root level, use (.) instead.`);
130254
- }
130255
- interceptedRoute = interceptingRoute.split("/").slice(0, -1).concat(interceptedRoute).join("/");
130256
- break;
130257
- case "(...)":
130258
- // (...) will match the route segment in the root directory, so we need to use the root directory to prepend the intercepted route
130259
- interceptedRoute = "/" + interceptedRoute;
130260
- break;
130261
- case "(..)(..)":
130262
- // (..)(..) indicates that we should match at two levels up, so we need to remove the last two segments of the intercepting route
130263
- const splitInterceptingRoute = interceptingRoute.split("/");
130264
- if (splitInterceptingRoute.length <= 2) {
130265
- throw new Error(`Invalid interception route: ${path}. Cannot use (..)(..) marker at the root level or one level up.`);
130266
- }
130267
- interceptedRoute = splitInterceptingRoute.slice(0, -2).concat(interceptedRoute).join("/");
130268
- break;
130269
- default:
130270
- throw new Error("Invariant: unexpected marker");
130271
- }
130272
- return {
130273
- interceptingRoute,
130274
- interceptedRoute
130275
- };
130276
- }
130277
-
130278
-
130279
- } (interceptionRoutes));
130280
- return interceptionRoutes;
130281
- }
130282
-
130283
- var hasRequiredIsDynamic;
130284
-
130285
- function requireIsDynamic () {
130286
- if (hasRequiredIsDynamic) return isDynamic;
130287
- hasRequiredIsDynamic = 1;
130288
- (function (exports) {
130289
- Object.defineProperty(exports, "__esModule", {
130290
- value: true
130291
- });
130292
- Object.defineProperty(exports, "isDynamicRoute", {
130293
- enumerable: true,
130294
- get: function() {
130295
- return isDynamicRoute;
130296
- }
130297
- });
130298
- const _interceptionroutes = requireInterceptionRoutes();
130299
- // Identify /[param]/ in route string
130300
- const TEST_ROUTE = /\/\[[^/]+?\](?=\/|$)/;
130301
- function isDynamicRoute(route) {
130302
- if ((0, _interceptionroutes.isInterceptionRouteAppPath)(route)) {
130303
- route = (0, _interceptionroutes.extractInterceptionRouteInformation)(route).interceptedRoute;
130304
- }
130305
- return TEST_ROUTE.test(route);
130306
- }
130307
-
130308
-
130309
- } (isDynamic));
130310
- return isDynamic;
130311
- }
130312
-
130313
- var hasRequiredUtils;
130314
-
130315
- function requireUtils () {
130316
- if (hasRequiredUtils) return utils;
130317
- hasRequiredUtils = 1;
130318
- (function (exports) {
130319
- Object.defineProperty(exports, "__esModule", {
130320
- value: true
130321
- });
130322
- function _export(target, all) {
130323
- for(var name in all)Object.defineProperty(target, name, {
130324
- enumerable: true,
130325
- get: all[name]
130326
- });
130327
- }
130328
- _export(exports, {
130329
- getSortedRoutes: function() {
130330
- return _sortedroutes.getSortedRoutes;
130331
- },
130332
- isDynamicRoute: function() {
130333
- return _isdynamic.isDynamicRoute;
130334
- }
130335
- });
130336
- const _sortedroutes = requireSortedRoutes();
130337
- const _isdynamic = requireIsDynamic();
130338
-
130339
-
130340
- } (utils));
130341
- return utils;
130342
- }
130343
-
130344
- var interpolateAs = {};
130345
-
130346
- var routeMatcher = {};
130347
-
130348
- var hasRequiredRouteMatcher;
130349
-
130350
- function requireRouteMatcher () {
130351
- if (hasRequiredRouteMatcher) return routeMatcher;
130352
- hasRequiredRouteMatcher = 1;
130353
- (function (exports) {
130354
- Object.defineProperty(exports, "__esModule", {
130355
- value: true
130356
- });
130357
- Object.defineProperty(exports, "getRouteMatcher", {
130358
- enumerable: true,
130359
- get: function() {
130360
- return getRouteMatcher;
130361
- }
130362
- });
130363
- const _utils = requireUtils$1();
130364
- function getRouteMatcher(param) {
130365
- let { re, groups } = param;
130366
- return (pathname)=>{
130367
- const routeMatch = re.exec(pathname);
130368
- if (!routeMatch) {
130369
- return false;
130370
- }
130371
- const decode = (param)=>{
130372
- try {
130373
- return decodeURIComponent(param);
130374
- } catch (_) {
130375
- throw new _utils.DecodeError("failed to decode param");
130376
- }
130377
- };
130378
- const params = {};
130379
- Object.keys(groups).forEach((slugName)=>{
130380
- const g = groups[slugName];
130381
- const m = routeMatch[g.pos];
130382
- if (m !== undefined) {
130383
- params[slugName] = ~m.indexOf("/") ? m.split("/").map((entry)=>decode(entry)) : g.repeat ? [
130384
- decode(m)
130385
- ] : decode(m);
130386
- }
130387
- });
130388
- return params;
130389
- };
130390
- }
130391
-
130392
-
130393
- } (routeMatcher));
130394
- return routeMatcher;
130395
- }
130396
-
130397
- var routeRegex = {};
130398
-
130399
- var escapeRegexp = {};
130400
-
130401
- var hasRequiredEscapeRegexp;
130402
-
130403
- function requireEscapeRegexp () {
130404
- if (hasRequiredEscapeRegexp) return escapeRegexp;
130405
- hasRequiredEscapeRegexp = 1;
130406
- (function (exports) {
130407
- Object.defineProperty(exports, "__esModule", {
130408
- value: true
130409
- });
130410
- Object.defineProperty(exports, "escapeStringRegexp", {
130411
- enumerable: true,
130412
- get: function() {
130413
- return escapeStringRegexp;
130414
- }
130415
- });
130416
- const reHasRegExp = /[|\\{}()[\]^$+*?.-]/;
130417
- const reReplaceRegExp = /[|\\{}()[\]^$+*?.-]/g;
130418
- function escapeStringRegexp(str) {
130419
- // see also: https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/escapeRegExp.js#L23
130420
- if (reHasRegExp.test(str)) {
130421
- return str.replace(reReplaceRegExp, "\\$&");
130422
- }
130423
- return str;
130424
- }
130425
-
130426
-
130427
- } (escapeRegexp));
130428
- return escapeRegexp;
130429
- }
130430
-
130431
- var hasRequiredRouteRegex;
130432
-
130433
- function requireRouteRegex () {
130434
- if (hasRequiredRouteRegex) return routeRegex;
130435
- hasRequiredRouteRegex = 1;
130436
- (function (exports) {
130437
- Object.defineProperty(exports, "__esModule", {
130438
- value: true
130439
- });
130440
- function _export(target, all) {
130441
- for(var name in all)Object.defineProperty(target, name, {
130442
- enumerable: true,
130443
- get: all[name]
130444
- });
130445
- }
130446
- _export(exports, {
130447
- getNamedMiddlewareRegex: function() {
130448
- return getNamedMiddlewareRegex;
130449
- },
130450
- getNamedRouteRegex: function() {
130451
- return getNamedRouteRegex;
130452
- },
130453
- getRouteRegex: function() {
130454
- return getRouteRegex;
130455
- }
130456
- });
130457
- const _interceptionroutes = requireInterceptionRoutes();
130458
- const _escaperegexp = requireEscapeRegexp();
130459
- const _removetrailingslash = requireRemoveTrailingSlash();
130460
- const NEXT_QUERY_PARAM_PREFIX = "nxtP";
130461
- const NEXT_INTERCEPTION_MARKER_PREFIX = "nxtI";
130462
- /**
130463
- * Parses a given parameter from a route to a data structure that can be used
130464
- * to generate the parametrized route. Examples:
130465
- * - `[...slug]` -> `{ key: 'slug', repeat: true, optional: true }`
130466
- * - `...slug` -> `{ key: 'slug', repeat: true, optional: false }`
130467
- * - `[foo]` -> `{ key: 'foo', repeat: false, optional: true }`
130468
- * - `bar` -> `{ key: 'bar', repeat: false, optional: false }`
130469
- */ function parseParameter(param) {
130470
- const optional = param.startsWith("[") && param.endsWith("]");
130471
- if (optional) {
130472
- param = param.slice(1, -1);
130473
- }
130474
- const repeat = param.startsWith("...");
130475
- if (repeat) {
130476
- param = param.slice(3);
130477
- }
130478
- return {
130479
- key: param,
130480
- repeat,
130481
- optional
130482
- };
130483
- }
130484
- function getParametrizedRoute(route) {
130485
- const segments = (0, _removetrailingslash.removeTrailingSlash)(route).slice(1).split("/");
130486
- const groups = {};
130487
- let groupIndex = 1;
130488
- return {
130489
- parameterizedRoute: segments.map((segment)=>{
130490
- const markerMatch = _interceptionroutes.INTERCEPTION_ROUTE_MARKERS.find((m)=>segment.startsWith(m));
130491
- const paramMatches = segment.match(/\[((?:\[.*\])|.+)\]/) // Check for parameters
130492
- ;
130493
- if (markerMatch && paramMatches) {
130494
- const { key, optional, repeat } = parseParameter(paramMatches[1]);
130495
- groups[key] = {
130496
- pos: groupIndex++,
130497
- repeat,
130498
- optional
130499
- };
130500
- return "/" + (0, _escaperegexp.escapeStringRegexp)(markerMatch) + "([^/]+?)";
130501
- } else if (paramMatches) {
130502
- const { key, repeat, optional } = parseParameter(paramMatches[1]);
130503
- groups[key] = {
130504
- pos: groupIndex++,
130505
- repeat,
130506
- optional
130507
- };
130508
- return repeat ? optional ? "(?:/(.+?))?" : "/(.+?)" : "/([^/]+?)";
130509
- } else {
130510
- return "/" + (0, _escaperegexp.escapeStringRegexp)(segment);
130511
- }
130512
- }).join(""),
130513
- groups
130514
- };
130515
- }
130516
- function getRouteRegex(normalizedRoute) {
130517
- const { parameterizedRoute, groups } = getParametrizedRoute(normalizedRoute);
130518
- return {
130519
- re: new RegExp("^" + parameterizedRoute + "(?:/)?$"),
130520
- groups: groups
130521
- };
130522
- }
130523
- /**
130524
- * Builds a function to generate a minimal routeKey using only a-z and minimal
130525
- * number of characters.
130526
- */ function buildGetSafeRouteKey() {
130527
- let i = 0;
130528
- return ()=>{
130529
- let routeKey = "";
130530
- let j = ++i;
130531
- while(j > 0){
130532
- routeKey += String.fromCharCode(97 + (j - 1) % 26);
130533
- j = Math.floor((j - 1) / 26);
130534
- }
130535
- return routeKey;
130536
- };
130537
- }
130538
- function getSafeKeyFromSegment(param) {
130539
- let { interceptionMarker, getSafeRouteKey, segment, routeKeys, keyPrefix } = param;
130540
- const { key, optional, repeat } = parseParameter(segment);
130541
- // replace any non-word characters since they can break
130542
- // the named regex
130543
- let cleanedKey = key.replace(/\W/g, "");
130544
- if (keyPrefix) {
130545
- cleanedKey = "" + keyPrefix + cleanedKey;
130546
- }
130547
- let invalidKey = false;
130548
- // check if the key is still invalid and fallback to using a known
130549
- // safe key
130550
- if (cleanedKey.length === 0 || cleanedKey.length > 30) {
130551
- invalidKey = true;
130552
- }
130553
- if (!isNaN(parseInt(cleanedKey.slice(0, 1)))) {
130554
- invalidKey = true;
130555
- }
130556
- if (invalidKey) {
130557
- cleanedKey = getSafeRouteKey();
130558
- }
130559
- if (keyPrefix) {
130560
- routeKeys[cleanedKey] = "" + keyPrefix + key;
130561
- } else {
130562
- routeKeys[cleanedKey] = key;
130563
- }
130564
- // if the segment has an interception marker, make sure that's part of the regex pattern
130565
- // this is to ensure that the route with the interception marker doesn't incorrectly match
130566
- // the non-intercepted route (ie /app/(.)[username] should not match /app/[username])
130567
- const interceptionPrefix = interceptionMarker ? (0, _escaperegexp.escapeStringRegexp)(interceptionMarker) : "";
130568
- return repeat ? optional ? "(?:/" + interceptionPrefix + "(?<" + cleanedKey + ">.+?))?" : "/" + interceptionPrefix + "(?<" + cleanedKey + ">.+?)" : "/" + interceptionPrefix + "(?<" + cleanedKey + ">[^/]+?)";
130569
- }
130570
- function getNamedParametrizedRoute(route, prefixRouteKeys) {
130571
- const segments = (0, _removetrailingslash.removeTrailingSlash)(route).slice(1).split("/");
130572
- const getSafeRouteKey = buildGetSafeRouteKey();
130573
- const routeKeys = {};
130574
- return {
130575
- namedParameterizedRoute: segments.map((segment)=>{
130576
- const hasInterceptionMarker = _interceptionroutes.INTERCEPTION_ROUTE_MARKERS.some((m)=>segment.startsWith(m));
130577
- const paramMatches = segment.match(/\[((?:\[.*\])|.+)\]/) // Check for parameters
130578
- ;
130579
- if (hasInterceptionMarker && paramMatches) {
130580
- const [usedMarker] = segment.split(paramMatches[0]);
130581
- return getSafeKeyFromSegment({
130582
- getSafeRouteKey,
130583
- interceptionMarker: usedMarker,
130584
- segment: paramMatches[1],
130585
- routeKeys,
130586
- keyPrefix: prefixRouteKeys ? NEXT_INTERCEPTION_MARKER_PREFIX : undefined
130587
- });
130588
- } else if (paramMatches) {
130589
- return getSafeKeyFromSegment({
130590
- getSafeRouteKey,
130591
- segment: paramMatches[1],
130592
- routeKeys,
130593
- keyPrefix: prefixRouteKeys ? NEXT_QUERY_PARAM_PREFIX : undefined
130594
- });
130595
- } else {
130596
- return "/" + (0, _escaperegexp.escapeStringRegexp)(segment);
130597
- }
130598
- }).join(""),
130599
- routeKeys
130600
- };
130601
- }
130602
- function getNamedRouteRegex(normalizedRoute, prefixRouteKey) {
130603
- const result = getNamedParametrizedRoute(normalizedRoute, prefixRouteKey);
130604
- return {
130605
- ...getRouteRegex(normalizedRoute),
130606
- namedRegex: "^" + result.namedParameterizedRoute + "(?:/)?$",
130607
- routeKeys: result.routeKeys
130608
- };
130609
- }
130610
- function getNamedMiddlewareRegex(normalizedRoute, options) {
130611
- const { parameterizedRoute } = getParametrizedRoute(normalizedRoute);
130612
- const { catchAll = true } = options;
130613
- if (parameterizedRoute === "/") {
130614
- let catchAllRegex = catchAll ? ".*" : "";
130615
- return {
130616
- namedRegex: "^/" + catchAllRegex + "$"
130617
- };
130618
- }
130619
- const { namedParameterizedRoute } = getNamedParametrizedRoute(normalizedRoute, false);
130620
- let catchAllGroupedRegex = catchAll ? "(?:(/.*)?)" : "";
130621
- return {
130622
- namedRegex: "^" + namedParameterizedRoute + catchAllGroupedRegex + "$"
130623
- };
130624
- }
130625
-
130626
-
130627
- } (routeRegex));
130628
- return routeRegex;
130629
- }
130630
-
130631
- var hasRequiredInterpolateAs;
130632
-
130633
- function requireInterpolateAs () {
130634
- if (hasRequiredInterpolateAs) return interpolateAs;
130635
- hasRequiredInterpolateAs = 1;
130636
- (function (exports) {
130637
- Object.defineProperty(exports, "__esModule", {
130638
- value: true
130639
- });
130640
- Object.defineProperty(exports, "interpolateAs", {
130641
- enumerable: true,
130642
- get: function() {
130643
- return interpolateAs;
130644
- }
130645
- });
130646
- const _routematcher = requireRouteMatcher();
130647
- const _routeregex = requireRouteRegex();
130648
- function interpolateAs(route, asPathname, query) {
130649
- let interpolatedRoute = "";
130650
- const dynamicRegex = (0, _routeregex.getRouteRegex)(route);
130651
- const dynamicGroups = dynamicRegex.groups;
130652
- const dynamicMatches = // Try to match the dynamic route against the asPath
130653
- (asPathname !== route ? (0, _routematcher.getRouteMatcher)(dynamicRegex)(asPathname) : "") || // Fall back to reading the values from the href
130654
- // TODO: should this take priority; also need to change in the router.
130655
- query;
130656
- interpolatedRoute = route;
130657
- const params = Object.keys(dynamicGroups);
130658
- if (!params.every((param)=>{
130659
- let value = dynamicMatches[param] || "";
130660
- const { repeat, optional } = dynamicGroups[param];
130661
- // support single-level catch-all
130662
- // TODO: more robust handling for user-error (passing `/`)
130663
- let replaced = "[" + (repeat ? "..." : "") + param + "]";
130664
- if (optional) {
130665
- replaced = (!value ? "/" : "") + "[" + replaced + "]";
130666
- }
130667
- if (repeat && !Array.isArray(value)) value = [
130668
- value
130669
- ];
130670
- return (optional || param in dynamicMatches) && // Interpolate group into data URL if present
130671
- (interpolatedRoute = interpolatedRoute.replace(replaced, repeat ? value.map(// these values should be fully encoded instead of just
130672
- // path delimiter escaped since they are being inserted
130673
- // into the URL and we expect URL encoded segments
130674
- // when parsing dynamic route params
130675
- (segment)=>encodeURIComponent(segment)).join("/") : encodeURIComponent(value)) || "/");
130676
- })) {
130677
- interpolatedRoute = "" // did not satisfy all requirements
130678
- ;
130679
- // n.b. We ignore this error because we handle warning for this case in
130680
- // development in the `<Link>` component directly.
130681
- }
130682
- return {
130683
- params,
130684
- result: interpolatedRoute
130685
- };
130686
- }
130687
-
130688
-
130689
- } (interpolateAs));
130690
- return interpolateAs;
130691
- }
130692
-
130693
- var hasRequiredResolveHref;
130694
-
130695
- function requireResolveHref () {
130696
- if (hasRequiredResolveHref) return resolveHref.exports;
130697
- hasRequiredResolveHref = 1;
130698
- (function (module, exports) {
130699
- Object.defineProperty(exports, "__esModule", {
130700
- value: true
130701
- });
130702
- Object.defineProperty(exports, "resolveHref", {
130703
- enumerable: true,
130704
- get: function() {
130705
- return resolveHref;
130706
- }
130707
- });
130708
- const _querystring = requireQuerystring();
130709
- const _formaturl = requireFormatUrl();
130710
- const _omit = requireOmit();
130711
- const _utils = requireUtils$1();
130712
- const _normalizetrailingslash = requireNormalizeTrailingSlash();
130713
- const _islocalurl = requireIsLocalUrl();
130714
- const _utils1 = requireUtils();
130715
- const _interpolateas = requireInterpolateAs();
130716
- function resolveHref(router, href, resolveAs) {
130717
- // we use a dummy base url for relative urls
130718
- let base;
130719
- let urlAsString = typeof href === "string" ? href : (0, _formaturl.formatWithValidation)(href);
130720
- // repeated slashes and backslashes in the URL are considered
130721
- // invalid and will never match a Next.js page/file
130722
- const urlProtoMatch = urlAsString.match(/^[a-zA-Z]{1,}:\/\//);
130723
- const urlAsStringNoProto = urlProtoMatch ? urlAsString.slice(urlProtoMatch[0].length) : urlAsString;
130724
- const urlParts = urlAsStringNoProto.split("?", 1);
130725
- if ((urlParts[0] || "").match(/(\/\/|\\)/)) {
130726
- console.error("Invalid href '" + urlAsString + "' passed to next/router in page: '" + router.pathname + "'. Repeated forward-slashes (//) or backslashes \\ are not valid in the href.");
130727
- const normalizedUrl = (0, _utils.normalizeRepeatedSlashes)(urlAsStringNoProto);
130728
- urlAsString = (urlProtoMatch ? urlProtoMatch[0] : "") + normalizedUrl;
130729
- }
130730
- // Return because it cannot be routed by the Next.js router
130731
- if (!(0, _islocalurl.isLocalURL)(urlAsString)) {
130732
- return resolveAs ? [
130733
- urlAsString
130734
- ] : urlAsString;
130735
- }
130736
- try {
130737
- base = new URL(urlAsString.startsWith("#") ? router.asPath : router.pathname, "http://n");
130738
- } catch (_) {
130739
- // fallback to / for invalid asPath values e.g. //
130740
- base = new URL("/", "http://n");
130741
- }
130742
- try {
130743
- const finalUrl = new URL(urlAsString, base);
130744
- finalUrl.pathname = (0, _normalizetrailingslash.normalizePathTrailingSlash)(finalUrl.pathname);
130745
- let interpolatedAs = "";
130746
- if ((0, _utils1.isDynamicRoute)(finalUrl.pathname) && finalUrl.searchParams && resolveAs) {
130747
- const query = (0, _querystring.searchParamsToUrlQuery)(finalUrl.searchParams);
130748
- const { result, params } = (0, _interpolateas.interpolateAs)(finalUrl.pathname, finalUrl.pathname, query);
130749
- if (result) {
130750
- interpolatedAs = (0, _formaturl.formatWithValidation)({
130751
- pathname: result,
130752
- hash: finalUrl.hash,
130753
- query: (0, _omit.omit)(query, params)
130754
- });
130755
- }
130756
- }
130757
- // if the origin didn't change, it means we received a relative href
130758
- const resolvedHref = finalUrl.origin === base.origin ? finalUrl.href.slice(finalUrl.origin.length) : finalUrl.href;
130759
- return resolveAs ? [
130760
- resolvedHref,
130761
- interpolatedAs || resolvedHref
130762
- ] : resolvedHref;
130763
- } catch (_) {
130764
- return resolveAs ? [
130765
- urlAsString
130766
- ] : urlAsString;
130767
- }
130768
- }
130769
-
130770
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
130771
- Object.defineProperty(exports.default, '__esModule', { value: true });
130772
- Object.assign(exports.default, exports);
130773
- module.exports = exports.default;
130774
- }
130775
-
130776
-
130777
- } (resolveHref, resolveHref.exports));
130778
- return resolveHref.exports;
130779
- }
130780
-
130781
- var addLocale$1 = {exports: {}};
130782
-
130783
- var addLocale = {};
130784
-
130785
- var addPathPrefix = {};
130786
-
130787
- var hasRequiredAddPathPrefix;
130788
-
130789
- function requireAddPathPrefix () {
130790
- if (hasRequiredAddPathPrefix) return addPathPrefix;
130791
- hasRequiredAddPathPrefix = 1;
130792
- (function (exports) {
130793
- Object.defineProperty(exports, "__esModule", {
130794
- value: true
130795
- });
130796
- Object.defineProperty(exports, "addPathPrefix", {
130797
- enumerable: true,
130798
- get: function() {
130799
- return addPathPrefix;
130800
- }
130801
- });
130802
- const _parsepath = requireParsePath();
130803
- function addPathPrefix(path, prefix) {
130804
- if (!path.startsWith("/") || !prefix) {
130805
- return path;
130806
- }
130807
- const { pathname, query, hash } = (0, _parsepath.parsePath)(path);
130808
- return "" + prefix + pathname + query + hash;
130809
- }
130810
-
130811
-
130812
- } (addPathPrefix));
130813
- return addPathPrefix;
130814
- }
130815
-
130816
- var hasRequiredAddLocale$1;
130817
-
130818
- function requireAddLocale$1 () {
130819
- if (hasRequiredAddLocale$1) return addLocale;
130820
- hasRequiredAddLocale$1 = 1;
130821
- (function (exports) {
130822
- Object.defineProperty(exports, "__esModule", {
130823
- value: true
130824
- });
130825
- Object.defineProperty(exports, "addLocale", {
130826
- enumerable: true,
130827
- get: function() {
130828
- return addLocale;
130829
- }
130830
- });
130831
- const _addpathprefix = requireAddPathPrefix();
130832
- const _pathhasprefix = requirePathHasPrefix();
130833
- function addLocale(path, locale, defaultLocale, ignorePrefix) {
130834
- // If no locale was given or the locale is the default locale, we don't need
130835
- // to prefix the path.
130836
- if (!locale || locale === defaultLocale) return path;
130837
- const lower = path.toLowerCase();
130838
- // If the path is an API path or the path already has the locale prefix, we
130839
- // don't need to prefix the path.
130840
- if (!ignorePrefix) {
130841
- if ((0, _pathhasprefix.pathHasPrefix)(lower, "/api")) return path;
130842
- if ((0, _pathhasprefix.pathHasPrefix)(lower, "/" + locale.toLowerCase())) return path;
130843
- }
130844
- // Add the locale prefix to the path.
130845
- return (0, _addpathprefix.addPathPrefix)(path, "/" + locale);
130846
- }
130847
-
130848
-
130849
- } (addLocale));
130850
- return addLocale;
130851
- }
130852
-
130853
- var hasRequiredAddLocale;
130854
-
130855
- function requireAddLocale () {
130856
- if (hasRequiredAddLocale) return addLocale$1.exports;
130857
- hasRequiredAddLocale = 1;
130858
- (function (module, exports) {
130859
- Object.defineProperty(exports, "__esModule", {
130860
- value: true
130861
- });
130862
- Object.defineProperty(exports, "addLocale", {
130863
- enumerable: true,
130864
- get: function() {
130865
- return addLocale;
130866
- }
130867
- });
130868
- const _normalizetrailingslash = requireNormalizeTrailingSlash();
130869
- const addLocale = function(path) {
130870
- for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
130871
- args[_key - 1] = arguments[_key];
130872
- }
130873
- if (process.env.__NEXT_I18N_SUPPORT) {
130874
- return (0, _normalizetrailingslash.normalizePathTrailingSlash)(requireAddLocale$1().addLocale(path, ...args));
130875
- }
130876
- return path;
130877
- };
130878
-
130879
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
130880
- Object.defineProperty(exports.default, '__esModule', { value: true });
130881
- Object.assign(exports.default, exports);
130882
- module.exports = exports.default;
130883
- }
130884
-
130885
-
130886
- } (addLocale$1, addLocale$1.exports));
130887
- return addLocale$1.exports;
130888
- }
130889
-
130890
- var routerContext_sharedRuntime = {};
130891
-
130892
- var hasRequiredRouterContext_sharedRuntime;
130893
-
130894
- function requireRouterContext_sharedRuntime () {
130895
- if (hasRequiredRouterContext_sharedRuntime) return routerContext_sharedRuntime;
130896
- hasRequiredRouterContext_sharedRuntime = 1;
130897
- (function (exports) {
130898
- Object.defineProperty(exports, "__esModule", {
130899
- value: true
130900
- });
130901
- Object.defineProperty(exports, "RouterContext", {
130902
- enumerable: true,
130903
- get: function() {
130904
- return RouterContext;
130905
- }
130906
- });
130907
- const _interop_require_default = _interop_require_default$1;
130908
- const _react = /*#__PURE__*/ _interop_require_default._(React);
130909
- const RouterContext = _react.default.createContext(null);
130910
- if (process.env.NODE_ENV !== "production") {
130911
- RouterContext.displayName = "RouterContext";
130912
- }
130913
-
130914
-
130915
- } (routerContext_sharedRuntime));
130916
- return routerContext_sharedRuntime;
130917
- }
130918
-
130919
- var appRouterContext_sharedRuntime = {};
130920
-
130921
- var hasRequiredAppRouterContext_sharedRuntime;
130922
-
130923
- function requireAppRouterContext_sharedRuntime () {
130924
- if (hasRequiredAppRouterContext_sharedRuntime) return appRouterContext_sharedRuntime;
130925
- hasRequiredAppRouterContext_sharedRuntime = 1;
130926
- (function (exports) {
130927
- "use client";
130928
- Object.defineProperty(exports, "__esModule", {
130929
- value: true
130930
- });
130931
- function _export(target, all) {
130932
- for(var name in all)Object.defineProperty(target, name, {
130933
- enumerable: true,
130934
- get: all[name]
130935
- });
130936
- }
130937
- _export(exports, {
130938
- AppRouterContext: function() {
130939
- return AppRouterContext;
130940
- },
130941
- GlobalLayoutRouterContext: function() {
130942
- return GlobalLayoutRouterContext;
130943
- },
130944
- LayoutRouterContext: function() {
130945
- return LayoutRouterContext;
130946
- },
130947
- MissingSlotContext: function() {
130948
- return MissingSlotContext;
130949
- },
130950
- TemplateContext: function() {
130951
- return TemplateContext;
130952
- }
130953
- });
130954
- const _interop_require_default = _interop_require_default$1;
130955
- const _react = /*#__PURE__*/ _interop_require_default._(React);
130956
- const AppRouterContext = _react.default.createContext(null);
130957
- const LayoutRouterContext = _react.default.createContext(null);
130958
- const GlobalLayoutRouterContext = _react.default.createContext(null);
130959
- const TemplateContext = _react.default.createContext(null);
130960
- if (process.env.NODE_ENV !== "production") {
130961
- AppRouterContext.displayName = "AppRouterContext";
130962
- LayoutRouterContext.displayName = "LayoutRouterContext";
130963
- GlobalLayoutRouterContext.displayName = "GlobalLayoutRouterContext";
130964
- TemplateContext.displayName = "TemplateContext";
130965
- }
130966
- const MissingSlotContext = _react.default.createContext(new Set());
130967
-
130968
-
130969
- } (appRouterContext_sharedRuntime));
130970
- return appRouterContext_sharedRuntime;
130971
- }
130972
-
130973
- var useIntersection = {exports: {}};
130974
-
130975
- var requestIdleCallback = {exports: {}};
130976
-
130977
- var hasRequiredRequestIdleCallback;
130978
-
130979
- function requireRequestIdleCallback () {
130980
- if (hasRequiredRequestIdleCallback) return requestIdleCallback.exports;
130981
- hasRequiredRequestIdleCallback = 1;
130982
- (function (module, exports) {
130983
- Object.defineProperty(exports, "__esModule", {
130984
- value: true
130985
- });
130986
- function _export(target, all) {
130987
- for(var name in all)Object.defineProperty(target, name, {
130988
- enumerable: true,
130989
- get: all[name]
130990
- });
130991
- }
130992
- _export(exports, {
130993
- cancelIdleCallback: function() {
130994
- return cancelIdleCallback;
130995
- },
130996
- requestIdleCallback: function() {
130997
- return requestIdleCallback;
130998
- }
130999
- });
131000
- const requestIdleCallback = typeof self !== "undefined" && self.requestIdleCallback && self.requestIdleCallback.bind(window) || function(cb) {
131001
- let start = Date.now();
131002
- return self.setTimeout(function() {
131003
- cb({
131004
- didTimeout: false,
131005
- timeRemaining: function() {
131006
- return Math.max(0, 50 - (Date.now() - start));
131007
- }
131008
- });
131009
- }, 1);
131010
- };
131011
- const cancelIdleCallback = typeof self !== "undefined" && self.cancelIdleCallback && self.cancelIdleCallback.bind(window) || function(id) {
131012
- return clearTimeout(id);
131013
- };
131014
-
131015
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
131016
- Object.defineProperty(exports.default, '__esModule', { value: true });
131017
- Object.assign(exports.default, exports);
131018
- module.exports = exports.default;
131019
- }
131020
-
131021
-
131022
- } (requestIdleCallback, requestIdleCallback.exports));
131023
- return requestIdleCallback.exports;
131024
- }
131025
-
131026
- var hasRequiredUseIntersection;
131027
-
131028
- function requireUseIntersection () {
131029
- if (hasRequiredUseIntersection) return useIntersection.exports;
131030
- hasRequiredUseIntersection = 1;
131031
- (function (module, exports) {
131032
- Object.defineProperty(exports, "__esModule", {
131033
- value: true
131034
- });
131035
- Object.defineProperty(exports, "useIntersection", {
131036
- enumerable: true,
131037
- get: function() {
131038
- return useIntersection;
131039
- }
131040
- });
131041
- const _react = React;
131042
- const _requestidlecallback = requireRequestIdleCallback();
131043
- const hasIntersectionObserver = typeof IntersectionObserver === "function";
131044
- const observers = new Map();
131045
- const idList = [];
131046
- function createObserver(options) {
131047
- const id = {
131048
- root: options.root || null,
131049
- margin: options.rootMargin || ""
131050
- };
131051
- const existing = idList.find((obj)=>obj.root === id.root && obj.margin === id.margin);
131052
- let instance;
131053
- if (existing) {
131054
- instance = observers.get(existing);
131055
- if (instance) {
131056
- return instance;
131057
- }
131058
- }
131059
- const elements = new Map();
131060
- const observer = new IntersectionObserver((entries)=>{
131061
- entries.forEach((entry)=>{
131062
- const callback = elements.get(entry.target);
131063
- const isVisible = entry.isIntersecting || entry.intersectionRatio > 0;
131064
- if (callback && isVisible) {
131065
- callback(isVisible);
131066
- }
131067
- });
131068
- }, options);
131069
- instance = {
131070
- id,
131071
- observer,
131072
- elements
131073
- };
131074
- idList.push(id);
131075
- observers.set(id, instance);
131076
- return instance;
131077
- }
131078
- function observe(element, callback, options) {
131079
- const { id, observer, elements } = createObserver(options);
131080
- elements.set(element, callback);
131081
- observer.observe(element);
131082
- return function unobserve() {
131083
- elements.delete(element);
131084
- observer.unobserve(element);
131085
- // Destroy observer when there's nothing left to watch:
131086
- if (elements.size === 0) {
131087
- observer.disconnect();
131088
- observers.delete(id);
131089
- const index = idList.findIndex((obj)=>obj.root === id.root && obj.margin === id.margin);
131090
- if (index > -1) {
131091
- idList.splice(index, 1);
131092
- }
131093
- }
131094
- };
131095
- }
131096
- function useIntersection(param) {
131097
- let { rootRef, rootMargin, disabled } = param;
131098
- const isDisabled = disabled || !hasIntersectionObserver;
131099
- const [visible, setVisible] = (0, _react.useState)(false);
131100
- const elementRef = (0, _react.useRef)(null);
131101
- const setElement = (0, _react.useCallback)((element)=>{
131102
- elementRef.current = element;
131103
- }, []);
131104
- (0, _react.useEffect)(()=>{
131105
- if (hasIntersectionObserver) {
131106
- if (isDisabled || visible) return;
131107
- const element = elementRef.current;
131108
- if (element && element.tagName) {
131109
- const unobserve = observe(element, (isVisible)=>isVisible && setVisible(isVisible), {
131110
- root: rootRef == null ? void 0 : rootRef.current,
131111
- rootMargin
131112
- });
131113
- return unobserve;
131114
- }
131115
- } else {
131116
- if (!visible) {
131117
- const idleCallback = (0, _requestidlecallback.requestIdleCallback)(()=>setVisible(true));
131118
- return ()=>(0, _requestidlecallback.cancelIdleCallback)(idleCallback);
131119
- }
131120
- }
131121
- // eslint-disable-next-line react-hooks/exhaustive-deps
131122
- }, [
131123
- isDisabled,
131124
- rootMargin,
131125
- rootRef,
131126
- visible,
131127
- elementRef.current
131128
- ]);
131129
- const resetVisible = (0, _react.useCallback)(()=>{
131130
- setVisible(false);
131131
- }, []);
131132
- return [
131133
- setElement,
131134
- visible,
131135
- resetVisible
131136
- ];
131137
- }
131138
-
131139
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
131140
- Object.defineProperty(exports.default, '__esModule', { value: true });
131141
- Object.assign(exports.default, exports);
131142
- module.exports = exports.default;
131143
- }
131144
-
131145
-
131146
- } (useIntersection, useIntersection.exports));
131147
- return useIntersection.exports;
131148
- }
131149
-
131150
- var getDomainLocale = {exports: {}};
131151
-
131152
- var normalizeLocalePath$1 = {exports: {}};
131153
-
131154
- var normalizeLocalePath = {};
131155
-
131156
- var hasRequiredNormalizeLocalePath$1;
131157
-
131158
- function requireNormalizeLocalePath$1 () {
131159
- if (hasRequiredNormalizeLocalePath$1) return normalizeLocalePath;
131160
- hasRequiredNormalizeLocalePath$1 = 1;
131161
- (function (exports) {
131162
- Object.defineProperty(exports, "__esModule", {
131163
- value: true
131164
- });
131165
- Object.defineProperty(exports, "normalizeLocalePath", {
131166
- enumerable: true,
131167
- get: function() {
131168
- return normalizeLocalePath;
131169
- }
131170
- });
131171
- function normalizeLocalePath(pathname, locales) {
131172
- let detectedLocale;
131173
- // first item will be empty string from splitting at first char
131174
- const pathnameParts = pathname.split("/");
131175
- (locales || []).some((locale)=>{
131176
- if (pathnameParts[1] && pathnameParts[1].toLowerCase() === locale.toLowerCase()) {
131177
- detectedLocale = locale;
131178
- pathnameParts.splice(1, 1);
131179
- pathname = pathnameParts.join("/") || "/";
131180
- return true;
131181
- }
131182
- return false;
131183
- });
131184
- return {
131185
- pathname,
131186
- detectedLocale
131187
- };
131188
- }
131189
-
131190
-
131191
- } (normalizeLocalePath));
131192
- return normalizeLocalePath;
131193
- }
131194
-
131195
- var hasRequiredNormalizeLocalePath;
131196
-
131197
- function requireNormalizeLocalePath () {
131198
- if (hasRequiredNormalizeLocalePath) return normalizeLocalePath$1.exports;
131199
- hasRequiredNormalizeLocalePath = 1;
131200
- (function (module, exports) {
131201
- Object.defineProperty(exports, "__esModule", {
131202
- value: true
131203
- });
131204
- Object.defineProperty(exports, "normalizeLocalePath", {
131205
- enumerable: true,
131206
- get: function() {
131207
- return normalizeLocalePath;
131208
- }
131209
- });
131210
- const normalizeLocalePath = (pathname, locales)=>{
131211
- if (process.env.__NEXT_I18N_SUPPORT) {
131212
- return requireNormalizeLocalePath$1().normalizeLocalePath(pathname, locales);
131213
- }
131214
- return {
131215
- pathname,
131216
- detectedLocale: undefined
131217
- };
131218
- };
131219
-
131220
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
131221
- Object.defineProperty(exports.default, '__esModule', { value: true });
131222
- Object.assign(exports.default, exports);
131223
- module.exports = exports.default;
131224
- }
131225
-
131226
-
131227
- } (normalizeLocalePath$1, normalizeLocalePath$1.exports));
131228
- return normalizeLocalePath$1.exports;
131229
- }
131230
-
131231
- var detectDomainLocale$1 = {exports: {}};
131232
-
131233
- var detectDomainLocale = {};
131234
-
131235
- var hasRequiredDetectDomainLocale$1;
131236
-
131237
- function requireDetectDomainLocale$1 () {
131238
- if (hasRequiredDetectDomainLocale$1) return detectDomainLocale;
131239
- hasRequiredDetectDomainLocale$1 = 1;
131240
- (function (exports) {
131241
- Object.defineProperty(exports, "__esModule", {
131242
- value: true
131243
- });
131244
- Object.defineProperty(exports, "detectDomainLocale", {
131245
- enumerable: true,
131246
- get: function() {
131247
- return detectDomainLocale;
131248
- }
131249
- });
131250
- function detectDomainLocale(domainItems, hostname, detectedLocale) {
131251
- if (!domainItems) return;
131252
- if (detectedLocale) {
131253
- detectedLocale = detectedLocale.toLowerCase();
131254
- }
131255
- for (const item of domainItems){
131256
- var _item_domain, _item_locales;
131257
- // remove port if present
131258
- const domainHostname = (_item_domain = item.domain) == null ? void 0 : _item_domain.split(":", 1)[0].toLowerCase();
131259
- if (hostname === domainHostname || detectedLocale === item.defaultLocale.toLowerCase() || ((_item_locales = item.locales) == null ? void 0 : _item_locales.some((locale)=>locale.toLowerCase() === detectedLocale))) {
131260
- return item;
131261
- }
131262
- }
131263
- }
131264
-
131265
-
131266
- } (detectDomainLocale));
131267
- return detectDomainLocale;
131268
- }
131269
-
131270
- var hasRequiredDetectDomainLocale;
131271
-
131272
- function requireDetectDomainLocale () {
131273
- if (hasRequiredDetectDomainLocale) return detectDomainLocale$1.exports;
131274
- hasRequiredDetectDomainLocale = 1;
131275
- (function (module, exports) {
131276
- Object.defineProperty(exports, "__esModule", {
131277
- value: true
131278
- });
131279
- Object.defineProperty(exports, "detectDomainLocale", {
131280
- enumerable: true,
131281
- get: function() {
131282
- return detectDomainLocale;
131283
- }
131284
- });
131285
- const detectDomainLocale = function() {
131286
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
131287
- args[_key] = arguments[_key];
131288
- }
131289
- if (process.env.__NEXT_I18N_SUPPORT) {
131290
- return requireDetectDomainLocale$1().detectDomainLocale(...args);
131291
- }
131292
- };
131293
-
131294
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
131295
- Object.defineProperty(exports.default, '__esModule', { value: true });
131296
- Object.assign(exports.default, exports);
131297
- module.exports = exports.default;
131298
- }
131299
-
131300
-
131301
- } (detectDomainLocale$1, detectDomainLocale$1.exports));
131302
- return detectDomainLocale$1.exports;
131303
- }
131304
-
131305
- var hasRequiredGetDomainLocale;
131306
-
131307
- function requireGetDomainLocale () {
131308
- if (hasRequiredGetDomainLocale) return getDomainLocale.exports;
131309
- hasRequiredGetDomainLocale = 1;
131310
- (function (module, exports) {
131311
- Object.defineProperty(exports, "__esModule", {
131312
- value: true
131313
- });
131314
- Object.defineProperty(exports, "getDomainLocale", {
131315
- enumerable: true,
131316
- get: function() {
131317
- return getDomainLocale;
131318
- }
131319
- });
131320
- const _normalizetrailingslash = requireNormalizeTrailingSlash();
131321
- const basePath = process.env.__NEXT_ROUTER_BASEPATH || "";
131322
- function getDomainLocale(path, locale, locales, domainLocales) {
131323
- if (process.env.__NEXT_I18N_SUPPORT) {
131324
- const normalizeLocalePath = requireNormalizeLocalePath().normalizeLocalePath;
131325
- const detectDomainLocale = requireDetectDomainLocale().detectDomainLocale;
131326
- const target = locale || normalizeLocalePath(path, locales).detectedLocale;
131327
- const domain = detectDomainLocale(domainLocales, undefined, target);
131328
- if (domain) {
131329
- const proto = "http" + (domain.http ? "" : "s") + "://";
131330
- const finalLocale = target === domain.defaultLocale ? "" : "/" + target;
131331
- return "" + proto + domain.domain + (0, _normalizetrailingslash.normalizePathTrailingSlash)("" + basePath + finalLocale + path);
131332
- }
131333
- return false;
131334
- } else {
131335
- return false;
131336
- }
131337
- }
131338
-
131339
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
131340
- Object.defineProperty(exports.default, '__esModule', { value: true });
131341
- Object.assign(exports.default, exports);
131342
- module.exports = exports.default;
131343
- }
131344
-
131345
-
131346
- } (getDomainLocale, getDomainLocale.exports));
131347
- return getDomainLocale.exports;
131348
- }
131349
-
131350
- var addBasePath = {exports: {}};
131351
-
131352
- var hasRequiredAddBasePath;
131353
-
131354
- function requireAddBasePath () {
131355
- if (hasRequiredAddBasePath) return addBasePath.exports;
131356
- hasRequiredAddBasePath = 1;
131357
- (function (module, exports) {
131358
- Object.defineProperty(exports, "__esModule", {
131359
- value: true
131360
- });
131361
- Object.defineProperty(exports, "addBasePath", {
131362
- enumerable: true,
131363
- get: function() {
131364
- return addBasePath;
131365
- }
131366
- });
131367
- const _addpathprefix = requireAddPathPrefix();
131368
- const _normalizetrailingslash = requireNormalizeTrailingSlash();
131369
- const basePath = process.env.__NEXT_ROUTER_BASEPATH || "";
131370
- function addBasePath(path, required) {
131371
- return (0, _normalizetrailingslash.normalizePathTrailingSlash)(process.env.__NEXT_MANUAL_CLIENT_BASE_PATH && !required ? path : (0, _addpathprefix.addPathPrefix)(path, basePath));
131372
- }
131373
-
131374
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
131375
- Object.defineProperty(exports.default, '__esModule', { value: true });
131376
- Object.assign(exports.default, exports);
131377
- module.exports = exports.default;
131378
- }
131379
-
131380
-
131381
- } (addBasePath, addBasePath.exports));
131382
- return addBasePath.exports;
131383
- }
131384
-
131385
- var routerReducerTypes = {exports: {}};
131386
-
131387
- var hasRequiredRouterReducerTypes;
131388
-
131389
- function requireRouterReducerTypes () {
131390
- if (hasRequiredRouterReducerTypes) return routerReducerTypes.exports;
131391
- hasRequiredRouterReducerTypes = 1;
131392
- (function (module, exports) {
131393
- Object.defineProperty(exports, "__esModule", {
131394
- value: true
131395
- });
131396
- function _export(target, all) {
131397
- for(var name in all)Object.defineProperty(target, name, {
131398
- enumerable: true,
131399
- get: all[name]
131400
- });
131401
- }
131402
- _export(exports, {
131403
- ACTION_FAST_REFRESH: function() {
131404
- return ACTION_FAST_REFRESH;
131405
- },
131406
- ACTION_NAVIGATE: function() {
131407
- return ACTION_NAVIGATE;
131408
- },
131409
- ACTION_PREFETCH: function() {
131410
- return ACTION_PREFETCH;
131411
- },
131412
- ACTION_REFRESH: function() {
131413
- return ACTION_REFRESH;
131414
- },
131415
- ACTION_RESTORE: function() {
131416
- return ACTION_RESTORE;
131417
- },
131418
- ACTION_SERVER_ACTION: function() {
131419
- return ACTION_SERVER_ACTION;
131420
- },
131421
- ACTION_SERVER_PATCH: function() {
131422
- return ACTION_SERVER_PATCH;
131423
- },
131424
- PrefetchCacheEntryStatus: function() {
131425
- return PrefetchCacheEntryStatus;
131426
- },
131427
- PrefetchKind: function() {
131428
- return PrefetchKind;
131429
- },
131430
- isThenable: function() {
131431
- return isThenable;
131432
- }
131433
- });
131434
- const ACTION_REFRESH = "refresh";
131435
- const ACTION_NAVIGATE = "navigate";
131436
- const ACTION_RESTORE = "restore";
131437
- const ACTION_SERVER_PATCH = "server-patch";
131438
- const ACTION_PREFETCH = "prefetch";
131439
- const ACTION_FAST_REFRESH = "fast-refresh";
131440
- const ACTION_SERVER_ACTION = "server-action";
131441
- var PrefetchKind;
131442
- (function(PrefetchKind) {
131443
- PrefetchKind["AUTO"] = "auto";
131444
- PrefetchKind["FULL"] = "full";
131445
- PrefetchKind["TEMPORARY"] = "temporary";
131446
- })(PrefetchKind || (PrefetchKind = {}));
131447
- var PrefetchCacheEntryStatus;
131448
- (function(PrefetchCacheEntryStatus) {
131449
- PrefetchCacheEntryStatus["fresh"] = "fresh";
131450
- PrefetchCacheEntryStatus["reusable"] = "reusable";
131451
- PrefetchCacheEntryStatus["expired"] = "expired";
131452
- PrefetchCacheEntryStatus["stale"] = "stale";
131453
- })(PrefetchCacheEntryStatus || (PrefetchCacheEntryStatus = {}));
131454
- function isThenable(value) {
131455
- // TODO: We don't gain anything from this abstraction. It's unsound, and only
131456
- // makes sense in the specific places where we use it. So it's better to keep
131457
- // the type coercion inline, instead of leaking this to other places in
131458
- // the codebase.
131459
- return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
131460
- }
131461
-
131462
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
131463
- Object.defineProperty(exports.default, '__esModule', { value: true });
131464
- Object.assign(exports.default, exports);
131465
- module.exports = exports.default;
131466
- }
131467
-
131468
-
131469
- } (routerReducerTypes, routerReducerTypes.exports));
131470
- return routerReducerTypes.exports;
131471
- }
131472
-
131473
- (function (module, exports) {
131474
- "use client";
131475
- Object.defineProperty(exports, "__esModule", {
131476
- value: true
131477
- });
131478
- Object.defineProperty(exports, "default", {
131479
- enumerable: true,
131480
- get: function() {
131481
- return _default;
131482
- }
131483
- });
131484
- const _interop_require_default = _interop_require_default$1;
131485
- const _jsxruntime = require$$1;
131486
- const _react = /*#__PURE__*/ _interop_require_default._(React);
131487
- const _resolvehref = requireResolveHref();
131488
- const _islocalurl = requireIsLocalUrl();
131489
- const _formaturl = requireFormatUrl();
131490
- const _utils = requireUtils$1();
131491
- const _addlocale = requireAddLocale();
131492
- const _routercontextsharedruntime = requireRouterContext_sharedRuntime();
131493
- const _approutercontextsharedruntime = requireAppRouterContext_sharedRuntime();
131494
- const _useintersection = requireUseIntersection();
131495
- const _getdomainlocale = requireGetDomainLocale();
131496
- const _addbasepath = requireAddBasePath();
131497
- const _routerreducertypes = requireRouterReducerTypes();
131498
- const prefetched = new Set();
131499
- function prefetch(router, href, as, options, appOptions, isAppRouter) {
131500
- if (typeof window === "undefined") {
131501
- return;
131502
- }
131503
- // app-router supports external urls out of the box so it shouldn't short-circuit here as support for e.g. `replace` is added in the app-router.
131504
- if (!isAppRouter && !(0, _islocalurl.isLocalURL)(href)) {
131505
- return;
131506
- }
131507
- // We should only dedupe requests when experimental.optimisticClientCache is
131508
- // disabled.
131509
- if (!options.bypassPrefetchedCheck) {
131510
- const locale = // Let the link's locale prop override the default router locale.
131511
- typeof options.locale !== "undefined" ? options.locale : "locale" in router ? router.locale : undefined;
131512
- const prefetchedKey = href + "%" + as + "%" + locale;
131513
- // If we've already fetched the key, then don't prefetch it again!
131514
- if (prefetched.has(prefetchedKey)) {
131515
- return;
131516
- }
131517
- // Mark this URL as prefetched.
131518
- prefetched.add(prefetchedKey);
131519
- }
131520
- const doPrefetch = async ()=>{
131521
- if (isAppRouter) {
131522
- // note that `appRouter.prefetch()` is currently sync,
131523
- // so we have to wrap this call in an async function to be able to catch() errors below.
131524
- return router.prefetch(href, appOptions);
131525
- } else {
131526
- return router.prefetch(href, as, options);
131527
- }
131528
- };
131529
- // Prefetch the JSON page if asked (only in the client)
131530
- // We need to handle a prefetch error here since we may be
131531
- // loading with priority which can reject but we don't
131532
- // want to force navigation since this is only a prefetch
131533
- doPrefetch().catch((err)=>{
131534
- if (process.env.NODE_ENV !== "production") {
131535
- // rethrow to show invalid URL errors
131536
- throw err;
131537
- }
131538
- });
131539
- }
131540
- function isModifiedEvent(event) {
131541
- const eventTarget = event.currentTarget;
131542
- const target = eventTarget.getAttribute("target");
131543
- return target && target !== "_self" || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || // triggers resource download
131544
- event.nativeEvent && event.nativeEvent.which === 2;
131545
- }
131546
- function linkClicked(e, router, href, as, replace, shallow, scroll, locale, isAppRouter) {
131547
- const { nodeName } = e.currentTarget;
131548
- // anchors inside an svg have a lowercase nodeName
131549
- const isAnchorNodeName = nodeName.toUpperCase() === "A";
131550
- if (isAnchorNodeName && (isModifiedEvent(e) || // app-router supports external urls out of the box so it shouldn't short-circuit here as support for e.g. `replace` is added in the app-router.
131551
- !isAppRouter && !(0, _islocalurl.isLocalURL)(href))) {
131552
- // ignore click for browser’s default behavior
131553
- return;
131554
- }
131555
- e.preventDefault();
131556
- const navigate = ()=>{
131557
- // If the router is an NextRouter instance it will have `beforePopState`
131558
- const routerScroll = scroll != null ? scroll : true;
131559
- if ("beforePopState" in router) {
131560
- router[replace ? "replace" : "push"](href, as, {
131561
- shallow,
131562
- locale,
131563
- scroll: routerScroll
131564
- });
131565
- } else {
131566
- router[replace ? "replace" : "push"](as || href, {
131567
- scroll: routerScroll
131568
- });
131569
- }
131570
- };
131571
- if (isAppRouter) {
131572
- _react.default.startTransition(navigate);
131573
- } else {
131574
- navigate();
131575
- }
131576
- }
131577
- function formatStringOrUrl(urlObjOrString) {
131578
- if (typeof urlObjOrString === "string") {
131579
- return urlObjOrString;
131580
- }
131581
- return (0, _formaturl.formatUrl)(urlObjOrString);
131582
- }
131583
- /**
131584
- * A React component that extends the HTML `<a>` element to provide [prefetching](https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#2-prefetching)
131585
- * and client-side navigation between routes.
131586
- *
131587
- * It is the primary way to navigate between routes in Next.js.
131588
- *
131589
- * Read more: [Next.js docs: `<Link>`](https://nextjs.org/docs/app/api-reference/components/link)
131590
- */ const Link = /*#__PURE__*/ _react.default.forwardRef(function LinkComponent(props, forwardedRef) {
131591
- let children;
131592
- const { href: hrefProp, as: asProp, children: childrenProp, prefetch: prefetchProp = null, passHref, replace, shallow, scroll, locale, onClick, onMouseEnter: onMouseEnterProp, onTouchStart: onTouchStartProp, legacyBehavior = false, ...restProps } = props;
131593
- children = childrenProp;
131594
- if (legacyBehavior && (typeof children === "string" || typeof children === "number")) {
131595
- children = /*#__PURE__*/ (0, _jsxruntime.jsx)("a", {
131596
- children: children
131597
- });
131598
- }
131599
- const pagesRouter = _react.default.useContext(_routercontextsharedruntime.RouterContext);
131600
- const appRouter = _react.default.useContext(_approutercontextsharedruntime.AppRouterContext);
131601
- const router = pagesRouter != null ? pagesRouter : appRouter;
131602
- // We're in the app directory if there is no pages router.
131603
- const isAppRouter = !pagesRouter;
131604
- const prefetchEnabled = prefetchProp !== false;
131605
- /**
131606
- * The possible states for prefetch are:
131607
- * - null: this is the default "auto" mode, where we will prefetch partially if the link is in the viewport
131608
- * - true: we will prefetch if the link is visible and prefetch the full page, not just partially
131609
- * - false: we will not prefetch if in the viewport at all
131610
- */ const appPrefetchKind = prefetchProp === null ? _routerreducertypes.PrefetchKind.AUTO : _routerreducertypes.PrefetchKind.FULL;
131611
- if (process.env.NODE_ENV !== "production") {
131612
- function createPropError(args) {
131613
- return new Error("Failed prop type: The prop `" + args.key + "` expects a " + args.expected + " in `<Link>`, but got `" + args.actual + "` instead." + (typeof window !== "undefined" ? "\nOpen your browser's console to view the Component stack trace." : ""));
131614
- }
131615
- // TypeScript trick for type-guarding:
131616
- const requiredPropsGuard = {
131617
- href: true
131618
- };
131619
- const requiredProps = Object.keys(requiredPropsGuard);
131620
- requiredProps.forEach((key)=>{
131621
- if (key === "href") {
131622
- if (props[key] == null || typeof props[key] !== "string" && typeof props[key] !== "object") {
131623
- throw createPropError({
131624
- key,
131625
- expected: "`string` or `object`",
131626
- actual: props[key] === null ? "null" : typeof props[key]
131627
- });
131628
- }
131629
- }
131630
- });
131631
- // TypeScript trick for type-guarding:
131632
- const optionalPropsGuard = {
131633
- as: true,
131634
- replace: true,
131635
- scroll: true,
131636
- shallow: true,
131637
- passHref: true,
131638
- prefetch: true,
131639
- locale: true,
131640
- onClick: true,
131641
- onMouseEnter: true,
131642
- onTouchStart: true,
131643
- legacyBehavior: true
131644
- };
131645
- const optionalProps = Object.keys(optionalPropsGuard);
131646
- optionalProps.forEach((key)=>{
131647
- const valType = typeof props[key];
131648
- if (key === "as") {
131649
- if (props[key] && valType !== "string" && valType !== "object") {
131650
- throw createPropError({
131651
- key,
131652
- expected: "`string` or `object`",
131653
- actual: valType
131654
- });
131655
- }
131656
- } else if (key === "locale") {
131657
- if (props[key] && valType !== "string") {
131658
- throw createPropError({
131659
- key,
131660
- expected: "`string`",
131661
- actual: valType
131662
- });
131663
- }
131664
- } else if (key === "onClick" || key === "onMouseEnter" || key === "onTouchStart") {
131665
- if (props[key] && valType !== "function") {
131666
- throw createPropError({
131667
- key,
131668
- expected: "`function`",
131669
- actual: valType
131670
- });
131671
- }
131672
- } else if (key === "replace" || key === "scroll" || key === "shallow" || key === "passHref" || key === "prefetch" || key === "legacyBehavior") {
131673
- if (props[key] != null && valType !== "boolean") {
131674
- throw createPropError({
131675
- key,
131676
- expected: "`boolean`",
131677
- actual: valType
131678
- });
131679
- }
131680
- } else ;
131681
- });
131682
- // This hook is in a conditional but that is ok because `process.env.NODE_ENV` never changes
131683
- // eslint-disable-next-line react-hooks/rules-of-hooks
131684
- const hasWarned = _react.default.useRef(false);
131685
- if (props.prefetch && !hasWarned.current && !isAppRouter) {
131686
- hasWarned.current = true;
131687
- console.warn("Next.js auto-prefetches automatically based on viewport. The prefetch attribute is no longer needed. More: https://nextjs.org/docs/messages/prefetch-true-deprecated");
131688
- }
131689
- }
131690
- if (process.env.NODE_ENV !== "production") {
131691
- if (isAppRouter && !asProp) {
131692
- let href;
131693
- if (typeof hrefProp === "string") {
131694
- href = hrefProp;
131695
- } else if (typeof hrefProp === "object" && typeof hrefProp.pathname === "string") {
131696
- href = hrefProp.pathname;
131697
- }
131698
- if (href) {
131699
- const hasDynamicSegment = href.split("/").some((segment)=>segment.startsWith("[") && segment.endsWith("]"));
131700
- if (hasDynamicSegment) {
131701
- throw new Error("Dynamic href `" + href + "` found in <Link> while using the `/app` router, this is not supported. Read more: https://nextjs.org/docs/messages/app-dir-dynamic-href");
131702
- }
131703
- }
131704
- }
131705
- }
131706
- const { href, as } = _react.default.useMemo(()=>{
131707
- if (!pagesRouter) {
131708
- const resolvedHref = formatStringOrUrl(hrefProp);
131709
- return {
131710
- href: resolvedHref,
131711
- as: asProp ? formatStringOrUrl(asProp) : resolvedHref
131712
- };
131713
- }
131714
- const [resolvedHref, resolvedAs] = (0, _resolvehref.resolveHref)(pagesRouter, hrefProp, true);
131715
- return {
131716
- href: resolvedHref,
131717
- as: asProp ? (0, _resolvehref.resolveHref)(pagesRouter, asProp) : resolvedAs || resolvedHref
131718
- };
131719
- }, [
131720
- pagesRouter,
131721
- hrefProp,
131722
- asProp
131723
- ]);
131724
- const previousHref = _react.default.useRef(href);
131725
- const previousAs = _react.default.useRef(as);
131726
- // This will return the first child, if multiple are provided it will throw an error
131727
- let child;
131728
- if (legacyBehavior) {
131729
- if (process.env.NODE_ENV === "development") {
131730
- if (onClick) {
131731
- console.warn('"onClick" was passed to <Link> with `href` of `' + hrefProp + '` but "legacyBehavior" was set. The legacy behavior requires onClick be set on the child of next/link');
131732
- }
131733
- if (onMouseEnterProp) {
131734
- console.warn('"onMouseEnter" was passed to <Link> with `href` of `' + hrefProp + '` but "legacyBehavior" was set. The legacy behavior requires onMouseEnter be set on the child of next/link');
131735
- }
131736
- try {
131737
- child = _react.default.Children.only(children);
131738
- } catch (err) {
131739
- if (!children) {
131740
- throw new Error("No children were passed to <Link> with `href` of `" + hrefProp + "` but one child is required https://nextjs.org/docs/messages/link-no-children");
131741
- }
131742
- throw new Error("Multiple children were passed to <Link> with `href` of `" + hrefProp + "` but only one child is supported https://nextjs.org/docs/messages/link-multiple-children" + (typeof window !== "undefined" ? " \nOpen your browser's console to view the Component stack trace." : ""));
131743
- }
131744
- } else {
131745
- child = _react.default.Children.only(children);
131746
- }
131747
- } else {
131748
- if (process.env.NODE_ENV === "development") {
131749
- if ((children == null ? void 0 : children.type) === "a") {
131750
- throw new Error("Invalid <Link> with <a> child. Please remove <a> or use <Link legacyBehavior>.\nLearn more: https://nextjs.org/docs/messages/invalid-new-link-with-extra-anchor");
131751
- }
131752
- }
131753
- }
131754
- const childRef = legacyBehavior ? child && typeof child === "object" && child.ref : forwardedRef;
131755
- const [setIntersectionRef, isVisible, resetVisible] = (0, _useintersection.useIntersection)({
131756
- rootMargin: "200px"
131757
- });
131758
- const setRef = _react.default.useCallback((el)=>{
131759
- // Before the link getting observed, check if visible state need to be reset
131760
- if (previousAs.current !== as || previousHref.current !== href) {
131761
- resetVisible();
131762
- previousAs.current = as;
131763
- previousHref.current = href;
131764
- }
131765
- setIntersectionRef(el);
131766
- if (childRef) {
131767
- if (typeof childRef === "function") childRef(el);
131768
- else if (typeof childRef === "object") {
131769
- childRef.current = el;
131770
- }
131771
- }
131772
- }, [
131773
- as,
131774
- childRef,
131775
- href,
131776
- resetVisible,
131777
- setIntersectionRef
131778
- ]);
131779
- // Prefetch the URL if we haven't already and it's visible.
131780
- _react.default.useEffect(()=>{
131781
- // in dev, we only prefetch on hover to avoid wasting resources as the prefetch will trigger compiling the page.
131782
- if (process.env.NODE_ENV !== "production") {
131783
- return;
131784
- }
131785
- if (!router) {
131786
- return;
131787
- }
131788
- // If we don't need to prefetch the URL, don't do prefetch.
131789
- if (!isVisible || !prefetchEnabled) {
131790
- return;
131791
- }
131792
- // Prefetch the URL.
131793
- prefetch(router, href, as, {
131794
- locale
131795
- }, {
131796
- kind: appPrefetchKind
131797
- }, isAppRouter);
131798
- }, [
131799
- as,
131800
- href,
131801
- isVisible,
131802
- locale,
131803
- prefetchEnabled,
131804
- pagesRouter == null ? void 0 : pagesRouter.locale,
131805
- router,
131806
- isAppRouter,
131807
- appPrefetchKind
131808
- ]);
131809
- const childProps = {
131810
- ref: setRef,
131811
- onClick (e) {
131812
- if (process.env.NODE_ENV !== "production") {
131813
- if (!e) {
131814
- throw new Error('Component rendered inside next/link has to pass click event to "onClick" prop.');
131815
- }
131816
- }
131817
- if (!legacyBehavior && typeof onClick === "function") {
131818
- onClick(e);
131819
- }
131820
- if (legacyBehavior && child.props && typeof child.props.onClick === "function") {
131821
- child.props.onClick(e);
131822
- }
131823
- if (!router) {
131824
- return;
131825
- }
131826
- if (e.defaultPrevented) {
131827
- return;
131828
- }
131829
- linkClicked(e, router, href, as, replace, shallow, scroll, locale, isAppRouter);
131830
- },
131831
- onMouseEnter (e) {
131832
- if (!legacyBehavior && typeof onMouseEnterProp === "function") {
131833
- onMouseEnterProp(e);
131834
- }
131835
- if (legacyBehavior && child.props && typeof child.props.onMouseEnter === "function") {
131836
- child.props.onMouseEnter(e);
131837
- }
131838
- if (!router) {
131839
- return;
131840
- }
131841
- if ((!prefetchEnabled || process.env.NODE_ENV === "development") && isAppRouter) {
131842
- return;
131843
- }
131844
- prefetch(router, href, as, {
131845
- locale,
131846
- priority: true,
131847
- // @see {https://github.com/vercel/next.js/discussions/40268?sort=top#discussioncomment-3572642}
131848
- bypassPrefetchedCheck: true
131849
- }, {
131850
- kind: appPrefetchKind
131851
- }, isAppRouter);
131852
- },
131853
- onTouchStart: process.env.__NEXT_LINK_NO_TOUCH_START ? undefined : function onTouchStart(e) {
131854
- if (!legacyBehavior && typeof onTouchStartProp === "function") {
131855
- onTouchStartProp(e);
131856
- }
131857
- if (legacyBehavior && child.props && typeof child.props.onTouchStart === "function") {
131858
- child.props.onTouchStart(e);
131859
- }
131860
- if (!router) {
131861
- return;
131862
- }
131863
- if (!prefetchEnabled && isAppRouter) {
131864
- return;
131865
- }
131866
- prefetch(router, href, as, {
131867
- locale,
131868
- priority: true,
131869
- // @see {https://github.com/vercel/next.js/discussions/40268?sort=top#discussioncomment-3572642}
131870
- bypassPrefetchedCheck: true
131871
- }, {
131872
- kind: appPrefetchKind
131873
- }, isAppRouter);
131874
- }
131875
- };
131876
- // If child is an <a> tag and doesn't have a href attribute, or if the 'passHref' property is
131877
- // defined, we specify the current 'href', so that repetition is not needed by the user.
131878
- // If the url is absolute, we can bypass the logic to prepend the domain and locale.
131879
- if ((0, _utils.isAbsoluteUrl)(as)) {
131880
- childProps.href = as;
131881
- } else if (!legacyBehavior || passHref || child.type === "a" && !("href" in child.props)) {
131882
- const curLocale = typeof locale !== "undefined" ? locale : pagesRouter == null ? void 0 : pagesRouter.locale;
131883
- // we only render domain locales if we are currently on a domain locale
131884
- // so that locale links are still visitable in development/preview envs
131885
- const localeDomain = (pagesRouter == null ? void 0 : pagesRouter.isLocaleDomain) && (0, _getdomainlocale.getDomainLocale)(as, curLocale, pagesRouter == null ? void 0 : pagesRouter.locales, pagesRouter == null ? void 0 : pagesRouter.domainLocales);
131886
- childProps.href = localeDomain || (0, _addbasepath.addBasePath)((0, _addlocale.addLocale)(as, curLocale, pagesRouter == null ? void 0 : pagesRouter.defaultLocale));
131887
- }
131888
- return legacyBehavior ? /*#__PURE__*/ _react.default.cloneElement(child, childProps) : /*#__PURE__*/ (0, _jsxruntime.jsx)("a", {
131889
- ...restProps,
131890
- ...childProps,
131891
- children: children
131892
- });
131893
- });
131894
- const _default = Link;
131895
-
131896
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
131897
- Object.defineProperty(exports.default, '__esModule', { value: true });
131898
- Object.assign(exports.default, exports);
131899
- module.exports = exports.default;
131900
- }
131901
-
131902
-
131903
- } (link$1, link$1.exports));
131904
-
131905
- var linkExports = link$1.exports;
131906
-
131907
- var link = linkExports;
131908
-
131909
- var Link = /*@__PURE__*/getDefaultExportFromCjs(link);
131910
-
131911
129185
  function Breadcrumbs(_a) {
131912
129186
  var items = _a.items;
129187
+ var components = React.useContext(SparkleContext).components;
129188
+ var Link = components.link;
131913
129189
  return (React.createElement("div", { className: "gap-2 s-flex s-flex-row s-items-center" }, items.map(function (item, index) { return (React.createElement("div", { key: index, className: "s-flex s-flex-row s-items-center s-gap-1" },
131914
129190
  React.createElement(Icon, { visual: item.icon, className: "s-text-brand" }),
131915
129191
  React.createElement("div", null, item.href ? (React.createElement(Link, { href: item.href, className: index === items.length - 1
@@ -132331,5 +129607,5 @@ exports.XMarkStrokeIcon = SvgXMark;
132331
129607
  exports.ZapierLogo = SvgZapier$1;
132332
129608
  exports.ZendeskLogo = SvgZapier;
132333
129609
  exports.ZoomableImageCitationWrapper = ZoomableImageCitationWrapper;
132334
- exports.avatarUtils = utils$2;
129610
+ exports.avatarUtils = utils;
132335
129611
  //# sourceMappingURL=index.js.map