@tdacorp/hyle-sdk 0.24.1 → 0.26.1
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/README.md +2 -2
- package/dist/{embed-BaLQbE_n.d.ts → brand-CwXvdSkk.d.ts} +14 -2
- package/dist/{embed-BrrGgkgQ.d.cts → brand-IuZSB9UX.d.cts} +14 -2
- package/dist/{chunk-RCK4NCYC.js → chunk-3UQGU62T.js} +12 -0
- package/dist/{chunk-O4QWHXVH.js → chunk-IDBQSMWT.js} +1 -1
- package/dist/{chunk-5TKJH2XC.js → chunk-NUQQ6VHH.js} +267 -43
- package/dist/{chunk-Y3BACEWA.js → chunk-T4EZAQFU.js} +129 -3
- package/dist/chunk-VAR2B7S6.js +82 -0
- package/dist/{chunk-U74B7AUG.js → chunk-ZWKAEWEW.js} +22 -74
- package/dist/{client-DN38IP63.d.ts → client-B2zi_BGq.d.ts} +1 -1
- package/dist/{client-CI-3cHtc.d.cts → client-DBZTvcCh.d.cts} +1 -1
- package/dist/comments.cjs +25 -1
- package/dist/comments.js +4 -2
- package/dist/html.cjs +129 -3
- package/dist/html.js +1 -1
- package/dist/index.cjs +12 -0
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/next.cjs +593 -177
- package/dist/next.d.cts +27 -11
- package/dist/next.d.ts +27 -11
- package/dist/next.js +188 -124
- package/dist/react.cjs +401 -46
- package/dist/react.d.cts +114 -4
- package/dist/react.d.ts +114 -4
- package/dist/react.js +14 -4
- package/dist/reactions.cjs +25 -1
- package/dist/reactions.js +4 -2
- package/dist/{resolve-Ce_yz8gC.d.cts → resolve-0nGnsIHo.d.cts} +1 -1
- package/dist/{resolve-DMHbYyTS.d.ts → resolve-CguSaZLa.d.ts} +1 -1
- package/dist/{revalidation-callback-BQl77tQR.d.cts → revalidation-callback-FT9ik1dh.d.cts} +11 -0
- package/dist/{revalidation-callback-BQl77tQR.d.ts → revalidation-callback-FT9ik1dh.d.ts} +11 -0
- package/dist/share-client.cjs +498 -0
- package/dist/share-client.d.cts +99 -0
- package/dist/share-client.d.ts +99 -0
- package/dist/share-client.js +390 -0
- package/dist/styles.css +176 -1
- package/dist/{types-CxE8kLeo.d.cts → types-CdaIzSjg.d.cts} +2 -0
- package/dist/{types-CxE8kLeo.d.ts → types-CdaIzSjg.d.ts} +2 -0
- package/dist/use-cache.d.cts +3 -3
- package/dist/use-cache.d.ts +3 -3
- package/dist/use-cache.js +2 -2
- package/package.json +1 -1
package/dist/next.cjs
CHANGED
|
@@ -439,6 +439,10 @@ async function runHook(hook, event) {
|
|
|
439
439
|
clearTimeout(timer);
|
|
440
440
|
}
|
|
441
441
|
}
|
|
442
|
+
function parseIndexUrls(value) {
|
|
443
|
+
if (!Array.isArray(value)) return [];
|
|
444
|
+
return value.flatMap((item) => isRecord(item) && isEventPath(item.path) && isText(item.locale) ? [{ path: item.path, locale: item.locale }] : []);
|
|
445
|
+
}
|
|
442
446
|
function createRevalidationCallbackRoute(options) {
|
|
443
447
|
const dedupe = new DeliveryDedupe(options.dedupeCapacity);
|
|
444
448
|
return {
|
|
@@ -491,6 +495,14 @@ function createRevalidationCallbackRoute(options) {
|
|
|
491
495
|
const hook = options.onCommentEvent;
|
|
492
496
|
const event = hook && parseCommentEvent(body);
|
|
493
497
|
if (hook && event) await runHook(hook, event);
|
|
498
|
+
const indexUrls = parseIndexUrls(body.index_urls);
|
|
499
|
+
if (options.onIndexUrls && indexUrls.length > 0) {
|
|
500
|
+
try {
|
|
501
|
+
options.onIndexUrls(indexUrls);
|
|
502
|
+
} catch {
|
|
503
|
+
console.error("hyle: onIndexUrls failed");
|
|
504
|
+
}
|
|
505
|
+
}
|
|
494
506
|
return okResponse(purged);
|
|
495
507
|
}
|
|
496
508
|
};
|
|
@@ -652,7 +664,31 @@ var SHAPES = {
|
|
|
652
664
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "8", r: "6" }),
|
|
653
665
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m3.8 12.2 8.4-8.4" })
|
|
654
666
|
] }),
|
|
655
|
-
refresh: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13 8a5 5 0 1 1-1.6-3.7M13 2.5v2.8h-2.8" })
|
|
667
|
+
refresh: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13 8a5 5 0 1 1-1.6-3.7M13 2.5v2.8h-2.8" }),
|
|
668
|
+
lock: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
669
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "3", y: "7", width: "10", height: "7", rx: "1.3" }),
|
|
670
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5.2 7V5a2.8 2.8 0 0 1 5.6 0v2" })
|
|
671
|
+
] }),
|
|
672
|
+
search: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
673
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "7", cy: "7", r: "4.5" }),
|
|
674
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m10.5 10.5 3.5 3.5" })
|
|
675
|
+
] }),
|
|
676
|
+
sun: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
677
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "8", r: "2.8" }),
|
|
678
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 1.5v1.8M8 12.7v1.8M1.5 8h1.8M12.7 8h1.8M3.4 3.4l1.3 1.3M11.3 11.3l1.3 1.3M3.4 12.6l1.3-1.3M11.3 4.7l1.3-1.3" })
|
|
679
|
+
] }),
|
|
680
|
+
moon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13 9.4A5.6 5.6 0 0 1 6.6 3a5.6 5.6 0 1 0 6.4 6.4z" }),
|
|
681
|
+
monitor: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
682
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "3", width: "12", height: "8", rx: "1.3" }),
|
|
683
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6 14h4M8 11v3" })
|
|
684
|
+
] }),
|
|
685
|
+
sidebar: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
686
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "3", width: "12", height: "10", rx: "1.3" }),
|
|
687
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6.5 3v10" })
|
|
688
|
+
] }),
|
|
689
|
+
shield: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 1.5 2.5 3.6v4c0 3.2 2.3 5.4 5.5 6.9 3.2-1.5 5.5-3.7 5.5-6.9v-4z" }),
|
|
690
|
+
"arrow-left": /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13 8H3M7 4 3 8l4 4" }),
|
|
691
|
+
menu: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.5 4.5h11M2.5 8h11M2.5 11.5h11" })
|
|
656
692
|
};
|
|
657
693
|
function Icon({ name, className }) {
|
|
658
694
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { className: className ? `hyle-ic ${className}` : "hyle-ic", viewBox: "0 0 16 16", "aria-hidden": "true", children: SHAPES[name] });
|
|
@@ -1344,7 +1380,49 @@ var en = {
|
|
|
1344
1380
|
unTitle: "This page is temporarily unavailable",
|
|
1345
1381
|
unBody: "The content could not be loaded. Please try again in a moment.",
|
|
1346
1382
|
viewer: VIEWER_LABELS_EN,
|
|
1347
|
-
comments: COMMENT_LABELS_EN
|
|
1383
|
+
comments: COMMENT_LABELS_EN,
|
|
1384
|
+
share: {
|
|
1385
|
+
protectedTag: "Protected",
|
|
1386
|
+
lock: "Lock",
|
|
1387
|
+
lockTitle: "Lock this share and return to the password page",
|
|
1388
|
+
searchLabel: "Search this share",
|
|
1389
|
+
searchHint: "Finds words in the titles and descriptions of its documents. Nothing outside the share is searched.",
|
|
1390
|
+
searchNone: "No documents match",
|
|
1391
|
+
searchScope: "Search covers the titles and descriptions of this share's documents.",
|
|
1392
|
+
searchCount: "{n} results",
|
|
1393
|
+
searchOne: "1 result",
|
|
1394
|
+
open: "Open",
|
|
1395
|
+
close: "Close",
|
|
1396
|
+
documents: "Documents",
|
|
1397
|
+
documentCount: "{n} documents",
|
|
1398
|
+
documentPosition: "Document {i} of {n}",
|
|
1399
|
+
privateCopy: "Private copy. Never listed or indexed.",
|
|
1400
|
+
noExpiry: "No expiry",
|
|
1401
|
+
expires: "Expires {when}",
|
|
1402
|
+
expiresSoon: "Expires soon",
|
|
1403
|
+
expired: "Expired",
|
|
1404
|
+
endedNotice: "This share has ended. You can finish this page, but the next one will not open.",
|
|
1405
|
+
soonNotice: "This share expires within 24 hours.",
|
|
1406
|
+
gateTitle: "Password required",
|
|
1407
|
+
gateBody: "Enter the password you were given to open this page.",
|
|
1408
|
+
gateWrong: "Wrong or expired password.",
|
|
1409
|
+
gatePassword: "Password",
|
|
1410
|
+
gateOpen: "Open",
|
|
1411
|
+
locked: "Locked",
|
|
1412
|
+
attemptsTitle: "Too many attempts",
|
|
1413
|
+
attemptsBody: "Try again in {n} seconds.",
|
|
1414
|
+
attemptsOne: "Try again in {n} second.",
|
|
1415
|
+
unavailableTitle: "This page is not available",
|
|
1416
|
+
unavailableBody: "The address may be wrong, or the share may have ended. Ask the person who sent it.",
|
|
1417
|
+
theme: "Theme",
|
|
1418
|
+
themeLight: "Light",
|
|
1419
|
+
themeDark: "Dark",
|
|
1420
|
+
themeSystem: "System",
|
|
1421
|
+
showDocuments: "Show documents",
|
|
1422
|
+
hideDocuments: "Hide documents",
|
|
1423
|
+
closeDocuments: "Close documents",
|
|
1424
|
+
skip: "Skip to content"
|
|
1425
|
+
}
|
|
1348
1426
|
};
|
|
1349
1427
|
var fr = {
|
|
1350
1428
|
toc: "Sur cette page",
|
|
@@ -1404,7 +1482,49 @@ var fr = {
|
|
|
1404
1482
|
unTitle: "Cette page est momentan\xE9ment indisponible",
|
|
1405
1483
|
unBody: "Le contenu n'a pas pu \xEAtre charg\xE9. R\xE9essayez dans un instant.",
|
|
1406
1484
|
viewer: VIEWER_LABELS_FR,
|
|
1407
|
-
comments: COMMENT_LABELS_FR
|
|
1485
|
+
comments: COMMENT_LABELS_FR,
|
|
1486
|
+
share: {
|
|
1487
|
+
protectedTag: "Prot\xE9g\xE9",
|
|
1488
|
+
lock: "Verrouiller",
|
|
1489
|
+
lockTitle: "Verrouiller ce partage et revenir \xE0 la page du mot de passe",
|
|
1490
|
+
searchLabel: "Rechercher dans ce partage",
|
|
1491
|
+
searchHint: "Recherche des mots dans les titres et descriptions de ses documents. Rien hors du partage n'est recherch\xE9.",
|
|
1492
|
+
searchNone: "Aucun document ne correspond",
|
|
1493
|
+
searchScope: "La recherche porte sur les titres et descriptions des documents de ce partage.",
|
|
1494
|
+
searchCount: "{n} r\xE9sultats",
|
|
1495
|
+
searchOne: "1 r\xE9sultat",
|
|
1496
|
+
open: "Ouvrir",
|
|
1497
|
+
close: "Fermer",
|
|
1498
|
+
documents: "Documents",
|
|
1499
|
+
documentCount: "{n} documents",
|
|
1500
|
+
documentPosition: "Document {i} sur {n}",
|
|
1501
|
+
privateCopy: "Copie priv\xE9e. Jamais list\xE9e ni index\xE9e.",
|
|
1502
|
+
noExpiry: "Sans expiration",
|
|
1503
|
+
expires: "Expire le {when}",
|
|
1504
|
+
expiresSoon: "Expire bient\xF4t",
|
|
1505
|
+
expired: "Expir\xE9",
|
|
1506
|
+
endedNotice: "Ce partage a pris fin. Vous pouvez terminer cette page, mais la suivante ne s'ouvrira pas.",
|
|
1507
|
+
soonNotice: "Ce partage expire dans les 24 heures.",
|
|
1508
|
+
gateTitle: "Mot de passe requis",
|
|
1509
|
+
gateBody: "Saisissez le mot de passe qui vous a \xE9t\xE9 donn\xE9 pour ouvrir cette page.",
|
|
1510
|
+
gateWrong: "Mot de passe incorrect ou expir\xE9.",
|
|
1511
|
+
gatePassword: "Mot de passe",
|
|
1512
|
+
gateOpen: "Ouvrir",
|
|
1513
|
+
locked: "Verrouill\xE9",
|
|
1514
|
+
attemptsTitle: "Trop de tentatives",
|
|
1515
|
+
attemptsBody: "R\xE9essayez dans {n} secondes.",
|
|
1516
|
+
attemptsOne: "R\xE9essayez dans {n} seconde.",
|
|
1517
|
+
unavailableTitle: "Cette page n'est pas disponible",
|
|
1518
|
+
unavailableBody: "L'adresse est peut-\xEAtre erron\xE9e, ou le partage a pris fin. Demandez \xE0 la personne qui vous l'a envoy\xE9.",
|
|
1519
|
+
theme: "Th\xE8me",
|
|
1520
|
+
themeLight: "Clair",
|
|
1521
|
+
themeDark: "Sombre",
|
|
1522
|
+
themeSystem: "Syst\xE8me",
|
|
1523
|
+
showDocuments: "Afficher les documents",
|
|
1524
|
+
hideDocuments: "Masquer les documents",
|
|
1525
|
+
closeDocuments: "Fermer les documents",
|
|
1526
|
+
skip: "Aller au contenu"
|
|
1527
|
+
}
|
|
1408
1528
|
};
|
|
1409
1529
|
var es = {
|
|
1410
1530
|
toc: "En esta p\xE1gina",
|
|
@@ -1464,7 +1584,49 @@ var es = {
|
|
|
1464
1584
|
unTitle: "Esta p\xE1gina no est\xE1 disponible por el momento",
|
|
1465
1585
|
unBody: "No se pudo cargar el contenido. Int\xE9ntalo de nuevo en un momento.",
|
|
1466
1586
|
viewer: VIEWER_LABELS_ES,
|
|
1467
|
-
comments: COMMENT_LABELS_ES
|
|
1587
|
+
comments: COMMENT_LABELS_ES,
|
|
1588
|
+
share: {
|
|
1589
|
+
protectedTag: "Protegido",
|
|
1590
|
+
lock: "Bloquear",
|
|
1591
|
+
lockTitle: "Bloquear este enlace compartido y volver a la p\xE1gina de contrase\xF1a",
|
|
1592
|
+
searchLabel: "Buscar en este enlace compartido",
|
|
1593
|
+
searchHint: "Busca palabras en los t\xEDtulos y descripciones de sus documentos. No se busca nada fuera del enlace compartido.",
|
|
1594
|
+
searchNone: "Ning\xFAn documento coincide",
|
|
1595
|
+
searchScope: "La b\xFAsqueda abarca los t\xEDtulos y descripciones de los documentos de este enlace compartido.",
|
|
1596
|
+
searchCount: "{n} resultados",
|
|
1597
|
+
searchOne: "1 resultado",
|
|
1598
|
+
open: "Abrir",
|
|
1599
|
+
close: "Cerrar",
|
|
1600
|
+
documents: "Documentos",
|
|
1601
|
+
documentCount: "{n} documentos",
|
|
1602
|
+
documentPosition: "Documento {i} de {n}",
|
|
1603
|
+
privateCopy: "Copia privada. Nunca se lista ni se indexa.",
|
|
1604
|
+
noExpiry: "Sin caducidad",
|
|
1605
|
+
expires: "Caduca el {when}",
|
|
1606
|
+
expiresSoon: "Caduca pronto",
|
|
1607
|
+
expired: "Caducado",
|
|
1608
|
+
endedNotice: "Este enlace compartido ha terminado. Puedes terminar esta p\xE1gina, pero la siguiente no se abrir\xE1.",
|
|
1609
|
+
soonNotice: "Este enlace compartido caduca en menos de 24 horas.",
|
|
1610
|
+
gateTitle: "Se requiere contrase\xF1a",
|
|
1611
|
+
gateBody: "Escribe la contrase\xF1a que te han dado para abrir esta p\xE1gina.",
|
|
1612
|
+
gateWrong: "Contrase\xF1a incorrecta o caducada.",
|
|
1613
|
+
gatePassword: "Contrase\xF1a",
|
|
1614
|
+
gateOpen: "Abrir",
|
|
1615
|
+
locked: "Bloqueado",
|
|
1616
|
+
attemptsTitle: "Demasiados intentos",
|
|
1617
|
+
attemptsBody: "Vuelve a intentarlo en {n} segundos.",
|
|
1618
|
+
attemptsOne: "Vuelve a intentarlo en {n} segundo.",
|
|
1619
|
+
unavailableTitle: "Esta p\xE1gina no est\xE1 disponible",
|
|
1620
|
+
unavailableBody: "La direcci\xF3n puede estar mal, o el enlace compartido ha terminado. Pregunta a quien te lo envi\xF3.",
|
|
1621
|
+
theme: "Tema",
|
|
1622
|
+
themeLight: "Claro",
|
|
1623
|
+
themeDark: "Oscuro",
|
|
1624
|
+
themeSystem: "Sistema",
|
|
1625
|
+
showDocuments: "Mostrar los documentos",
|
|
1626
|
+
hideDocuments: "Ocultar los documentos",
|
|
1627
|
+
closeDocuments: "Cerrar los documentos",
|
|
1628
|
+
skip: "Ir al contenido"
|
|
1629
|
+
}
|
|
1468
1630
|
};
|
|
1469
1631
|
var TABLE = { en, fr, es };
|
|
1470
1632
|
function stringsFor(locale) {
|
|
@@ -2278,7 +2440,30 @@ var import_reactions = require("./reactions.cjs");
|
|
|
2278
2440
|
|
|
2279
2441
|
// src/react/docs.tsx
|
|
2280
2442
|
var import_docs_enhance = require("./docs-enhance.cjs");
|
|
2443
|
+
|
|
2444
|
+
// src/react/docs-main.tsx
|
|
2281
2445
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2446
|
+
function DocsMain({ article, c, components, narrowToc, prev, next, eyebrow }) {
|
|
2447
|
+
const { publication: pub } = article;
|
|
2448
|
+
const { s } = c;
|
|
2449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
2450
|
+
eyebrow,
|
|
2451
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h1", { className: "hyle-title", children: pub.title }),
|
|
2452
|
+
pub.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "hyle-desc", children: pub.description }) : null,
|
|
2453
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { className: "hyle-updated", children: [
|
|
2454
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { name: "calendar" }),
|
|
2455
|
+
s.updated,
|
|
2456
|
+
" ",
|
|
2457
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("time", { dateTime: pub.updated_at, title: pub.updated_at, children: formatDate(pub.updated_at, c.locale) })
|
|
2458
|
+
] }),
|
|
2459
|
+
narrowToc,
|
|
2460
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Body, { article, components, locale: c.locale }),
|
|
2461
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Pager, { prev, next, c })
|
|
2462
|
+
] });
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
// src/react/docs.tsx
|
|
2466
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2282
2467
|
var ROOT_ID = "hyle-docs";
|
|
2283
2468
|
var NAV_ID = "hyle-docs-nav";
|
|
2284
2469
|
function navTreeOf(article) {
|
|
@@ -2302,15 +2487,15 @@ function pathTo(nodes, path) {
|
|
|
2302
2487
|
}
|
|
2303
2488
|
function Branch({ nodes, current, onPath, c }) {
|
|
2304
2489
|
const { Link } = c;
|
|
2305
|
-
return /* @__PURE__ */ (0,
|
|
2306
|
-
const link = /* @__PURE__ */ (0,
|
|
2307
|
-
if (node.children.length === 0) return /* @__PURE__ */ (0,
|
|
2308
|
-
return /* @__PURE__ */ (0,
|
|
2309
|
-
/* @__PURE__ */ (0,
|
|
2310
|
-
/* @__PURE__ */ (0,
|
|
2490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { children: nodes.map((node) => {
|
|
2491
|
+
const link = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Link, { href: c.href(node.canonical_path), ...node.canonical_path === current ? { "aria-current": "page" } : {}, children: node.title });
|
|
2492
|
+
if (node.children.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: link }, node.canonical_path);
|
|
2493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("details", { ...onPath.has(node.canonical_path) ? { open: true } : {}, children: [
|
|
2494
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("summary", { children: [
|
|
2495
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "chev" }),
|
|
2311
2496
|
link
|
|
2312
2497
|
] }),
|
|
2313
|
-
/* @__PURE__ */ (0,
|
|
2498
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Branch, { nodes: node.children, current, onPath, c })
|
|
2314
2499
|
] }) }, node.canonical_path);
|
|
2315
2500
|
}) });
|
|
2316
2501
|
}
|
|
@@ -2324,52 +2509,224 @@ function DocsPage({ article, ...base }) {
|
|
|
2324
2509
|
const siteName = article.breadcrumbs[0]?.title ?? "";
|
|
2325
2510
|
const headingIds = article.toc.filter((t) => t.depth === 2 || t.depth === 3).map((t) => scopeId(t.id));
|
|
2326
2511
|
const notTranslated = article.fallback ? s.fallbackTitle.replace("{language}", languageName(article.fallback.requested_locale, c.locale)) : void 0;
|
|
2327
|
-
return /* @__PURE__ */ (0,
|
|
2328
|
-
/* @__PURE__ */ (0,
|
|
2329
|
-
/* @__PURE__ */ (0,
|
|
2330
|
-
/* @__PURE__ */ (0,
|
|
2512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Shell, { theme: article.theme, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "hyle-docs", id: ROOT_ID, lang: c.locale, children: [
|
|
2513
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_docs_enhance.DocsEnhance, { headingIds, rootId: ROOT_ID }),
|
|
2514
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "hyle-nav-bar", popoverTarget: NAV_ID, children: [
|
|
2515
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "file" }),
|
|
2331
2516
|
s.menu,
|
|
2332
|
-
/* @__PURE__ */ (0,
|
|
2333
|
-
/* @__PURE__ */ (0,
|
|
2517
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "cur", children: pub.title }),
|
|
2518
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "chev-down", className: "hyle-chev" })
|
|
2334
2519
|
] }),
|
|
2335
|
-
/* @__PURE__ */ (0,
|
|
2336
|
-
/* @__PURE__ */ (0,
|
|
2337
|
-
/* @__PURE__ */ (0,
|
|
2338
|
-
/* @__PURE__ */ (0,
|
|
2339
|
-
/* @__PURE__ */ (0,
|
|
2520
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("aside", { className: "hyle-nav-d", id: NAV_ID, popover: "auto", "aria-label": s.docs, children: [
|
|
2521
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "hyle-side-head", children: [
|
|
2522
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("b", { children: siteName }),
|
|
2523
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Slot, { name: "docs.version", slots: base.slots, tag: "span" }),
|
|
2524
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "hyle-nav-x", popoverTarget: NAV_ID, popoverTargetAction: "hide", "aria-label": s.closeMenu, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "x" }) })
|
|
2340
2525
|
] }),
|
|
2341
|
-
/* @__PURE__ */ (0,
|
|
2342
|
-
/* @__PURE__ */ (0,
|
|
2343
|
-
/* @__PURE__ */ (0,
|
|
2526
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Slot, { name: "docs.sidebar-header", slots: base.slots, className: "hyle-side-slot" }),
|
|
2527
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("nav", { className: "hyle-tree", "aria-label": s.docs, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Branch, { nodes: tree, current: pub.canonical_path, onPath, c }) }),
|
|
2528
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Slot, { name: "docs.sidebar-footer", slots: base.slots, className: "hyle-side-slot" })
|
|
2344
2529
|
] }),
|
|
2345
|
-
/* @__PURE__ */ (0,
|
|
2346
|
-
notTranslated ? /* @__PURE__ */ (0,
|
|
2347
|
-
/* @__PURE__ */ (0,
|
|
2348
|
-
/* @__PURE__ */ (0,
|
|
2349
|
-
/* @__PURE__ */ (0,
|
|
2530
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "hyle-docs-main", "data-hyle-page": "docs", children: [
|
|
2531
|
+
notTranslated ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "hyle-banner", "data-kind": "warn", role: "status", children: [
|
|
2532
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "alert" }),
|
|
2533
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
2534
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("b", { children: notTranslated }),
|
|
2350
2535
|
" ",
|
|
2351
2536
|
s.fallbackBody
|
|
2352
2537
|
] })
|
|
2353
2538
|
] }) : null,
|
|
2354
|
-
/* @__PURE__ */ (0,
|
|
2355
|
-
/* @__PURE__ */ (0,
|
|
2356
|
-
|
|
2357
|
-
/* @__PURE__ */ (0,
|
|
2358
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { name: "calendar" }),
|
|
2359
|
-
s.updated,
|
|
2360
|
-
" ",
|
|
2361
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("time", { dateTime: pub.updated_at, title: pub.updated_at, children: formatDate(pub.updated_at, c.locale) })
|
|
2362
|
-
] }),
|
|
2363
|
-
toc.narrow,
|
|
2364
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Body, { article, components: base.components, locale: c.locale }),
|
|
2365
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Pager, { prev: article.prev, next: article.next, c }),
|
|
2366
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Slot, { name: "docs.after", slots: base.slots, className: "hyle-after" }),
|
|
2367
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "hyle-docs-end", "aria-hidden": "true" })
|
|
2539
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("nav", { className: "hyle-crumbs", "aria-label": s.crumbs, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ol", { children: article.breadcrumbs.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { "aria-current": i === article.breadcrumbs.length - 1 ? "page" : void 0, children: i === article.breadcrumbs.length - 1 ? b.title : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Link, { href: c.href(b.canonical_path), children: b.title }) }, b.canonical_path)) }) }),
|
|
2540
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DocsMain, { article, c, components: base.components, narrowToc: toc.narrow, prev: article.prev, next: article.next }),
|
|
2541
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Slot, { name: "docs.after", slots: base.slots, className: "hyle-after" }),
|
|
2542
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "hyle-docs-end", "aria-hidden": "true" })
|
|
2368
2543
|
] }),
|
|
2369
2544
|
toc.wide
|
|
2370
2545
|
] }) });
|
|
2371
2546
|
}
|
|
2372
2547
|
|
|
2548
|
+
// src/react/share/chrome.tsx
|
|
2549
|
+
var import_share_client = require("./share-client.cjs");
|
|
2550
|
+
|
|
2551
|
+
// src/react/share/model.ts
|
|
2552
|
+
var THEME_COOKIE = "hyle_theme";
|
|
2553
|
+
var SIDE_COOKIE = "hyle_share_side";
|
|
2554
|
+
var SOON_MS = 24 * 60 * 60 * 1e3;
|
|
2555
|
+
function expiryState(expiresAt, now) {
|
|
2556
|
+
if (expiresAt === null) return "none";
|
|
2557
|
+
const end = Date.parse(expiresAt);
|
|
2558
|
+
if (Number.isNaN(end) || now >= end) return "expired";
|
|
2559
|
+
return end - now <= SOON_MS ? "soon" : "ok";
|
|
2560
|
+
}
|
|
2561
|
+
function shareDate(iso, locale) {
|
|
2562
|
+
const date = new Date(iso);
|
|
2563
|
+
const text = new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeStyle: "short", timeZone: "UTC" }).format(date);
|
|
2564
|
+
return `${text} UTC`;
|
|
2565
|
+
}
|
|
2566
|
+
function themeFromCookie(value) {
|
|
2567
|
+
return value === "light" || value === "dark" ? value : "system";
|
|
2568
|
+
}
|
|
2569
|
+
function actFor(choice) {
|
|
2570
|
+
return choice === "system" ? void 0 : choice;
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
// src/react/share/brand.tsx
|
|
2574
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2575
|
+
function brandFor(host, fill) {
|
|
2576
|
+
if (fill) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "hyle-brand", "data-slot": "chrome.brand", children: fill });
|
|
2577
|
+
if (!host) return null;
|
|
2578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("a", { className: "hyle-brand", href: host.href ?? "/", children: [
|
|
2579
|
+
host.logo,
|
|
2580
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "nm", children: host.name })
|
|
2581
|
+
] });
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
// src/react/share/chrome.tsx
|
|
2585
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2586
|
+
function ShareChrome(props) {
|
|
2587
|
+
const { name, expiresAt, documents, article, docSlug, host, theme = "system", sidebarOpen = true, htmlTheme = false, hrefFor, lockAction, slug, now = Date.now(), ...base } = props;
|
|
2588
|
+
const { publication: pub } = article;
|
|
2589
|
+
const c = ctx(base, pub.locale);
|
|
2590
|
+
const s = c.s.share;
|
|
2591
|
+
const list = [...documents].sort((a, b) => a.position - b.position || (a.doc_slug < b.doc_slug ? -1 : 1));
|
|
2592
|
+
const index = list.findIndex((d) => d.doc_slug === docSlug);
|
|
2593
|
+
const single = list.length <= 1;
|
|
2594
|
+
const initial = expiryState(expiresAt, now);
|
|
2595
|
+
const labels = {
|
|
2596
|
+
protectedTag: s.protectedTag,
|
|
2597
|
+
noExpiry: s.noExpiry,
|
|
2598
|
+
expires: s.expires,
|
|
2599
|
+
expiresSoon: s.expiresSoon,
|
|
2600
|
+
expired: s.expired,
|
|
2601
|
+
soonNotice: s.soonNotice,
|
|
2602
|
+
endedNotice: s.endedNotice
|
|
2603
|
+
};
|
|
2604
|
+
const navItem = (d) => ({ slug: d.doc_slug, title: d.title, description: d.description ?? null, canonical_path: hrefFor(d.doc_slug) });
|
|
2605
|
+
const prev = index > 0 ? navItem(list[index - 1]) : null;
|
|
2606
|
+
const next = index >= 0 && index < list.length - 1 ? navItem(list[index + 1]) : null;
|
|
2607
|
+
const searchDocs = list.map((d) => ({ slug: d.doc_slug, title: d.title, description: d.description ?? null, href: hrefFor(d.doc_slug) }));
|
|
2608
|
+
const when = expiresAt === null ? s.noExpiry : s.expires.replace("{when}", shareDate(expiresAt, c.locale));
|
|
2609
|
+
const toc = Toc({ toc: article.toc, c });
|
|
2610
|
+
const side = single ? "none" : sidebarOpen ? "open" : "closed";
|
|
2611
|
+
const eyebrow = single || index < 0 ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "hyle-eyebrow", children: s.documentPosition.replace("{i}", String(index + 1)).replace("{n}", String(list.length)) });
|
|
2612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
2613
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(HyleTheme, { theme: article.theme }),
|
|
2614
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_share_client.ShareFrame, { sidebarOpen, single, act: actFor(theme), lang: c.locale, children: [
|
|
2615
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("a", { className: "hyle-skip", href: "#hyle-main", children: s.skip }),
|
|
2616
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("header", { className: "hyle-bar", children: [
|
|
2617
|
+
single ? null : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_share_client.ShareMenuButton, { label: s.showDocuments }),
|
|
2618
|
+
single ? null : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_share_client.ShareFoldButton, { show: s.showDocuments, hide: s.hideDocuments }),
|
|
2619
|
+
brandFor(host, base.slots?.["chrome.brand"]),
|
|
2620
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "hyle-bar-title", children: [
|
|
2621
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "share", children: name }),
|
|
2622
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "sep", "aria-hidden": "true", children: "/" }),
|
|
2623
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "doc", children: pub.title })
|
|
2624
|
+
] }),
|
|
2625
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "sp" }),
|
|
2626
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_share_client.ShareSearch, { docs: searchDocs, labels: { label: s.searchLabel, hint: s.searchHint, none: s.searchNone, scope: s.searchScope, count: s.searchCount, one: s.searchOne, close: s.close } }),
|
|
2627
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_share_client.ShareThemeMenu, { choice: theme, htmlTheme, labels: { label: s.theme, light: s.themeLight, dark: s.themeDark, system: s.themeSystem } }),
|
|
2628
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_share_client.ShareExpiryChip, { expiresAt, initial, locale: c.locale, labels }),
|
|
2629
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("form", { className: "hyle-lock-form", method: "post", action: lockAction, children: [
|
|
2630
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "hidden", name: "slug", value: slug }),
|
|
2631
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "hidden", name: "lock", value: "1" }),
|
|
2632
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { className: "hyle-lock", type: "submit", "aria-label": s.lock, title: s.lockTitle, children: [
|
|
2633
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { name: "lock" }),
|
|
2634
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: s.lock })
|
|
2635
|
+
] })
|
|
2636
|
+
] })
|
|
2637
|
+
] }),
|
|
2638
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_share_client.ShareExpiryNotice, { expiresAt, initial, labels }),
|
|
2639
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "hyle-statusrow", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_share_client.ShareExpiryChip, { expiresAt, initial, locale: c.locale, labels }) }),
|
|
2640
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "hyle-share-body", "data-side": side, children: [
|
|
2641
|
+
single ? null : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("aside", { className: "hyle-side", id: "hyle-side", popover: "auto", "aria-label": s.documents, children: [
|
|
2642
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "hyle-side-head", children: [
|
|
2643
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
|
|
2644
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "nm", children: name }),
|
|
2645
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "n", children: s.documentCount.replace("{n}", String(list.length)) })
|
|
2646
|
+
] }),
|
|
2647
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_share_client.ShareDrawerClose, { label: s.closeDocuments })
|
|
2648
|
+
] }),
|
|
2649
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("nav", { className: "hyle-side-list", "aria-label": s.documents, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ol", { children: list.map((d) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(c.Link, { href: hrefFor(d.doc_slug), title: d.title, ...d.doc_slug === docSlug ? { "aria-current": "page" } : {}, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: d.title }) }) }, d.doc_slug)) }) }),
|
|
2650
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "hyle-side-foot", children: [
|
|
2651
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { children: [
|
|
2652
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { name: "clock" }),
|
|
2653
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: when })
|
|
2654
|
+
] }),
|
|
2655
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { children: [
|
|
2656
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { name: "lock" }),
|
|
2657
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: s.privateCopy })
|
|
2658
|
+
] }),
|
|
2659
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Slot, { name: "chrome.sidebar-footer", slots: base.slots })
|
|
2660
|
+
] })
|
|
2661
|
+
] }) }),
|
|
2662
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("main", { className: "hyle-share-main", id: "hyle-main", tabIndex: -1, children: [
|
|
2663
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("article", { className: "hyle-doc", "data-hyle-page": "docs", lang: pub.locale, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DocsMain, { article, c, components: base.components, narrowToc: toc.narrow, prev, next, eyebrow }) }),
|
|
2664
|
+
toc.wide
|
|
2665
|
+
] })
|
|
2666
|
+
] })
|
|
2667
|
+
] })
|
|
2668
|
+
] });
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2671
|
+
// src/react/share/gate.tsx
|
|
2672
|
+
var import_share_client2 = require("./share-client.cjs");
|
|
2673
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2674
|
+
var PASSWORD_FIELD = "hyle-share-password";
|
|
2675
|
+
var ERROR_ID = "hyle-share-error";
|
|
2676
|
+
function ShareGate({ state, slug, unlockAction, docSlug, retryAfterSeconds = 0, host, theme = "system", htmlTheme = false, ...base }) {
|
|
2677
|
+
const c = ctx(base, "en");
|
|
2678
|
+
const s = c.s.share;
|
|
2679
|
+
const act = actFor(theme);
|
|
2680
|
+
const wrong = state === "wrong";
|
|
2681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "hyle hyle-share", lang: c.locale, "data-hyle-chrome": "gate", ...act ? { "data-act": act } : {}, children: [
|
|
2682
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("a", { className: "hyle-skip", href: "#hyle-main", children: s.skip }),
|
|
2683
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("header", { className: "hyle-bar", children: [
|
|
2684
|
+
brandFor(host, base.slots?.["chrome.brand"]),
|
|
2685
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "sp" }),
|
|
2686
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_share_client2.ShareThemeMenu, { choice: theme, htmlTheme, labels: { label: s.theme, light: s.themeLight, dark: s.themeDark, system: s.themeSystem } })
|
|
2687
|
+
] }),
|
|
2688
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("main", { className: "hyle-gate", id: "hyle-main", tabIndex: -1, children: state === "attempts" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: "hyle-card", "data-kind": "warn", children: [
|
|
2689
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "glyph", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { name: "clock" }) }),
|
|
2690
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h1", { children: s.attemptsTitle }),
|
|
2691
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { role: "alert", children: (retryAfterSeconds === 1 ? s.attemptsOne : s.attemptsBody).replace("{n}", String(retryAfterSeconds)) })
|
|
2692
|
+
] }) : state === "unavailable" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: "hyle-card", children: [
|
|
2693
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "glyph", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { name: "x-circle" }) }),
|
|
2694
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h1", { children: s.unavailableTitle }),
|
|
2695
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: s.unavailableBody })
|
|
2696
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: "hyle-card", children: [
|
|
2697
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "glyph", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { name: "lock" }) }),
|
|
2698
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h1", { children: s.gateTitle }),
|
|
2699
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: s.gateBody }),
|
|
2700
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("form", { method: "post", action: unlockAction, autoComplete: "off", children: [
|
|
2701
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "hidden", name: "slug", value: slug }),
|
|
2702
|
+
docSlug !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "hidden", name: "docSlug", value: docSlug }),
|
|
2703
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { htmlFor: PASSWORD_FIELD, children: s.gatePassword }),
|
|
2704
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2705
|
+
"input",
|
|
2706
|
+
{
|
|
2707
|
+
id: PASSWORD_FIELD,
|
|
2708
|
+
name: "password",
|
|
2709
|
+
type: "password",
|
|
2710
|
+
autoComplete: "off",
|
|
2711
|
+
spellCheck: false,
|
|
2712
|
+
required: true,
|
|
2713
|
+
minLength: 12,
|
|
2714
|
+
maxLength: 128,
|
|
2715
|
+
"aria-invalid": wrong || void 0,
|
|
2716
|
+
"aria-describedby": wrong ? ERROR_ID : void 0
|
|
2717
|
+
}
|
|
2718
|
+
),
|
|
2719
|
+
wrong ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "err", id: ERROR_ID, role: "alert", children: s.gateWrong }) : null,
|
|
2720
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { className: "hyle-btn primary", type: "submit", children: s.gateOpen })
|
|
2721
|
+
] })
|
|
2722
|
+
] }) }),
|
|
2723
|
+
state === "locked" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "hyle-toast", role: "status", children: [
|
|
2724
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { name: "check-circle" }),
|
|
2725
|
+
s.locked
|
|
2726
|
+
] }) : null
|
|
2727
|
+
] });
|
|
2728
|
+
}
|
|
2729
|
+
|
|
2373
2730
|
// src/next/options.ts
|
|
2374
2731
|
var import_navigation = require("next/navigation");
|
|
2375
2732
|
|
|
@@ -2780,7 +3137,7 @@ ${built.query.toString()}`, () => listing(viewer, call)) : await call();
|
|
|
2780
3137
|
}
|
|
2781
3138
|
|
|
2782
3139
|
// src/next/embed.tsx
|
|
2783
|
-
var
|
|
3140
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2784
3141
|
async function resolveEmbed(options, run, cursor) {
|
|
2785
3142
|
try {
|
|
2786
3143
|
return { result: await run() };
|
|
@@ -2795,11 +3152,11 @@ async function HyleList({ options, limit = 5, locale, layout, title, headingLeve
|
|
|
2795
3152
|
const route = routeContext(locale ? { ...options, locale } : options, {});
|
|
2796
3153
|
const path = sitePathFrom(route.basePath, void 0);
|
|
2797
3154
|
if (path === void 0) return null;
|
|
2798
|
-
const
|
|
2799
|
-
const { result, failure } = await resolveEmbed(options, () => resolve(path, route.locale, limit,
|
|
3155
|
+
const after2 = validCursor(cursor);
|
|
3156
|
+
const { result, failure } = await resolveEmbed(options, () => resolve(path, route.locale, limit, after2), after2);
|
|
2800
3157
|
if (failure !== void 0) return failure;
|
|
2801
3158
|
const next = olderHref && result?.kind === "list" ? validCursor(result.next_cursor) : void 0;
|
|
2802
|
-
return /* @__PURE__ */ (0,
|
|
3159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(HyleListView, { items: result?.kind === "list" ? result.items : [], theme: result?.kind === "list" ? result.theme : void 0, layout, title, headingLevel, moreHref, olderHref: next ? olderHref?.(next) : void 0, components: options.components, slots: options.slots, locale: route.locale, toHref: route.toHref });
|
|
2803
3160
|
}
|
|
2804
3161
|
async function HyleArticle({ options, path, locale, headingLevel }) {
|
|
2805
3162
|
if (!isSitePath2(path)) return null;
|
|
@@ -2808,7 +3165,7 @@ async function HyleArticle({ options, path, locale, headingLevel }) {
|
|
|
2808
3165
|
const { result, failure } = await resolveEmbed(options, () => resolve(path, route.locale));
|
|
2809
3166
|
if (failure !== void 0) return failure;
|
|
2810
3167
|
if (result?.kind !== "article") return null;
|
|
2811
|
-
return /* @__PURE__ */ (0,
|
|
3168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(HyleArticleView, { article: result, headingLevel, components: options.components, slots: options.slots, locale: route.locale, toHref: route.toHref });
|
|
2812
3169
|
}
|
|
2813
3170
|
var MAX_LISTING_BYTES = 4 * 1024 * 1024;
|
|
2814
3171
|
var COMMENTS_TIMEOUT_MS = 1e4;
|
|
@@ -2840,13 +3197,13 @@ async function HyleComments({ options, path, revalidate = 60, interactive }) {
|
|
|
2840
3197
|
return null;
|
|
2841
3198
|
}
|
|
2842
3199
|
if (!listing) return null;
|
|
2843
|
-
if (!interactive) return /* @__PURE__ */ (0,
|
|
3200
|
+
if (!interactive) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(HyleCommentsView, { listing, locale });
|
|
2844
3201
|
const config = interactive === true ? {} : interactive;
|
|
2845
|
-
return /* @__PURE__ */ (0,
|
|
3202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "hyle hyle-embed", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_comments2.Comments, { path, endpoint: config.endpoint ?? "/api/hyle/engage", signInHref: config.signInHref, locale, labels: stringsFor(locale).comments, initial: listing, initialAt: fetchedAt }) });
|
|
2846
3203
|
}
|
|
2847
3204
|
|
|
2848
3205
|
// src/next/page.tsx
|
|
2849
|
-
var
|
|
3206
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2850
3207
|
function hylePage(options) {
|
|
2851
3208
|
const resolve = resolverFor(options);
|
|
2852
3209
|
async function relatedItems(article) {
|
|
@@ -2868,13 +3225,13 @@ function hylePage(options) {
|
|
|
2868
3225
|
const image = articleImage(options, result);
|
|
2869
3226
|
const related = options.related && options.layout !== "docs" ? await relatedItems(result) : void 0;
|
|
2870
3227
|
const props = { article: result, components: options.components, slots: options.slots, locale, toHref };
|
|
2871
|
-
return options.layout === "docs" ? /* @__PURE__ */ (0,
|
|
3228
|
+
return options.layout === "docs" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DocsPage, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ArticlePage, { ...props, origin: options.siteOrigin, jsonLd: options.jsonLd, imageUrl: image?.url, imageWidth: image?.width, imageHeight: image?.height, related, ...options.engagement ? { engagement: options.engagement } : {} });
|
|
2872
3229
|
}
|
|
2873
3230
|
case "list": {
|
|
2874
3231
|
const list = options.list?.title ? { ...result, section: { ...result.section, title: options.list.title } } : result;
|
|
2875
3232
|
const next = options.paginate === "searchParams" ? validCursor(result.next_cursor) : void 0;
|
|
2876
3233
|
const olderHref = next ? `${toHref(path)}?cursor=${next}` : void 0;
|
|
2877
|
-
return /* @__PURE__ */ (0,
|
|
3234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ListPage, { list, ...olderHref ? { olderHref } : {}, ...options.list?.description ? { description: options.list.description } : {}, components: options.components, slots: options.slots, locale, toHref, origin: options.siteOrigin, path, jsonLd: options.jsonLd, cursor });
|
|
2878
3235
|
}
|
|
2879
3236
|
case "redirect": {
|
|
2880
3237
|
const to = safeRedirectTarget(result.to);
|
|
@@ -3117,10 +3474,62 @@ async function hyleFeed(options) {
|
|
|
3117
3474
|
}
|
|
3118
3475
|
|
|
3119
3476
|
// src/next/revalidate.ts
|
|
3477
|
+
var import_server = require("next/server");
|
|
3120
3478
|
var import_cache = require("next/cache");
|
|
3479
|
+
|
|
3480
|
+
// src/indexnow.ts
|
|
3481
|
+
var INDEXNOW_ENDPOINT = "https://api.indexnow.org/indexnow";
|
|
3482
|
+
var ATTEMPTS = 3;
|
|
3483
|
+
var TIMEOUT_MS = 3e3;
|
|
3484
|
+
var RETRY_DELAY_MS = 500;
|
|
3485
|
+
async function submitIndexNow(site, urls) {
|
|
3486
|
+
try {
|
|
3487
|
+
const base = new URL(site.origin);
|
|
3488
|
+
const prefix = site.localePrefix ?? (() => "");
|
|
3489
|
+
const urlList = urls.map((url) => new URL(encodeURI((url.locale ? prefix(url.locale) : "") + url.path.normalize("NFC")), base)).filter((url) => url.origin === base.origin).map((url) => url.href);
|
|
3490
|
+
if (urlList.length === 0) return;
|
|
3491
|
+
const body = JSON.stringify({ host: base.host, key: site.key, urlList });
|
|
3492
|
+
let status;
|
|
3493
|
+
for (let attempt = 1; attempt <= ATTEMPTS; attempt++) {
|
|
3494
|
+
status = await postOnce(body);
|
|
3495
|
+
if (status !== void 0 && status < 500) break;
|
|
3496
|
+
if (attempt < ATTEMPTS) await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY_MS));
|
|
3497
|
+
}
|
|
3498
|
+
console.log(`hyle: IndexNow ${status ?? "no answer"} for ${urlList.length} url(s) on ${base.host}`);
|
|
3499
|
+
} catch (error) {
|
|
3500
|
+
console.error("hyle: IndexNow not submitted", error instanceof Error ? error.name : "unknown");
|
|
3501
|
+
}
|
|
3502
|
+
}
|
|
3503
|
+
async function postOnce(body) {
|
|
3504
|
+
try {
|
|
3505
|
+
const res = await fetch(INDEXNOW_ENDPOINT, {
|
|
3506
|
+
method: "POST",
|
|
3507
|
+
headers: { "Content-Type": "application/json; charset=utf-8" },
|
|
3508
|
+
body,
|
|
3509
|
+
signal: AbortSignal.timeout(TIMEOUT_MS)
|
|
3510
|
+
});
|
|
3511
|
+
await res.body?.cancel().catch(() => void 0);
|
|
3512
|
+
return res.status;
|
|
3513
|
+
} catch {
|
|
3514
|
+
return void 0;
|
|
3515
|
+
}
|
|
3516
|
+
}
|
|
3517
|
+
|
|
3518
|
+
// src/next/revalidate.ts
|
|
3121
3519
|
var isSwitchedOff2 = (value) => ["0", "false"].includes(value?.trim().toLowerCase() ?? "");
|
|
3520
|
+
function indexNowSite(option) {
|
|
3521
|
+
const key = option?.key?.trim();
|
|
3522
|
+
if (!option || !key) return void 0;
|
|
3523
|
+
try {
|
|
3524
|
+
return { origin: httpsOrigin(option.origin), key, localePrefix: option.localePrefix };
|
|
3525
|
+
} catch {
|
|
3526
|
+
console.error("hyle: IndexNow disabled, origin is not a bare https origin");
|
|
3527
|
+
return void 0;
|
|
3528
|
+
}
|
|
3529
|
+
}
|
|
3122
3530
|
function createRevalidateRoute(options) {
|
|
3123
3531
|
let cached;
|
|
3532
|
+
const indexNow = indexNowSite(options.indexNow);
|
|
3124
3533
|
return {
|
|
3125
3534
|
async POST(req) {
|
|
3126
3535
|
if (isSwitchedOff2((options.env ?? process.env).HYLE_CONTENT_ENABLED)) return new Response(null, { status: 404 });
|
|
@@ -3130,7 +3539,19 @@ function createRevalidateRoute(options) {
|
|
|
3130
3539
|
if (!workspaceId || secrets.length === 0) return new Response(null, { status: 503 });
|
|
3131
3540
|
const key = `${workspaceId}\0${secrets.join("\0")}`;
|
|
3132
3541
|
if (cached?.key !== key) {
|
|
3133
|
-
cached = {
|
|
3542
|
+
cached = {
|
|
3543
|
+
key,
|
|
3544
|
+
route: createRevalidationCallbackRoute({
|
|
3545
|
+
workspaceId,
|
|
3546
|
+
secrets,
|
|
3547
|
+
revalidateTag: (tag2) => (0, import_cache.revalidateTag)(tag2, { expire: 0 }),
|
|
3548
|
+
onCommentEvent: options.onCommentEvent,
|
|
3549
|
+
onIndexUrls: (urls) => {
|
|
3550
|
+
const env = options.env ?? process.env;
|
|
3551
|
+
if (indexNow && (env.VERCEL_ENV ?? env.NODE_ENV) === "production") (0, import_server.after)(() => submitIndexNow(indexNow, urls));
|
|
3552
|
+
}
|
|
3553
|
+
})
|
|
3554
|
+
};
|
|
3134
3555
|
}
|
|
3135
3556
|
return cached.route.POST(req);
|
|
3136
3557
|
}
|
|
@@ -3138,7 +3559,7 @@ function createRevalidateRoute(options) {
|
|
|
3138
3559
|
}
|
|
3139
3560
|
|
|
3140
3561
|
// src/next/root.ts
|
|
3141
|
-
var
|
|
3562
|
+
var import_navigation6 = require("next/navigation");
|
|
3142
3563
|
|
|
3143
3564
|
// src/next/mount-match.ts
|
|
3144
3565
|
function activeMounts(mounts) {
|
|
@@ -3166,144 +3587,104 @@ function isReserved(path, reserved) {
|
|
|
3166
3587
|
|
|
3167
3588
|
// src/next/protected.tsx
|
|
3168
3589
|
var import_headers = require("next/headers");
|
|
3169
|
-
var import_navigation6 = require("next/navigation");
|
|
3170
|
-
|
|
3171
|
-
// src/next/preview.tsx
|
|
3172
3590
|
var import_navigation5 = require("next/navigation");
|
|
3173
|
-
var
|
|
3174
|
-
function drawArticle(article, options) {
|
|
3175
|
-
const { locale } = article.publication;
|
|
3176
|
-
const toHref = (sitePath, linkLocale = locale) => (options.localePrefix?.(linkLocale) ?? "") + sitePath;
|
|
3177
|
-
const props = { article, components: options.components, slots: options.slots, locale, toHref };
|
|
3178
|
-
return options.layout === "docs" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DocsPage, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ArticlePage, { ...props });
|
|
3179
|
-
}
|
|
3180
|
-
var hylePreviewMetadata = { robots: { index: false, follow: false }, referrer: "no-referrer" };
|
|
3181
|
-
var BANNER = {
|
|
3182
|
-
position: "sticky",
|
|
3183
|
-
top: 0,
|
|
3184
|
-
zIndex: 2147483647,
|
|
3185
|
-
padding: "8px 16px",
|
|
3186
|
-
background: "#fde047",
|
|
3187
|
-
color: "#1a1a1a",
|
|
3188
|
-
font: "600 14px/1.4 system-ui, sans-serif",
|
|
3189
|
-
textAlign: "center"
|
|
3190
|
-
};
|
|
3191
|
-
function hylePreviewPage(options) {
|
|
3192
|
-
return async function HylePreviewPage({ searchParams }) {
|
|
3193
|
-
const { token } = await searchParams ?? {};
|
|
3194
|
-
const result = await createHyleClient(options).preview(typeof token === "string" ? token : void 0);
|
|
3195
|
-
if (result.kind !== "preview") (0, import_navigation5.notFound)();
|
|
3196
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
3197
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("meta", { name: "robots", content: "noindex, nofollow" }),
|
|
3198
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("meta", { name: "referrer", content: "no-referrer" }),
|
|
3199
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { role: "status", style: BANNER, children: "Unpublished draft preview" }),
|
|
3200
|
-
drawArticle(result.article, options)
|
|
3201
|
-
] });
|
|
3202
|
-
};
|
|
3203
|
-
}
|
|
3204
|
-
|
|
3205
|
-
// src/next/protected.tsx
|
|
3206
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3591
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3207
3592
|
var hyleProtectedMetadata = { robots: { index: false, follow: false }, referrer: "no-referrer" };
|
|
3208
3593
|
var COOKIE_MAX_AGE_SECONDS = 12 * 60 * 60;
|
|
3209
3594
|
var UNLOCK_MAX_BYTES = 1024;
|
|
3210
3595
|
var PRIVATE_HEADERS = { "Cache-Control": "no-store", "Referrer-Policy": "no-referrer", "X-Robots-Tag": "noindex, nofollow" };
|
|
3211
3596
|
var UNLOCK_PATH = "/hyle-protected/unlock";
|
|
3212
|
-
var
|
|
3213
|
-
var
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { htmlFor: PASSWORD_FIELD, children: "Password" }),
|
|
3220
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3221
|
-
"input",
|
|
3222
|
-
{
|
|
3223
|
-
id: PASSWORD_FIELD,
|
|
3224
|
-
name: "password",
|
|
3225
|
-
type: "password",
|
|
3226
|
-
autoComplete: "off",
|
|
3227
|
-
spellCheck: false,
|
|
3228
|
-
required: true,
|
|
3229
|
-
minLength: 12,
|
|
3230
|
-
maxLength: 128,
|
|
3231
|
-
"aria-invalid": failed || void 0,
|
|
3232
|
-
"aria-describedby": failed ? ERROR_ID : void 0
|
|
3233
|
-
}
|
|
3234
|
-
),
|
|
3235
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "submit", children: "Open" }),
|
|
3236
|
-
failed ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { id: ERROR_ID, role: "alert", children: "Wrong or expired password." }) : null
|
|
3237
|
-
] })
|
|
3238
|
-
] });
|
|
3597
|
+
var DOC_SLUG = /^[a-z0-9-]{1,200}$/;
|
|
3598
|
+
var PRIVATE_META = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3599
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("meta", { name: "robots", content: "noindex, nofollow" }),
|
|
3600
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("meta", { name: "referrer", content: "no-referrer" })
|
|
3601
|
+
] });
|
|
3602
|
+
function gate(state, slug, retryAfterSeconds, host) {
|
|
3603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ShareGate, { state, slug, unlockAction: UNLOCK_PATH, retryAfterSeconds, host });
|
|
3239
3604
|
}
|
|
3240
|
-
function
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { role: "alert", children: [
|
|
3244
|
-
"Try again in ",
|
|
3245
|
-
seconds,
|
|
3246
|
-
" ",
|
|
3247
|
-
seconds === 1 ? "second" : "seconds",
|
|
3248
|
-
"."
|
|
3249
|
-
] })
|
|
3250
|
-
] });
|
|
3605
|
+
async function visitorPrefs() {
|
|
3606
|
+
const jar = await (0, import_headers.cookies)();
|
|
3607
|
+
return { theme: themeFromCookie(jar.get(THEME_COOKIE)?.value), sidebarOpen: jar.get(SIDE_COOKIE)?.value !== "closed" };
|
|
3251
3608
|
}
|
|
3252
|
-
|
|
3253
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("meta", { name: "robots", content: "noindex, nofollow" }),
|
|
3254
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("meta", { name: "referrer", content: "no-referrer" })
|
|
3255
|
-
] });
|
|
3256
|
-
async function drawProtectedShare(options, slug, docSlug, clientIp) {
|
|
3609
|
+
async function drawProtectedShare(options, slug, docSlug, clientIp, { locked = false } = {}) {
|
|
3257
3610
|
const client = createHyleClient({ baseUrl: options.baseUrl, token: options.token });
|
|
3258
3611
|
const visitor = { clientIp };
|
|
3259
3612
|
const password = (await (0, import_headers.cookies)()).get(await protectedCookieName(slug))?.value;
|
|
3260
3613
|
const share = password === void 0 ? void 0 : await client.protected(slug, password, docSlug, visitor);
|
|
3261
|
-
if (share?.kind === "limited") return /* @__PURE__ */ (0,
|
|
3614
|
+
if (share?.kind === "limited") return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3262
3615
|
PRIVATE_META,
|
|
3263
|
-
|
|
3616
|
+
gate("attempts", slug, share.retryAfterSeconds, options.host)
|
|
3264
3617
|
] });
|
|
3265
|
-
if (share?.kind === "disabled") (0,
|
|
3618
|
+
if (share?.kind === "disabled") (0, import_navigation5.notFound)();
|
|
3266
3619
|
if (share?.kind === "protected") {
|
|
3267
|
-
if (docSlug !== void 0 && share.doc_slug !== docSlug) (0,
|
|
3268
|
-
const
|
|
3269
|
-
const
|
|
3270
|
-
|
|
3271
|
-
publication: { ...share.article.publication, canonical_path: here },
|
|
3272
|
-
nav: { truncated: false, items: share.documents.map((d) => ({ slug: d.doc_slug, title: d.title, canonical_path: `/${slug}/${d.doc_slug}`, children: [] })) }
|
|
3273
|
-
};
|
|
3274
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
3620
|
+
if (docSlug !== void 0 && share.doc_slug !== docSlug) (0, import_navigation5.notFound)();
|
|
3621
|
+
const article = { ...share.article, publication: { ...share.article.publication, canonical_path: `/${slug}/${share.doc_slug}` } };
|
|
3622
|
+
const { theme: theme2, sidebarOpen } = await visitorPrefs();
|
|
3623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3275
3624
|
PRIVATE_META,
|
|
3276
|
-
|
|
3625
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3626
|
+
ShareChrome,
|
|
3627
|
+
{
|
|
3628
|
+
name: share.name,
|
|
3629
|
+
expiresAt: share.expires_at,
|
|
3630
|
+
documents: share.documents,
|
|
3631
|
+
article,
|
|
3632
|
+
docSlug: share.doc_slug,
|
|
3633
|
+
host: options.host,
|
|
3634
|
+
theme: theme2,
|
|
3635
|
+
sidebarOpen,
|
|
3636
|
+
slots: options.slots,
|
|
3637
|
+
components: options.components,
|
|
3638
|
+
hrefFor: (doc) => `/${slug}/${doc}`,
|
|
3639
|
+
lockAction: UNLOCK_PATH,
|
|
3640
|
+
slug
|
|
3641
|
+
}
|
|
3642
|
+
)
|
|
3277
3643
|
] });
|
|
3278
3644
|
}
|
|
3279
|
-
const
|
|
3280
|
-
if (
|
|
3645
|
+
const gateReply = await client.protectedGate(slug, visitor);
|
|
3646
|
+
if (gateReply.kind === "limited") return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3281
3647
|
PRIVATE_META,
|
|
3282
|
-
|
|
3648
|
+
gate("attempts", slug, gateReply.retryAfterSeconds, options.host)
|
|
3283
3649
|
] });
|
|
3284
|
-
if (
|
|
3285
|
-
|
|
3650
|
+
if (gateReply.kind !== "gate") (0, import_navigation5.notFound)();
|
|
3651
|
+
const { theme } = await visitorPrefs();
|
|
3652
|
+
const state = locked ? "locked" : password !== void 0 ? "wrong" : "password";
|
|
3653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3286
3654
|
PRIVATE_META,
|
|
3287
|
-
/* @__PURE__ */ (0,
|
|
3655
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ShareGate, { state, slug, docSlug, unlockAction: UNLOCK_PATH, host: options.host, theme })
|
|
3288
3656
|
] });
|
|
3289
3657
|
}
|
|
3658
|
+
async function readProtectedForm(req) {
|
|
3659
|
+
const site = req.headers.get("sec-fetch-site");
|
|
3660
|
+
if (site === null ? originMismatch(req) : site !== "same-origin") return new Response(null, { status: 403, headers: PRIVATE_HEADERS });
|
|
3661
|
+
if (!/^application\/x-www-form-urlencoded(\s*;|$)/i.test(req.headers.get("content-type") ?? "")) return new Response(null, { status: 415, headers: PRIVATE_HEADERS });
|
|
3662
|
+
if (Number(req.headers.get("content-length")) > UNLOCK_MAX_BYTES) return new Response(null, { status: 413, headers: PRIVATE_HEADERS });
|
|
3663
|
+
const form = await readCapped(new Response(req.body), UNLOCK_MAX_BYTES).catch(() => void 0);
|
|
3664
|
+
if (form === void 0) return new Response(null, { status: 413, headers: PRIVATE_HEADERS });
|
|
3665
|
+
return new URLSearchParams(form);
|
|
3666
|
+
}
|
|
3667
|
+
function sharePaths(slug) {
|
|
3668
|
+
return [`/${slug}`, ASSET_ROUTE_PREFIX];
|
|
3669
|
+
}
|
|
3290
3670
|
function createProtectedUnlockRoute() {
|
|
3291
3671
|
return {
|
|
3292
3672
|
async POST(req) {
|
|
3293
|
-
const
|
|
3294
|
-
if (
|
|
3295
|
-
if (!/^application\/x-www-form-urlencoded(\s*;|$)/i.test(req.headers.get("content-type") ?? "")) return new Response(null, { status: 415, headers: PRIVATE_HEADERS });
|
|
3296
|
-
if (Number(req.headers.get("content-length")) > UNLOCK_MAX_BYTES) return new Response(null, { status: 413, headers: PRIVATE_HEADERS });
|
|
3297
|
-
const form = await readCapped(new Response(req.body), UNLOCK_MAX_BYTES).catch(() => void 0);
|
|
3298
|
-
if (form === void 0) return new Response(null, { status: 413, headers: PRIVATE_HEADERS });
|
|
3299
|
-
const fields = new URLSearchParams(form);
|
|
3673
|
+
const fields = await readProtectedForm(req);
|
|
3674
|
+
if (fields instanceof Response) return fields;
|
|
3300
3675
|
const slug = fields.get("slug") ?? "";
|
|
3301
3676
|
if (!PROTECTED_SLUG.test(slug)) return new Response(null, { status: 404, headers: PRIVATE_HEADERS });
|
|
3677
|
+
const name = await protectedCookieName(slug);
|
|
3678
|
+
if (fields.get("lock") === "1") {
|
|
3679
|
+
const headers3 = new Headers({ ...PRIVATE_HEADERS, Location: `/${slug}?locked=1` });
|
|
3680
|
+
for (const path of sharePaths(slug)) headers3.append("Set-Cookie", `${name}=; Max-Age=0; Path=${path}; HttpOnly; Secure; SameSite=Lax`);
|
|
3681
|
+
return new Response(null, { status: 303, headers: headers3 });
|
|
3682
|
+
}
|
|
3683
|
+
const doc = fields.get("docSlug") ?? "";
|
|
3684
|
+
const headers2 = new Headers({ ...PRIVATE_HEADERS, Location: DOC_SLUG.test(doc) ? `/${slug}/${doc}` : `/${slug}` });
|
|
3302
3685
|
const password = fields.get("password") ?? "";
|
|
3303
|
-
const headers2 = new Headers({ ...PRIVATE_HEADERS, Location: `/${slug}` });
|
|
3304
3686
|
if (PROTECTED_PASSWORD.test(password)) {
|
|
3305
|
-
const
|
|
3306
|
-
for (const path of [`/${slug}`, ASSET_ROUTE_PREFIX]) headers2.append("Set-Cookie", `${name}=${password}; Max-Age=${COOKIE_MAX_AGE_SECONDS}; Path=${path}; HttpOnly; Secure; SameSite=Lax`);
|
|
3687
|
+
for (const path of sharePaths(slug)) headers2.append("Set-Cookie", `${name}=${password}; Max-Age=${COOKIE_MAX_AGE_SECONDS}; Path=${path}; HttpOnly; Secure; SameSite=Lax`);
|
|
3307
3688
|
}
|
|
3308
3689
|
return new Response(null, { status: 303, headers: headers2 });
|
|
3309
3690
|
}
|
|
@@ -3331,7 +3712,7 @@ function mountsLoader(config, ttlMs) {
|
|
|
3331
3712
|
lastKnownGood.set(key, { loaded, at: Date.now() });
|
|
3332
3713
|
return loaded;
|
|
3333
3714
|
} catch (error) {
|
|
3334
|
-
(0,
|
|
3715
|
+
(0, import_navigation6.unstable_rethrow)(error);
|
|
3335
3716
|
if (error instanceof Cp1ClientError && (error.status === 401 || error.status === 403)) {
|
|
3336
3717
|
lastKnownGood.delete(key);
|
|
3337
3718
|
throw error;
|
|
@@ -3438,10 +3819,10 @@ function createRouter(options, make, share) {
|
|
|
3438
3819
|
};
|
|
3439
3820
|
}
|
|
3440
3821
|
function hyleRootPage(options) {
|
|
3441
|
-
const route = createRouter(options, hylePage, () => async () => (0,
|
|
3822
|
+
const route = createRouter(options, hylePage, () => async () => (0, import_navigation6.notFound)());
|
|
3442
3823
|
return async function HyleRootPage({ params, searchParams }) {
|
|
3443
3824
|
const hit = await route(await params ?? {});
|
|
3444
|
-
if (!hit) (0,
|
|
3825
|
+
if (!hit) (0, import_navigation6.notFound)();
|
|
3445
3826
|
return hit.handler({ params: Promise.resolve(hit.params), ...searchParams ? { searchParams } : {} });
|
|
3446
3827
|
};
|
|
3447
3828
|
}
|
|
@@ -3506,7 +3887,7 @@ function createMarkdownRoute(options) {
|
|
|
3506
3887
|
}
|
|
3507
3888
|
|
|
3508
3889
|
// src/next/llms.ts
|
|
3509
|
-
var
|
|
3890
|
+
var import_navigation7 = require("next/navigation");
|
|
3510
3891
|
var oneLine = (text) => text.replace(/\s+/g, " ").trim();
|
|
3511
3892
|
var linkTarget = (url) => url.replace(/[()]/g, (c) => c === "(" ? "%28" : "%29");
|
|
3512
3893
|
function createLlmsTxtRoute(options, llms) {
|
|
@@ -3531,7 +3912,7 @@ function createLlmsTxtRoute(options, llms) {
|
|
|
3531
3912
|
return new Response(`${lines.join("\n")}
|
|
3532
3913
|
`, { headers: { "Content-Type": "text/plain; charset=utf-8" } });
|
|
3533
3914
|
} catch (error) {
|
|
3534
|
-
(0,
|
|
3915
|
+
(0, import_navigation7.unstable_rethrow)(error);
|
|
3535
3916
|
console.error(`hyle: ${error instanceof Error ? error.name : "UnknownError"}`);
|
|
3536
3917
|
return new Response(null, { status: 503 });
|
|
3537
3918
|
}
|
|
@@ -3670,7 +4051,7 @@ function createAssetRoute(options) {
|
|
|
3670
4051
|
}
|
|
3671
4052
|
|
|
3672
4053
|
// src/next/og.tsx
|
|
3673
|
-
var
|
|
4054
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3674
4055
|
var SIZE = { width: 1200, height: 630 };
|
|
3675
4056
|
var MAX_TITLE = 140;
|
|
3676
4057
|
function createOgImageRoute(options) {
|
|
@@ -3700,9 +4081,9 @@ function createOgImageRoute(options) {
|
|
|
3700
4081
|
const chars = [...title];
|
|
3701
4082
|
const shown = chars.length > MAX_TITLE ? `${chars.slice(0, MAX_TITLE - 1).join("")}\u2026` : title;
|
|
3702
4083
|
return new import_og.ImageResponse(
|
|
3703
|
-
/* @__PURE__ */ (0,
|
|
3704
|
-
/* @__PURE__ */ (0,
|
|
3705
|
-
options.siteName ? /* @__PURE__ */ (0,
|
|
4084
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", flexDirection: "column", justifyContent: "space-between", width: "100%", height: "100%", padding: 80, background: "#111827", color: "#ffffff" }, children: [
|
|
4085
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { fontSize: 64, fontWeight: 700, lineHeight: 1.2 }, children: shown }),
|
|
4086
|
+
options.siteName ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { fontSize: 32, color: "#9ca3af" }, children: options.siteName }) : null
|
|
3706
4087
|
] }),
|
|
3707
4088
|
// shortcut: @vercel/og fetches Google Fonts / emoji assets at render time for non-Latin titles and emoji (no switch to disable it), upgrade to a satori render with bundled fonts if a host needs zero egress.
|
|
3708
4089
|
{ ...SIZE, headers: { "cache-control": "public, max-age=3600, s-maxage=31536000, immutable" } }
|
|
@@ -3711,10 +4092,44 @@ function createOgImageRoute(options) {
|
|
|
3711
4092
|
};
|
|
3712
4093
|
}
|
|
3713
4094
|
|
|
4095
|
+
// src/next/preview.tsx
|
|
4096
|
+
var import_navigation8 = require("next/navigation");
|
|
4097
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
4098
|
+
function drawArticle(article, options) {
|
|
4099
|
+
const { locale } = article.publication;
|
|
4100
|
+
const toHref = (sitePath, linkLocale = locale) => (options.localePrefix?.(linkLocale) ?? "") + sitePath;
|
|
4101
|
+
const props = { article, components: options.components, slots: options.slots, locale, toHref };
|
|
4102
|
+
return options.layout === "docs" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DocsPage, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ArticlePage, { ...props });
|
|
4103
|
+
}
|
|
4104
|
+
var hylePreviewMetadata = { robots: { index: false, follow: false }, referrer: "no-referrer" };
|
|
4105
|
+
var BANNER = {
|
|
4106
|
+
position: "sticky",
|
|
4107
|
+
top: 0,
|
|
4108
|
+
zIndex: 2147483647,
|
|
4109
|
+
padding: "8px 16px",
|
|
4110
|
+
background: "#fde047",
|
|
4111
|
+
color: "#1a1a1a",
|
|
4112
|
+
font: "600 14px/1.4 system-ui, sans-serif",
|
|
4113
|
+
textAlign: "center"
|
|
4114
|
+
};
|
|
4115
|
+
function hylePreviewPage(options) {
|
|
4116
|
+
return async function HylePreviewPage({ searchParams }) {
|
|
4117
|
+
const { token } = await searchParams ?? {};
|
|
4118
|
+
const result = await createHyleClient(options).preview(typeof token === "string" ? token : void 0);
|
|
4119
|
+
if (result.kind !== "preview") (0, import_navigation8.notFound)();
|
|
4120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
4121
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("meta", { name: "robots", content: "noindex, nofollow" }),
|
|
4122
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("meta", { name: "referrer", content: "no-referrer" }),
|
|
4123
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { role: "status", style: BANNER, children: "Unpublished draft preview" }),
|
|
4124
|
+
drawArticle(result.article, options)
|
|
4125
|
+
] });
|
|
4126
|
+
};
|
|
4127
|
+
}
|
|
4128
|
+
|
|
3714
4129
|
// src/next/protected-view.ts
|
|
3715
4130
|
var import_headers2 = require("next/headers");
|
|
3716
4131
|
var import_navigation9 = require("next/navigation");
|
|
3717
|
-
var
|
|
4132
|
+
var import_server2 = require("next/server");
|
|
3718
4133
|
var VIEW_PATH = "/hyle-protected/view";
|
|
3719
4134
|
var MOUNTS_SNAPSHOT_MS = 3e4;
|
|
3720
4135
|
var DEFAULT_LOOKUP_TIMEOUT_MS = 1500;
|
|
@@ -3727,17 +4142,18 @@ function hyleProtectedProxy(options, { lookupTimeoutMs = DEFAULT_LOOKUP_TIMEOUT_
|
|
|
3727
4142
|
let timer;
|
|
3728
4143
|
const deadline = new Promise((resolve) => timer = setTimeout(resolve, lookupTimeoutMs));
|
|
3729
4144
|
const hit = await Promise.race([mounts.locate(path).catch(() => void 0), deadline]).finally(() => clearTimeout(timer));
|
|
3730
|
-
return hit && "share" in hit ?
|
|
4145
|
+
return hit && "share" in hit ? import_server2.NextResponse.rewrite(new URL(`${VIEW_PATH}${path}${req.nextUrl.search}`, req.url)) : void 0;
|
|
3731
4146
|
};
|
|
3732
4147
|
}
|
|
3733
4148
|
var forwardedClientIp = (h) => h.get("x-forwarded-for")?.split(",")[0]?.trim() || h.get("x-real-ip")?.trim() || void 0;
|
|
3734
4149
|
function hyleProtectedPage(options, { clientIp = forwardedClientIp } = {}) {
|
|
3735
4150
|
const mounts = rootMounts(options);
|
|
3736
|
-
return async function HyleProtectedPage({ params }) {
|
|
4151
|
+
return async function HyleProtectedPage({ params, searchParams }) {
|
|
3737
4152
|
const path = `/${((await params).path ?? []).join("/")}`;
|
|
3738
4153
|
const hit = SHARE_PATH.test(path) ? await mounts.locate(path) : void 0;
|
|
3739
4154
|
if (!hit || !("share" in hit)) (0, import_navigation9.notFound)();
|
|
3740
|
-
|
|
4155
|
+
const locked = (await searchParams)?.locked === "1";
|
|
4156
|
+
return drawProtectedShare(hit.share.config, hit.share.slug, hit.share.docSlug, clientIp(await (0, import_headers2.headers)()), { locked });
|
|
3741
4157
|
};
|
|
3742
4158
|
}
|
|
3743
4159
|
// Annotate the CommonJS export names for ESM import in node:
|